Sha256: 393bd7de430a1a1c9732539e54436f6b2fc29b79901d1d68aa0e2630ef419869

Contents?: true

Size: 1.05 KB

Versions: 17

Compression:

Stored size: 1.05 KB

Contents

module Dev
class Deps < Hash
  def refresh
    puts_debug "Dev::Deps.refresh"
	start_time=Time.now
    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
	}
	puts_debug "Deps refresh elapsed time " + (Time.now-start_time).to_s
  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

Version data entries

17 entries across 17 versions & 1 rubygems

Version Path
dev-1.0.247 lib/dev/Deps.rb
dev-1.0.246 lib/dev/Deps.rb
dev-1.0.245 lib/dev/Deps.rb
dev-1.0.244 lib/dev/Deps.rb
dev-1.0.243 lib/dev/Deps.rb
dev-1.0.242 lib/dev/Deps.rb
dev-1.0.241 lib/dev/Deps.rb
dev-1.0.240 lib/dev/Deps.rb
dev-1.0.239 lib/dev/Deps.rb
dev-1.0.238 lib/dev/Deps.rb
dev-1.0.237 lib/dev/Deps.rb
dev-1.0.236 lib/dev/Deps.rb
dev-1.0.235 lib/dev/Deps.rb
dev-1.0.233 lib/dev/Deps.rb
dev-1.0.232 lib/dev/Deps.rb
dev-1.0.231 lib/dev/Deps.rb
dev-1.0.230 lib/dev/Deps.rb