lib/dev/Svn.rb in dev-1.0.17 vs lib/dev/Svn.rb in dev-1.0.18

- old
+ new

@@ -14,37 +14,41 @@ def self.update_revision_variable(filename,variable_name,url) if File.exist?(filename) revision=Dev::Svn::last_changed_revision(url) replace="#{variable_name}='#{revision}'" + puts " " + replace + " in " + filename unless revision=="0" text=File.read(filename) unless text.include?(replace) unless revision == "0" puts " updating " + filename + " with " + replace - search=Regexp.new("#{variable_name}='[\\d]+'") + search=Regexp.new("#{variable_name}=['\"][\\d]+['\"]") Dev::Environment.replace_text_in_file(filename,search,"#{variable_name}='#{revision}'") end end end end def self.update_revision_variables(filename) if File.exist?(filename) + puts_debug "scanning " + filename + " for revision variables" text=File.read(filename) # extract potential variable names of form - text.scan(/([A-Z_]+)='[\d]+'/).each{ | var_match | - #puts "found var_match: " + var_match[0].to_s + text.scan(/([\dA-Z_]+)=['"][\d]+['"]/).each{ | var_match | + puts_debug "found var_match: " + var_match[0].to_s varname = var_match[0].to_s # extract potential urls that use the variable name # '([.\w:\/-]+)@#{INTERFACE_REV}' - uri_search=Regexp.new("'([.\\w:\\/-]+)@" + '#{' + "#{varname}" + '}' + "'") + uri_search=Regexp.new("['\"]([.\\w:\\/-]+)@" + '#{' + "#{varname}" + '}' + "['\"]") #puts uri_search.to_s text.scan(uri_search).each { |uri_match| - #puts "found uri_match: " + uri_match.to_s + puts_debug "found uri_match: " + uri_match.to_s uri=uri_match[0].to_s update_revision_variable(filename,varname,uri) } } + else + puts " " + filename + " does not exist" end end end # class Svn end # module Dev \ No newline at end of file