module MavenCentral

Public Instance Methods

dict2id(d) click to toggle source
# File lib/mvn-get/mvn-get.rb, line 41
def dict2id(d)
  "#{d["groupId"]}:#{d["artifactId"]}:#{d["version"]}"
end
extract_url_from_dict(d, filetype="pom") click to toggle source
# File lib/mvn-get/mvn-get.rb, line 19
def extract_url_from_dict(d, filetype="pom")
  "#{MAVEN_CENTRAL_REMOTE_CONTENT}?filepath=#{d["groupId"].gsub(".", "/")}/#{d["artifactId"]}/#{d["version"]}/#{d["artifactId"]}-#{d["version"]}.#{filetype}"
end
extract_url_from_id(id, filetype="pom") click to toggle source
# File lib/mvn-get/mvn-get.rb, line 23
def extract_url_from_id(id, filetype="pom")
  MavenCentral.extract_url_from_dict(id2dict(id), filetype)
end
fetch_lastest_version(groupId, artifactId) click to toggle source
# File lib/mvn-get/mvn-get.rb, line 60
def fetch_lastest_version(groupId, artifactId)
  id2dict(search("#{groupId}:#{artifactId}")["candidates"].sort.last)["version"]
end
id2dict(id) click to toggle source
# File lib/mvn-get/mvn-get.rb, line 27
def id2dict(id)
  if (res = id.scan(/(.*):(.*)/)[0]) != nil
    if (res1 = id.scan(/(.*):(.*):(.*)/)[0]) != nil
      res = res1
    end
  else
    return nil
  end

  d = {}
  d["groupId"], d["artifactId"], d["version"] = res
  d
end
request(url) click to toggle source
# File lib/mvn-get/mvn-get.rb, line 64
def request(url)
  RestClient.get(url)
end
version() click to toggle source
# File lib/mvn-get/mvn-get.rb, line 15
def version
  "0.0.4"
end