Sha256: 7a3c020f29a0c10ed91dfffdbf76a2b580a7c410c4445957df70f301e30e5218

Contents?: true

Size: 978 Bytes

Versions: 34

Compression:

Stored size: 978 Bytes

Contents

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

Version data entries

34 entries across 34 versions & 1 rubygems

Version Path
dev-1.0.229 lib/dev/Deps.rb
dev-1.0.228 lib/dev/Deps.rb
dev-1.0.227 lib/dev/Deps.rb
dev-1.0.225 lib/dev/Deps.rb
dev-1.0.224 lib/dev/Deps.rb
dev-1.0.223 lib/dev/Deps.rb
dev-1.0.222 lib/dev/Deps.rb
dev-1.0.221 lib/dev/Deps.rb
dev-1.0.220 lib/dev/Deps.rb
dev-1.0.219 lib/dev/Deps.rb
dev-1.0.218 lib/dev/Deps.rb
dev-1.0.217 lib/dev/Deps.rb
dev-1.0.214 lib/dev/Deps.rb
dev-1.0.213 lib/dev/Deps.rb
dev-1.0.212 lib/dev/Deps.rb
dev-1.0.211 lib/dev/Deps.rb
dev-1.0.210 lib/dev/Deps.rb
dev-1.0.209 lib/dev/Deps.rb
dev-1.0.208 lib/dev/Deps.rb
dev-1.0.207 lib/dev/Deps.rb