-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdeploy.rb
50 lines (42 loc) · 1.05 KB
/
deploy.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
require 'heroku/command/base'
# deploy apps to Heroku
#
class Heroku::Command::Deploy < Heroku::Command::Base
# deploy
#
# list all known deployment strategies
#
def index
display 'Available deployment strategies:'
display 'heroku deploy:rails'
# The heroku-deploy plugin offers deployment of .war files.
display 'heroku deploy:war' if `heroku plugins`.match(/^heroku-deploy$/)
end
# deploy:rails
#
# Deploy a Rails app with migrations, etc
#
# -b BRANCH, --branch BRANCH # Specify a branch/tag to deploy. Defaults to master.
# -f, --force # Force push repo.
#
def rails
deployer = Heroku::Deploy::Rails.new(app, branch, git_remote_name, force?)
begin
deployer.deploy
rescue StandardError => e
raise Heroku::Command::CommandFailed, e.message
end
end
private
def branch
options[:branch] || 'master'
end
def force?
options[:force] || false
end
def git_remote_name
git_remotes('.').each do |name, appname|
return name if appname == app
end
end
end