cucumber_scaffold 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Manifest CHANGED
@@ -2,6 +2,7 @@ Manifest
2
2
  README.rdoc
3
3
  Rakefile
4
4
  TODO
5
+ cucumber_scaffold.gemspec
5
6
  lib/generators/cucumber_scaffold/feature/USAGE
6
7
  lib/generators/cucumber_scaffold/feature/feature_generator.rb
7
8
  lib/generators/cucumber_scaffold/feature/templates/feature.feature
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('cucumber_scaffold', '0.1.1') do |p|
5
+ Echoe.new('cucumber_scaffold', '0.1.2') do |p|
6
6
  p.description = "Generate scaffolding for Cucumber features and steps definitions"
7
7
  p.url = "http://github.com/andyw8/cucumber_scaffold"
8
8
  p.author = "Andy Waite"
data/TODO CHANGED
@@ -8,4 +8,5 @@
8
8
  * Add support for belongs_to associations
9
9
  * Test for model names containing more than one word (e.g. DocumentCategory)
10
10
  * Add automated test suite
11
- * Prevent excess whitespace in generated files
11
+ * Prevent excess whitespace in generated files
12
+ * Better interaction with Pickle
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{cucumber_scaffold}
5
- s.version = "0.1.1"
5
+ s.version = "0.1.2"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Andy Waite"]
@@ -10,7 +10,7 @@ Gem::Specification.new do |s|
10
10
  s.description = %q{Generate scaffolding for Cucumber features and steps definitions}
11
11
  s.email = %q{andy@andywaite.com}
12
12
  s.extra_rdoc_files = ["README.rdoc", "TODO", "lib/generators/cucumber_scaffold/feature/USAGE", "lib/generators/cucumber_scaffold/feature/feature_generator.rb", "lib/generators/cucumber_scaffold/feature/templates/feature.feature", "lib/generators/cucumber_scaffold/feature/templates/steps.rb", "lib/generators/cucumber_scaffold/install/USAGE", "lib/generators/cucumber_scaffold/install/install_generator.rb", "lib/generators/cucumber_scaffold/install/templates/shared/web_steps_additional.rb"]
