diff --git a/Gruntfile.js b/Gruntfile.js index 937d64b..ddf0287 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -299,5 +299,7 @@ module.exports = function(grunt) { grunt.registerTask('build', ['clean:dist', 'useminPrepare', 'concurrent:dist', 'autoprefixer', 'concat', 'copy:dist', 'cdnify', 'ngmin', 'cssmin', 'uglify', 'rev', 'usemin']); - grunt.registerTask('default', ['jshint', 'test', 'build']); + grunt.registerTask('default', [ + //'jshint', + 'test', 'build']); }; diff --git a/Procfile b/Procfile new file mode 100644 index 0000000..6f86b16 --- /dev/null +++ b/Procfile @@ -0,0 +1 @@ +web: node server.js \ No newline at end of file diff --git a/README.md b/README.md index 3ddcdd3..a765fbc 100755 --- a/README.md +++ b/README.md @@ -5,6 +5,41 @@ The purpose of this CMS is for many reasons, the most important reason is this i The book is going to be published during the 2nd quarter of the new year by Packt Publishing. Each piece has to do with a corresponding chapter in the book that I am writing. + +## Features + +### Database +The database of choice is Mongo, its fast, easy and scalable. + +### Server +The server of choice is Node, its JavaScript, its fast and scalable. + +### AngularJS +The client-side framework of choice is Angular, its a full-stack, just what we need. + +### Responsive +The client-side ui of choice is Twitter Bootstrap, its updated and clean. + +### HTML5 +Using HTML5 in every way to make a better user experience. + +### Customizable +Using a modular approach you can easily extend the core to your application. + + + +_(Coming soon)_ + + + + + + + + + + + ## Server The server is a Node.js server that supports dynamic RESTful API calls to resource endpoints. @@ -36,13 +71,6 @@ These are the events that this socket server dispatches. 7. cms:server:connect 8. cms: -## Features - - - - -_(Coming soon)_ - @@ -80,6 +108,37 @@ _(Coming soon)_ _(Coming soon)_ +### Themes +Themes will be installed via bower, we will have a ui for searching and installing angular-cms themes searching by tag angular-cms. + +##### Theme Structure +This is the structure of the themes. + + my-theme/ + package.json + bower.json + css/ + my-theme.css + js/ + my-theme.js + index.html + partials/ + header.html + sidebar.html + footer.html + content.html + + + + +### Plugins +Plugins will be installed via bower as well, keywords angular-cms. + + + + + + ## Examples _(Coming soon)_ diff --git a/app/index.html b/app/index.html index e6b3a84..3e11d12 100755 --- a/app/index.html +++ b/app/index.html @@ -5,26 +5,23 @@ - + - Angular CMS | + Angular CMS - - - - - + + + - + - - - - - + @@ -83,10 +76,8 @@ - --> + - - @@ -97,10 +88,8 @@ - - + + - - diff --git a/app/scripts/app.js b/app/scripts/app.js index 25424c6..4dd7a73 100755 --- a/app/scripts/app.js +++ b/app/scripts/app.js @@ -3,6 +3,7 @@ var app = angular.module('angularCmsBaseApp', []); + app.config(['$routeProvider', '$locationProvider', function ($routeProvider, $locationProvider) { diff --git a/app/scripts/controllers/docs.js b/app/scripts/controllers/docs.js index d377d9d..20843df 100755 --- a/app/scripts/controllers/docs.js +++ b/app/scripts/controllers/docs.js @@ -1,32 +1,28 @@ 'use strict'; -angular.module('angularCmsBaseApp') - .controller('DocsCtrl', function ($scope, $http) { +angular.module('angularCmsBaseApp').controller('DocsCtrl', function($scope, $http) { $scope.readme = ''; - - $http.get('/api/v2/README').success(function(data){ - $scope.readme = data; - $scope.tocify(); - }); - - $scope.tocify = function(){ + + $scope.loadReadme = function() { + $http.get('/api/v2/README').success(function(data) { + $scope.readme = data; + $scope.tocify(); + }); + }; + + $scope.tocify = function() { //Executes your code when the DOM is ready. Acts the same as $(document).ready(). $(function() { - setTimeout(function(){ + setTimeout(function() { //Calls the tocify method on your HTML div. - $("#toc").tocify({ - hashGenerator: 'compact', - content: '#docs-content' + $("#toc").tocify({ + hashGenerator : 'compact', + content : '#docs-content' }); - }, 500); + }, 500); }); }; - - $scope.awesomeThings = [ - 'HTML5 Boilerplate', - 'AngularJS', - 'Karma' - ]; - }); + $scope.awesomeThings = ['HTML5 Boilerplate', 'AngularJS', 'Karma']; +}); diff --git a/app/styles/main.css b/app/styles/main.css index 66740ff..d02a789 100755 --- a/app/styles/main.css +++ b/app/styles/main.css @@ -2,7 +2,8 @@ http://127.0.0.1:9000/styles/main.css http://localhost:9090/styles/main.css */ -@import url('/bower_components/jquery.tocify.js/src/stylesheets/jquery.tocify.css'); + +@import url('../bower_components/jquery.tocify.js/src/stylesheets/jquery.tocify.css'); body { background:#fafafa; font-family:"Helvetica Neue",Helvetica,Arial,sans-serif; diff --git a/app/views/docs.html b/app/views/docs.html index 4431464..55844ba 100755 --- a/app/views/docs.html +++ b/app/views/docs.html @@ -6,6 +6,7 @@
+
diff --git a/bin/db.sh b/bin/db.sh index 01dcea5..f95c8fe 100644 --- a/bin/db.sh +++ b/bin/db.sh @@ -1,2 +1,3 @@ #!/bin/sh +rm ../db/mongod.lock mongod --dbpath db --rest --jsonp; \ No newline at end of file diff --git a/db/mongod.lock b/db/mongod.lock index 8e67429..b1cff30 100755 --- a/db/mongod.lock +++ b/db/mongod.lock @@ -1 +1 @@ -832 +1447 diff --git a/karma.conf.js b/karma.conf.js index ccf2ef1..1bf794e 100755 --- a/karma.conf.js +++ b/karma.conf.js @@ -2,55 +2,46 @@ // http://karma-runner.github.io/0.10/config/configuration-file.html module.exports = function(config) { - config.set({ - // base path, that will be used to resolve files and exclude - basePath: '', - - // testing framework to use (jasmine/mocha/qunit/...) - frameworks: ['jasmine'], - - // list of files / patterns to load in the browser - files: [ - 'app/bower_components/angular/angular.js', - 'app/bower_components/angular/angular-mocks.js', - 'app/scripts/*.js', - 'app/scripts/**/*.js', - 'test/mock/**/*.js', - 'test/spec/**/*.js' - ], - - // list of files / patterns to exclude - exclude: [], - - // web server port - port: 8080, - - // level of logging - // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG - logLevel: config.LOG_INFO, - - - // enable / disable watching file and executing tests whenever any file changes - autoWatch: false, - - - // Start these browsers, currently available: - // - Chrome - // - ChromeCanary - // - Firefox - // - Opera - // - Safari (only Mac) - // - PhantomJS - // - IE (only Windows) - browsers: ['PhantomJS'], - reporters: [ - 'progress', - //'coverage' - ], - - - // Continuous Integration mode - // if true, it capture browsers, run tests and exit - singleRun: false - }); + config.set({ + // base path, that will be used to resolve files and exclude + basePath : '', + + // testing framework to use (jasmine/mocha/qunit/...) + frameworks : ['jasmine'], + preprocessors : { + 'app/scripts/**/*.coffee' : 'coffee' + }, + // list of files / patterns to load in the browser + files : ['app/bower_components/angular/angular.js', 'app/bower_components/angular-scenario/angular-scenario.js', 'app/bower_components/angular-mocks/angular-mocks.js', 'app/scripts/*.js', 'app/scripts/**/*.js', + // 'test/mock/**/*.js', + 'test/spec/**/*.js'], + + // list of files / patterns to exclude + exclude : [], + + // web server port + port : 9090, + + // level of logging + // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG + logLevel : config.LOG_INFO, + + // enable / disable watching file and executing tests whenever any file changes + autoWatch : false, + + // Start these browsers, currently available: + // - Chrome + // - ChromeCanary + // - Firefox + // - Opera + // - Safari (only Mac) + // - PhantomJS + // - IE (only Windows) + browsers : ['PhantomJS'], + reporters : ['progress', 'dot'], + + // Continuous Integration mode + // if true, it capture browsers, run tests and exit + singleRun : false + }); }; diff --git a/package.json b/package.json index 2397973..6ca7744 100755 --- a/package.json +++ b/package.json @@ -1,86 +1,83 @@ { - "name": "angular-cms", - "version": "0.0.1", - "dependencies": { - "http": "*", - "http-proxy": "~0.10.3", - "inspect": "*", - "mongodb": "~1.1.11", - "mongoose": "~3.3.1", - "restify": "1.4.x", - "node-gcm": "0.9.x", - "request": "~2.0.5", - "express": "~3.4.4", - "url": "0.7.x", - "socket.io": "~0.9.16", - "colors": "~0.6.2", - "connect": "~2.11.0", - "jquery-file-upload-middleware": "~0.1.0", - "cloudfiles": "~0.3.4", - "easyimage": "~0.1.3", - "racker": "0.0.1-alpha3" - }, - "devDependencies": { - "grunt": "~0.4.1", - "grunt-contrib-copy": "~0.4.1", - "grunt-contrib-concat": "~0.3.0", - "grunt-contrib-coffee": "~0.7.0", - "grunt-contrib-uglify": "~0.2.0", - "grunt-contrib-compass": "~0.5.0", - "grunt-contrib-jshint": "~0.6.0", - "grunt-contrib-cssmin": "~0.6.0", - "grunt-contrib-connect": "~0.5.0", - "grunt-contrib-clean": "~0.5.0", - "grunt-contrib-htmlmin": "~0.1.3", - "grunt-contrib-imagemin": "~0.2.0", - "grunt-contrib-watch": "~0.5.2", - "grunt-autoprefixer": "~0.2.0", - "grunt-usemin": "~0.1.11", - "grunt-svgmin": "~0.2.0", - "grunt-rev": "~0.1.0", - "grunt-concurrent": "~0.3.0", - "load-grunt-tasks": "~0.1.0", - "grunt-google-cdn": "~0.2.0", - "grunt-ngmin": "~0.0.2", - "time-grunt": "~0.1.0", - "grunt-karma": "~0.6.2", - "grunt-docular": "~0.1.2", - "grunt-ngdocs": "~0.1.7", - "karma-script-launcher": "~0.1.0", - "karma-chrome-launcher": "~0.1.0", - "karma-firefox-launcher": "~0.1.0", - "karma-html2js-preprocessor": "~0.1.0", - "karma-jasmine": "~0.1.3", - "karma-requirejs": "~0.1.0", - "karma-coffee-preprocessor": "~0.1.0", - "karma-phantomjs-launcher": "~0.1.0", - "karma": "~0.10.5" - }, - "engines": { - "node": ">=0.8.0" - }, - "scripts": { - "test": "grunt test", - "start": "node server.js" - }, - "description": "This is a lightweight CMS built with Angular.js, Twitter Bootstrap and Node.js.", - "main": "Gruntfile.js", - "directories": { - "test": "test" - }, - "repository": { - "type": "git", - "url": "https://github.com/jonniespratley/angular-cms.git" - }, - "keywords": [ - "angular", - "cms", - "generator" - ], - "author": "Jonnie Spratley", - "license": "BSD-2-Clause", - "bugs": { - "url": "https://github.com/jonniespratley/angular-cms/issues" - }, - "homepage": "https://github.com/jonniespratley/angular-cms" + "name": "angular-cms", + "version": "0.0.1", + "dependencies": { + "http": "*", + "http-proxy": "~0.10.3", + "inspect": "*", + "mongodb": "~1.1.11", + "mongoose": "~3.3.1", + "restify": "1.4.x", + "node-gcm": "0.9.x", + "request": "~2.0.5", + "express": "~3.4.4", + "url": "0.7.x", + "socket.io": "~0.9.16", + "colors": "~0.6.2", + "connect": "~2.11.0", + "jquery-file-upload-middleware": "~0.1.0", + "cloudfiles": "~0.3.4", + "easyimage": "~0.1.3", + "racker": "0.0.1-alpha3" + }, + "devDependencies": { + "grunt": "~0.4.1", + "grunt-contrib-copy": "~0.4.1", + "grunt-contrib-concat": "~0.3.0", + "grunt-contrib-coffee": "~0.7.0", + "grunt-contrib-uglify": "~0.2.0", + "grunt-contrib-compass": "~0.5.0", + "grunt-contrib-jshint": "~0.6.0", + "grunt-contrib-cssmin": "~0.6.0", + "grunt-contrib-connect": "~0.5.0", + "grunt-contrib-clean": "~0.5.0", + "grunt-contrib-htmlmin": "~0.1.3", + "grunt-contrib-imagemin": "~0.2.0", + "grunt-contrib-watch": "~0.5.2", + "grunt-autoprefixer": "~0.2.0", + "grunt-usemin": "~0.1.11", + "grunt-svgmin": "~0.2.0", + "grunt-rev": "~0.1.0", + "grunt-concurrent": "~0.3.0", + "load-grunt-tasks": "~0.1.0", + "grunt-google-cdn": "~0.2.0", + "grunt-ngmin": "~0.0.2", + "time-grunt": "~0.1.0", + "grunt-karma": "~0.6.2", + "grunt-docular": "~0.1.2", + "grunt-ngdocs": "~0.1.7", + "karma-script-launcher": "~0.1.0", + "karma-chrome-launcher": "~0.1.0", + "karma-firefox-launcher": "~0.1.0", + "karma-html2js-preprocessor": "~0.1.0", + "karma-jasmine": "~0.1.3", + "karma-requirejs": "~0.1.0", + "karma-coffee-preprocessor": "~0.1.0", + "karma-phantomjs-launcher": "~0.1.0", + "karma": "~0.10.5" + }, + "engines": { + "node": "0.10.x", + "npm": "1.2.x" + }, + "scripts": { + "test": "grunt test", + "start": "node server.js" + }, + "description": "This is a lightweight CMS built with Angular.js, Twitter Bootstrap and Node.js.", + "main": "Gruntfile.js", + "directories": { + "test": "test" + }, + "repository": { + "type": "git", + "url": "https://github.com/jonniespratley/angular-cms.git" + }, + "keywords": ["angular", "cms", "generator"], + "author": "Jonnie Spratley", + "license": "BSD-2-Clause", + "bugs": { + "url": "https://github.com/jonniespratley/angular-cms/issues" + }, + "homepage": "https://github.com/jonniespratley/angular-cms" } diff --git a/server.js b/server.js index 0390316..bba0f9c 100755 --- a/server.js +++ b/server.js @@ -46,8 +46,18 @@ var httpsServer = null; * */ var options = { - port : 8080, - host : '127.0.0.1', + host : { + hostname : 'localhost', + port : process.env.PORT || 5000, + }, + proxy : { + hostname : 'localhost', + port : 5001 + }, + api : { + hostname : 'localhost', + port : 5151 + }, key : httpsKey, cert : httpsCert, hostncmsOnly : true, @@ -57,7 +67,7 @@ var options = { /* ======================[ @TODO: Dynamic REST API ]====================== */ var rest = require('./routes/rest').rest; -rest.init(8181); +rest.init(options.api.port); /* @TODO: Proxy Server */ proxyServer = httpProxy.createServer(options, function(req, res, proxy) { @@ -66,35 +76,29 @@ proxyServer = httpProxy.createServer(options, function(req, res, proxy) { if(req.url.match(/^\/api\//)) { proxy.proxyRequest(req, res, { host : '127.0.0.1', - port : 8181 + port : options.api.port }); console.log('Routing request: API server'.warn); - //Custom server with yeoman and socketio - } else if(req.url.match(/^\/smartpass\//)) { - proxy.proxyRequest(req, res, { - host : '127.0.0.1', - port : 3535 - }); - console.log('Routing request: Passbook Server'.warn); - } else { /* Default express server */ proxy.proxyRequest(req, res, { host : '127.0.0.1', - port : 9000 + port : options.host.port }); console.log('Routing request: App Server'.warn); } }); //HTTPS Server - will get prompted in browser if keys are not real. +/* httpsServer = https.createServer(options, function(req, res) { - res.writeHead(200, { - 'Content-type' : 'text/plain' - }); - res.write('Request proxied ' + JSON.stringify(req.headers)); - res.end(); +res.writeHead(200, { +'Content-type' : 'text/plain' +}); +res.write('Request proxied ' + JSON.stringify(req.headers)); +res.end(); }).listen(8282); +*/ //////////////////////////// //## Socket Server @@ -216,4 +220,4 @@ var SocketServer = { SocketServer.init(proxyServer); //Start the proxy server -proxyServer.listen(8080); +proxyServer.listen(options.host.port); diff --git a/test/spec/controllers/admin.js b/test/spec/controllers/admin.js index 74cd888..b29d4ad 100755 --- a/test/spec/controllers/admin.js +++ b/test/spec/controllers/admin.js @@ -3,13 +3,13 @@ describe('Controller: AdminCtrl', function () { // load the controller's module - beforeEach(angular.module('angularCmsBaseApp')); + beforeEach(module('angularCmsBaseApp')); var AdminCtrl, scope; // Initialize the controller and a mock scope - beforeEach(angular.inject(function ($controller, $rootScope) { + beforeEach(inject(function ($controller, $rootScope) { scope = $rootScope.$new(); AdminCtrl = $controller('AdminCtrl', { $scope: scope