forked from recortable/capistrano-recipes
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbase.rb
28 lines (24 loc) · 802 Bytes
/
base.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
def template(from, to)
erb = File.read(File.expand_path("../templates/#{from}", __FILE__))
put ERB.new(erb).result(binding), to
end
def set_default(name, *args, &block)
set(name, *args, &block) unless exists?(name)
end
def set_required(name)
set_default(name) { throw Exception.new("#{name} variable is required inside deploy.rb") }
end
namespace :deploy do
desc "Install everything onto the server"
task :install do
run "#{sudo} apt-get -y update"
run "#{sudo} apt-get -y install python-software-properties"
end
end
namespace :custom do
desc "Run a task on a remote server."
# run like: cap staging rake:invoke task=a_certain_task
task :rake do
run("cd #{deploy_to}/current; /usr/bin/env bundle exec rake #{ENV['task']} RAILS_ENV=#{rails_env}")
end
end