class Object
Public Instance Methods
_cset(name, *args, &block)
click to toggle source
# File lib/amoeba_deploy_tools/capistrano/common.rb, line 1 def _cset(name, *args, &block) unless exists?(name) set(name, *args, &block) end end
dedent(s)
click to toggle source
# File lib/amoeba_deploy_tools/helpers.rb, line 26 def dedent(s) indent = s.split("\n").reject {|l| l =~ /^\s*$/}.map {|l| l.index /\S/ }.min s.sub(/^\n/, '').gsub(/ +$/, '').gsub(/^ {#{indent}}/, '') end
in_tmpdir() { || ... }
click to toggle source
# File lib/amoeba_deploy_tools/helpers.rb, line 18 def in_tmpdir Dir.mktmpdir do |tmpd| Dir.chdir tmpd do yield end end end
indent(s, indent=4)
click to toggle source
# File lib/amoeba_deploy_tools/helpers.rb, line 31 def indent(s, indent=4) s.gsub(/^/, ' ' * indent) end
say_bold(text)
click to toggle source
# File lib/amoeba_deploy_tools/helpers.rb, line 35 def say_bold(text) say text, :bold end
say_fatal(text)
click to toggle source
# File lib/amoeba_deploy_tools/helpers.rb, line 39 def say_fatal(text) say text, :red exit 1 end
with_tmpfile(content=nil, options={} ) { |path, tmpf| ... }
click to toggle source
# File lib/amoeba_deploy_tools/helpers.rb, line 5 def with_tmpfile(content=nil, options={} ) name = options[:name] || 'amoebatmp' tmpf = Tempfile.new name tmpf.write content tmpf.close results = yield tmpf.path, tmpf tmpf.unlink results end