Top Level Namespace
Defined Under Namespace
Modules: AmoebaDeployTools
Classes: Exception
Instance Method Summary
collapse
Instance Method Details
#_cset(name, *args, &block) ⇒ Object
1
2
3
4
5
|
# 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) ⇒ Object
26
27
28
29
|
# 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 ⇒ Object
18
19
20
21
22
23
24
|
# 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) ⇒ Object
31
32
33
|
# File 'lib/amoeba_deploy_tools/helpers.rb', line 31
def indent(s, indent=4)
s.gsub(/^/, ' ' * indent)
end
|
#say_bold(text) ⇒ Object
35
36
37
|
# File 'lib/amoeba_deploy_tools/helpers.rb', line 35
def say_bold(text)
say text, :bold
end
|
#say_fatal(text) ⇒ Object
39
40
41
42
|
# File 'lib/amoeba_deploy_tools/helpers.rb', line 39
def say_fatal(text)
say text, :red
exit 1
end
|
#with_tmpfile(content = nil, options = {}) ⇒ Object
5
6
7
8
9
10
11
12
13
14
15
16
|
# 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
|