Class: MultiEngine
- Inherits:
-
Thor::Group
- Object
- Thor::Group
- MultiEngine
- Includes:
- Thor::Actions
- Defined in:
- lib/multi_engine.rb
Class Method Summary collapse
Instance Method Summary collapse
- #change_gitignore ⇒ Object
- #create_root ⇒ Object
- #create_tests_or_specs ⇒ Object
- #invoke_rails_app_generators ⇒ Object
Class Method Details
.say_step(message) ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/multi_engine.rb', line 20 def self.say_step() @step = (@step || 0) + 1 class_eval <<-METHOD, __FILE__, __LINE__ + 1 def step_#{@step} #{"puts" if @step > 1} say_status "STEP #{@step}", #{.inspect} end METHOD end |
.source_root ⇒ Object
16 17 18 |
# File 'lib/multi_engine.rb', line 16 def self.source_root @_source_root ||= File.('../templates', __FILE__) end |
Instance Method Details
#change_gitignore ⇒ Object
65 66 67 |
# File 'lib/multi_engine.rb', line 65 def change_gitignore template "gitignore", ".gitignore" end |
#create_root ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/multi_engine.rb', line 53 def create_root self.destination_root = File.(path, destination_root) set_accessors! directory "root", "." FileUtils.cd(destination_root) end |
#create_tests_or_specs ⇒ Object
61 62 63 |
# File 'lib/multi_engine.rb', line 61 def create_tests_or_specs directory test_path end |
#invoke_rails_app_generators ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/multi_engine.rb', line 69 def invoke_rails_app_generators say "Vendoring Rails applications at #{test_path}/dummy-apps" types.each do |type| say "Creating #{type} apps" self.current_type = type orms.each do |orm| self.current_orm = translate(orm) say "Creating #{type} dummy Rails app with #{orm_name}", :green # say "Location: #{dummy_app_path}" command = "rails new #{app_args.join(' ')} -f" # force overwrite say command exec_command command #invoke Rails::Generators::AppGenerator, app_args say "Configuring Rails app" change_config_files # say "Removing unneeded files" remove_uneeded_rails_files send orm_config_method if respond_to?(orm_config_method) say "Configuring testing framework for #{orm_name}" set_orm_helpers ensure_app_class_name FileUtils.cd(destination_root) end end end |