Sha256: cbca4366ab937f50799047721c9fff0edfd8f71474e85be0d94646933387cd0d
Contents?: true
Size: 1.79 KB
Versions: 1
Compression:
Stored size: 1.79 KB
Contents
require 'thor' require 'bukin/installer' require 'bukin/bukfile' require 'bukin/providers/bukget' require 'bukin/providers/bukkit_dl' class Bukin::CLI < Thor desc 'install', "Download and install the resources specified in a Bukfile" def install # Parse in the Bukfile bukfile = section 'Parsing Bukfile' do Bukin::Bukfile.from_file end server = bukfile.server_info plugins = bukfile.plugins_info # Grab information from the various providers bukkit_dl = Bukin::BukkitDl.new bukget = Bukin::Bukget.new section "Fetching information from #{bukkit_dl.url}" do bukkit_dl.resolve_info(server) end section "Fetching information from #{bukget.url}" do plugins.map do |plugin| plugin[:server] ||= server[:name] begin bukget.resolve_info(plugin) rescue OpenURI::HTTPError => ex raise Bukin::BukinError, "There was an error downloading #{plugin[:name]} (#{plugin[:version]}).\n#{ex.message}" end end end # Download and install server and plugins installer = Bukin::Installer.new(Dir.pwd, true) downloading server[:name], server[:display_version] do installer.install(:server, bukkit_dl, server) end plugins.each do |plugin| downloading plugin[:name], plugin[:version] do installer.install(:plugin, bukget, plugin) end end end def help(*) shell.say "Bukin is a plugin and server package manager for Minecraft." shell.say super end private def section(message) say "#{message}... " value = yield say 'Done', :green value rescue => ex say 'Error', :red raise ex end def downloading(name, version, &block) msg = "Downloading #{name}" msg << " (#{version})" if version section(msg, &block) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
bukin-0.4.0 | lib/bukin/cli.rb |