rails_backbone_generators 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d69602ad8279414373bf8b18ecce58ec1886db56
4
- data.tar.gz: 9ba42fbcab97ba86327dfa95aa3085f69db8852f
3
+ metadata.gz: c00bfb328f4282ad26dd62a088d1bdffcbed9bef
4
+ data.tar.gz: a94928e125c0b1af245ee88535d84b8267bc0734
5
5
  SHA512:
6
- metadata.gz: dd02b0089ad007aa6a3854578400e538d957f2c53bae6329d75094d459c5b7ba928f63ead69b92dbe10758e50286eef8f3338c58bebc94fb58c12dd5f5e92190
7
- data.tar.gz: 47fd50dcde42c92e44257cfa000b9ff91bb1a1b41225fe9cb2103b3310e8a2365352087ef64bee2c016c6930a0e6d736ee44ff921f07286ee2d90f15ba23646a
6
+ metadata.gz: 271dca8bc22d69666182c52c8812edcdf5f95447aabce4632844eafddd205c58c27f394635f8215b54ca7f2807c313d64f80c4d4ca53fe5b572985aad55dbdc1
7
+ data.tar.gz: 1f2bd21fc928813bf525857e2d219c6baa0aaca32e68037ec2497507c765ac27a59e2812db8607323a2971caa22286d732da56b686260bad812a5c4a35580c74
@@ -1,9 +1,11 @@
1
1
  Description:
2
- Create a CoffeeScript Backbone collection with spec
2
+ Create a CoffeeScript Backbone collection with model and spec
3
3
 
4
4
  Example:
5
5
  rails generate backbone:collection Things
6
6
 
7
7
  This will create:
8
8
  app/assets/javascript/collections/things.js.coffee
9
+ app/assets/javascript/models/thing.js.coffee
9
10
  spec/javascript/collections/things_spec.js.coffee
11
+ spec/javascript/models/thing_spec.js.coffee
@@ -3,11 +3,24 @@ module Backbone
3
3
  source_root File.expand_path('../templates', __FILE__)
4
4
 
5
5
  def copy_collection_file
6
- template 'collection.js.coffee', "app/assets/javascripts/collections/#{file_name}.js.coffee"
6
+ template 'collection.js.coffee', "app/assets/javascripts/collections/#{plural_file_name}.js.coffee"
7
+ end
8
+
9
+ def copy_model_file
10
+ template 'model.js.coffee', "app/assets/javascripts/models/#{singular_file_name}.js.coffee"
7
11
  end
8
12
 
9
13
  def copy_spec_file
10
- template 'collection_spec.js.coffee', "spec/javascripts/collections/#{file_name}_spec.js.coffee"
14
+ template 'collection_spec.js.coffee', "spec/javascripts/collections/#{plural_file_name}_spec.js.coffee"
15
+ end
16
+
17
+ def copy_model_spec_file
18
+ template 'model_spec.js.coffee', "spec/javascripts/models/#{singular_file_name}_spec.js.coffee"
19
+ end
20
+
21
+ protected
22
+ def singular_file_name
23
+ @singular_file_name ||= file_name.singularize
11
24
  end
12
25
  end
13
26
  end
@@ -1 +1,2 @@
1
- class window.<%= class_name %> extends Backbone.Collection
1
+ class window.<%= class_name.pluralize %> extends Backbone.Collection
2
+ model: <%= class_name.singularize %>
@@ -0,0 +1 @@
1
+ class window.<%= class_name %> extends Backbone.Model
@@ -0,0 +1,4 @@
1
+ describe '<%= class_name %>', ->
2
+ beforeEach ->
3
+ @sut = new <%= class_name %>
4
+
@@ -1,3 +1,3 @@
1
1
  module RailsBackboneGenerators
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails_backbone_generators
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jade Meskill
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-25 00:00:00.000000000 Z
12
+ date: 2013-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -39,6 +39,8 @@ files:
39
39
  - lib/generators/backbone/collection/collection_generator.rb
40
40
  - lib/generators/backbone/collection/templates/collection.js.coffee
41
41
  - lib/generators/backbone/collection/templates/collection_spec.js.coffee
42
+ - lib/generators/backbone/collection/templates/model.js.coffee
43
+ - lib/generators/backbone/collection/templates/model_spec.js.coffee
42
44
  - lib/generators/backbone/model/USAGE
43
45
  - lib/generators/backbone/model/model_generator.rb
44
46
  - lib/generators/backbone/model/templates/model.js.coffee
@@ -74,7 +76,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
74
76
  version: '0'
75
77
  requirements: []
76
78
  rubyforge_project:
77
- rubygems_version: 2.0.3
79
+ rubygems_version: 2.0.2
78
80
  signing_key:
79
81
  specification_version: 4
80
82
  summary: Generators for creating CoffeeScript Backbone Views, Models, Collections