Parent

Warbler::WebServer::Artifact

Public Instance Methods

cached_path() click to toggle source
# File lib/warbler/web_server.rb, line 8
def cached_path
  @cached_path ||= File.expand_path("~/.m2/repository/#{path_fragment}")
end
download_url() click to toggle source
# File lib/warbler/web_server.rb, line 12
def download_url
  @download_url ||= "#{repo}/#{path_fragment}" #:nocov:
end
local_path() click to toggle source
# File lib/warbler/web_server.rb, line 16
def local_path
  unless File.exist?(cached_path)
    puts "Downloading #{artifact_id}-#{version}.jar" #:nocov:
    FileUtils.mkdir_p File.dirname(cached_path) #:nocov:
    require 'open-uri'                    #:nocov:
    begin
      open(download_url) do |stream|        #:nocov:
        File.open(cached_path, "wb") do |f| #:nocov:
          while buf = stream.read(4096) #:nocov:
            f << buf                    #:nocov:
          end                           #:nocov:
        end                             #:nocov:
      end                               #:nocov:
    rescue => e
      e.message.concat " - #{download_url}"
      raise e
    end
  end
  cached_path
end
path_fragment() click to toggle source
# File lib/warbler/web_server.rb, line 4
def path_fragment
  @path_fragment ||= "#{group_id.gsub('.', '/')}/#{artifact_id}/#{version}/#{artifact_id}-#{version}.jar"
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.