Class: Rails::Generators::PluginGenerator
- Inherits:
-
AppBase
show all
- Defined in:
- railties/lib/rails/generators/rails/plugin/plugin_generator.rb
Overview
Constant Summary
Constants inherited
from AppBase
AppBase::DATABASES, AppBase::JDBC_DATABASES
Instance Attribute Summary
Attributes inherited from AppBase
#rails_template
Instance Method Summary
collapse
Methods inherited from AppBase
add_shared_options_for, strict_args_position
Methods inherited from Base
base_root, class_option, default_source_root, desc, hide!, hook_for, inherited, namespace, remove_hook_for, source_root
Methods included from Actions
#add_source, #capify!, #environment, #gem, #gem_group, #generate, #git, #initializer, #lib, #rake, #rakefile, #readme, #route, #vendor
Constructor Details
Returns a new instance of PluginGenerator.
178
179
180
181
182
183
184
185
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 178
def initialize(*args)
@dummy_path = nil
super
unless plugin_path
raise Error, "Plugin name should be provided in arguments. For details run: rails plugin new --help"
end
end
|
Instance Method Details
#create_app_files ⇒ Object
199
200
201
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 199
def create_app_files
build(:app)
end
|
#create_bin_files ⇒ Object
223
224
225
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 223
def create_bin_files
build(:bin)
end
|
#create_config_files ⇒ Object
203
204
205
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 203
def create_config_files
build(:config)
end
|
#create_images_directory ⇒ Object
219
220
221
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 219
def create_images_directory
build(:images)
end
|
#create_javascript_files ⇒ Object
215
216
217
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 215
def create_javascript_files
build(:javascripts)
end
|
#create_lib_files ⇒ Object
207
208
209
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 207
def create_lib_files
build(:lib)
end
|
#create_public_stylesheets_files ⇒ Object
211
212
213
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 211
def create_public_stylesheets_files
build(:stylesheets)
end
|
#create_root_files ⇒ Object
190
191
192
193
194
195
196
197
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 190
def create_root_files
build(:readme)
build(:rakefile)
build(:gemspec) unless options[:skip_gemspec]
build(:license)
build(:gitignore) unless options[:skip_git]
build(:gemfile) unless options[:skip_gemfile]
end
|
#create_test_dummy_files ⇒ Object
231
232
233
234
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 231
def create_test_dummy_files
return unless with_dummy_app?
create_dummy_app
end
|
#create_test_files ⇒ Object
227
228
229
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 227
def create_test_files
build(:test) unless options[:skip_test_unit]
end
|
#finish_template ⇒ Object
240
241
242
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 240
def finish_template
build(:leftovers)
end
|
246
247
248
249
250
251
252
253
254
255
256
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 246
def name
@name ||= begin
underscored = original_name.dup
underscored.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
underscored.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
underscored.downcase!
underscored
end
end
|
#update_gemfile ⇒ Object
236
237
238
|
# File 'railties/lib/rails/generators/rails/plugin/plugin_generator.rb', line 236
def update_gemfile
build(:gemfile_entry) unless options[:skip_gemfile_entry]
end
|