module Dev class Deps < Hash def refresh puts_debug "Dev::Deps.refresh" self.each{ |k,v| if !v.nil? && v.kind_of?(Hash) v[:dir]=get_dir(v) if !v.has_key?(:dir) v[:rev]=get_rev(v) if !v.has_key?(:rev) && !get_rev(v).nil? v[:uri]=get_uri(v) end } end def get_dir(h) uri=Dev::Environment.expand_string_variables(h[:uri]) uri_words=uri.split('/') while(uri_words.length > 3) do uri_words.shift end return uri_words.join('/') end def get_rev(h) if(h.has_key?(:uri) && h[:uri].include?('@') && !h[:uri].include?("@REV")) return h[:uri].split('@')[1] end if(h.has_key?(:dir) && h[:dir].include?('@') && !h[:dir].include?("@REV")) return h[:dir].split('@')[1] end nil end def get_uri(h) uri=h[:uri] if(uri.include?("@REV") && h.has_key?(:rev) && !h[:rev].nil?) uri=uri.gsub("@REV","@#{h[:rev]}") end return uri end end # class Deps end # module Dev