heroku_deploy 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +4 -2
- data/VERSION +1 -1
- data/heroku_deploy.gemspec +4 -5
- data/lib/heroku_deploy/tasks.rb +9 -0
- metadata +4 -5
- data/lib/tasks/heroku_deploy.rake +0 -116
data/README.markdown
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# heroku_deploy
|
2
2
|
This gem is an easy way to quickly setup and
|
3
|
-
deploy staging and production environments for
|
3
|
+
deploy staging and production branches and environments for
|
4
4
|
your project on heroku.
|
5
5
|
|
6
6
|
###Installation Instructions
|
@@ -47,4 +47,6 @@ or
|
|
47
47
|
|
48
48
|
rake heroku_deploy:backup:production
|
49
49
|
|
50
|
-
|
50
|
+
###Coming Soon
|
51
|
+
* Before and after hooks that allow you to arbitrarily execute code before and after deploy
|
52
|
+
* a --nobackup option that skips the backup when deploying to production or staging
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.1
|
data/heroku_deploy.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{heroku_deploy}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ross Hale", "Chris Lemcke"]
|
12
|
-
s.date = %q{2010-
|
12
|
+
s.date = %q{2010-09-03}
|
13
13
|
s.description = %q{Deploy strategy and scripts for Heroku.}
|
14
14
|
s.email = %q{rosshale@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -23,14 +23,13 @@ Gem::Specification.new do |s|
|
|
23
23
|
"heroku_deploy.gemspec",
|
24
24
|
"lib/heroku_deploy.rb",
|
25
25
|
"lib/heroku_deploy/tasks.rb",
|
26
|
-
"lib/tasks/heroku_deploy.rake",
|
27
26
|
"test/heroku_deploy_test.rb",
|
28
27
|
"test/test_helper.rb"
|
29
28
|
]
|
30
29
|
s.homepage = %q{http://github.com/lottay/heroku_deploy}
|
31
30
|
s.rdoc_options = ["--charset=UTF-8"]
|
32
31
|
s.require_paths = ["lib"]
|
33
|
-
s.rubygems_version = %q{1.3.
|
32
|
+
s.rubygems_version = %q{1.3.5}
|
34
33
|
s.summary = %q{initial import}
|
35
34
|
s.test_files = [
|
36
35
|
"test/heroku_deploy_test.rb",
|
@@ -41,7 +40,7 @@ Gem::Specification.new do |s|
|
|
41
40
|
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
42
41
|
s.specification_version = 3
|
43
42
|
|
44
|
-
if Gem::Version.new(Gem::
|
43
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
45
44
|
s.add_development_dependency(%q<heroku>, [">= 0"])
|
46
45
|
else
|
47
46
|
s.add_dependency(%q<heroku>, [">= 0"])
|
data/lib/heroku_deploy/tasks.rb
CHANGED
@@ -149,6 +149,14 @@ class HerokuDeploy
|
|
149
149
|
|
150
150
|
`heroku maintenance:on --app #{app}`
|
151
151
|
|
152
|
+
puts "Waiting for slug to re-compile..."
|
153
|
+
30.times do
|
154
|
+
sleep 1
|
155
|
+
print "."
|
156
|
+
STDOUT.flush
|
157
|
+
end
|
158
|
+
puts ""
|
159
|
+
|
152
160
|
puts "Pushing to #{app}"
|
153
161
|
|
154
162
|
`git push git@heroku.com:#{app}.git #{branch}:master`
|
@@ -182,6 +190,7 @@ class HerokuDeploy
|
|
182
190
|
print "Waiting for Bundle to become available..."
|
183
191
|
while bundle_not_yet_captured?( app ) do
|
184
192
|
print "."
|
193
|
+
STDOUT.flush
|
185
194
|
end
|
186
195
|
puts ""
|
187
196
|
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku_deploy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 1
|
10
|
+
version: 0.1.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ross Hale
|
@@ -16,7 +16,7 @@ autorequire:
|
|
16
16
|
bindir: bin
|
17
17
|
cert_chain: []
|
18
18
|
|
19
|
-
date: 2010-
|
19
|
+
date: 2010-09-03 00:00:00 -07:00
|
20
20
|
default_executable:
|
21
21
|
dependencies:
|
22
22
|
- !ruby/object:Gem::Dependency
|
@@ -49,7 +49,6 @@ files:
|
|
49
49
|
- heroku_deploy.gemspec
|
50
50
|
- lib/heroku_deploy.rb
|
51
51
|
- lib/heroku_deploy/tasks.rb
|
52
|
-
- lib/tasks/heroku_deploy.rake
|
53
52
|
- test/heroku_deploy_test.rb
|
54
53
|
- test/test_helper.rb
|
55
54
|
has_rdoc: true
|
@@ -1,116 +0,0 @@
|
|
1
|
-
namespace :heroku_deploy do
|
2
|
-
|
3
|
-
desc 'Setup branches and apps on heroku'
|
4
|
-
task :setup => :environment do
|
5
|
-
puts "I AM THE SETUP TASK!!"
|
6
|
-
end
|
7
|
-
|
8
|
-
desc 'Deploy changes to staging'
|
9
|
-
task :staging => :environment do
|
10
|
-
|
11
|
-
Rake::Task['deploy:backup:staging'].invoke
|
12
|
-
|
13
|
-
puts "Deploying to Staging"
|
14
|
-
puts "Merging staging with master"
|
15
|
-
|
16
|
-
`git checkout master`
|
17
|
-
`git pull origin master`
|
18
|
-
`git checkout staging`
|
19
|
-
`git pull origin staging`
|
20
|
-
`git merge master`
|
21
|
-
`git push origin staging`
|
22
|
-
|
23
|
-
push_to 'staging'
|
24
|
-
puts ""
|
25
|
-
puts "Staging Deployed!"
|
26
|
-
puts ""
|
27
|
-
end
|
28
|
-
|
29
|
-
desc 'Deploy changes to production'
|
30
|
-
task :production => :environment do
|
31
|
-
|
32
|
-
Rake::Task['deploy:backup:production'].invoke
|
33
|
-
|
34
|
-
puts "Deploying to Production"
|
35
|
-
puts "Merging production with staging"
|
36
|
-
|
37
|
-
`git checkout staging`
|
38
|
-
`git pull origin staging`
|
39
|
-
`git checkout production`
|
40
|
-
`git pull origin production`
|
41
|
-
`git merge staging`
|
42
|
-
`git push origin production`
|
43
|
-
|
44
|
-
push_to 'production'
|
45
|
-
|
46
|
-
puts ""
|
47
|
-
puts "Production Deployed!"
|
48
|
-
puts ""
|
49
|
-
end
|
50
|
-
|
51
|
-
desc 'Backup and download the code and database'
|
52
|
-
namespace :backup do
|
53
|
-
task :staging => :environment do
|
54
|
-
backup "grouppay-staging"
|
55
|
-
end
|
56
|
-
|
57
|
-
task :production => :environment do
|
58
|
-
backup "grouppay"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
end
|
63
|
-
|
64
|
-
def push_to( branch )
|
65
|
-
|
66
|
-
app = "grouppay" if branch == "production"
|
67
|
-
app = "grouppay-staging" if branch == "staging"
|
68
|
-
|
69
|
-
puts "Going into maintenance mode"
|
70
|
-
|
71
|
-
`heroku maintenance:on --app #{app}`
|
72
|
-
|
73
|
-
puts "Pushing to #{app}"
|
74
|
-
|
75
|
-
`git push git@heroku.com:#{app}.git #{branch}:master`
|
76
|
-
`git checkout master`
|
77
|
-
|
78
|
-
puts "Migrating"
|
79
|
-
|
80
|
-
`heroku rake db:migrate --app #{app}`
|
81
|
-
|
82
|
-
puts "Restarting"
|
83
|
-
|
84
|
-
`heroku restart --app #{app}`
|
85
|
-
|
86
|
-
puts "Getting out of maintenance mode"
|
87
|
-
|
88
|
-
`heroku maintenance:off --app #{app}`
|
89
|
-
|
90
|
-
end
|
91
|
-
|
92
|
-
def backup( app )
|
93
|
-
puts ""
|
94
|
-
puts "Beginning Backup"
|
95
|
-
timestamp = Time.now.to_s(:number)
|
96
|
-
old_bundle = `heroku bundles --app #{app}`.split.first
|
97
|
-
|
98
|
-
`heroku bundles:destroy #{old_bundle} --app #{app}`
|
99
|
-
puts "Old Bundle Destroyed"
|
100
|
-
`heroku bundles:capture backup-#{timestamp} --app #{app}`
|
101
|
-
puts "New Bundle Captured on Heroku: backup-#{timestamp}"
|
102
|
-
|
103
|
-
while !`heroku bundles --app #{app}`.include?("complete") do
|
104
|
-
end
|
105
|
-
|
106
|
-
puts "New Bundle Ready For Download"
|
107
|
-
|
108
|
-
`heroku bundles:download backup-#{timestamp} --app #{app}`
|
109
|
-
`mv #{app}.tar.gz #{app}-#{timestamp}.tar.gz`
|
110
|
-
|
111
|
-
puts "New Bundle Downloaded: #{app}-#{timestamp}.tar.gz"
|
112
|
-
|
113
|
-
puts "Backup Complete!"
|
114
|
-
puts ""
|
115
|
-
|
116
|
-
end
|