13
- s.files = ["Manifest", "README.rdoc", "Rakefile", "TODO", "lib/generators/cucumber_scaffold/feature/USAGE", "lib/generators/cucumber_scaffold/feature/feature_generator.rb", "lib/generators/cucumber_scaffold/feature/templates/feature.feature", "lib/generators/cucumber_scaffold/feature/templates/steps.rb", "lib/generators/cucumber_scaffold/install/USAGE", "lib/generators/cucumber_scaffold/install/install_generator.rb", "lib/generators/cucumber_scaffold/install/templates/shared/web_steps_additional.rb", "cucumber_scaffold.gemspec"]
13
+ s.files = ["Manifest", "README.rdoc", "Rakefile", "TODO", "cucumber_scaffold.gemspec", "lib/generators/cucumber_scaffold/feature/USAGE", "lib/generators/cucumber_scaffold/feature/feature_generator.rb", "lib/generators/cucumber_scaffold/feature/templates/feature.feature", "lib/generators/cucumber_scaffold/feature/templates/steps.rb", "lib/generators/cucumber_scaffold/install/USAGE", "lib/generators/cucumber_scaffold/install/install_generator.rb", "lib/generators/cucumber_scaffold/install/templates/shared/web_steps_additional.rb"]
14
14
  s.homepage = %q{http://github.com/andyw8/cucumber_scaffold}
15
15
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Cucumber_scaffold", "--main", "README.rdoc"]
16
16
  s.require_paths = ["lib"]
@@ -10,14 +10,11 @@ module CucumberScaffold
10
10
  source_root File.expand_path('../templates', __FILE__)
11
11
 
12
12
  def initialize(args, *options)
13
- # copied setup from
14
- # http://apidock.com/rails/Rails/Generators/NamedBase/new/class
15
- args[0] = args[0].dup if args[0].is_a?(String) && args[0].frozen?
16
13
  super
17
- assign_names!(self.name)
18
- parse!
19
14
  args.shift
20
15
  @args = args
16
+ # seems to be a conflict if I call this @options
17
+ @x_options = options
21
18
  end
22
19
 
23
20
  def do_it
@@ -54,141 +51,142 @@ EOF
54
51
 
55
52
  private
56
53
 
57
- def generated_by
58
- '# Generated by cucumber_scaffold - http://github.com/andyw8/cucumber_scaffold'
59
- end
54
+ def generated_by
55
+ '# Generated by cucumber_scaffold - http://github.com/andyw8/cucumber_scaffold'
56
+ end
60
57
 
61
- def nifty?
62
- options[:nifty].present?
63
- end
58
+ def nifty?
59
+ # there's probably a better way to do this
60
+ @x_options.include?(["--nifty"])
61
+ end
64
62
 
65
- def singular
66
- name.underscore.downcase
67
- end
63
+ def singular
64
+ name.underscore.downcase
65
+ end
68
66
 
69
- def plural
70
- singular.pluralize
71
- end
67
+ def plural
68
+ singular.pluralize
69
+ end
72
70
 
73
- def singular_title
74
- singular.titleize
75
- end
71
+ def singular_title
72
+ singular.titleize
73
+ end
76
74
 
77
- def plural_title
78
- plural.titleize
79
- end
75
+ def plural_title
76
+ plural.titleize
77
+ end
80
78
 
81
- def activerecord_table_header_row
82
- make_row(attribute_names)
83
- end
79
+ def activerecord_table_header_row
80
+ make_row(attribute_names)
81
+ end
84
82
 
85
- def html_table_header_row
86
- make_row(attribute_names.map(&:titleize))
87
- end
83
+ def html_table_header_row
84
+ make_row(attribute_names.map(&:titleize))
85
+ end
88
86
 
89
- def attribute_names
90
- @attributes.collect {|a| a.first[0]}
91
- end
87
+ def attribute_names
88
+ @attributes.collect {|a| a.first[0]}
89
+ end
92
90
 
93
- def html_single_resource(updated=nil, commented=nil)
94
- lines = []
95
- @attributes.each do |pair|
96
- attribute_name = pair.first[0]
97
- attribute_value = pair.first[1]
98
- lines << "| #{attribute_name.titleize}: | #{default_value(attribute_name, attribute_value, updated)} |"
91
+ def html_single_resource(updated=nil, commented=nil)
92
+ lines = []
93
+ @attributes.each do |pair|
94
+ attribute_name = pair.first[0]
95
+ attribute_value = pair.first[1]
96
+ lines << "| #{attribute_name.titleize}: | #{default_value(attribute_name, attribute_value, updated)} |"
97
+ end
98
+ lines.join(commented ? LINE_BREAK_WITH_INDENT_COMMENTED : LINE_BREAK_WITH_INDENT)
99
99
  end
100
- lines.join(commented ? LINE_BREAK_WITH_INDENT_COMMENTED : LINE_BREAK_WITH_INDENT)
101
- end
102
100
 
103
- def form_single_resource_commented
104
- form_single_resource(false, true)
105
- end
101
+ def form_single_resource_commented
102
+ form_single_resource(false, true)
103
+ end
106
104
 
107
- def html_single_resource_commented
108
- html_single_resource(false, true)
109
- end
105
+ def html_single_resource_commented
106
+ html_single_resource(false, true)
107
+ end
110
108
 
111
- def form_single_resource(updated=nil, commented=nil)
112
- lines = []
113
- @attributes.each do |pair|
114
- attribute_name = pair.first[0]
115
- attribute_value = pair.first[1]
116
- lines << "| #{attribute_name.titleize} | #{default_value(attribute_name, attribute_value, updated)} |"
109
+ def form_single_resource(updated=nil, commented=nil)
110
+ lines = []
111
+ @attributes.each do |pair|
112
+ attribute_name = pair.first[0]
113
+ attribute_value = pair.first[1]
114
+ lines << "| #{attribute_name.titleize} | #{default_value(attribute_name, attribute_value, updated)} |"
115
+ end
116
+ result = lines.join(commented ? LINE_BREAK_WITH_INDENT_COMMENTED : LINE_BREAK_WITH_INDENT)
117
117
  end
118
- result = lines.join(commented ? LINE_BREAK_WITH_INDENT_COMMENTED : LINE_BREAK_WITH_INDENT)
119
- end
120
118
 
121
- def activerecord_single_resource(updated=nil)
122
- lines = []
123
- @attributes.each do |pair|
124
- attribute_name = pair.first[0]
125
- attribute_value = pair.first[1]
126
- lines << "| #{attribute_name} | #{default_value(attribute_name, attribute_value, updated)} |"
119
+ def activerecord_single_resource(updated=nil)
120
+ lines = []
121
+ @attributes.each do |pair|
122
+ attribute_name = pair.first[0]
123
+ attribute_value = pair.first[1]
124
+ lines << "| #{attribute_name} | #{default_value(attribute_name, attribute_value, updated)} |"
125
+ end
126
+ lines.join(LINE_BREAK_WITH_INDENT)
127
127
  end
128
- lines.join(LINE_BREAK_WITH_INDENT)
129
- end
130
128
 
131
- def html_resources
132
- [html_table_header_row,
133
- html_table_row(1),
134
- html_table_row(2),
135
- html_table_row(3)].join(LINE_BREAK_WITH_INDENT)
136
- end
129
+ def html_resources
130
+ [html_table_header_row,
131
+ html_table_row(1),
132
+ html_table_row(2),
133
+ html_table_row(3)].join(LINE_BREAK_WITH_INDENT)
134
+ end
137
135
 
138
- def activerecord_resources
139
- [activerecord_table_header_row,
140
- activerecord_table_row(1),
141
- activerecord_table_row(2),
142
- activerecord_table_row(3)].join(LINE_BREAK_WITH_INDENT)
143
- end
136
+ def activerecord_resources
137
+ [activerecord_table_header_row,
138
+ activerecord_table_row(1),
139
+ activerecord_table_row(2),
140
+ activerecord_table_row(3)].join(LINE_BREAK_WITH_INDENT)
141
+ end
144
142
 
145
- def activerecord_single_resource_updated
146
- activerecord_single_resource(true)
147
- end
143
+ def activerecord_single_resource_updated
144
+ activerecord_single_resource(true)
145
+ end
148
146
 
149
- def form_single_resource_updated
150
- form_single_resource(true)
151
- end
147
+ def form_single_resource_updated
148
+ form_single_resource(true)
149
+ end
152
150
 
153
- def html_single_resource_updated
154
- html_single_resource(true)
155
- end
151
+ def html_single_resource_updated
152
+ html_single_resource(true)
153
+ end
156
154
 
157
- def default_value(attribute_name, attribute_type, updated=false, index=1)
158
- # TODO use an options hash instead of all these arguments
159
- if ['string', 'text'].include?(attribute_type)
160
- result = "#{attribute_name} #{index}"
161
- result += ' updated' if updated
162
- elsif attribute_type == 'integer'
163
- result = 10 + index
164
- result = -result if updated
165
- else
166
- raise "Cannot create default value for attribute type '#{attribute_type}'"
167
- end
168
- result
169
- end
155
+ def default_value(attribute_name, attribute_type, updated=false, index=1)
156
+ # TODO use an options hash instead of all these arguments
157
+ if ['string', 'text'].include?(attribute_type)
158
+ result = "#{attribute_name} #{index}"
159
+ result += ' updated' if updated
160
+ elsif attribute_type == 'integer'
161
+ result = 10 + index
162
+ result = -result if updated
163
+ else
164
+ raise "Cannot create default value for attribute type '#{attribute_type}'"
165
+ end
166
+ result
167
+ end
170
168
 
171
- def activerecord_table_row(n)
172
- data = []
173
- @attributes.each do |attribute|
174
- attribute_name = attribute.first[0]
175
- attribute_type = attribute.first[1]
176
- data << default_value(attribute_name, attribute_type, false, n)
169
+ def activerecord_table_row(n)
170
+ data = []
171
+ @attributes.each do |attribute|
172
+ attribute_name = attribute.first[0]
173
+ attribute_type = attribute.first[1]
174
+ data << default_value(attribute_name, attribute_type, false, n)
175
+ end
176
+ make_row(data)
177
177
  end
178
- make_row(data)
179
- end
180
178
 
181
- def html_table_row(n)
182
- activerecord_table_row(n)
183
- end
179
+ def html_table_row(n)
180
+ activerecord_table_row(n)
181
+ end
184
182
 
185
- def tags(tags)
186
- tags
187
- end
183
+ def tags(tags)
184
+ tags
185
+ end
188
186
 
189
- def make_row(data)
190
- "| #{data.join(' | ')} |"
191
- end
187
+ def make_row(data)
188
+ "| #{data.join(' | ')} |"
189
+ end
192
190
 
193
191
  end
194
192
  end
@@ -279,4 +279,4 @@ Feature: Manage <%= plural_title %>
279
279
  Then the heading should be "<%= edit_heading %>"
280
280
  <% if index_title %>
281
281
  And the title should be "<%= edit_title %>"
282
- <% end -%>
282
+ <% end %>
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cucumber_scaffold
3
3
  version: !ruby/object:Gem::Version
4
- hash: 25
4
+ hash: 31
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 1
10
- version: 0.1.1
9
+ - 2
10
+ version: 0.1.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Andy Waite
@@ -40,6 +40,7 @@ files:
40
40
  - README.rdoc
41
41
  - Rakefile
42
42
  - TODO
43
+ - cucumber_scaffold.gemspec
43
44
  - lib/generators/cucumber_scaffold/feature/USAGE
44
45
  - lib/generators/cucumber_scaffold/feature/feature_generator.rb
45
46
  - lib/generators/cucumber_scaffold/feature/templates/feature.feature
@@ -47,7 +48,6 @@ files:
47
48
  - lib/generators/cucumber_scaffold/install/USAGE
48
49
  - lib/generators/cucumber_scaffold/install/install_generator.rb
49
50
  - lib/generators/cucumber_scaffold/install/templates/shared/web_steps_additional.rb
50
- - cucumber_scaffold.gemspec
51
51
  has_rdoc: true
52
52
  homepage: http://github.com/andyw8/cucumber_scaffold
53
53
  licenses: []