Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' into fix_upstart

  • Loading branch information...
commit 9466d6c4af5268b2895b94c641d2a758920ce5b4 2 parents 0abd6d8 + 766638d
@addisonj addisonj authored
View
6 index.coffee
@@ -1,5 +1,5 @@
###
-CLI to automatically deploy stuff, kind of like heroku.
+CLI to automatically deploy stuff, kind of like heroku.
Ubuntu only! (upstart)
TODO remember last command again
@@ -130,7 +130,7 @@ init = (cb) ->
// cron jobs (from your app folder)
cron: {
someTask: { time: "0 3 * * *", command: "node sometask.js"},
- }
+ },
// servers to deploy to
servers: {
@@ -200,7 +200,7 @@ getLayer = (name, cb) ->
layer = new Layer name, layerConfig, repoName, mainConfig, program.local
layer.on "error", (err) -> return cb err
layer.on "ready", ->
- cb null, layer
+ cb null, layer
# our handler on the finish
finish = (err) ->
View
20 lib/MainConfig.coffee
@@ -1,4 +1,3 @@
-
path = require "path"
# read a config file
@@ -6,18 +5,15 @@ readConfig = (f, cb) ->
try
m = require f
catch e
- console.log "BAD", e
- throw e
- cb e
+ return cb e
cb null, m
-
class MainConfig
constructor: ({@start, @install, @plugins, @cron, servers}) ->
# normalize to an array for multi server deploys
@layers = []
- for name, layer of servers
+ for name, layer of servers
@layers[name] = @normalizeLayer layer
getLayerByName: (name) ->
@@ -48,7 +44,7 @@ class MainConfig
console.log "using deprecated cron syntax"
matches = cron.match(/([0-9\s\*]+)\s+(.*)/)
if not matches? then throw new Error "Invalid Cron: #{@cron}"
- warning =
+ warning =
"""
you should switch your cron to instead be the following in ggg.js:
cron: { cronName: {time: '#{matches[1]}', command: '#{matches[2]}' } }
@@ -58,7 +54,6 @@ class MainConfig
return cron
-
normalizeLayer: (config) ->
if typeof config == "string"
config = {
@@ -73,10 +68,9 @@ class MainConfig
return config
-
-MainConfig.loadFromFile = (file, cb) ->
- readConfig file, (err, config) ->
- if err? then return cb err
- cb null, new MainConfig config
+ @loadFromFile = (file, cb) ->
+ readConfig file, (err, config) ->
+ if err? then return cb new Error "Could not load config file #{file}. Are you sure it exists?"
+ cb null, new MainConfig config
module.exports = MainConfig
View
37 package.json
@@ -1,25 +1,34 @@
{
"name": "gogogo",
- "description":"CLI to automate deploys based on package.json",
+ "description": "CLI to automate deploys based on package.json",
"author": "Sean Hess",
"contributors": [
- "Addison Higham <addisonj@gmail.com> (github.com/addisonj)"
+ "Addison Higham <addisonj@gmail.com> (github.com/addisonj)",
+ "Jamison Dance <jergason@gmail.com> (http://jamisondance.com)"
],
- "version": "0.4.6",
- "repository": { "url": "git@github.com:idottv/gogogo.git" },
- "bin": {
- "gogogo" : "bin/gogogo.js",
- "ggg" : "bin/gogogo.js"
+ "version": "0.4.7",
+ "repository": {
+ "url": "git@github.com:idottv/gogogo.git"
+ },
+ "bin": {
+ "gogogo": "bin/gogogo.js",
+ "ggg": "bin/gogogo.js"
},
"main": "index.js",
- "scripts": { "prepublish" : "coffee -c lib/*.coffee plugins/*.coffee index.coffee" },
+ "scripts": {
+ "prepublish": "coffee -c lib/*.coffee plugins/*.coffee index.coffee",
+ "test": "node_modules/.bin/mocha --compilers coffee:coffee-script test/*"
+ },
"devDependencies": {
- "coffee-script":"1.3.1"
- },
+ "coffee-script": "1.3.1",
+ "mocha": "~1.6.0"
+ },
"dependencies": {
- "commander" : "0.6.1",
- "async" : "0.1.22",
- "fjs" : "0.4.3"
+ "commander": "0.6.1",
+ "async": "0.1.22",
+ "fjs": "0.4.3"
},
- "engines": { "node": ">= 0.6.x < 0.9.0" }
+ "engines": {
+ "node": ">= 0.6.x < 0.9.0"
+ }
}
View
10 test/mainConfigTest.coffee
@@ -0,0 +1,10 @@
+MainConfig = require '../lib/MainConfig'
+assert = require 'assert'
+
+describe 'MainConfig', ->
+ describe 'loadFromFile', ->
+ it 'returns a sensible error if the config file doesnt exist', ->
+ MainConfig.loadFromFile 'someBogusFile', (err, config) ->
+ assert err
+ assert.equal undefined, config
+ assert /config file/i.test err.message
Please sign in to comment.
Something went wrong with that request. Please try again.