Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensuring rails_options are parsed #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions lib/engine_cart/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def default_config
destination: ENV['ENGINE_CART_DESTINATION'] || ENV['RAILS_ROOT'] || default_destination,
template: ENV['ENGINE_CART_TEMPLATE'],
templates_path: ENV['ENGINE_CART_TEMPLATES_PATH'] || './spec/test_app_templates',
rails_options: parse_options(ENV['ENGINE_CART_RAILS_OPTIONS']),
rails_options: Array(parse_options(ENV['ENGINE_CART_RAILS_OPTIONS'])),
extra_fingerprinted_files: []
}
end
Expand All @@ -103,7 +103,13 @@ def read_config(config_file)
end

def convert_keys(hash)
hash.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
hash.each_with_object({}) do |(k, v), h|
k_as_sym = k.to_sym
if k_as_sym == :rails_options
v = parse_options(v)
end
h[k_as_sym] = v
end
end

def default_configuration_paths
Expand Down
12 changes: 8 additions & 4 deletions lib/engine_cart/tasks/engine_cart.rake
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,7 @@ namespace :engine_cart do
require 'rails/generators'
require 'rails/generators/rails/app/app_generator'

# Using the Rails generator directly, instead of shelling out, to
# ensure we use the right version of Rails.
Rails::Generators::AppGenerator.start([
generator_parameters = [
'internal',
'--skip-git',
'--skip-keeps',
Expand All @@ -47,7 +45,13 @@ namespace :engine_cart do
'--skip-test',
*EngineCart.rails_options,
("-m #{EngineCart.template}" if EngineCart.template)
].compact)
].compact.uniq

puts "EngineCart generated Rails app '#{EngineCart.destination}' with the following parameters: #{generator_parameters.inspect}"

# Using the Rails generator directly, instead of shelling out, to
# ensure we use the right version of Rails.
Rails::Generators::AppGenerator.start(generator_parameters)
end
exit 0
end
Expand Down