module Rails::Generators::Actions
def environment(data=nil, options={}, &block)
file in config/environments.
If options :env is specified, the line is appended to the corresponding
Adds a line inside the Application class for config/application.rb.
def environment(data=nil, options={}, &block) sentinel = /class [a-z_:]+ < Rails::Application/i data = block.call if !data && block_given? in_root do if options[:env].nil? inject_into_file 'config/application.rb', "\n #{data}", :after => sentinel, :verbose => false else Array.wrap(options[:env]).each do|env| append_file "config/environments/#{env}.rb", "\n#{data}", :verbose => false end end end end