railsbuilder 0.1.9 → 0.1.10

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: 6aca3f4e0c2b9ef37e271538bd263f1506017d54
4
- data.tar.gz: 47b59da00202648b6551e6b89617e1bebea137f7
3
+ metadata.gz: 7a53d1909bcb338048d8b383aebdbcc35752e8fc
4
+ data.tar.gz: 0ff37fdb31bc77ccbe6386fb39de773db624d9fa
5
5
  SHA512:
6
- metadata.gz: 480b3d607489c3b5838ec5df541233a0a46f2f1fa53a845722f79e1036bbade4153ede7c36fb56c5eb871626efe9cd895ad5172fbd31bab385754f9dde26c319
7
- data.tar.gz: 282823b058cfba278ecbc35463b0c6559a8a754992b3db972ea1fc4450a35b696cd2d68db9baf746fd1cd5b98e6382753e6a849f0cd6124bc2649449e33af87f
6
+ metadata.gz: c4423924292843ca4037390cfac3235be78272ef916a5314369959d2e7c53f7a469f303fd8f6aab68f02e13f202904d2a0810dfff1483fda342fa5bba6ca748f
7
+ data.tar.gz: e548f193a35ed8356174bad133e2ca8f840aaa14a6ec0e2d941c630ac5b7583bd55d249108988c07f78db0844796525a6036321abe2e2b828396dfcbac9e44eb
checksums.yaml.gz.sig CHANGED
Binary file
data/lib/railsbuilder.rb CHANGED
@@ -23,7 +23,7 @@ class RailsBuilder
23
23
  [:model, ':class_name', :model_class],
24
24
  [:model_class, /(\w+):\s*(string|text)/, :class_attribute],
25
25
  [:resource, /controller \+ views/, :resource_cv],
26
- [:resource_cv, /(\w+)(?:\s+[av]{1,2})?/, :resource_cv_av],
26
+ [:resource_cv, /(\w+)(?:\s+([av]{1,2}))?/, :resource_cv_av],
27
27
  [:all, /^\s*#/, :comment]
28
28
  ]
29
29
 
@@ -137,8 +137,8 @@ class RailsBuilder
137
137
  command = "rake db:migrate"
138
138
 
139
139
  puts ":: preparing to execute shell command: `#{command}`"
140
- puts 'Are you sure you want to commit this database operation? (Y/n)'
141
-
140
+ puts 'Are you sure you want to commit this ' \
141
+ + 'database operation? (Y/n)'
142
142
  shell command
143
143
 
144
144
  when :resource_cv
@@ -178,16 +178,31 @@ class RailsBuilder
178
178
  File.write controller_file, buffer
179
179
  puts ':: updated ' + controller
180
180
  end
181
+
182
+ av_type = av.attributes[:captures1]
183
+ next unless av_type
184
+
185
+ if av_type[/v/] then
186
+
187
+ page = action + '.html.erb'
188
+ view_file = File.join('app','views', resource, page)
189
+
190
+ unless File.exists? view_file then
191
+ File.write view_file, ''
192
+ puts ':: created ' + page
193
+ end
194
+ end
181
195
  end
182
196
 
183
197
  else
184
198
 
185
199
  unless File.exists? view_file then
186
200
 
187
- command = "rails generate controller %s %s" % [resource, action]
201
+ command = "rails generate controller %s %s" %
202
+ [resource, action]
188
203
  puts ":: preparing to execute shell command: `#{command}`"
189
- puts 'Are you sure you want to generate a controller action? (Y/n)'
190
-
204
+ puts 'Are you sure you want to generate a ' \
205
+ + 'controller action? (Y/n)'
191
206
  shell command
192
207
  end
193
208
  end
@@ -233,8 +248,7 @@ EOF
233
248
  end
234
249
 
235
250
  @config = s
236
- @lp = LineParser.new(patterns)
237
- @lp.parse s
251
+ @lp = LineParser.new(patterns, s)
238
252
 
239
253
  end
240
254
 
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: railsbuilder
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Robertson
@@ -31,7 +31,7 @@ cert_chain:
31
31
  bNcCWso1cJhifoTCytPAyf9YVuyU4HjqC3eqx3p00NCg0VoELwMEkyhkpvYOGz2l
32
32
  NSkTRB6yCN+xzQ==
33
33
  -----END CERTIFICATE-----
34
- date: 2014-03-12 00:00:00.000000000 Z
34
+ date: 2014-03-13 00:00:00.000000000 Z
35
35
  dependencies:
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rails
metadata.gz.sig CHANGED
Binary file