Class: Rails::Generators::PluginGenerator
- Inherits:
-
AppBase
- Object
- Thor::Group
- Base
- AppBase
- Rails::Generators::PluginGenerator
show all
- Defined in:
- lib/rails/generators/rails/plugin/plugin_generator.rb
Overview
Constant Summary
Constants included
from AppName
AppName::RESERVED_NAMES
Constants included
from Database
Database::DATABASES, Database::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 included from Database
#convert_database_option_for_jruby, #gem_for_database
Methods inherited from Base
base_root, class_option, default_source_root, desc, exit_on_failure?, hide!, hook_for, inherited, namespace, remove_hook_for, source_root
Methods included from Actions
#add_source, #environment, #gem, #gem_group, #generate, #git, #github, #initializer, #lib, #rails_command, #rake, #rakefile, #readme, #route, #vendor
Constructor Details
Returns a new instance of PluginGenerator.
191
192
193
194
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 191
def initialize(*args)
@dummy_path = nil
super
end
|
Instance Method Details
#create_app_files ⇒ Object
208
209
210
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 208
def create_app_files
build(:app)
end
|
#create_assets_manifest_file ⇒ Object
220
221
222
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 220
def create_assets_manifest_file
build(:assets_manifest) if !api? && engine?
end
|
#create_bin_files ⇒ Object
228
229
230
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 228
def create_bin_files
build(:bin)
end
|
#create_config_files ⇒ Object
212
213
214
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 212
def create_config_files
build(:config)
end
|
#create_lib_files ⇒ Object
216
217
218
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 216
def create_lib_files
build(:lib)
end
|
#create_public_stylesheets_files ⇒ Object
224
225
226
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 224
def create_public_stylesheets_files
build(:stylesheets) unless api?
end
|
#create_root_files ⇒ Object
199
200
201
202
203
204
205
206
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 199
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
236
237
238
239
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 236
def create_test_dummy_files
return unless with_dummy_app?
create_dummy_app
end
|
#create_test_files ⇒ Object
232
233
234
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 232
def create_test_files
build(:test) unless options[:skip_test]
end
|
#finish_template ⇒ Object
245
246
247
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 245
def finish_template
build(:leftovers)
end
|
#name ⇒ Object
251
252
253
254
255
256
257
258
259
260
261
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 251
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
|
#namespaced_name ⇒ Object
267
268
269
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 267
def namespaced_name
@namespaced_name ||= name.tr("-", "/")
end
|
#underscored_name ⇒ Object
263
264
265
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 263
def underscored_name
@underscored_name ||= original_name.underscore
end
|
#update_gemfile ⇒ Object
241
242
243
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 241
def update_gemfile
build(:gemfile_entry) unless options[:skip_gemfile_entry]
end
|