Skip to content

Commit

Permalink
fix up tests to work much better
Browse files Browse the repository at this point in the history
- pull from real github repo
- fix strange bug in prepublish task
- remove unneeded deps
- eliminate any extra console logs when overriding prompt
  • Loading branch information
Jeff Escalante committed Dec 14, 2013
1 parent a9b6ae2 commit a0a2150
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.DS_Store
node_modules
node_modules
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
language: node_js
node_js:
- '0.8'
- '0.10'
2 changes: 1 addition & 1 deletion Gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ var g = require('gulp'),
coffee = require('gulp-coffee');

g.task('build', function(){
g.src('src/**/*.coffee').pipe(coffee({ bare: true })).pipe(g.dest('lib'))
g.src('src/**/*.coffee').pipe(coffee()).pipe(g.dest('lib'))
});
4 changes: 2 additions & 2 deletions lib/commands/add.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
require 'shelljs/global'
which = require 'which'
exec = require('child_process').exec
Base = require '../base'
accord = require '../utils/accord'
Expand All @@ -10,7 +10,7 @@ class Add extends Base
accord.call(@, { name: name, url: url, options: opts, cb: cb })

if not @name then return @cb('your template needs a name!')
if not which('git') then return @cb('you need to have git installed')
if not which.sync('git') then return @cb('you need to have git installed')

if @name and not @url
@url = @name
Expand Down
6 changes: 4 additions & 2 deletions lib/commands/init.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,16 @@ class Init extends Base
@config_values = @options
return W.resolve()

console.log '\nplease enter the following information:'.yellow
prompt.override = @options
prompt.message = ''
prompt.delimiter = ''

if not prompt.override then console.log '\nplease enter the following information:'.yellow

prompt.start()
nodefn.call(prompt.get, @config.configure).tap (res) =>
@config_values = res
console.log('')
if not prompt.override then console.log('')

user_after_fn = ->
if not @config.before then return W.resolve()
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,23 +15,23 @@
"colors": "0.6.x",
"optimist": "0.6.x",
"indx": "0.0.x",
"shelljs": "0.2.x",
"osenv": "0.0.x",
"rimraf": "2.x.x",
"ncp": "0.4.x",
"ejs": "0.8.x",
"prompt": "0.2.x",
"readdirp": "0.3.x",
"event-stream": "3.x.x",
"when": "2.x.x",
"sugar": "1.x.x",
"mkdirp": "0.3.x"
"mkdirp": "0.3.x",
"which": "1.0.x"
},
"devDependencies": {
"mocha": "*",
"should": "*",
"gulp": "3.x.x",
"gulp-coffee": "1.x.x"
"gulp-coffee": "1.x.x",
"shelljs": "0.2.x"
},
"scripts": {
"test": "mocha",
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/basic
Submodule basic deleted from 7f01f0
5 changes: 2 additions & 3 deletions test/test.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ before ->
@exec = (cmd) -> exec(cmd, {silent: true})
@$ = path.join(__dirname, '../bin/sprout')


describe 'accord', ->

beforeEach ->
Expand Down Expand Up @@ -72,7 +71,7 @@ describe 'js api', ->

it '[init] creates a project template correctly', (done) ->
basic_path = path.join(__dirname, 'fixtures/basic')
sprout.add 'foobar', "file:////#{basic_path}", (err, res) ->
sprout.add 'foobar', "https://github.com/jenius/sprout-test-template.git", (err, res) ->
should.not.exist(err)
testpath = path.join(__dirname, 'testproj')
sprout.init 'foobar', testpath, { foo: 'bar' }, (err, res) =>
Expand Down Expand Up @@ -124,7 +123,7 @@ describe 'cli', ->
cmd.code.should.be.above(0)

it '[init] creates a project template correctly', ->
cmd = @exec("#{@$} add foobar file:////#{path.join(__dirname, 'fixtures/basic')}")
cmd = @exec("#{@$} add foobar https://github.com/jenius/sprout-test-template.git")
cmd.code.should.eql(0)
testpath = path.join(__dirname, 'testproj')
cmd = @exec("#{@$} init foobar #{testpath} --foo bar")
Expand Down

0 comments on commit a0a2150

Please sign in to comment.