Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Escalante committed Mar 17, 2016
1 parent 4073856 commit ef32b86
Show file tree
Hide file tree
Showing 11 changed files with 803 additions and 827 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015", "stage-2"]
}
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
build:
cp -R lib src
babel src --out-dir lib

unbuild:
rm -rf lib
mv src lib

publish:
make build
npm publish .
make unbuild
4 changes: 2 additions & 2 deletions contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ If you are opening an issue about a bug, make sure that you include clear steps
### Getting Set Up

- Clone the project down
- Make sure [nodejs](http://nodejs.org) has been installed and is above version `0.10.x`
- Make sure [nodejs](http://nodejs.org) has been installed and is above version `4.x`
- Run `npm install`
- Put in work

Expand All @@ -21,7 +21,7 @@ To run the test suite, make sure you have installed mocha (`npm install mocha -g

### Code Style

To keep a consistant coding style in the project, we're using [Polar Mobile's guide](https://github.com/polarmobile/coffeescript-style-guide), with one difference begin that much of this project uses `under_scores` rather than `camelCase` for variable naming. For any inline documentation in the code, we're using [JSDoc](http://usejsdoc.org/).
To keep a consistent coding style in the project, we use [standard](http://standardjs.com). For any inline documentation in the code, we're using [JSDoc](http://usejsdoc.org/).

### Commit Cleanliness

Expand Down
2 changes: 1 addition & 1 deletion lib/api/add.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Template from './../template'
import Template from '../template'

/*
* Create a new template.
Expand Down
11 changes: 11 additions & 0 deletions lib/api/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import add from './add'
import remove from './remove'
import init from './init'
import run from './run'

export default {
add: add,
remove: remove,
init: init,
run: run
}
9 changes: 5 additions & 4 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import Template from './template'
import {EventEmitter} from 'events'
import fs from 'fs'
import path from 'path'
import api from './api'

/*
* Given a base path, returns a Sprout instance.
Expand Down Expand Up @@ -43,7 +44,7 @@ class Sprout {
* @return {Promise} - Promise for Sprout instance.
*/
add (name, src) {
return require('./api/add')(this, name, src).return(this)
return api.add(this, name, src).return(this)
}

/*
Expand All @@ -52,7 +53,7 @@ class Sprout {
* @return {Promise} - Promise for Sprout instance.
*/
remove (name) {
return require('./api/remove')(this, name).return(this)
return api.remove(this, name).return(this)
}

/*
Expand All @@ -64,7 +65,7 @@ class Sprout {
* @return {Promise} - Promise for Sprout instance.
*/
init (name, target, options) {
return require('./api/init')(this, name, target, options).return(this)
return api.init(this, name, target, options).return(this)
}

/*
Expand All @@ -77,7 +78,7 @@ class Sprout {
* @return {Promise} - Promise for Sprout instance.
*/
run (name, target, generator, args) {
return require('./api/run')(this, name, target, generator, args)
return api.run(this, name, target, generator, args)
.return(this)
}
}
Expand Down
28 changes: 14 additions & 14 deletions lib/template.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,19 @@ import path from 'path'
import yaml from 'js-yaml'
import minimatch from 'minimatch'
import _ from 'lodash'
import rimraf from 'rimraf'
import {exec} from 'child_process'
import readdirp from 'readdirp'
import {ncp} from 'ncp'
import fs from 'fs'
import dns from 'dns'

rimraf = Promise.promisify(rimraf)
exec = Promise.promisify(exec)
readdirp = Promise.promisify(readdirp)
ncp = Promise.promisify(ncp)
fs = Promise.promisifyAll(fs)
dns = Promise.promisifyAll(dns)
import _rimraf from 'rimraf'
import _readdirp from 'readdirp'
import _fs from 'fs'
import _dns from 'dns'
import {exec as _exec} from 'child_process'
import {ncp as _ncp} from 'ncp'

const rimraf = Promise.promisify(_rimraf)
const exec = Promise.promisify(_exec)
const readdirp = Promise.promisify(_readdirp)
const ncp = Promise.promisify(_ncp)
const fs = Promise.promisifyAll(_fs)
const dns = Promise.promisifyAll(_dns)

/*
* Register CoffeeScript `init` file in template
Expand Down Expand Up @@ -179,7 +179,7 @@ class Template {
return exec(`git checkout tags/${options.tag}`, { cwd: this.path })
}
}
throw new Error(`tag '${options.tag} does not exist`)
throw new Error(`tag '${options.tag}' does not exist`)
})
}
}).then(() => {
Expand Down
18 changes: 9 additions & 9 deletions lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import ejs from 'ejs'
import path from 'path'
import _ from 'lodash'
import underscoreString from 'underscore.string'
import fs from 'fs'
import mkdirp from 'mkdirp'
import {exec} from 'child_process'
import {ncp} from 'ncp'

fs = Promise.promisifyAll(fs)
exec = Promise.promisify(exec)
ncp = Promise.promisify(ncp)
mkdirp = Promise.promisify(mkdirp)
import _fs from 'fs'
import _mkdirp from 'mkdirp'
import {exec as _exec} from 'child_process'
import {ncp as _ncp} from 'ncp'

const fs = Promise.promisifyAll(_fs)
const exec = Promise.promisify(_exec)
const ncp = Promise.promisify(_ncp)
const mkdirp = Promise.promisify(_mkdirp)

/*
* Given a source path and a target path, returns a Utils instance.
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@
"which": "^1.1.1"
},
"devDependencies": {
"babel-core": "^6.7.2",
"babel-preset-es2015": "^6.6.0",
"babel-preset-stage-2": "^6.5.0",
"chai": "^3.0.0",
"coveralls": "^2.11.2",
"errno": "^0.1.2",
Expand Down Expand Up @@ -57,7 +60,7 @@
"lint": "standard --verbose | snazzy",
"precommit": "npm run lint -s",
"pretest": "npm run lint -s",
"test": "istanbul cover _mocha -- -u exports -R spec"
"test": "mocha"
},
"standard": {
"ignore": [
Expand Down
1 change: 1 addition & 0 deletions test/mocha.opts
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
--reporter spec
--require babel-core/register
--timeout 30000
Loading

0 comments on commit ef32b86

Please sign in to comment.