class MotorheadGenerator
Public Class Methods
new(*args)
click to toggle source
Calls superclass method
# File lib/generators/motorhead_generator.rb, line 19 def initialize(*args) options = args.extract_options! options[:destination_root] = 'app/engines' super(*args, options) options = @options.dup options[:mountable] = options[:skip_bundle] = options[:skip_test_unit] = options[:skip_git] = options[:skip_gemfile] = true @options = options.freeze end
source_paths()
click to toggle source
Calls superclass method
# File lib/generators/motorhead_generator.rb, line 14 def source_paths [File.expand_path('../motorhead/templates', __FILE__), *super] end
Public Instance Methods
bundle_to_parent()
click to toggle source
# File lib/generators/motorhead_generator.rb, line 52 def bundle_to_parent gemfile = Rails.root + 'Gemfile' append_to_file gemfile, "gem '#{name}', path: '#{destination_root.sub(%r(^#{Rails.root}/), '')}'\n" if gemfile.exist? end
create_bin_files()
click to toggle source
override
# File lib/generators/motorhead_generator.rb, line 33 def create_bin_files end
generate_controller()
click to toggle source
# File lib/generators/motorhead_generator.rb, line 57 def generate_controller if base_controller Dir.chdir destination_root do #FIXME call the controller generator directly puts `rails g motorhead:controller #{name}/#{base_controller} #{actions * ' '}` end end end
get_builder_class()
click to toggle source
# File lib/generators/motorhead_generator.rb, line 28 def get_builder_class EngineBuilder end
no_dependency()
click to toggle source
# File lib/generators/motorhead_generator.rb, line 47 def no_dependency gemspec = "#{name}.gemspec" gsub_file gemspec, /^\s*s\.add_(?:development_)?dependency .*\n/, '' end
put_litter_in_its_place()
click to toggle source
# File lib/generators/motorhead_generator.rb, line 36 def put_litter_in_its_place remove_file 'MIT-LICENSE' remove_file "app/controllers/#{name}/application_controller.rb" remove_file "lib/tasks" end
rm_rakefile()
click to toggle source
# File lib/generators/motorhead_generator.rb, line 66 def rm_rakefile remove_file 'Rakefile' end
untodo_gemspec()
click to toggle source
# File lib/generators/motorhead_generator.rb, line 42 def untodo_gemspec gemspec = "#{name}.gemspec" gsub_file gemspec, /"TODO.*?"/, '""' end
with_dummy_app?()
click to toggle source
override
# File lib/generators/motorhead_generator.rb, line 71 def with_dummy_app? false end