Sha256: b5d25de95c385a474d6c3178f604de4cc4ca21a69d124cc7387e563a18f0ddc0
Contents?: true
Size: 1.07 KB
Versions: 14
Compression:
Stored size: 1.07 KB
Contents
module JsonVoorhees class CreateEngineGenerator < Rails::Generators::Base source_root File.expand_path('../templates', __FILE__) argument :module_name, :type => :string def sprint inside "" do run "rails plugin new engines/#{module_snake} --mountable" end inside "engines/#{module_snake}" do add_dependency run "rails g json_voorhees:setup_engine #{module_snake}" end inside "config" do mount end inside "" do gem "#{module_snake}", :path => "engines/#{module_snake}" run "bundle install" end end private def mount gsub_file "routes.rb", "root to: \"app_index#app\"\n", "root to: \"app_index#app\"\n mount #{module_camel}::Engine, at: '/'\n" end def add_dependency inject_into_file "#{module_snake}.gemspec", after: "s.add_development_dependency \"sqlite3\"\n" do <<-'RUBY' s.add_development_dependency "json_voorhees" RUBY end end def module_camel module_name.camelize end def module_snake module_name.underscore.downcase end end end
Version data entries
14 entries across 14 versions & 1 rubygems