Commit 668d886e by sanjay-patel-1991 Committed by Vishal Kadam

-Added dist task to gruntfile.

-Removed unnecessary code from nginx.conf file -Removed express from DGI/gruntfile -Removed head.html and foot.html -Removed duplication of including bootstrap.css -Added script tag after last div in index.html
parent 0702815a
...@@ -14,7 +14,7 @@ module.exports = function(grunt) { ...@@ -14,7 +14,7 @@ module.exports = function(grunt) {
}, },
js: { js: {
files: ['public/**/*.js', '!public/lib/**', '!public/dist/**'], files: ['public/**/*.js', '!public/lib/**', '!public/dist/**'],
tasks: ['shell'] tasks: ['shell','copy:mainjs']
}, },
html: { html: {
files: ['public/**/*.html'] files: ['public/**/*.html']
...@@ -31,27 +31,8 @@ module.exports = function(grunt) { ...@@ -31,27 +31,8 @@ module.exports = function(grunt) {
} }
} }
}, },
nodemon: {
local: {
script: 'server.js',
options: {
ext: 'js,json',
ignore: ['public/**', 'node_modules/**'],
nodeArgs: ['--debug=6868']
}
},
prod: {
script: 'server.js',
options: {
ignore: ['.'],
env: {
NODE_ENV: 'production'
}
}
}
},
concurrent: { concurrent: {
tasks: ['nodemon:local', 'watch','ngserver'], tasks: ['build','watch', 'ngserver'],
options: { options: {
logConcurrentOutput: true logConcurrentOutput: true
} }
...@@ -123,16 +104,32 @@ module.exports = function(grunt) { ...@@ -123,16 +104,32 @@ module.exports = function(grunt) {
}, },
nginx: { nginx: {
options: { options: {
config: 'nginx.conf' config: 'nginx.conf',
} }
} },
copy: {
dist: {
expand: true,
cwd: 'public/',
src: '**',
dest: 'dist'
},
mainjs:{
expand: true,
cwd: 'public/',
src: 'dist/*.js',
dest: 'dist/dist/',
flatten: true,
filter: 'isFile'
}
},
clean: ['dist']
}); });
require('load-grunt-tasks')(grunt); require('load-grunt-tasks')(grunt);
grunt.registerTask('default', ['devUpdate', 'bower', 'jshint', 'jsbeautifier:default']); grunt.registerTask('default', ['devUpdate', 'bower', 'jshint', 'jsbeautifier:default']);
grunt.registerTask('server', ['bower', 'jshint', 'minify', 'concurrent']); grunt.registerTask('server', ['bower', 'jshint', 'minify', 'concurrent']);
grunt.registerTask('server:prod', ['nodemon:prod']);
grunt.registerTask('minify', 'Minify the all js', function() { grunt.registerTask('minify', 'Minify the all js', function() {
var done = this.async(); var done = this.async();
...@@ -142,12 +139,16 @@ module.exports = function(grunt) { ...@@ -142,12 +139,16 @@ module.exports = function(grunt) {
}); });
grunt.registerTask('ngserver', 'Nginx server', function() { grunt.registerTask('ngserver', 'Nginx server', function() {
var done = this.async();
grunt.file.mkdir('logs/log'); grunt.file.mkdir('logs/log');
grunt.file.mkdir('temp/client_body_temp'); grunt.file.mkdir('temp/client_body_temp');
grunt.file.write('mime.types');
grunt.task.run(['nginx:start']); grunt.task.run(['nginx:start']);
done();
});
grunt.registerTask('build','Build DGI',function(){
grunt.task.run(['clean']);
grunt.task.run(['copy:dist']);
}); });
grunt.registerTask('release', 'Create release package', function() { grunt.registerTask('release', 'Create release package', function() {
var done = this.async(); var done = this.async();
git.short(function(str) { git.short(function(str) {
......
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events { events {
worker_connections 1024; worker_connections 1024;
} }
http { http {
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server { server {
listen 8071; listen 3010;
server_name localhost; server_name localhost;
#charset koi8-r; root dist;
#access_log logs/host.access.log main;
root public;
location / { location / {
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
} }
location /api { location /api {
proxy_pass http://162.249.6.39:21000/api; proxy_pass http://162.249.6.39:21000/api;
} }
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html; error_page 500 502 503 504 /50x.html;
location = /50x.html { location = /50x.html {
root html; root html;
} }
# proxy the PHP scripts to Apache listening on 127.0.0.1:80error
#
#location ~ \.php$ {
# proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
#location ~ \.php$ {
# root html;
# fastcgi_pass 127.0.0.1:9000;
# fastcgi_index index.php;
# fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name;
# include fastcgi_params;
#}
# deny access to .htaccess files, if Apache's document root
# concurs with nginx's one
#
#location ~ /\.ht {
# deny all;
#}
} }
# another virtual host using mix of IP-, name-, and port-based configuration
#
#server {
# listen 8000;
# listen somename:8080;
# server_name somename alias another.alias;
# location / {
# root html;
# index index.html index.htm;
# }
#}
# HTTPS server
#
#server {
# listen 443 ssl;
# server_name localhost;
# ssl_certificate cert.pem;
# ssl_certificate_key cert.key;
# ssl_session_cache shared:SSL:1m;
# ssl_session_timeout 5m;
# ssl_ciphers HIGH:!aNULL:!MD5;
# ssl_prefer_server_ciphers on;
# location / {
# root html;
# index index.html index.htm;
# }
#}
} }
{ {
"name": "dgc-metadata", "name": "dgc-metadata",
"description": "DGC Metadata", "description": "DGC Metadata",
"version": "1.0.0-SNAPSHOT", "version": "1.0.0-SNAPSHOT",
"private": true, "private": true,
"bin": "server.js", "bin": "server.js",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/hortonworks/metadata" "url": "https://github.com/hortonworks/metadata"
}, },
"engines": { "engines": {
"node": "0.10.x", "node": "0.10.x",
"npm": "1.3.x" "npm": "1.3.x"
}, },
"keywords": [ "keywords": [
"DGC", "DGC",
"HortonWorks" "HortonWorks"
], ],
"scripts": { "scripts": {
"postinstall": "node node_modules/bower/bin/bower install" "postinstall": "node node_modules/bower/bin/bower install"
}, },
"dependencies": { "dependencies": {
"body-parser": "^1.2.0", "body-parser": "^1.2.0",
"bower": "~1.3.1", "bower": "~1.3.1",
"compression": "^1.0.2", "compression": "^1.0.2",
"consolidate": "~0.10.0", "consolidate": "~0.10.0",
"cookie-parser": "^1.0.1", "cookie-parser": "^1.0.1",
"cookies": "~0.4.0", "cookies": "~0.4.0",
"express": "~4.2.0", "express": "~4.2.0",
"express-load": "^1.1.14", "express-load": "^1.1.14",
"forever": "~0.11.1", "forever": "~0.11.1",
"lodash": "~2.4.1", "lodash": "~2.4.1",
"method-override": "^1.0.0", "method-override": "^1.0.0",
"morgan": "^1.0.1", "morgan": "^1.0.1",
"path-extra": "~0.1.1", "path-extra": "~0.1.1",
"proxit": "^0.6.0", "proxit": "^0.6.0",
"q": "~1.0.1", "q": "~1.0.1",
"rc": "~0.3.4", "rc": "~0.3.4",
"serve-favicon": "^2.0.0", "serve-favicon": "^2.0.0",
"static-favicon": "^2.0.0-alpha", "static-favicon": "^2.0.0-alpha",
"superagent": "^0.20.0", "superagent": "^0.20.0",
"swig": "~1.3.2", "swig": "~1.3.2",
"view-helpers": "~0.1.4" "view-helpers": "~0.1.4",
}, "grunt-contrib-clean": "~0.6.0"
"devDependencies": { },
"git-rev": "^0.2.1", "devDependencies": {
"grunt": "~0.4.2", "git-rev": "^0.2.1",
"grunt-bower-task": "~0.4.0", "grunt": "~0.4.2",
"grunt-cli": "~0.1.11", "grunt-bower-task": "~0.4.0",
"grunt-concurrent": "^1.0.0", "grunt-cli": "~0.1.11",
"grunt-contrib-compress": "^0.13.0", "grunt-concurrent": "^1.0.0",
"grunt-contrib-jshint": "^0.11.0", "grunt-contrib-compress": "^0.13.0",
"grunt-contrib-watch": "^0.6.0", "grunt-contrib-jshint": "^0.11.0",
"grunt-dev-update": "^1.0.2", "grunt-contrib-watch": "^0.6.0",
"grunt-jsbeautifier": "^0.2.6", "grunt-dev-update": "^1.0.2",
"grunt-nodemon": "^0.4.0", "grunt-jsbeautifier": "^0.2.6",
"grunt-shell": "^1.1.1", "grunt-nodemon": "^0.4.0",
"load-grunt-tasks": "^3.1.0", "grunt-shell": "^1.1.1",
"grunt-nginx": "~0.2.2" "load-grunt-tasks": "^3.1.0",
} "grunt-nginx": "~0.2.2",
"grunt-contrib-copy": "~0.8.0",
"grunt-contrib-clean": "~0.6.0"
}
} }
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
<link href="img/favicon.ico" rel="shortcut icon" type="image/x-icon"> <link href="img/favicon.ico" rel="shortcut icon" type="image/x-icon">
<link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css"> <link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/sticky-footer-navbar.css"> <link rel="stylesheet" href="/css/sticky-footer-navbar.css">
<link rel="stylesheet" href="/css/common.css"> <link rel="stylesheet" href="/css/common.css">
...@@ -40,6 +39,20 @@ ...@@ -40,6 +39,20 @@
<link href="img/favicon.ico" rel="shortcut icon" type="image/x-icon"> <link href="img/favicon.ico" rel="shortcut icon" type="image/x-icon">
<body>
<header class="navbar navbar-static-top navbar-top" data-role="navigation">
<div class="container" data-ng-include="'/modules/home/views/header.html'"></div>
</header>
<div class="content">
<div data-ng-include="'/modules/notification/views/notifications.html'"></div>
<div data-ui-view></div>
</div>
<footer class="footer navbar-bottom">
<div class="container">
<p align="right">Powered by<img src="modules/home/img/logo-green.png"></p>
</div>
</footer>
<script src="lib/jquery/dist/jquery.js"></script> <script src="lib/jquery/dist/jquery.js"></script>
<script src="lib/angular/angular.js"></script> <script src="lib/angular/angular.js"></script>
<script src="lib/bootstrap/dist/js/bootstrap.js"></script> <script src="lib/bootstrap/dist/js/bootstrap.js"></script>
...@@ -55,19 +68,5 @@ ...@@ -55,19 +68,5 @@
<script src="http://cpettitt.github.io/project/dagre-d3/latest/dagre-d3.js"></script> <script src="http://cpettitt.github.io/project/dagre-d3/latest/dagre-d3.js"></script>
<script src="dist/app.min.js"></script> <script src="dist/app.min.js"></script>
<body>
<header class="navbar navbar-static-top navbar-top" data-role="navigation">
<div class="container" data-ng-include="'/modules/home/views/header.html'"></div>
</header>
<div class="content">
<div data-ng-include="'/modules/notification/views/notifications.html'"></div>
<div data-ui-view></div>
</div>
<footer class="footer navbar-bottom">
<div class="container">
<p align="right">Powered by<img src="modules/home/img/logo-green.png"></p>
</div>
</footer>
</body> </body>
</html> </html>
\ No newline at end of file
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<!-- Angular JS -->
<script type="text/javascript" src="/lib/angular/angular.min.js"></script>
<script type="text/javascript" src="/lib/lodash/lodash.min.js"></script>
<script type="text/javascript" src="/lib/angular-cookies/angular-cookies.min.js"></script>
<script type="text/javascript" src="/lib/angular-resource/angular-resource.min.js"></script>
<script type="text/javascript" src="/lib/angular-ui-router/release/angular-ui-router.js"></script>
<!-- Angular UI -->
<script type="text/javascript" src="/lib/angular-bootstrap/ui-bootstrap.js"></script>
<script type="text/javascript" src="/lib/angular-bootstrap/ui-bootstrap-tpls.js"></script>
<script type="text/javascript" src="/lib/d3/d3.min.js"></script>
<!--<script type="text/javascript" src="/lib/d3-tip/index.js"></script>-->
<!--<script src="http://cdnjs.cloudflare.com/ajax/libs/d3/3.5.5/d3.min.js"></script>
<script src="http://cpettitt.github.io/project/dagre-d3/latest/dagre-d3.js"></script>-->
<script type="text/javascript" src="dist/app.min.js"></script>
\ No newline at end of file
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>{{app.title}}</title>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<link href="/img/favicon.ico" rel="shortcut icon" type="image/x-icon">
<link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css">
<link rel="stylesheet" href="/css/sticky-footer-navbar.css">
<link rel="stylesheet" href="/css/common.css">
<link rel="stylesheet" href="/css/details.css">
<link rel="stylesheet" href="/css/lineage.css">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<!--[if lt IE 9]>
<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
{% block content %}
<script type="text/javascript">
window.user = {{JSON.stringify(user)}};
window.renderErrors = {{JSON.stringify(renderErrors)}};
</script>
{% endblock %}
</head>
\ No newline at end of file
<!doctype html>
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<html lang="en" xmlns="http://www.w3.org/1999/xhtml" itemscope="itemscope" itemtype="http://schema.org/Product">
{% include 'includes/head.html' %}
<body>
<header class="navbar navbar-static-top navbar-top" data-role="navigation">
<div class="container" data-ng-include="'/modules/home/views/header.html'"></div>
</header>
<div class="content">
<div data-ng-include="'/modules/notification/views/notifications.html'"></div>
<div class="container" data-ui-view></div>
</div>
<footer class="footer navbar-bottom">
<div class="container">
<p align="right">Powered by<img src="modules/home/img/logo-green.png"></p>
</div>
</footer>
{% include 'includes/foot.html' %}
</body>
</html>
\ No newline at end of file
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
// Extend the base configuration in all.js with environment
// specific configuration
var path = require('path'),
oneLevelUp = path.sep + '..',
rootPath = path.normalize(__dirname + oneLevelUp + oneLevelUp),
packageJson = require(rootPath + path.sep + 'package.json'),
config = require('rc')(packageJson.name, {
app: {
name: packageJson.name,
title: 'DGI'
},
nodeEnv: 'local',
root: rootPath,
port: process.env.PORT || 3010,
templateEngine: 'swig',
proxit: {
verbose: true,
hosts: [{
routes: {
'/api': 'http://162.249.6.39:21000/api'
}
}]
}
});
// Set the node environment variable if not set before
config.nodeEnv = process.env.NODE_ENV = process.env.NODE_ENV || config.nodeEnv;
module.exports = config;
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
/**
* Module dependencies.
*/
var express = require('express'),
expressLoad = require('express-load'),
consolidate = require('consolidate'),
helpers = require('view-helpers'),
cookieParser = require('cookie-parser'),
compress = require('compression'),
bodyParser = require('body-parser'),
favicon = require('serve-favicon'),
methodOverride = require('method-override'),
swig = require('swig'),
proxit = require('proxit'),
config = require('./config');
module.exports = function(app) {
app.set('showStackError', true);
// Prettify HTML
app.locals.pretty = true;
// cache=memory or swig dies in NODE_ENV=production
app.locals.cache = 'memory';
// The cookieParser should be above session
app.use(cookieParser());
app.use(proxit(config.proxit));
// Should be placed before express.static
// To ensure that all assets and data are compressed (utilize bandwidth)
app.use(compress({
filter: function(req, res) {
return (/json|text|javascript|css/).test(res.getHeader('Content-Type'));
},
// Levels are specified in a range of 0 to 9, where-as 0 is
// no compression and 9 is best compression, but slowest
level: 9
}));
// assign the template engine to .html files
app.engine('html', consolidate[config.templateEngine]);
// set .html as the default extension
app.set('view engine', 'html');
// Set views path, template engine and default layout
app.set('views', config.root + '/public/views');
// Enable jsonp
app.enable('jsonp callback');
app.use(methodOverride());
// Dynamic helpers
app.use(helpers(config.app.name));
// Connect flash for flash messages
//app.use(flash());
// Setting the fav icon and static folder
app.use(favicon(__dirname + '/../../public/img/favicon.ico'));
app.use(bodyParser.urlencoded());
/**
* User json parser after proxied requests. If its used before proxied requests post request doesn't work
* */
app.use(bodyParser.json());
/*
* Make app details available to routes
* */
app.config = config;
/**
* System Routes
* */
expressLoad('../routes/system', {
extlist: /(.*)\.(js$)/,
cwd: __dirname
}).into(app);
var viewsDir = config.root + '/public';
app.use(express.static(viewsDir));
if (process.env.NODE_ENV === 'local') {
// Swig will cache templates for you, but you can disable
// that and use Express's caching instead, if you like:
app.set('view cache', false);
// To disable Swig's cache, do the following:
swig.setDefaults({
cache: false
});
}
// Assume "not found" in the error message is a 404. this is somewhat
// silly, but valid, you can do whatever you like, set properties,
// use instanceof etc.
app.use(function(err, req, res, next) {
// Treat as 404
if (~err.message.indexOf('not found')) return next();
// Log it
console.error(err.stack);
// Error page
res.status(500).send('500', {
error: err.stack
});
});
// Assume 404 since no middleware responded
app.use(function(req, res) {
res.status(404).send('404', {
url: req.originalUrl,
error: 'Not found'
});
});
// Do not stop server on any unhandled error
process.on('uncaughtException', function(err) {
console.error('UNCAUGHT EXCEPTION\n' + err.stack || err.message);
});
};
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use strict';
module.exports = function(app) {
app.get('/', function(req, res) {
res.render('index', {
renderErrors: {}, //req.flash('error')
app: app.config.app
});
});
};
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment