How to regenerate config/application.rb in Rails 4.2?

33 views
Skip to first unread message

Eliot Sykes

unread,
Mar 10, 2015, 5:54:08 AM3/10/15
to rubyonra...@googlegroups.com
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

tamouse pontiki

unread,
Mar 10, 2015, 8:48:44 AM3/10/15
to rubyonra...@googlegroups.com
I don't know of a command to do that, so I keep the expanded version in a snippet in my editor :(


--
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-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@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.

Dennis Krupenik

unread,
Mar 11, 2015, 7:20:01 AM3/11/15
to rubyonra...@googlegroups.com
well, if that snippet is all you want, you can just

    cat $(bundle show rails)/railties/lib/rails/all.rb

and copy whatever you need to your config/application.rb
Reply all
Reply to author
Forward
0 new messages