heroku_deploy 0.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/README.markdown +4 -0
- data/Rakefile +30 -0
- data/VERSION +1 -0
- data/config/heroku_deploy.yml +6 -0
- data/lib/heroku_deploy.rake +116 -0
- metadata +85 -0
data/README.markdown
ADDED
data/Rakefile
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'rake'
|
3
|
+
|
4
|
+
|
5
|
+
begin
|
6
|
+
require 'jeweler'
|
7
|
+
Jeweler::Tasks.new do |gem|
|
8
|
+
gem.name = "heroku_deploy"
|
9
|
+
gem.summary = %Q{initial import}
|
10
|
+
gem.description = %Q{Deploy strategy and scripts for Heroku.}
|
11
|
+
gem.email = "rosshale@gmail.com"
|
12
|
+
gem.homepage = "http://github.com/lottay/heroku_deploy"
|
13
|
+
gem.authors = ["Ross Hale", "Chris Lemcke"]
|
14
|
+
gem.add_development_dependency "heroku", ">= 0"
|
15
|
+
# gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
|
16
|
+
end
|
17
|
+
Jeweler::GemcutterTasks.new
|
18
|
+
rescue LoadError
|
19
|
+
puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler"
|
20
|
+
end
|
21
|
+
|
22
|
+
require 'rake/rdoctask'
|
23
|
+
Rake::RDocTask.new do |rdoc|
|
24
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
25
|
+
|
26
|
+
rdoc.rdoc_dir = 'rdoc'
|
27
|
+
rdoc.title = "heroku_deploy #{version}"
|
28
|
+
rdoc.rdoc_files.include('README*')
|
29
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
30
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.0.0
|
@@ -0,0 +1,116 @@
|
|
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
|
metadata
ADDED
@@ -0,0 +1,85 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: heroku_deploy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 31
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 0
|
8
|
+
- 0
|
9
|
+
- 0
|
10
|
+
version: 0.0.0
|
11
|
+
platform: ruby
|
12
|
+
authors:
|
13
|
+
- Ross Hale
|
14
|
+
- Chris Lemcke
|
15
|
+
autorequire:
|
16
|
+
bindir: bin
|
17
|
+
cert_chain: []
|
18
|
+
|
19
|
+
date: 2010-06-29 00:00:00 -07:00
|
20
|
+
default_executable:
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: heroku
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
version: "0"
|
34
|
+
type: :development
|
35
|
+
version_requirements: *id001
|
36
|
+
description: Deploy strategy and scripts for Heroku.
|
37
|
+
email: rosshale@gmail.com
|
38
|
+
executables: []
|
39
|
+
|
40
|
+
extensions: []
|
41
|
+
|
42
|
+
extra_rdoc_files:
|
43
|
+
- README.markdown
|
44
|
+
files:
|
45
|
+
- README.markdown
|
46
|
+
- Rakefile
|
47
|
+
- VERSION
|
48
|
+
- config/heroku_deploy.yml
|
49
|
+
- lib/heroku_deploy.rake
|
50
|
+
has_rdoc: true
|
51
|
+
homepage: http://github.com/lottay/heroku_deploy
|
52
|
+
licenses: []
|
53
|
+
|
54
|
+
post_install_message:
|
55
|
+
rdoc_options:
|
56
|
+
- --charset=UTF-8
|
57
|
+
require_paths:
|
58
|
+
- lib
|
59
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
60
|
+
none: false
|
61
|
+
requirements:
|
62
|
+
- - ">="
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
hash: 3
|
65
|
+
segments:
|
66
|
+
- 0
|
67
|
+
version: "0"
|
68
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
69
|
+
none: false
|
70
|
+
requirements:
|
71
|
+
- - ">="
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
hash: 3
|
74
|
+
segments:
|
75
|
+
- 0
|
76
|
+
version: "0"
|
77
|
+
requirements: []
|
78
|
+
|
79
|
+
rubyforge_project:
|
80
|
+
rubygems_version: 1.3.7
|
81
|
+
signing_key:
|
82
|
+
specification_version: 3
|
83
|
+
summary: initial import
|
84
|
+
test_files: []
|
85
|
+
|