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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 54d6aa9f935ff9204b98ff880dc5a5df4cab415a
|
4
|
+
data.tar.gz: c3fb84df209e9c391a6dc681b680cb49e868c2f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
-
|
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
|
-
|
52
|
-
puts "#{target_file_path} exists, overwrite? [yaN] y"
|
53
|
-
end
|
54
|
-
'y'
|
49
|
+
'a'
|
55
50
|
else
|
56
|
-
|
51
|
+
ask("#{target_file_path} exists, overwrite? [yaN]").downcase
|
57
52
|
end
|
58
53
|
|
59
|
-
@@aways_ovewrite =
|
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
|
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 %>])
|