stefanpenner-my_scaffold 1.0.0 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
data/VERSION.yml
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
class MyScaffoldGeneratorConfig
|
6
6
|
|
7
7
|
DEFAULT_TEMPLATING = 'haml'
|
8
|
-
DEFAULT_FUNCTIONAL_TEST_STYLE = '
|
8
|
+
DEFAULT_FUNCTIONAL_TEST_STYLE = 'basic'
|
9
9
|
|
10
10
|
def initialize()
|
11
11
|
@config = load_file(config_file)
|
@@ -68,6 +68,7 @@ class MyScaffoldGenerator < Rails::Generator::NamedBase
|
|
68
68
|
:controller_underscore_name,
|
69
69
|
:controller_singular_name,
|
70
70
|
:controller_plural_name
|
71
|
+
|
71
72
|
alias_method :controller_file_name, :controller_underscore_name
|
72
73
|
alias_method :controller_table_name, :controller_plural_name
|
73
74
|
|
@@ -81,6 +82,7 @@ class MyScaffoldGenerator < Rails::Generator::NamedBase
|
|
81
82
|
base_name, @controller_class_path, @controller_file_path, @controller_class_nesting, @controller_class_nesting_depth = extract_modules(@controller_name)
|
82
83
|
@controller_class_name_without_nesting, @controller_underscore_name, @controller_plural_name = inflect_names(base_name)
|
83
84
|
@controller_singular_name=base_name.singularize
|
85
|
+
|
84
86
|
if @controller_class_nesting.empty?
|
85
87
|
@controller_class_name = @controller_class_name_without_nesting
|
86
88
|
else
|
@@ -113,18 +115,29 @@ class MyScaffoldGenerator < Rails::Generator::NamedBase
|
|
113
115
|
end
|
114
116
|
|
115
117
|
# Layout and stylesheet.
|
116
|
-
m.template("#{templating}/layout.html.#{templating}",
|
118
|
+
m.template("#{templating}/layout.html.#{templating}",
|
119
|
+
File.join('app/views/layouts',
|
120
|
+
controller_class_path,
|
121
|
+
"#{controller_file_name}.html.#{templating}"))
|
117
122
|
|
118
123
|
%w(print screen ie).each do |stylesheet|
|
119
124
|
m.template("blueprint/#{stylesheet}.css", "public/stylesheets/blueprint/#{stylesheet}.css")
|
120
125
|
end
|
121
126
|
|
122
|
-
m.template(
|
123
|
-
|
124
|
-
|
127
|
+
m.template('controller.rb',
|
128
|
+
File.join('app/controllers',
|
129
|
+
controller_class_path,
|
130
|
+
"#{controller_file_name}_controller.rb")
|
131
|
+
|
132
|
+
m.template("functional_test/#{functional_test_style}.rb",
|
133
|
+
File.join('test/functional',
|
134
|
+
controller_class_path,
|
135
|
+
"#{controller_file_name}_controller_test.rb"))
|
125
136
|
|
126
|
-
m.template(
|
127
|
-
|
137
|
+
m.template('helper.rb',
|
138
|
+
File.join('app/helpers',
|
139
|
+
controller_class_path,
|
140
|
+
"#{controller_file_name}_helper.rb"))
|
128
141
|
|
129
142
|
m.route_resources controller_file_name
|
130
143
|
|
@@ -151,10 +164,15 @@ class MyScaffoldGenerator < Rails::Generator::NamedBase
|
|
151
164
|
opt.separator 'Options:'
|
152
165
|
opt.on("--skip-timestamps",
|
153
166
|
"Don't add timestamps to the migration file for this model") { |v| options[:skip_timestamps] = v }
|
167
|
+
|
154
168
|
opt.on("--skip-migration",
|
155
169
|
"Don't generate a migration file for this model") { |v| options[:skip_migration] = v }
|
156
|
-
|
157
|
-
opt.on("--
|
170
|
+
|
171
|
+
opt.on("--templating [erb|haml]",
|
172
|
+
"Specify the templating to use (haml by default)") { |v| options[:templating] = v }
|
173
|
+
|
174
|
+
opt.on("--functional-test-style [basic|should_be_restful]",
|
175
|
+
"Specify the style of the functional test (should_be_restful by default)") { |v| options[:functional_test_style] = v }
|
158
176
|
|
159
177
|
end
|
160
178
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stefanpenner-my_scaffold
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stefan Penner
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-01
|
12
|
+
date: 2009-02-01 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|