Simplify remove_from_config.
This commit is contained in:
parent
375aaa9db1
commit
5098302fa1
@ -216,14 +216,10 @@ def add_to_config(str)
|
||||
end
|
||||
|
||||
def remove_from_config(str)
|
||||
application_file = "#{app_path}/config/application.rb"
|
||||
environment = File.read(application_file)
|
||||
lines = File.readlines(application_file)
|
||||
if environment =~ /(\n\s*end\s*end\s*)\Z/
|
||||
File.open(application_file, 'w') do |f|
|
||||
lines.each {|line| f.puts(line) unless line =~ /#{str}/ }
|
||||
end
|
||||
end
|
||||
file = "#{app_path}/config/application.rb"
|
||||
contents = File.read(file)
|
||||
contents.sub!(/#{str}/, "")
|
||||
File.open(file, "w+") { |f| f.puts contents }
|
||||
end
|
||||
|
||||
def app_file(path, contents)
|
||||
@ -242,7 +238,7 @@ def use_frameworks(arr)
|
||||
:activemodel,
|
||||
:activerecord,
|
||||
:activeresource] - arr
|
||||
remove_from_config "config.active_record" if to_remove.include? :activerecord
|
||||
remove_from_config "config.active_record.identity_map = true" if to_remove.include? :activerecord
|
||||
$:.reject! {|path| path =~ %r'/(#{to_remove.join('|')})/' }
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user