Sha256: 89c5c9cef634b129d97c96c9b60957adadf2d7e5e2d98e68dbfa2fa8c0c266ef
Contents?: true
Size: 1.84 KB
Versions: 13
Compression:
Stored size: 1.84 KB
Contents
require 'spiderfw/setup/setup_task' class SetupCommand < CmdParse::Command def initialize super( 'setup', false, true ) @short_desc = _("Setup an application") # @description = _("") @apps = [] self.options = CmdParse::OptionParserWrapper.new do |opt| # TODO opt.on("--from [VERSION]", _("Assume a specific version is installed"), "-f"){ |from| @from = Gem::Version.new(from) } opt.on("--to [VERSION]", _("Setup to a specific version"), "-t"){ |to| @to = Gem::Version.new(to) } opt.on("--all", _("Setup all active apps")){ |all| @all = true } end set_execution_block do |apps| require 'spiderfw' apps = Spider.apps.keys if @all if (apps.length > 1) && (@to || @from) raise "Can't use --from or --to with multiple apps" end apps.each do |name| Spider.load_app(name) unless Spider.apps[name] app = Spider.apps[name] path = app.setup_path current = @from || app.installed_version new_version = @to || app.version next unless File.exist?(path) Dir.entries(path).sort.each do |entry| next if (entry[0].chr == '.') task = Spider::SetupTask.load("#{path}/#{entry}") next unless task next if current && task.version < current next if new_version && task.version > new_version Spider.logger.info("Running setup task #{path+'/'+entry}") task.up end app.installed_version = app.version end end end end
Version data entries
13 entries across 13 versions & 1 rubygems