Top Level Namespace

Defined Under Namespace

Modules: Aptitude, Bluepill, DeployMate, Shell, Upstart, UserManagement

Instance Method Summary collapse

Instance Method Details

#execute_script(name, params = "") ⇒ Object



17
18
19
20
21
22
# File 'lib/capistrano/helpers.rb', line 17

def execute_script(name, params = "")
  upload! File.expand_path("../scripts/#{name}", __FILE__), name.to_s
  execute "chmod 755 #{name}"
  execute "./#{name} #{params}"
  execute "rm #{name}"
end

#set_default(name, *args, &block) ⇒ Object



13
14
15
# File 'lib/capistrano/helpers.rb', line 13

def set_default(name, *args, &block)
  set(name, *args, &block) if fetch(name).nil?
end

#template(from, to) ⇒ Object

Place all custom helper methods used in capistrano tasks here This file is loaded before the tasks



4
5
6
7
8
9
10
11
# File 'lib/capistrano/helpers.rb', line 4

def template(from, to)
  path = File.expand_path("lib/capistrano/configs/#{from}", ENV['PWD'])
  path = File.expand_path("../configs/#{from}", __FILE__) unless File.exist?(path)
  erb = File.read(path)
  compiled = ERB.new(erb).result(binding)
  io = StringIO.new(compiled)
  upload! io, to
end