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 inherited
from AppBase
AppBase::ASSET_PIPELINE_OPTIONS, AppBase::BUN_VERSION, AppBase::CSS_OPTIONS, AppBase::JAVASCRIPT_OPTIONS, AppBase::NODE_LTS_VERSION
Constants included
from AppName
AppName::RESERVED_NAMES
Instance Attribute Summary
Attributes inherited from AppBase
#rails_template
Instance Method Summary
collapse
Methods inherited from AppBase
add_shared_options_for, edge_branch, strict_args_position
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.
227
228
229
230
231
232
233
234
235
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 227
def initialize(*args)
@dummy_path = nil
super
imply_options
if !engine? || !with_dummy_app?
self.options = options.merge(skip_asset_pipeline: true).freeze
end
end
|
Instance Method Details
#create_app_files ⇒ Object
255
256
257
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 255
def create_app_files
build(:app)
end
|
#create_assets_manifest_file ⇒ Object
277
278
279
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 277
def create_assets_manifest_file
build(:assets_manifest) if !api? && engine?
end
|
#create_bin_files ⇒ Object
285
286
287
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 285
def create_bin_files
build(:bin)
end
|
#create_cifiles ⇒ Object
264
265
266
267
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 264
def create_cifiles
return if skip_ci?
build(:cifiles)
end
|
#create_config_files ⇒ Object
269
270
271
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 269
def create_config_files
build(:config)
end
|
#create_lib_files ⇒ Object
273
274
275
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 273
def create_lib_files
build(:lib)
end
|
#create_public_stylesheets_files ⇒ Object
281
282
283
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 281
def create_public_stylesheets_files
build(:stylesheets) unless api?
end
|
#create_root_files ⇒ Object
245
246
247
248
249
250
251
252
253
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 245
def create_root_files
build(:readme)
build(:rakefile)
build(:gemspec) unless options[:skip_gemspec]
build(:license)
build(:gitignore) unless options[:skip_git]
build(:gemfile)
build(:version_control)
end
|
#create_rubocop_file ⇒ Object
259
260
261
262
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 259
def create_rubocop_file
return if skip_rubocop?
build(:rubocop)
end
|
#create_test_dummy_files ⇒ Object
293
294
295
296
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 293
def create_test_dummy_files
return unless with_dummy_app?
create_dummy_app
end
|
#create_test_files ⇒ Object
289
290
291
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 289
def create_test_files
build(:test) unless options[:skip_test]
end
|
#finish_template ⇒ Object
302
303
304
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 302
def finish_template
build(:leftovers)
end
|
#name ⇒ Object
308
309
310
311
312
313
314
315
316
317
318
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 308
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
324
325
326
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 324
def namespaced_name
@namespaced_name ||= name.tr("-", "/")
end
|
#target_rails_prerelease ⇒ Object
241
242
243
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 241
def target_rails_prerelease
super("plugin new")
end
|
#underscored_name ⇒ Object
320
321
322
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 320
def underscored_name
@underscored_name ||= original_name.underscore
end
|
#update_gemfile ⇒ Object
298
299
300
|
# File 'lib/rails/generators/rails/plugin/plugin_generator.rb', line 298
def update_gemfile
build(:gemfile_entry) unless options[:skip_gemfile_entry]
end
|