Class: CreateRailsApp::CommandBuilder
- Inherits:
-
Object
- Object
- CreateRailsApp::CommandBuilder
- Defined in:
- lib/create_rails_app/command_builder.rb
Overview
Converts an app name, Rails version, and option hash into a rails new command array.
Instance Method Summary collapse
-
#build(app_name:, rails_version: nil, options: {}, minimal: false) ⇒ Array<String>
Builds the rails new command array.
Instance Method Details
#build(app_name:, rails_version: nil, options: {}, minimal: false) ⇒ Array<String>
Builds the rails new command array.
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/create_rails_app/command_builder.rb', line 21 def build(app_name:, rails_version: nil, options: {}, minimal: false) command = ['rails'] command << "_#{rails_version}_" if rails_version command.push('new', app_name) command << '--minimal' if minimal Options::Catalog::ORDER.each do |key| next unless .key?(key) append_option!(command, key, [key]) end command end |