lib/dev/Environment.rb in dev-1.0.9 vs lib/dev/Environment.rb in dev-1.0.10

- old
+ new

@@ -8,21 +8,27 @@ #end module Dev class Environment + def self.replace_text_in_glob(glob,search,replace) + Dir.glob(glob).each{ |f| replace_text_in_file(f,search,replace) } + end + def self.replace_text_in_file(filename,search,replace) text1 = File.read(filename) text2 = text1.gsub(search) { |str| str=replace } - File.open(filename,"w") { |f| f.puts text2 } unless text1==text2 + unless text1==text2 + File.open(filename,"w") { |f| f.puts text2 } + puts "replaced text in #{filename}" + end end def self.dev_root dir="~" dir=ENV["HOME"] unless ENV["HOME"].nil? dir=ENV["USERPROFILE"].gsub('\\','/') unless ENV["USERPROFILE"].nil? dir=ENV["DEV_ROOT"].gsub('\\','/') unless ENV["DEV_ROOT"].nil? - return dir end def self.expand_string_variables(str) eval("\"#{str.gsub('"','\"')}\"")