Commit 42664301 by Vishal Kadam

Vishal: App skeleton created

parents
{
"directory": "public/lib",
"storage": {
"packages": ".bower-cache",
"registry": ".bower-registry"
},
"tmp": ".bower-tmp"
}
.DS_Store
.bower-*/
.idea/
node_modules/
lib/
public/lib
*.log
public/css/common.css
\ No newline at end of file
test/coverage/**
\ No newline at end of file
{
"browser": true, // Standard browser globals e.g. `window`, `document`.
"bitwise": false, // Prohibit bitwise operators (&, |, ^, etc.).
"camelcase": false, // Permit only camelcase for `var` and `object indexes`.
"curly": false, // Require {} for every new block or scope.
"devel": true, // Allow development statements e.g. `console.log();`.
"esnext": true, // Allow ES.next specific features such as `const` and `let`.
"eqeqeq": true, // Require triple equals i.e. `===`.
"immed": true, // Require immediate invocations to be wrapped in parens e.g. `( function(){}() );`
"indent": false, // Specify indentation spacing
"latedef": true, // Prohibit variable use before definition.
"node": true, // Enable globals available when code is running inside of the NodeJS runtime environment.
"newcap": false, // Require capitalization of all constructor functions e.g. `new F()`.
"noarg": true, // Prohibit use of `arguments.caller` and `arguments.callee`.
"noempty": true, // Prohibit use of empty blocks.
"quotmark": false, // Define quotes to string values.
"regexp": true, // Prohibit `.` and `[^...]` in regular expressions.
"strict": true, // Require `use strict` pragma in every file.
"smarttabs": false, // Suppresses warnings about mixed tabs and spaces
"trailing": true, // Prohibit trailing whitespaces.
"undef": true, // Require all non-global variables be declared before they are used.
"unused": true, // Warn unused variables.
"globals": { // Globals variables.
"angular": true
},
"predef": [ // Extra globals.
"define",
"require",
"exports",
"module",
"spyOn",
"describe",
"xdescribe",
"before",
"beforeEach",
"after",
"afterEach",
"jasmine",
"it",
"xit",
"inject",
"expect",
"ngGridFlexibleHeightPlugin"
]
}
\ No newline at end of file
File added
{
"name": "app-builder",
"version": "0.1.3",
"dependencies": {
"angular": "1.2.15",
"angular-resource": "1.2.15",
"angular-cookies": "1.2.15",
"angular-route": "1.2.15",
"angular-sanitize": "1.2.15",
"bootstrap": "~3.1.1",
"angular-bootstrap": "~0.10.0",
"angular-ui-router": "~0.2.10",
"jquery": "~2.1.0",
"lodash": "~2.4.1",
"angular-ui-utils": "~0.1.1",
"font-awesome": "~4.2.0"
}
}
'use strict';
module.exports = function(grunt) {
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
options: {
livereload: 35730
},
js: {
files: ['public/**/*.js', '!public/lib/**'],
tasks: ['jshint']
},
html: {
files: ['public/**/*.html']
},
css: {
files: ['public/**/*.css']
}
},
jshint: {
all: {
src: ['gruntfile.js', 'package.json', 'server.js', 'server/**/*.js', 'public/**/*.js', '!public/lib/**'],
options: {
jshintrc: true
}
}
},
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: {
tasks: ['nodemon:local', 'watch'],
options: {
logConcurrentOutput: true
}
},
jsbeautifier: {
'default': {
src: ['<%= jshint.all.src %>', 'bower.json'],
options: {
js: {
preserveNewlines: true,
maxPreserveNewlines: 2
}
}
},
'build': {
src: '<%= jsbeautifier.default.src %>',
options: {
mode: 'VERIFY_ONLY',
js: '<%= jsbeautifier.default.options.js%>'
}
}
},
bower: {
install: {
options: {
verbose: true
}
}
}
});
//Load NPM tasks
require('load-grunt-tasks')(grunt);
//Default task(s).
grunt.registerTask('default', ['bower', 'jsbeautifier:default']);
// Server task
grunt.registerTask('server', ['bower', 'jshint', 'concurrent']);
grunt.registerTask('server:prod', ['nodemon:prod']);
};
{
"name": "dgc-metadata",
"description": "DGC Metadata",
"version": "1.0.0-SNAPSHOT",
"private": true,
"bin": "server.js",
"repository": {
"type": "git",
"url": "https://github.com/hortonworks/metadata"
},
"engines": {
"node": "0.10.x",
"npm": "1.3.x"
},
"keywords": [
"DGC",
"HortonWorks"
],
"scripts": {
"postinstall": "node node_modules/bower/bin/bower install"
},
"dependencies": {
"body-parser": "^1.2.0",
"bower": "~1.3.1",
"compression": "^1.0.2",
"consolidate": "~0.10.0",
"cookie-parser": "^1.0.1",
"cookies": "~0.4.0",
"express": "~4.2.0",
"express-load": "^1.1.14",
"forever": "~0.11.1",
"lodash": "~2.4.1",
"method-override": "^1.0.0",
"morgan": "^1.0.1",
"path-extra": "~0.1.1",
"q": "~1.0.1",
"rc": "~0.3.4",
"serve-favicon": "^2.0.0",
"static-favicon": "^2.0.0-alpha",
"superagent": "^0.20.0",
"swig": "~1.3.2",
"view-helpers": "~0.1.4"
},
"devDependencies": {
"grunt": "~0.4.2",
"grunt-bower-task": "~0.4.0",
"grunt-cli": "~0.1.11",
"grunt-concurrent": "0.4.3",
"grunt-contrib-jshint": "0.9.2",
"grunt-contrib-watch": "0.6.0",
"grunt-jsbeautifier": "~0.2.6",
"grunt-nodemon": "0.2.0",
"load-grunt-tasks": "^2.0.0"
}
}
'use strict';
angular.module('dgc', ['ngCookies',
'ngResource',
'ui.bootstrap',
'ui.router',
'dgc.system'
]);
angular.module('dgc.system', ['dgc.system.notification']);
angular.module('dgc').factory('lodash', ['$window',
function($window) {
return $window._;
}
]).factory('Global', ['$window',
function($window) {
return {
user: $window.user,
authenticated: !!$window.user,
renderErrors: $window.renderErrors
};
}
]).run(function(Global, NotificationService, lodash) {
var errors = Global.renderErrors;
if (angular.isArray(errors) || angular.isObject(errors)) {
lodash.forEach(errors, function(err) {
err = angular.isObject(err) ? err : {
message: err
};
err.timeout = false;
NotificationService.error(err);
});
} else {
errors.timeout = false;
NotificationService.error(errors);
}
});
'use strict';
angular.element(document).ready(function() {
/* Fixing facebook bug with redirect */
if (window.location.hash === '#_=_') window.location.hash = '#!';
//Then init the app
angular.bootstrap(document, ['dgc']);
});
'use strict';
//Setting up route
angular.module('dgc').config(['$stateProvider', '$urlRouterProvider',
function($stateProvider, $urlRouterProvider) {
// For unmatched routes:
$urlRouterProvider.otherwise('/');
// states for my app
$stateProvider.state('home', {
url: '/',
templateUrl: '/modules/home/views/home.html',
data: {
isSecured: false
}
});
}
]);
//Setting HTML5 Location Mode
angular.module('dgc').config(['$locationProvider',
function($locationProvider) {
$locationProvider.hashPrefix('!');
}
]);
'use strict';
angular.module('dgc.system').controller('HeaderController', ['$scope', function($scope) {
$scope.menu = [];
$scope.isCollapsed = true;
$scope.isLoggedIn = function() {
return true;
};
}
]);
<div data-ng-controller="HeaderController">
<div class="navbar-header">
<button class="navbar-toggle" type="button" data-ng-click="isCollapsed = !isCollapsed">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a data-ui-sref="home" class="navbar-brand" data-ui-sref-active="active">DGC aetna</a>
</div>
<nav class="collapse navbar-collapse" data-collapse="isCollapsed" data-role="navigation">
<ul class="navbar-nav nav" data-ng-if="isLoggedIn()">
<li data-ng-repeat="item in menu" data-ui-sref-active="active">
<a data-ui-sref="{{item.state}}">{{item.title}}</a>
</li>
</ul>
</nav>
</div>
\ No newline at end of file
<section>
<h1 class="text-center">This is the home view</h1>
</section>
\ No newline at end of file
'use strict';
angular.module('dgc.system.notification').controller('NotificationController', ['$scope', 'NotificationService',
function($scope, NotificationService) {
$scope.getNotifications = NotificationService.getAll;
$scope.close = function(notification) {
NotificationService.close(notification);
};
}
]);
'use strict';
angular.module('dgc.system.notification', ['ui.router']).constant('ColorCoding', {
info: 'success',
error: 'danger'
}).run(function($rootScope, NotificationService) {
$rootScope.$on('$locationChangeSuccess', function(evt, from, to) {
if (from !== to) {
NotificationService.reset();
}
});
});
\ No newline at end of file
'use strict';
angular.module('dgc.system.notification').service('NotificationService', ['$timeout', 'lodash', 'ColorCoding', function($timeout, _, colorCoding) {
var notifications = [],
service = {
timeout: 2000,
getAll: function() {
return notifications;
},
reset: function() {
notifications = [];
},
close: function(notification) {
_.remove(notifications, notification);
}
};
_.each(colorCoding, function(value, key) {
service[key] = function(message) {
var notification = message;
if (_.isString(message)) {
notification = {message: message};
}
notification.message = notification.msg || notification.message;
delete notification.msg;
notification.type = value;
notification.timeout = _.isUndefined(notification.timeout) ? true : notification.timeout;
notifications.push(notification);
if (notification.timeout) {
$timeout(function() {
service.close(notification);
}, angular.isNumber(notification.timeout) ? notification.timeout : service.timeout);
}
};
});
return service;
}]);
<div data-ng-controller="NotificationController">
<alert data-ng-repeat="notification in getNotifications()" type="notification.type" close="close(notification)">
{{notification.message}}
</alert>
</div>
\ No newline at end of file
<!-- Angular JS -->
<script type="text/javascript" src="/lib/angular/angular.min.js"></script>
<script type="text/javascript" src="/lib/lodash/dist/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>
<script type="text/javascript" src="/lib/angular-base64/angular-base64.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>
<!-- Application Depedencies -->
<!-- Application Init -->
<script type="text/javascript" src="js/app.js"></script>
<script type="text/javascript" src="js/routes.js"></script>
<!-- Notification module -->
<script type="text/javascript" src="/modules/notification/notificationModule.js"></script>
<script type="text/javascript" src="/modules/notification/notificationService.js"></script>
<script type="text/javascript" src="/modules/notification/notificationController.js"></script>
<!-- Home Module -->
<script type="text/javascript" src="/modules/home/headerController.js"></script>
<!-- Initialize the application -->
<script type="text/javascript" src="js/init.js"></script>
{% if (process.env.NODE_ENV == 'local') %}
<!-- Livereload script rendered -->
<script type="text/javascript" src="http://localhost:35730/livereload.js"></script>
{% endif %}
<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">
<meta name="keywords" content="artifact-graph, Cengage, registry-services">
<meta name="description" content="Cengage registry services">
<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/common.css">
<!--[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>
<!doctype html>
<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-inverse navbar-static-top" data-role="navigation">
<div class="container" data-ng-include="'/modules/home/views/header.html'"></div>
</header>
<div class="container">
<div data-ng-include="'/modules/notification/views/notifications.html'"></div>
<div data-ui-view></div>
</div>
{% include 'includes/foot.html' %}
</body>
</html>
\ No newline at end of file
#!/usr/bin/env node
'use strict';
/**
* Module dependencies.
*/
var express = require('express');
/**
* Main application entry file.
* Please note that the order of loading is important.
*/
// Initializing system variables
var config = require('./server/config/config');
// Load configurations
// Set the node enviornment variable if not set before
process.env.NODE_ENV = config.nodeEnv;
var app = express();
// Express settings
require('./server/config/express')(app);
// Start the app by listening on <port>
var port = process.env.PORT || config.port;
app.listen(port);
console.log('Environment is = "' + process.env.NODE_ENV + '"');
console.log('Express app started on port ' + port + ' using config\n', config);
// Expose app
module.exports = app;
'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: 'DGC'
},
nodeEnv: 'local',
root: rootPath,
port: process.env.PORT || 3010,
templateEngine: 'swig'
});
module.exports = config;
'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'),
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());
// 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
console.log(config.root + '/public/views');
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());
/**
* 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);
});
};
'use strict';
module.exports = function(app) {
app.get('/', function(req, res) {
res.render('index', {
renderErrors: {} //req.flash('error')
});
});
};
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