scaffold_pico 1.1.3 → 1.1.4

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: f6252d7d37ef3137b59bca56ca783c27a189ad02
4
- data.tar.gz: c22de7e4559f054972670417c304863612a896d4
3
+ metadata.gz: 54d6aa9f935ff9204b98ff880dc5a5df4cab415a
4
+ data.tar.gz: c3fb84df209e9c391a6dc681b680cb49e868c2f6
5
5
  SHA512:
6
- metadata.gz: cb7107ddd6cf2075ab3ad3942279104aed0c5cd6b6fc922151fd0d42f6fc17d794fe9e530a08eaaf676ca6831340950f05672cd862356118f6670a685ed85722
7
- data.tar.gz: 3d91bf047b15ac72f1adb6f5fddc11e31e1eca9cb156ba32943975c43fa06ecd39e3ee9549ebca3c6728aa2e97046e68aa38826ce5e27152a728ed19eddbe329
6
+ metadata.gz: c9ea4e9a1e107e18d4fdae253ddc2c2a09eae3987482518c67d97d05f22addfa89a1c1376773ebdac7e9ed39c98bf4ef4f285059cd639ce16ab706047d74545e
7
+ data.tar.gz: 01615efab46b43b4b02955016df7457d4f9e90d32335d2f98bac50828c761f9d4523da2a20faf334fb9191bac0636121c0e49d8f29396ff92090f03cbef48c91
@@ -40,25 +40,20 @@ module Scaffold
40
40
  end
41
41
 
42
42
  def write_with_confirmation(target_file_path, content)
43
- unless File.exists?(target_file_path)
43
+ if !File.exists?(target_file_path) || @rails.choice[:force].present?
44
44
  IO.write(target_file_path, content)
45
45
  return
46
46
  end
47
47
 
48
- @@aways_ovewrite = 'a' if @rails.choice[:force].present?
49
-
50
48
  answer = if @@aways_ovewrite
51
- if @rails.choice[:force].blank?
52
- puts "#{target_file_path} exists, overwrite? [yaN] y"
53
- end
54
- 'y'
49
+ 'a'
55
50
  else
56
- ask("#{target_file_path} exists, overwrite? [yaN]").downcase
51
+ ask("#{target_file_path} exists, overwrite? [yaN]").downcase
57
52
  end
58
53
 
59
- @@aways_ovewrite = true if answer == 'a'
54
+ @@aways_ovewrite = answer == 'a'
60
55
 
61
- IO.write(target_file_path, content) if answer == 'y'
56
+ IO.write(target_file_path, content) if answer == 'y' || @@aways_ovewrite
62
57
  end
63
58
 
64
59
  def parse_template(content, context_hash)
@@ -7,8 +7,8 @@ module Scaffold
7
7
 
8
8
  # example: Manage::BooksController
9
9
  def class_name
10
- if @rails.controller.namespaced?
11
- "#{namespaces_as_modules}::#{@rails.resource.class_name.pluralize}Controller"
10
+ if self.namespaced?
11
+ "#{self.namespaces_as_modules}::#{@rails.resource.class_name.pluralize}Controller"
12
12
  else
13
13
  "#{@rails.resource.class_name.pluralize}Controller"
14
14
  end
@@ -1,7 +1,7 @@
1
1
  class <%= @rails.controller.class_name %> < <%= @rails.controller.base_controller %>
2
2
 
3
3
  protect_from_forgery with: :exception
4
-
4
+
5
5
  <% @rails.nested_in_resources.each do |resource| -%>
6
6
  def <%= resource.name %>
7
7
  <%= resource.instance_name %> ||= <%= resource.class_name_with_modules %>.find(params[:<%= resource.param_name %>])
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scaffold_pico
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.3
4
+ version: 1.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - gudata