From f805a8ac2973c7ea0e59ab431aef92894bb5a1d8 Mon Sep 17 00:00:00 2001 From: Jonnie Spratley Date: Wed, 15 Jul 2015 16:52:21 -0700 Subject: [PATCH] fix: added pouchdb --- .gitignore | 3 +- .travis.yml | 2 +- Gruntfile.js | 249 +++++++++++------------ app/.DS_Store | Bin 10244 -> 10244 bytes app/images/00000002 | Bin 4373 -> 0 bytes config/config.json | 461 ++++++++++++++++++++----------------------- package.json | 14 +- routes/cms-auth.js | 42 ++-- routes/cms-db.js | 30 +-- routes/cms-proxy.js | 29 +-- routes/cms-rest.js | 26 +-- routes/cms-router.js | 48 +++-- routes/rest.js | 211 +++++++------------- server.js | 20 +- www/views/main.html | 1 - 15 files changed, 500 insertions(+), 636 deletions(-) delete mode 100644 app/images/00000002 mode change 100755 => 100644 package.json diff --git a/.gitignore b/.gitignore index d1a8e31..f049c53 100755 --- a/.gitignore +++ b/.gitignore @@ -13,4 +13,5 @@ db coverage docs dist -node_modules \ No newline at end of file +node_modules +angular-cms-db diff --git a/.travis.yml b/.travis.yml index 592b35a..5a392b8 100755 --- a/.travis.yml +++ b/.travis.yml @@ -4,7 +4,7 @@ node_js: before_script: - 'npm install -g bower grunt-cli' - 'bower install' - - 'grunt --force' + - 'grunt -f -v' #- sleep 2 #- 'grunt serve' after_script: diff --git a/Gruntfile.js b/Gruntfile.js index 6f7de46..a19e399 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,20 +1,26 @@ - /* jshint camelcase:false */ 'use strict'; var fs = require('fs'), - express = require('express'), - cmsRouter = require('./routes/cms-router.js'), - config = JSON.parse(fs.readFileSync('./config/config.json')), - LIVERELOAD_PORT = 35729, - SERVER_PORT = process.env.PORT || 9000; + express = require('express'), + cmsRouter = require('./routes/cms-router.js'), + config = JSON.parse(fs.readFileSync('./config/config.json')), + LIVERELOAD_PORT = 35329, + SERVER_PORT = process.env.PORT || 9005; + + +var startNodeServer = function() { + var app = express(); + var router = new cmsRouter(config, app); + router.mount(); + + app.listen(config.port, function() { + console.log('express server listening on port: ' + config.port); + }); -var startNodeServer = function(){ - var _app = express(); - var server = new cmsRouter.mount(config, _app); }; -var serverEndpoint = 'http://127.0.0.1:8181'; +var serverEndpoint = 'http://127.0.0.1:' + config.port; var proxyConfig = { proxy: { forward: { @@ -27,16 +33,14 @@ var proxyConfig = { //var lrSnippet = require('connect-livereload')({port: LIVERELOAD_PORT}); -var mountFolder = function (connect, dir) { +var mountFolder = function(connect, dir) { return connect.static(require('path').resolve(dir)); }; -module.exports = function (grunt) { +module.exports = function(grunt) { //Connect proxy to route requests to localhost:8181/api - grunt.loadNpmTasks('grunt-connect-proxy'); - grunt.loadNpmTasks('intern'); - require('json-proxy').initialize({}); + //require('json-proxy').initialize({}); require('load-grunt-tasks')(grunt); require('time-grunt')(grunt); @@ -96,7 +100,7 @@ module.exports = function (grunt) { options: { open: true, base: ['.tmp', '<%= yeoman.app %>'], - middleware: function (connect, options) { + middleware: function(connect, options) { startNodeServer(options, connect); return [ require('json-proxy').initialize(proxyConfig), @@ -119,7 +123,7 @@ module.exports = function (grunt) { keepAlive: true, open: true, base: '<%= yeoman.dist %>', - middleware: function (connect, options) { + middleware: function(connect, options) { return [ require('json-proxy').initialize(proxyConfig), mountFolder(connect, 'dist') @@ -131,7 +135,7 @@ module.exports = function (grunt) { options: { port: 9191, open: true, - middleware: function (connect, options) { + middleware: function(connect, options) { return [ mountFolder(connect, '.grunt'), mountFolder(connect, '.tmp'), @@ -152,20 +156,18 @@ module.exports = function (grunt) { //'Gruntfile.js' ], app: [ - '<%= yeoman.app %>/scripts', - '!<%= yeoman.app %>/scripts/libs' + '<%= yeoman.app %>/scripts', + '!<%= yeoman.app %>/scripts/libs' ] }, // Empties folders to start fresh clean: { dist: { - files: [ - { - dot: true, - src: ['.tmp', '<%= yeoman.dist %>/*', '!<%= yeoman.dist %>/.git*'] - } - ] + files: [{ + dot: true, + src: ['.tmp', '<%= yeoman.dist %>/*', '!<%= yeoman.dist %>/.git*'] + }] }, server: '.tmp' }, @@ -176,14 +178,12 @@ module.exports = function (grunt) { browsers: ['last 1 version'] }, dist: { - files: [ - { - expand: true, - cwd: '.tmp/styles/', - src: '{,*/}*.css', - dest: '.tmp/styles/' - } - ] + files: [{ + expand: true, + cwd: '.tmp/styles/', + src: '{,*/}*.css', + dest: '.tmp/styles/' + }] } }, @@ -195,48 +195,40 @@ module.exports = function (grunt) { sourceRoot: '' }, dist: { - files: [ - { - expand: true, - cwd: '<%= yeoman.app %>/scripts', - src: '{,*/}*.coffee', - dest: '.tmp/scripts', - ext: '.js' - } - ] + files: [{ + expand: true, + cwd: '<%= yeoman.app %>/scripts', + src: '{,*/}*.coffee', + dest: '.tmp/scripts', + ext: '.js' + }] }, test: { - files: [ - { - expand: true, - cwd: 'test', - src: '{,**/}*.{coffee,litcoffee,coffee.md}', - dest: '.tmp', - ext: '.js' - } - ] + files: [{ + expand: true, + cwd: 'test', + src: '{,**/}*.{coffee,litcoffee,coffee.md}', + dest: '.tmp', + ext: '.js' + }] }, e2e: { - files: [ - { - expand: true, - cwd: 'test/e2e', - src: '{,*/}*.coffee', - dest: '.tmp/e2e', - ext: '.js' - } - ] + files: [{ + expand: true, + cwd: 'test/e2e', + src: '{,*/}*.coffee', + dest: '.tmp/e2e', + ext: '.js' + }] }, routes: { - files: [ - { - expand: true, - cwd: 'routes', - src: '{,*/}*.coffee', - dest: '.tmp/routes', - ext: '.js' - } - ] + files: [{ + expand: true, + cwd: 'routes', + src: '{,*/}*.coffee', + dest: '.tmp/routes', + ext: '.js' + }] } }, @@ -305,26 +297,22 @@ module.exports = function (grunt) { // The following *-min tasks produce minified files in the dist folder imagemin: { dist: { - files: [ - { - expand: true, - cwd: '<%= yeoman.app %>/images', - src: '{,*/}*.{png,jpg,jpeg,gif}', - dest: '<%= yeoman.dist %>/images' - } - ] + files: [{ + expand: true, + cwd: '<%= yeoman.app %>/images', + src: '{,*/}*.{png,jpg,jpeg,gif}', + dest: '<%= yeoman.dist %>/images' + }] } }, svgmin: { dist: { - files: [ - { - expand: true, - cwd: '<%= yeoman.app %>/images', - src: '{,*/}*.svg', - dest: '<%= yeoman.dist %>/images' - } - ] + files: [{ + expand: true, + cwd: '<%= yeoman.app %>/images', + src: '{,*/}*.svg', + dest: '<%= yeoman.dist %>/images' + }] } }, htmlmin: { @@ -350,14 +338,12 @@ module.exports = function (grunt) { */ }, - files: [ - { - expand: true, - cwd: '<%= yeoman.app %>', - src: ['*.html', 'views/*.html'], - dest: '<%= yeoman.dist %>' - } - ] + files: [{ + expand: true, + cwd: '<%= yeoman.app %>', + src: ['*.html', 'views/*.html'], + dest: '<%= yeoman.dist %>' + }] } }, @@ -386,14 +372,12 @@ module.exports = function (grunt) { // minsafe compatible so Uglify does not destroy the ng references ngmin: { dist: { - files: [ - { - expand: true, - cwd: '.tmp/concat/scripts', - src: '*.js', - dest: '.tmp/concat/scripts' - } - ] + files: [{ + expand: true, + cwd: '.tmp/concat/scripts', + src: '*.js', + dest: '.tmp/concat/scripts' + }] } }, @@ -407,26 +391,23 @@ module.exports = function (grunt) { // Copies remaining files to places other tasks can use copy: { dist: { - files: [ - { - expand: true, - dot: true, - cwd: '<%= yeoman.app %>', - dest: '<%= yeoman.dist %>', - src: [ - '*.{ico,png,txt}', '.htaccess', - //'bower_components/**/*', - 'images/{,*/}*.{webp}', - 'fonts/*' - ] - }, - { - expand: true, - cwd: '.tmp/images', - dest: '<%= yeoman.dist %>/images', - src: ['generated/*'] - } - ] + files: [{ + expand: true, + dot: true, + cwd: '<%= yeoman.app %>', + dest: '<%= yeoman.dist %>', + src: [ + '*.{ico,png,txt}', '.htaccess', + //'bower_components/**/*', + 'images/{,*/}*.{webp}', + 'fonts/*' + ] + }, { + expand: true, + cwd: '.tmp/images', + dest: '<%= yeoman.dist %>/images', + src: ['generated/*'] + }] }, styles: { expand: true, @@ -550,7 +531,7 @@ module.exports = function (grunt) { dest: '.tmp/scripts/templates.js', options: { module: 'angularCmsApp', - url: function (url) { + url: function(url) { return url.replace('app/', ''); }, prefix: '', @@ -619,23 +600,13 @@ module.exports = function (grunt) { 'test/routes/*-spec.js' ] } - }, - intern: { - test: { - options: { - runType: 'client', - config: 'test/intern.conf', - reporters: [ 'console' ], - suites: [] - } - } } }; // Define the configuration for all the tasks grunt.initConfig(GruntConfig); - grunt.registerTask('serve', function (target) { + grunt.registerTask('serve', function(target) { if (target === 'dist') { return grunt.task.run(['build', 'connect:dist:keepalive']); } @@ -643,12 +614,12 @@ module.exports = function (grunt) { grunt.task.run(['clean:server', 'concurrent:server', 'autoprefixer', 'connect:livereload', 'watch']); }); - grunt.registerTask('server', function () { + grunt.registerTask('server', function() { grunt.log.warn('The `server` task has been deprecated. Use `grunt serve` to start a server.'); grunt.task.run(['serve']); }); - grunt.registerTask('test', function (target) { + grunt.registerTask('test', function(target) { grunt.task.run(['clean:server', 'concurrent:test', 'autoprefixer', 'connect:test']); if (target === 'e2e') { return grunt.task.run(['karma', 'protractor_webdriver', 'protractor', 'coveralls']); @@ -658,7 +629,7 @@ module.exports = function (grunt) { return grunt.task.run(['karma:unit', 'coveralls']); } }); - + grunt.registerTask('build', [ 'clean:dist', 'useminPrepare', @@ -669,7 +640,7 @@ module.exports = function (grunt) { 'ngtemplates', 'copy:dist', //'cdnify', - 'cssmin', + //'cssmin', 'uglify', 'rev', 'usemin' @@ -678,8 +649,8 @@ module.exports = function (grunt) { grunt.registerTask('ptor', ['coffee:test', 'protractor_webdriver', 'protractor']); grunt.registerTask('build-docs', ['useminPrepare', 'autoprefixer', 'concat', 'ngmin']); grunt.registerTask('docs', ['coffee', 'ngdocs', 'connect:docs', 'watch:scripts']); + grunt.registerTask('dist', ['docs', 'build']); grunt.registerTask('default', ['newer:jshint', 'test', 'build']); - grunt.registerTask('heroku:production', 'build'); grunt.registerTask('heroku:development', 'build'); }; diff --git a/app/.DS_Store b/app/.DS_Store index b532b2a7c1dcba2df4db69bb1b6cdc332f3e3710..eb331eefe3154a3ce52028748d4b474fde262642 100644 GIT binary patch delta 41 xcmZn(XbG6$aFU^hRb>SPB2mCXhM;f$O0g>LXpY*?|GUEvqY=9Qw%%m5?h4blJr delta 204 zcmZn(XbG6$XEU^hRb=41x}mCXhM;f(d%49N_+48;t(Kr){pg`t!ohar`rI49jO zI5|JJfB^w;sLaiGaY-pHNoHWUu=&t@uyUL#Q!rGjVz<5^1I7By&4PD$H?u4JV%Z!i H!psZ+TIevm diff --git a/app/images/00000002 b/app/images/00000002 deleted file mode 100644 index c8cd16a7e27c9562ad06e77572bb26b8a10c2519..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4373 zcmZuz2{=@38y-yAx6%+|nk*@1>>^`l$R08y>sZG&3>hl>_Sur1$&!?8gQ5syi7YK9 z`#zE_TN2sn*Yf{=-*pZhuQb6w}e7#Sd#8Mqk$006U&w#L~h zD6>u>9CV;2N9JpWMx0jzhw1=E`(ePBzDTMN>3k%|=cN|Q6DQxaZBcWvQL!MYnx~wc zfQW4k>i&HaJS(e6yS-}jGc?4ZeoVB(QfI)LWRxwD3bCx>Qr0Uga z$?w3|8)+hvQ4*4%eEJ7vkmDmN>y0P`!Ks3HV7_Ih z;0Nb|+q8}(Qyl_ecI$j!-*&bhK%67X=Iy*tzI%+MCdcW|F<+?xbg6Cf4LFv#9eI~r zfPbO$Oe`=)2VKZMl!=-B)akUlR%Nn-mbjSOsz3FYzaDv`n(2->XGjG$U6V=><&ou* zv_j-vSwRiXx$HEJO!5Vp9Kbto?wPF#Et7Lq<8x7y?#pE`5(uyZO;-G?gA4SMmD++JQ7_H|Q~{8rYR&wJM{ z7ji0xp3^xc<)}GZ__$D41KJ%yRKHz?7U{qwa8Cq#-CE@BVt_Y zBNaoDccBgp5y1mf!CbP!w5Nk|+&Elr*Z=|}<&A1}XgjfRfciNa0Z-+d)PYOa*(4Y` z8yj4RNfkbck~a_McljADV?C$zR3RpFn@ougIKc;^rwb+{+*_zm+@^GZGDE?ct7&U>LE zt_$HM`RYdSjdQ--b#zwYyZ33|gQbrj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