Skip to content
Browse files

Update generators and docs.

  • Loading branch information...
1 parent adff599 commit a9aec0c827318835c488a2d612175b9f4228fc1d @elving committed Apr 3, 2013
View
44 README.md
@@ -36,14 +36,52 @@ or
$ git clone git@github.com:elving/brunch-with-hipsters.git && npm install && brunch w -s
+## Generators
+
+First install [scaffolt](https://github.com/paulmillr/scaffolt#readme):
+
+ npm install -g scaffolt
+
+Then you can use the following commands to generate files:
+
+ scaffolt view <name>
+ → app/views/name.coffee
+ → test/views/name_test.coffee
+
+ scaffolt model <name>
+ → app/models/name.coffee
+ → test/models/name_test.coffee
+
+ scaffolt style <name>
+ → app/views/styles/name.styl
+
+ scaffolt template <name>
+ → app/views/templates/name.hbs
+
+ scaffolt collection <name>
+ → app/collections/name.coffee
+ → test/collections/name_test.coffee
+
+ scaffolt module <name>
+ → app/views/name.coffee
+ → test/views/name_test.coffee
+ → app/models/name.coffee
+ → test/models/name_test.coffee
+ → app/views/styles/name.styl
+ → app/views/templates/name.hbs
+
## Testing
-To run your tests using [Karma](https://github.com/karma-runner) you will need to install phantomJS:
+To run your tests using [Karma](https://github.com/karma-runner) you will need to install [phantomjs](https://github.com/ariya/phantomjs):
- brew install phantomjs
+ brew update && brew install phantomjs
-To run the tests just:
+Run the tests:
cake test
+Build and test your app:
+
+ cake build:test
+
You can change Karma's configuration by editing `test/karma.conf.js` and add any test helpers by editing `test/helpers.coffee`.
View
3 generators/collection_test/collection_test.coffee.hbs
@@ -3,3 +3,6 @@
describe '{{#camelize}}{{pluralName}}{{/camelize}}Collection', ->
beforeEach ->
@collection = new {{#camelize}}{{pluralName}}{{/camelize}}Collection()
+
+ it 'should exist', ->
+ expect(@collection).to.be.ok
View
1 generators/collection_test/generator.json
@@ -3,5 +3,6 @@
"from": "collection_test.coffee.hbs",
"to": "test/collections/{{pluralName}}_test.coffee"
}],
+
"dependencies": []
}
View
19 generators/generator/generator.json
@@ -1,13 +1,12 @@
{
- "files": [
- {
- "from": "generator.json.hbs",
- "to": "generators/{{name}}/generator.json"
- },
- {
- "from": "generated_file.coffee.hbs",
- "to": "generators/{{name}}/{{name}}.coffee.hbs"
- }
- ],
+ "files": [{
+ "from": "generator.json.hbs",
+ "to": "generators/{{name}}/generator.json"
+ },
+ {
+ "from": "generated_file.coffee.hbs",
+ "to": "generators/{{name}}/{{name}}.coffee.hbs"
+ }],
+
"dependencies": []
}
View
1 generators/generator/generator.json.hbs
@@ -3,5 +3,6 @@
"from": "{{name}}.coffee.hbs",
"to": "app/file.coffee"
}],
+
"dependencies": []
}
View
1 generators/model/generator.json
@@ -3,6 +3,7 @@
"from": "model.coffee.hbs",
"to": "app/models/{{name}}.coffee"
}],
+
"dependencies": [{
"name": "model_test",
"params": "{{name}}"
View
1 generators/model_test/generator.json
@@ -3,5 +3,6 @@
"from": "model_test.coffee.hbs",
"to": "test/models/{{name}}_test.coffee"
}],
+
"dependencies": []
}
View
3 generators/model_test/model_test.coffee.hbs
@@ -3,3 +3,6 @@
describe '{{#camelize}}{{name}}{{/camelize}}Model', ->
beforeEach ->
@model = new {{#camelize}}{{name}}{{/camelize}}Model()
+
+ it 'should exist', ->
+ expect(@model).to.be.ok
View
1 generators/module/generator.json
@@ -3,6 +3,7 @@
"from": "view.coffee.hbs",
"to": "app/views/{{name}}.coffee"
}],
+
"dependencies": [{
"name": "model",
"params": "{{name}}"
View
7 generators/module/view.coffee.hbs
@@ -1,7 +1,6 @@
-View = require '../lib/view'
{{#camelize}}{{name}}{{/camelize}}Model = require '../models/{{name}}'
-module.exports = class {{#camelize}}{{name}}{{/camelize}}View extends View
- template: require 'views/templates/{{name}}'
-
+module.exports = class {{#camelize}}{{name}}{{/camelize}}View extends Backbone.View
model: new {{#camelize}}{{name}}{{/camelize}}Model()
+
+ template: require 'views/templates/{{name}}'
View
1 generators/style/generator.json
@@ -3,5 +3,6 @@
"from": "style.styl.hbs",
"to": "app/views/styles/_{{name}}.styl"
}],
+
"dependencies": []
}
View
3 generators/style/style.styl.hbs
@@ -1,2 +1,3 @@
+// {{#camelize}}{{name}}{{/camelize}}
+
.{{name}}
- // {{#camelize}}{{name}}{{/camelize}} Module
View
1 generators/template/generator.json
@@ -3,5 +3,6 @@
"from": "template.hbs.hbs",
"to": "app/views/templates/{{name}}.hbs"
}],
+
"dependencies": []
}
View
5 generators/view/generator.json
@@ -3,8 +3,9 @@
"from": "view.coffee.hbs",
"to": "app/views/{{name}}.coffee"
}],
+
"dependencies": [{
- "name": "view_test",
- "params": "{{name}}"
+ "name": "view_test",
+ "params": "{{name}}"
}]
}
View
6 generators/view/view.coffee.hbs
@@ -1,6 +1,4 @@
-View = require '../lib/view'
+module.exports = class {{#camelize}}{{name}}{{/camelize}}View extends Backbone.View
+ className: '{{name}}'
-module.exports = class {{#camelize}}{{name}}{{/camelize}}View extends View
template: require 'views/templates/{{name}}'
-
- className: {{name}}
View
13 generators/view_test/generator.json
@@ -1,9 +1,8 @@
{
- "files": [
- {
- "from": "view_test.coffee.hbs",
- "to": "test/views/{{name}}_test.coffee"
- }
- ],
- "dependencies": []
+ "files": [{
+ "from": "view_test.coffee.hbs",
+ "to": "test/views/{{name}}_test.coffee"
+ }],
+
+ "dependencies": []
}
View
3 generators/view_test/view_test.coffee.hbs
@@ -3,3 +3,6 @@
describe '{{#camelize}}{{name}}{{/camelize}}View', ->
beforeEach ->
@view = new {{#camelize}}{{name}}{{/camelize}}View()
+
+ it 'should exist', ->
+ expect(@view).to.be.ok

0 comments on commit a9aec0c

Please sign in to comment.
Something went wrong with that request. Please try again.