From 4ad71dd2406d916466c6c2a28c499257016f5046 Mon Sep 17 00:00:00 2001 From: "didier.amyot" Date: Thu, 30 Oct 2014 22:22:47 -0700 Subject: [PATCH] fixed make file and added an example database --- api.go | 4 ++- client/Gruntfile.coffee | 57 ----------------------------------------- client/bower.json | 5 +++- client/gulpfile.js | 36 ++++++++++++++++++++++++++ client/index.html | 4 +-- client/package.json | 16 +++++------- makefile | 10 +++++--- params.yml | 6 ++++- 8 files changed, 62 insertions(+), 76 deletions(-) delete mode 100644 client/Gruntfile.coffee create mode 100644 client/gulpfile.js diff --git a/api.go b/api.go index 0050067..8ae70bd 100644 --- a/api.go +++ b/api.go @@ -7,6 +7,7 @@ import ( "net/http" "net/url" "strconv" + "strings" "github.com/gorilla/mux" "gopkg.in/mgo.v2" @@ -63,9 +64,10 @@ func (this *VultureBackend) GetDataBases() ([]string, error) { dbs, err := this.Client.DatabaseNames() if err == nil { return dbs, nil - } else if err.Error() == "unauthorized" { + } else if strings.Contains(err.Error(), "authorized") { return this.getDatabaseFromMongoURL() } else { + fmt.Println(">>> ", err.Error()) return nil, err } } diff --git a/client/Gruntfile.coffee b/client/Gruntfile.coffee deleted file mode 100644 index c537a2e..0000000 --- a/client/Gruntfile.coffee +++ /dev/null @@ -1,57 +0,0 @@ -module.exports = (grunt) -> - - # Project configuration. - grunt.initConfig( - packagekg: grunt.file.readJSON('package.json') - bower: - install:{} - shell: - bower: - command: "node_modules/.bin/bower install" - connect: - server: - options: - port: 4506 - base: '.' - keepalive: true - - clean: - compiledFiles: ["js"] - prod: [ - "node_modules", - "bower_components/fontawesome/src", - ] - - coffee: - compile: - expand: true - cwd: 'coffee' - src: ['**/*.coffee'] - dest: 'js' - ext: '.js' - - watch: - coffee: - files: ['**/*.coffee'] - tasks: ['coffee'] - options: - spawn: false - - concurrent: - target: ['watch', 'connect'], - - ) - - # Plugins - grunt.loadNpmTasks('grunt-bower-task') - grunt.loadNpmTasks('grunt-contrib-connect') - grunt.loadNpmTasks('grunt-contrib-coffee') - grunt.loadNpmTasks('grunt-contrib-watch') - grunt.loadNpmTasks('grunt-concurrent') - grunt.loadNpmTasks('grunt-contrib-clean') - grunt.loadNpmTasks('grunt-shell') - - # tasks - grunt.registerTask('default', ['bower', 'clean:compiledFiles', 'coffee:compile']) - grunt.registerTask('prod', ['shell:bower', 'clean:compiledFiles', 'coffee:compile', 'clean:prod']) - grunt.registerTask('dev', ['default', 'concurrent:target']) diff --git a/client/bower.json b/client/bower.json index f5d838d..3ad36c0 100644 --- a/client/bower.json +++ b/client/bower.json @@ -11,7 +11,7 @@ "dependencies": { "underscore": "~1.6.0", "foundation": "~5.2.1", - "angular": "~1.2.14", + "angular": "1.3.x", "angular-route": "~1.2.14", "angular-local-storage": "~0.0.1", "qunit": "~1.14.0", @@ -25,5 +25,8 @@ "angular-spinner": "~0.4.0", "highcharts-ng": "~0.0.6", "highcharts": "~3.0.7" + }, + "resolutions": { + "angular": "1.3.x" } } diff --git a/client/gulpfile.js b/client/gulpfile.js new file mode 100644 index 0000000..1cd73a3 --- /dev/null +++ b/client/gulpfile.js @@ -0,0 +1,36 @@ +var bower = require('gulp-bower'); +var gulp = require('gulp'); +var coffee = require('gulp-coffee'); +var help = require('gulp-task-listing'); +var clean = require('gulp-clean'); + + + +gulp.task('help', help); + +gulp.task('bower', function() { + return bower() + .pipe(gulp.dest('bower_components/')) +}); + +gulp.task('coffee', function() { + gulp.src('coffee/**/*.coffee') + .pipe(coffee({bare: true})) + .pipe(gulp.dest('./js/')) +}); + +gulp.task('clean', function(){ + return gulp.src(["js/", "bower_components/"], {read: false}) + .pipe(clean()) +}); + + +gulp.task('default', ['bower', 'coffee']); + + + +gulp.task('dev', ['bower', 'coffee'], function(){ + gulp.watch('coffee/**/*.coffee', ['coffee']); +}); + + diff --git a/client/index.html b/client/index.html index cc5fa4d..17062c6 100644 --- a/client/index.html +++ b/client/index.html @@ -10,7 +10,7 @@ - + @@ -45,7 +45,7 @@
- + diff --git a/client/package.json b/client/package.json index 90ea205..ef210b5 100644 --- a/client/package.json +++ b/client/package.json @@ -1,13 +1,9 @@ { - "devDependencies": { - "grunt": "^0.4.4", - "grunt-contrib-connect": "^0.7.1", - "grunt-contrib-coffee": "^0.10.1", - "grunt-contrib-watch": "^0.6.1", - "grunt-concurrent": "^0.5.0", - "grunt-contrib-clean": "^0.5.0", - "bower": "~1.3.0", - "grunt-bower-task": "^0.3.4", - "grunt-shell": "~0.7.0" + "dependencies": { + "gulp-task-listing": "~0.3.0", + "gulp-clean": "~0.3.1", + "gulp-coffee": "~2.2.0", + "gulp": "~3.8.9", + "gulp-bower": "0.0.7" } } diff --git a/makefile b/makefile index 773205b..4c9d9bc 100644 --- a/makefile +++ b/makefile @@ -1,13 +1,15 @@ prod: cd client; npm install - cd client; grunt prod + cd client; node_modules/.bin/gulp goxc - cd client; npm install - cd client; grunt dev: go get go test go build cd client; npm install - cd client; grunt + cd client; node_modules/.bin/gulp + +clean: + cd client; node_modules/.bin/gulp clean + rm -rf client/node_modules diff --git a/params.yml b/params.yml index 7b3d95e..d30ed43 100644 --- a/params.yml +++ b/params.yml @@ -17,4 +17,8 @@ ServingAddress: 0.0.0.0 MongoServers: - name: localhost - url: localhost:27017 \ No newline at end of file + url: localhost:27017 + + - + name: vulture example + url: mongodb://vulture:vulture_example@ds047800.mongolab.com:47800/vulture_example \ No newline at end of file