heroku_deploy 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +2 -1
- data/.idea/dictionaries/rosshale.xml +3 -0
- data/VERSION +1 -1
- data/heroku_deploy.gemspec +3 -6
- data/lib/heroku_deploy/tasks.rb +136 -0
- data/lib/heroku_deploy.rb +5 -1
- metadata +5 -8
- data/.idea/encodings.xml +0 -5
- data/.idea/heroku_deploy.iml +0 -9
- data/.idea/misc.xml +0 -11
- data/.idea/modules.xml +0 -9
- data/.idea/vcs.xml +0 -8
data/.gitignore
CHANGED
@@ -1 +1,2 @@
|
|
1
|
-
.idea
|
1
|
+
.idea
|
2
|
+
.idea/*
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.2
|
data/heroku_deploy.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{heroku_deploy}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.2"
|
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"]
|
@@ -17,17 +17,14 @@ Gem::Specification.new do |s|
|
|
17
17
|
]
|
18
18
|
s.files = [
|
19
19
|
".gitignore",
|
20
|
-
".idea/
|
21
|
-
".idea/heroku_deploy.iml",
|
22
|
-
".idea/misc.xml",
|
23
|
-
".idea/modules.xml",
|
24
|
-
".idea/vcs.xml",
|
20
|
+
".idea/dictionaries/rosshale.xml",
|
25
21
|
"README.markdown",
|
26
22
|
"Rakefile",
|
27
23
|
"VERSION",
|
28
24
|
"config/heroku_deploy.yml",
|
29
25
|
"heroku_deploy.gemspec",
|
30
26
|
"lib/heroku_deploy.rb",
|
27
|
+
"lib/heroku_deploy/tasks.rb",
|
31
28
|
"lib/tasks/heroku_deploy.rake"
|
32
29
|
]
|
33
30
|
s.homepage = %q{http://github.com/lottay/heroku_deploy}
|
@@ -0,0 +1,136 @@
|
|
1
|
+
require 'rake'
|
2
|
+
require 'rake/tasklib'
|
3
|
+
|
4
|
+
class HerokuDeploy
|
5
|
+
|
6
|
+
class Tasks < ::Rake::TaskLib
|
7
|
+
attr_accessor :heroku_deploy
|
8
|
+
|
9
|
+
def initialize
|
10
|
+
yield self if block_given?
|
11
|
+
|
12
|
+
self.heroku_deploy = Rake.application.heroku_deploy
|
13
|
+
|
14
|
+
define
|
15
|
+
end
|
16
|
+
|
17
|
+
def define
|
18
|
+
namespace :heroku_deploy do
|
19
|
+
desc 'Setup branches and apps on heroku'
|
20
|
+
task :setup => :environment do
|
21
|
+
puts "I AM THE SETUP TASK!!"
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Deploy changes to staging'
|
25
|
+
task :staging => :environment do
|
26
|
+
|
27
|
+
Rake::Task['deploy:backup:staging'].invoke
|
28
|
+
|
29
|
+
puts "Deploying to Staging"
|
30
|
+
puts "Merging staging with master"
|
31
|
+
|
32
|
+
`git checkout master`
|
33
|
+
`git pull origin master`
|
34
|
+
`git checkout staging`
|
35
|
+
`git pull origin staging`
|
36
|
+
`git merge master`
|
37
|
+
`git push origin staging`
|
38
|
+
|
39
|
+
heroku_deploy.push_to 'staging'
|
40
|
+
puts ""
|
41
|
+
puts "Staging Deployed!"
|
42
|
+
puts ""
|
43
|
+
end
|
44
|
+
|
45
|
+
desc 'Deploy changes to production'
|
46
|
+
task :production => :environment do
|
47
|
+
|
48
|
+
Rake::Task['deploy:backup:production'].invoke
|
49
|
+
|
50
|
+
puts "Deploying to Production"
|
51
|
+
puts "Merging production with staging"
|
52
|
+
|
53
|
+
`git checkout staging`
|
54
|
+
`git pull origin staging`
|
55
|
+
`git checkout production`
|
56
|
+
`git pull origin production`
|
57
|
+
`git merge staging`
|
58
|
+
`git push origin production`
|
59
|
+
|
60
|
+
heroku_deploy.push_to 'production'
|
61
|
+
|
62
|
+
puts ""
|
63
|
+
puts "Production Deployed!"
|
64
|
+
puts ""
|
65
|
+
end
|
66
|
+
|
67
|
+
desc 'Backup and download the code and database'
|
68
|
+
namespace :backup do
|
69
|
+
task :staging => :environment do
|
70
|
+
heroku_deploy.backup "grouppay-staging"
|
71
|
+
end
|
72
|
+
|
73
|
+
task :production => :environment do
|
74
|
+
heroku_deploy.backup "grouppay"
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def push_to( branch )
|
83
|
+
|
84
|
+
app = "grouppay" if branch == "production"
|
85
|
+
app = "grouppay-staging" if branch == "staging"
|
86
|
+
|
87
|
+
puts "Going into maintenance mode"
|
88
|
+
|
89
|
+
`heroku maintenance:on --app #{app}`
|
90
|
+
|
91
|
+
puts "Pushing to #{app}"
|
92
|
+
|
93
|
+
`git push git@heroku.com:#{app}.git #{branch}:master`
|
94
|
+
`git checkout master`
|
95
|
+
|
96
|
+
puts "Migrating"
|
97
|
+
|
98
|
+
`heroku rake db:migrate --app #{app}`
|
99
|
+
|
100
|
+
puts "Restarting"
|
101
|
+
|
102
|
+
`heroku restart --app #{app}`
|
103
|
+
|
104
|
+
puts "Getting out of maintenance mode"
|
105
|
+
|
106
|
+
`heroku maintenance:off --app #{app}`
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
def backup( app )
|
111
|
+
puts ""
|
112
|
+
puts "Beginning Backup"
|
113
|
+
timestamp = Time.now.to_s(:number)
|
114
|
+
old_bundle = `heroku bundles --app #{app}`.split.first
|
115
|
+
|
116
|
+
`heroku bundles:destroy #{old_bundle} --app #{app}`
|
117
|
+
puts "Old Bundle Destroyed"
|
118
|
+
`heroku bundles:capture backup-#{timestamp} --app #{app}`
|
119
|
+
puts "New Bundle Captured on Heroku: backup-#{timestamp}"
|
120
|
+
|
121
|
+
while !`heroku bundles --app #{app}`.include?("complete") do
|
122
|
+
end
|
123
|
+
|
124
|
+
puts "New Bundle Ready For Download"
|
125
|
+
|
126
|
+
`heroku bundles:download backup-#{timestamp} --app #{app}`
|
127
|
+
`mv #{app}.tar.gz #{app}-#{timestamp}.tar.gz`
|
128
|
+
|
129
|
+
puts "New Bundle Downloaded: #{app}-#{timestamp}.tar.gz"
|
130
|
+
|
131
|
+
puts "Backup Complete!"
|
132
|
+
puts ""
|
133
|
+
|
134
|
+
end
|
135
|
+
|
136
|
+
end
|
data/lib/heroku_deploy.rb
CHANGED
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: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 2
|
10
|
+
version: 0.0.2
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ross Hale
|
@@ -43,17 +43,14 @@ extra_rdoc_files:
|
|
43
43
|
- README.markdown
|
44
44
|
files:
|
45
45
|
- .gitignore
|
46
|
-
- .idea/
|
47
|
-
- .idea/heroku_deploy.iml
|
48
|
-
- .idea/misc.xml
|
49
|
-
- .idea/modules.xml
|
50
|
-
- .idea/vcs.xml
|
46
|
+
- .idea/dictionaries/rosshale.xml
|
51
47
|
- README.markdown
|
52
48
|
- Rakefile
|
53
49
|
- VERSION
|
54
50
|
- config/heroku_deploy.yml
|
55
51
|
- heroku_deploy.gemspec
|
56
52
|
- lib/heroku_deploy.rb
|
53
|
+
- lib/heroku_deploy/tasks.rb
|
57
54
|
- lib/tasks/heroku_deploy.rake
|
58
55
|
has_rdoc: true
|
59
56
|
homepage: http://github.com/lottay/heroku_deploy
|
data/.idea/encodings.xml
DELETED
data/.idea/heroku_deploy.iml
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<module type="RUBY_MODULE" version="4">
|
3
|
-
<component name="NewModuleRootManager">
|
4
|
-
<content url="file://$MODULE_DIR$" />
|
5
|
-
<orderEntry type="inheritedJdk" />
|
6
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
7
|
-
</component>
|
8
|
-
</module>
|
9
|
-
|
data/.idea/misc.xml
DELETED
@@ -1,11 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="DependencyValidationManager">
|
4
|
-
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
5
|
-
</component>
|
6
|
-
<component name="ProjectDetails">
|
7
|
-
<option name="projectName" value="heroku_deploy" />
|
8
|
-
</component>
|
9
|
-
<component name="ProjectRootManager" version="2" project-jdk-name="Ruby SDK 1.8.7 (/opt/local/bin/ruby)" project-jdk-type="RUBY_SDK" />
|
10
|
-
</project>
|
11
|
-
|
data/.idea/modules.xml
DELETED
@@ -1,9 +0,0 @@
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
2
|
-
<project version="4">
|
3
|
-
<component name="ProjectModuleManager">
|
4
|
-
<modules>
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/heroku_deploy.iml" filepath="$PROJECT_DIR$/.idea/heroku_deploy.iml" />
|
6
|
-
</modules>
|
7
|
-
</component>
|
8
|
-
</project>
|
9
|
-
|