/
rails3_push.rb
56 lines (45 loc) · 1.59 KB
/
rails3_push.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
51
52
53
54
55
56
module Inploy
module Templates
module Rails3Push
def remote_setup
command = []
command << "mkdir -p #{application_path}"
command << "cd #{application_path}"
command << "git init"
command << "sed -i'' -e 's/master/#{branch}/' .git/HEAD" unless branch == 'master'
command << "git config --bool receive.denyNonFastForwards false"
command << "git config receive.denyCurrentBranch ignore"
remote_run command.join(' && ')
push_code
command = []
command << "cd #{application_path}"
command << "rake inploy:local:setup RAILS_ENV=#{environment} environment=#{environment}#{skip_steps_cmd}"
remote_run command.join(' && ')
end
def remote_update
push_code
command = []
command << "cd #{application_path}"
command << "rake inploy:local:update RAILS_ENV=#{environment} environment=#{environment}#{skip_steps_cmd}"
remote_run command.join(' && ')
end
def install_gems
end
def update_code
end
private
def push_code
hosts.each do |host|
run "git push -f #{user}@#{host}:#{application_path} #{branch}"
end
command = []
command << "cd #{application_path}"
command << "git reset --hard"
command << "git clean -f -d -e public/system" # Keeps paperclip uploaded files
command << "git submodule update --init"
command << "bundle install --deployment" unless skip_step?('bundle_install')
remote_run command.join(' && ')
end
end
end
end