Class: Capistrano::Deploy::Strategy::Awesome

Inherits:
Base
  • Object
show all
Defined in:
lib/capistrano/git/strategy.rb

Instance Method Summary collapse

Instance Method Details

#check!Object



17
18
19
# File 'lib/capistrano/git/strategy.rb', line 17

def check!

end

#deploy!Object



21
22
23
24
25
26
27
28
29
# File 'lib/capistrano/git/strategy.rb', line 21

def deploy!
  puts "\n\n### DEPLOY!: Deploying...\n\n"
  unless @tag_created
    create_tag
    @tag_created = true
  end
  get_tag
  deploy_no_tag
end

#migrate!Object



41
42
43
44
45
46
47
# File 'lib/capistrano/git/strategy.rb', line 41

def migrate!
  puts "\n\n### MIGRATE!: Migrating...\n\n"
  run "cd #{configuration[:deploy_to]} && sudo -u #{configuration[:sudo_user]} git checkout #{configuration[:branch]}"
  run "cd #{configuration[:deploy_to]} && sudo -u #{configuration[:sudo_user]} git pull"
  rake_command = configuration[:without_bundler] ? "#{configuration[:ruby_bin_dir]}/rake" : "#{configuration[:ruby_bin_dir]}/bundle exec rake"
  run "cd #{configuration[:deploy_to]} && sudo -u #{configuration[:sudo_user]} #{rake_command} db:migrate --trace RAILS_ENV=#{configuration[:rails_env]}"
end

#restart!Object



49
50
51
52
53
# File 'lib/capistrano/git/strategy.rb', line 49

def restart!
  puts "\n\n### RESTART!: Restarting the Passengers...\n\n"
  run "sudo chown -R #{configuration[:passenger_user]}:#{configuration[:passenger_group]} #{configuration[:deploy_to]}"
  run "sudo touch #{configuration[:deploy_to]}/tmp/restart.txt"
end

#rollback!Object



31
32
33
34
35
36
37
38
39
# File 'lib/capistrano/git/strategy.rb', line 31

def rollback!
  puts "\n\n### ROLLBACK!: Rolling back...\n\n"
  unless @got_tag
    get_tag
    @got_tag = true
  end
  run "cd #{configuration[:deploy_to]} && sudo -u #{configuration[:sudo_user]} git checkout ."
  run "cd #{configuration[:deploy_to]} && sudo -u #{configuration[:sudo_user]} git checkout #{@tag}"
end

#setup!Object



9
10
11
12
13
14
15
# File 'lib/capistrano/git/strategy.rb', line 9

def setup!
  run "sudo rm -rf #{configuration[:deploy_to]}"
  run "sudo mkdir -p #{configuration[:deploy_to]} && sudo chown -R #{configuration[:passenger_user]}:#{configuration[:passenger_user]} #{configuration[:deploy_to]}"
  run "cd #{configuration[:deploy_to]} && sudo -u #{configuration[:sudo_user]} git clone #{configuration[:repository]} ."
  run "sudo mkdir -p #{configuration[:deploy_to]}/log && sudo mkdir -p #{configuration[:deploy_to]}/tmp"
  deploy_no_tag
end