Sha256: ddd82ea89b664983979d75251d93e57e670fc210e3f33093e8f9581a09328407
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module Command class Repository attr_reader :options def initialize(options) @options = options @cmds = [] end def add(cmd, options = {}) @cmds << cmd.new(rvm_prefix, options) end def execute with_transaction do |trash| while @cmds.any? command = @cmds.shift puts(command.name.brown) command.execute trash.unshift(command) end end puts 'Success bump current gem'.green end private def rvm_prefix if options[:gemset] "rvm #{ options[:gemset] } exec " end end def with_transaction trash = [] wrapper = Command::StashGemfileLockCommand.new begin wrapper.execute yield(trash) rescue Exception => e trash.each(&:cancel) puts 'Fail bump current gem'.red raise Command::ExecuteError ensure wrapper.cancel end end end end class String def red; "\033[31m#{self}\033[0m" end def green; "\033[32m#{self}\033[0m" end def brown; "\033[33m#{self}\033[0m" end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pumper-0.0.1 | lib/command/repository.rb |