Ruby on Rails Tuesday, March 10, 2015

Hi all,

I've been trying to find out if Rails 4.2 provides a single command that regenerates config/application.rb in an existing application. 

I'm trying to find something more lightweight than running 'rails new MyApp' in a new directory and copying over the file.

The reason I ask is imagine a Rails app is 'rails new'-ed without the --skip-test-unit option.

Then at a much later date, this app is switched to RSpec. Can config/application.rb be regenerated as if the --skip-test-unit option had been supplied originally to 'rails new ...'?

All this would effectively do is change the require statements near the top of config/application.rb file from:

require 'rails/all'

to:

# Pick the frameworks you want:
require "active_model/railtie"
require "active_job/railtie"
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
require "sprockets/railtie"
# require "rails/test_unit/railtie"


It's possible to get part of the way there with this command:

bin/rake rails:update:configs

Which asks if you want to overwrite config/application.rb and generates a new copy. However, I've not been successful in getting that command to make use of the --skip-test-unit option. I've tried variations on this without luck:

bin/rake rails:update:configs[--skip-test-unit]

Many thanks in advance for any help,

Eliot

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/17b0a4d6-42a9-4d47-8d75-b5f1ae2ff3db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment