Module: Gem::Release::Helper

Extended by:
Forwardable
Included in:
Cmds::Base
Defined in:
lib/gem/release/helper.rb,
lib/gem/release/helper/hash.rb,
lib/gem/release/helper/http.rb,
lib/gem/release/helper/string.rb

Defined Under Namespace

Modules: Hash, Http, String Classes: Wrapper

Instance Method Summary collapse

Instance Method Details

#abort(msg, *args) ⇒ Object



36
37
38
39
40
41
42
43
# File 'lib/gem/release/helper.rb', line 36

def abort(msg, *args)
  processed_msg = if msg.is_a?(Symbol)
    self.class::MSGS.fetch(msg) % args
  else
    msg
  end
  context.abort("#{processed_msg} Aborting.")
end

#cmd(cmd, *args) ⇒ Object



13
14
15
16
17
18
19
20
21
22
# File 'lib/gem/release/helper.rb', line 13

def cmd(cmd, *args)
  if cmd.is_a?(Symbol)
    info cmd, *args
    cmd = self.class::CMDS[cmd] % args
  end
  cmd = cmd.strip
  ui.cmd cmd
  result = pretend? ? true : context.run(cmd)
  abort "The command `#{cmd}` was unsuccessful." unless result
end

#gem_cmd(cmd, *args) ⇒ Object



24
25
26
27
28
# File 'lib/gem/release/helper.rb', line 24

def gem_cmd(cmd, *args)
  info cmd, *args if cmd.is_a?(Symbol)
  ui.cmd "gem #{cmd} #{args.join(' ')}"
  pretend? ? true : context.gem_cmd(cmd, *args)
end

#run(cmd) ⇒ Object



9
10
11
# File 'lib/gem/release/helper.rb', line 9

def run(cmd)
  return true if send(cmd)
end