Sha256: 654206d7898b50eb709cc295d61584c445f6470c6113f49e5ea40999f40af74c

Contents?: true

Size: 849 Bytes

Versions: 13

Compression:

Stored size: 849 Bytes

Contents

def act_as(name, &block)
  normal_user = user
  set :user, name.to_s
  yield
  set :user, normal_user
end

def runtime_environment_exports
  file = "deploy/#{env}/env"
  raise "Missing deployment file: #{file}" unless File.exists?(file)

  File.read(file).split("\n").map do |line|
    k, v = line.split("=")
    %Q(export #{k}="#{v}";)
  end.join(" ")
end

def upload_template(template_name, destination)
  file = "deploy/#{env}/#{template_name}.erb"
  raise "Missing deployment file: #{file}" unless File.exists?(file)

  erb = File.read(file)
  result = ERB.new(erb).result(binding)
  put result, destination
end

def require_settings(*methods)
  methods.each do |method|
    set_default(method.to_sym) { raise "Please set #{method} "}
  end
end

def set_default(name, *args, &block)
  unless exists?(name)
    set(name, *args, &block)
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
capistrano-elobuff-0.2.7 lib/capistrano/elobuff/helpers.rb
capistrano-elobuff-0.2.6 lib/capistrano/elobuff/helpers.rb
capistrano-elobuff-0.2.5 lib/capistrano/elobuff/helpers.rb
capistrano-elobuff-0.2.4 lib/capistrano/elobuff/helpers.rb
capistrano-elobuff-0.2.3 lib/capistrano/elobuff/helpers.rb
capistrano-elobuff-0.2.2 lib/capistrano/elobuff/helpers.rb
capistrano-elobuff-0.2.1 lib/capistrano/elobuff/helpers.rb
capistrano-elobuff-0.2.0 lib/capistrano/elobuff/helpers.rb
capistrano-elobuff-0.1.4 lib/capistrano/elobuff/helpers.rb
capistrano-elobuff-0.1.3 lib/capistrano/elobuff/helpers.rb
capistrano-elobuff-0.1.2 lib/capistrano/elobuff/helpers.rb
capistrano-elobuff-0.1.1 lib/capistrano/elobuff/helpers.rb
capistrano-elobuff-0.1.0 lib/capistrano/elobuff/helpers.rb