Sha256: 05c5b814c5d866667e97942ce0f18bbfab5a2d04c85bb6373182e59c048a48a3
Contents?: true
Size: 1.41 KB
Versions: 1
Compression:
Stored size: 1.41 KB
Contents
require 'open-uri' def save_download(data, name, path) FileUtils.mkdir_p(path) open("#{path}/#{name}", "wb") do |file| file.print data end end def download_file(url, content_disposition = false) open(url) do |download| file_name = if content_disposition download.meta['content-disposition'] .match(/filename=(\"?)(.+)\1/)[2] .force_encoding("UTF-8") else File.basename(url) end data = download.read return data, file_name end end def install_plugin(name, version, server) return false if @lockfile.plugins.has_key?(name) download_version = @bukget.resolve_version(name, version, server) data, file_name = @bukget.download(name, download_version, server) save_download(data, file_name, PLUGINS_PATH) @lockfile.add_plugin(name, download_version, file_name) return file_name, download_version end def pretty_version(version) case version when 'latest' "the latest version" when 'latest-rb' "the latest recommended build" when 'latest-beta' "the latest beta build" when 'latest-dev' "the latest development build" when /^git-(.*)$/ "git commit #{$1}" when /^build-(.*)$/ "build \##{$1}" else "version #{version}" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bukin-0.1.0 | lib/bukin/utils.rb |