module CapUtil
Constants
- VERSION
Public Class Methods
color(*args)
click to toggle source
# File lib/cap-util/say.rb, line 5 def self.color(*args) Capistrano::CLI.ui.color(*args) end
halt(msg = 'halted')
click to toggle source
# File lib/cap-util/halt.rb, line 7 def self.halt(msg = 'halted') raise CapUtil::Halted, color(msg, :bold, :yellow) end
included(receiver)
click to toggle source
# File lib/cap-util.rb, line 10 def self.included(receiver) receiver.send(:attr_accessor, :cap) receiver.send(:include, CapUtil::Say) receiver.send(:include, CapUtil::Halt) receiver.send(:include, CapUtil::Run) receiver.send(:include, CapUtil::Time) end
run_locally(cmd_str)
click to toggle source
# File lib/cap-util/run.rb, line 5 def self.run_locally(cmd_str) LocalCmdRunner.new(cmd_str).run! end
run_locally_with_stdin(cmd_str, input)
click to toggle source
# File lib/cap-util/run.rb, line 9 def self.run_locally_with_stdin(cmd_str, input) LocalCmdRunner.new(cmd_str).run!(input) end
say(msg, *args)
click to toggle source
# File lib/cap-util/say.rb, line 9 def self.say(msg, *args) say_raw(" #{msg}", *args) end
say_bulleted(msg, *args)
click to toggle source
# File lib/cap-util/say.rb, line 13 def self.say_bulleted(msg, *args) say_raw(" * #{msg}", *args) end
say_error(msg, *args)
click to toggle source
# File lib/cap-util/say.rb, line 17 def self.say_error(msg, *args) say("#{color "[ERROR]", :bold, :red} #{msg}", *args) end
say_raw(msg, *args)
click to toggle source
# File lib/cap-util/say.rb, line 25 def self.say_raw(msg, *args) Capistrano::CLI.ui.say(msg, *args) if !ENV['CAPUTIL_SILENCE_SAY'] end
say_warning(msg, *args)
click to toggle source
# File lib/cap-util/say.rb, line 21 def self.say_warning(msg, *args) say("#{color "[WARN]", :bold, :yellow} #{msg}", *args) end
time(timer_set, name, &block)
click to toggle source
# File lib/cap-util/time.rb, line 5 def self.time(timer_set, name, &block) timer_set[name] ||= CapUtil::Timer.new(name) if !block.nil? begin timer_set[name].start block.call ensure timer_set[name].end end end timer_set[name] end
Public Instance Methods
get(*args, &block)
click to toggle source
# File lib/cap-util.rb, line 19 def get(*args, &block) cap.get(*args, &block) end
hostname()
click to toggle source
# File lib/cap-util.rb, line 23 def hostname val = "" run("hostname") {|ch, stream, out| val = out.strip} val end