heroku-rails 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +2 -0
- data/Gemfile.lock +36 -30
- data/heroku-rails.gemspec +1 -1
- data/lib/generators/templates/heroku.rake +2 -2
- data/lib/heroku-rails/config.rb +3 -1
- data/lib/heroku-rails/runner.rb +40 -10
- data/lib/heroku/rails/tasks.rb +4 -4
- metadata +40 -46
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,47 +1,50 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
heroku-rails (0.
|
4
|
+
heroku-rails (0.4.0)
|
5
5
|
heroku (>= 1.11.0)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: http://rubygems.org/
|
9
9
|
specs:
|
10
|
+
ZenTest (4.6.2)
|
11
|
+
addressable (2.2.6)
|
10
12
|
archive-tar-minitar (0.5.2)
|
11
|
-
autotest (4.4.
|
12
|
-
|
13
|
-
|
14
|
-
diff-lcs (1.1.
|
13
|
+
autotest (4.4.6)
|
14
|
+
ZenTest (>= 4.4.1)
|
15
|
+
columnize (0.3.5)
|
16
|
+
diff-lcs (1.1.3)
|
15
17
|
growl-glue (1.0.7)
|
16
|
-
heroku (
|
17
|
-
launchy (
|
18
|
-
rest-client (
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
18
|
+
heroku (2.15.1)
|
19
|
+
launchy (>= 0.3.2)
|
20
|
+
rest-client (~> 1.6.1)
|
21
|
+
rubyzip
|
22
|
+
term-ansicolor (~> 1.0.5)
|
23
|
+
launchy (2.0.5)
|
24
|
+
addressable (~> 2.2.6)
|
25
|
+
linecache (0.46)
|
26
|
+
rbx-require-relative (> 0.0.4)
|
27
|
+
linecache19 (0.5.12)
|
24
28
|
ruby_core_source (>= 0.1.4)
|
25
|
-
mime-types (1.
|
29
|
+
mime-types (1.17.2)
|
26
30
|
rake (0.8.7)
|
27
|
-
|
31
|
+
rbx-require-relative (0.0.5)
|
32
|
+
rest-client (1.6.7)
|
28
33
|
mime-types (>= 1.16)
|
29
|
-
rspec (2.0
|
30
|
-
rspec-core (~> 2.0
|
31
|
-
rspec-expectations (~> 2.0
|
32
|
-
rspec-mocks (~> 2.0
|
33
|
-
rspec-core (2.
|
34
|
-
rspec-expectations (2.0
|
35
|
-
diff-lcs (
|
36
|
-
rspec-mocks (2.0
|
37
|
-
|
38
|
-
rspec-expectations (~> 2.0.1)
|
39
|
-
ruby-debug (0.10.3)
|
34
|
+
rspec (2.7.0)
|
35
|
+
rspec-core (~> 2.7.0)
|
36
|
+
rspec-expectations (~> 2.7.0)
|
37
|
+
rspec-mocks (~> 2.7.0)
|
38
|
+
rspec-core (2.7.1)
|
39
|
+
rspec-expectations (2.7.0)
|
40
|
+
diff-lcs (~> 1.1.2)
|
41
|
+
rspec-mocks (2.7.0)
|
42
|
+
ruby-debug (0.10.4)
|
40
43
|
columnize (>= 0.1)
|
41
|
-
ruby-debug-base (~> 0.10.
|
42
|
-
ruby-debug-base (0.10.
|
44
|
+
ruby-debug-base (~> 0.10.4.0)
|
45
|
+
ruby-debug-base (0.10.4)
|
43
46
|
linecache (>= 0.3)
|
44
|
-
ruby-debug-base19 (0.11.
|
47
|
+
ruby-debug-base19 (0.11.25)
|
45
48
|
columnize (>= 0.3.1)
|
46
49
|
linecache19 (>= 0.5.11)
|
47
50
|
ruby_core_source (>= 0.1.4)
|
@@ -49,8 +52,10 @@ GEM
|
|
49
52
|
columnize (>= 0.3.1)
|
50
53
|
linecache19 (>= 0.5.11)
|
51
54
|
ruby-debug-base19 (>= 0.11.19)
|
52
|
-
ruby_core_source (0.1.
|
55
|
+
ruby_core_source (0.1.5)
|
53
56
|
archive-tar-minitar (>= 0.5.2)
|
57
|
+
rubyzip (0.9.5)
|
58
|
+
term-ansicolor (1.0.7)
|
54
59
|
|
55
60
|
PLATFORMS
|
56
61
|
ruby
|
@@ -59,6 +64,7 @@ DEPENDENCIES
|
|
59
64
|
autotest
|
60
65
|
growl-glue
|
61
66
|
heroku-rails!
|
67
|
+
rake (= 0.8.7)
|
62
68
|
rspec (~> 2.0)
|
63
69
|
ruby-debug
|
64
70
|
ruby-debug19
|
data/heroku-rails.gemspec
CHANGED
@@ -16,12 +16,12 @@ namespace :heroku do
|
|
16
16
|
end
|
17
17
|
|
18
18
|
# runs before each push to a particular heroku deploy environment
|
19
|
-
task :before_each_deploy do
|
19
|
+
task :before_each_deploy, [:app_name] do |t,args|
|
20
20
|
|
21
21
|
end
|
22
22
|
|
23
23
|
# runs after each push to a particular heroku deploy environment
|
24
|
-
task :after_each_deploy do
|
24
|
+
task :after_each_deploy, [:app_name] do |t,args|
|
25
25
|
|
26
26
|
end
|
27
27
|
|
data/lib/heroku-rails/config.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
require 'erb'
|
2
|
+
|
1
3
|
module HerokuRails
|
2
4
|
class Config
|
3
5
|
|
@@ -14,7 +16,7 @@ module HerokuRails
|
|
14
16
|
|
15
17
|
def initialize(config_filepath)
|
16
18
|
if File.exists?(config_filepath)
|
17
|
-
self.settings = YAML.
|
19
|
+
self.settings = YAML.load(ERB.new(File.read(config_filepath)).result) || {}
|
18
20
|
else
|
19
21
|
self.settings = {}
|
20
22
|
end
|
data/lib/heroku-rails/runner.rb
CHANGED
@@ -46,7 +46,7 @@ module HerokuRails
|
|
46
46
|
|
47
47
|
stack = @config.stack(heroku_env)
|
48
48
|
stack_option = " --stack #{stack}" if stack.to_s.size > 0
|
49
|
-
|
49
|
+
creation_command "heroku create #{app_name}#{stack_option} --remote #{app_name}"
|
50
50
|
end
|
51
51
|
end
|
52
52
|
|
@@ -63,7 +63,7 @@ module HerokuRails
|
|
63
63
|
# if the stacks don't match, then perform a migration
|
64
64
|
if stack != heroku_app_info[:stack]
|
65
65
|
puts "Migrating the app: #{app_name} to the stack: #{stack}"
|
66
|
-
|
66
|
+
creation_command "heroku stack:migrate #{stack} --app #{app_name}"
|
67
67
|
end
|
68
68
|
end
|
69
69
|
end
|
@@ -90,7 +90,7 @@ module HerokuRails
|
|
90
90
|
# check to see if we need to delete this person
|
91
91
|
unless collaborator_emails.include?(existing_email)
|
92
92
|
# delete that collaborator if they arent on the approved list
|
93
|
-
|
93
|
+
destroy_command "heroku sharing:remove #{existing_email} --app #{app_name}"
|
94
94
|
end
|
95
95
|
end
|
96
96
|
|
@@ -99,9 +99,12 @@ module HerokuRails
|
|
99
99
|
# check to see if we need to add this person
|
100
100
|
unless existing_emails.include?(collaborator_email)
|
101
101
|
# add the collaborator if they are not already on the server
|
102
|
-
|
102
|
+
creation_command "heroku sharing:add #{collaborator_email} --app #{app_name}"
|
103
103
|
end
|
104
104
|
end
|
105
|
+
|
106
|
+
# display the destructive commands
|
107
|
+
output_destroy_commands
|
105
108
|
end
|
106
109
|
end
|
107
110
|
|
@@ -134,7 +137,7 @@ module HerokuRails
|
|
134
137
|
set_config << "#{key}='#{val}' "
|
135
138
|
end
|
136
139
|
|
137
|
-
|
140
|
+
creation_command "heroku config:add #{set_config} --app #{app_name}"
|
138
141
|
end
|
139
142
|
end
|
140
143
|
end
|
@@ -150,7 +153,7 @@ module HerokuRails
|
|
150
153
|
existing_addons = (@heroku.installed_addons(app_name) || []).map{|a| a["name"]}
|
151
154
|
|
152
155
|
# all apps need the shared database
|
153
|
-
addons << "shared-database:5mb" unless addons.index("shared-database:5mb")
|
156
|
+
addons << "shared-database:5mb" unless addons.index("shared-database:5mb") || addons.index("shared-database:20gb")
|
154
157
|
|
155
158
|
# add "custom_domains" if that addon doesnt already exist
|
156
159
|
# and we have domains configured for this app
|
@@ -163,7 +166,7 @@ module HerokuRails
|
|
163
166
|
# check to see if we need to delete this addon
|
164
167
|
unless addons.include?(existing_addon)
|
165
168
|
# delete this addon if they arent on the approved list
|
166
|
-
|
169
|
+
destroy_command "heroku addons:remove #{existing_addon} --app #{app_name}"
|
167
170
|
end
|
168
171
|
end
|
169
172
|
|
@@ -172,9 +175,12 @@ module HerokuRails
|
|
172
175
|
# check to see if we need to add this addon
|
173
176
|
unless existing_addons.include?(addon)
|
174
177
|
# add this addon if they are not already added
|
175
|
-
|
178
|
+
creation_command "heroku addons:add #{addon} --app #{app_name}"
|
176
179
|
end
|
177
180
|
end
|
181
|
+
|
182
|
+
# display the destructive commands
|
183
|
+
output_destroy_commands
|
178
184
|
end
|
179
185
|
end
|
180
186
|
|
@@ -193,7 +199,7 @@ module HerokuRails
|
|
193
199
|
# check to see if we need to delete this domain
|
194
200
|
unless domains.include?(existing_domain)
|
195
201
|
# delete this domain if they arent on the approved list
|
196
|
-
|
202
|
+
destroy_command "heroku domains:remove #{existing_domain} --app #{app_name}"
|
197
203
|
end
|
198
204
|
end
|
199
205
|
|
@@ -202,9 +208,12 @@ module HerokuRails
|
|
202
208
|
# check to see if we need to add this domain
|
203
209
|
unless existing_domains.include?(domain)
|
204
210
|
# add this domain if they are not already added
|
205
|
-
|
211
|
+
creation_command "heroku domains:add #{domain} --app #{app_name}"
|
206
212
|
end
|
207
213
|
end
|
214
|
+
|
215
|
+
# display the destructive commands
|
216
|
+
output_destroy_commands
|
208
217
|
end
|
209
218
|
end
|
210
219
|
|
@@ -248,6 +257,27 @@ module HerokuRails
|
|
248
257
|
command(*args)
|
249
258
|
end
|
250
259
|
|
260
|
+
def creation_command(*args)
|
261
|
+
system_with_echo(*args)
|
262
|
+
end
|
263
|
+
|
264
|
+
def destroy_command(*args)
|
265
|
+
puts args.join(' ')
|
266
|
+
@destroy_commands ||= []
|
267
|
+
@destroy_commands << @destroy_commands
|
268
|
+
end
|
269
|
+
|
270
|
+
def output_destroy_commands(app)
|
271
|
+
puts "The #{app} had a few things removed from the heroku.yml."
|
272
|
+
puts "If they are no longer neccessary, then run the following commands:"
|
273
|
+
(@destroy_commands || []).each do |destroy_command|
|
274
|
+
puts destroy_command
|
275
|
+
end
|
276
|
+
puts "these commands may cause data loss so make sure you know that these are necessary"
|
277
|
+
# clear destroy commands
|
278
|
+
@destroy_commands = []
|
279
|
+
end
|
280
|
+
|
251
281
|
def command(*args)
|
252
282
|
system(*args)
|
253
283
|
end
|
data/lib/heroku/rails/tasks.rb
CHANGED
@@ -60,7 +60,7 @@ namespace :heroku do
|
|
60
60
|
# set the current heroku_app so that callbacks can read the data
|
61
61
|
@heroku_app = {:env => heroku_env, :app_name => app_name, :repo => repo}
|
62
62
|
Rake::Task["heroku:before_each_deploy"].reenable
|
63
|
-
Rake::Task["heroku:before_each_deploy"].invoke
|
63
|
+
Rake::Task["heroku:before_each_deploy"].invoke(app_name)
|
64
64
|
|
65
65
|
branch = `git branch`.scan(/^\* (.*)\n/).flatten.first.to_s
|
66
66
|
if branch.present?
|
@@ -71,7 +71,7 @@ namespace :heroku do
|
|
71
71
|
exit(1)
|
72
72
|
end
|
73
73
|
Rake::Task["heroku:after_each_deploy"].reenable
|
74
|
-
Rake::Task["heroku:after_each_deploy"].invoke
|
74
|
+
Rake::Task["heroku:after_each_deploy"].invoke(app_name)
|
75
75
|
puts "\n"
|
76
76
|
end
|
77
77
|
Rake::Task["heroku:after_deploy"].invoke
|
@@ -86,11 +86,11 @@ namespace :heroku do
|
|
86
86
|
end
|
87
87
|
|
88
88
|
# Callback before each deploy
|
89
|
-
task :before_each_deploy do
|
89
|
+
task :before_each_deploy, [:app_name] do |t,args|
|
90
90
|
end
|
91
91
|
|
92
92
|
# Callback after each deploy
|
93
|
-
task :after_each_deploy do
|
93
|
+
task :after_each_deploy, [:app_name] do |t,args|
|
94
94
|
end
|
95
95
|
|
96
96
|
# Callback for when we switch environment
|
metadata
CHANGED
@@ -1,54 +1,51 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku-rails
|
3
|
-
version: !ruby/object:Gem::Version
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
4
5
|
prerelease:
|
5
|
-
version: 0.3.2
|
6
6
|
platform: ruby
|
7
|
-
authors:
|
7
|
+
authors:
|
8
8
|
- Elijah Miller
|
9
9
|
- Glenn Roberts
|
10
10
|
- Jacques Crocker
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
dependencies:
|
18
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
date: 2011-12-07 00:00:00.000000000Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
19
17
|
name: heroku
|
20
|
-
requirement: &
|
18
|
+
requirement: &2153321540 !ruby/object:Gem::Requirement
|
21
19
|
none: false
|
22
|
-
requirements:
|
23
|
-
- -
|
24
|
-
- !ruby/object:Gem::Version
|
20
|
+
requirements:
|
21
|
+
- - ! '>='
|
22
|
+
- !ruby/object:Gem::Version
|
25
23
|
version: 1.11.0
|
26
24
|
type: :runtime
|
27
25
|
prerelease: false
|
28
|
-
version_requirements: *
|
29
|
-
- !ruby/object:Gem::Dependency
|
26
|
+
version_requirements: *2153321540
|
27
|
+
- !ruby/object:Gem::Dependency
|
30
28
|
name: rspec
|
31
|
-
requirement: &
|
29
|
+
requirement: &2153320680 !ruby/object:Gem::Requirement
|
32
30
|
none: false
|
33
|
-
requirements:
|
31
|
+
requirements:
|
34
32
|
- - ~>
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version:
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: '2.0'
|
37
35
|
type: :development
|
38
36
|
prerelease: false
|
39
|
-
version_requirements: *
|
40
|
-
description: Manage multiple Heroku instances/apps for a single Rails app using Rake.
|
37
|
+
version_requirements: *2153320680
|
38
|
+
description: Manage multiple Heroku instances/apps for a single Rails app using Rake.
|
39
|
+
It's the Capistrano for Heroku, without the suck.
|
41
40
|
email: railsjedi@gmail.com
|
42
41
|
executables: []
|
43
|
-
|
44
42
|
extensions: []
|
45
|
-
|
46
|
-
extra_rdoc_files:
|
43
|
+
extra_rdoc_files:
|
47
44
|
- LICENSE
|
48
45
|
- README.md
|
49
46
|
- TODO
|
50
47
|
- CHANGELOG
|
51
|
-
files:
|
48
|
+
files:
|
52
49
|
- lib/generators/heroku/config_generator.rb
|
53
50
|
- lib/generators/templates/heroku.rake
|
54
51
|
- lib/generators/templates/heroku.yml
|
@@ -69,41 +66,38 @@ files:
|
|
69
66
|
- Rakefile
|
70
67
|
- README.md
|
71
68
|
- TODO
|
72
|
-
has_rdoc: true
|
73
69
|
homepage: http://github.com/railsjedi/heroku-rails
|
74
70
|
licenses: []
|
75
|
-
|
76
71
|
post_install_message:
|
77
|
-
rdoc_options:
|
72
|
+
rdoc_options:
|
78
73
|
- --charset=UTF-8
|
79
|
-
require_paths:
|
74
|
+
require_paths:
|
80
75
|
- lib
|
81
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
82
77
|
none: false
|
83
|
-
requirements:
|
84
|
-
- -
|
85
|
-
- !ruby/object:Gem::Version
|
86
|
-
|
87
|
-
segments:
|
78
|
+
requirements:
|
79
|
+
- - ! '>='
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0'
|
82
|
+
segments:
|
88
83
|
- 0
|
89
|
-
|
90
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
|
+
hash: -3500876346162424707
|
85
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
91
86
|
none: false
|
92
|
-
requirements:
|
93
|
-
- -
|
94
|
-
- !ruby/object:Gem::Version
|
95
|
-
|
96
|
-
segments:
|
87
|
+
requirements:
|
88
|
+
- - ! '>='
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: '0'
|
91
|
+
segments:
|
97
92
|
- 0
|
98
|
-
|
93
|
+
hash: -3500876346162424707
|
99
94
|
requirements: []
|
100
|
-
|
101
95
|
rubyforge_project: none
|
102
|
-
rubygems_version: 1.6
|
96
|
+
rubygems_version: 1.8.6
|
103
97
|
signing_key:
|
104
98
|
specification_version: 3
|
105
99
|
summary: Deployment and configuration tools for Heroku/Rails
|
106
|
-
test_files:
|
100
|
+
test_files:
|
107
101
|
- spec/fixtures/heroku-config.yml
|
108
102
|
- spec/heroku/rails/heroku_config_spec.rb
|
109
103
|
- spec/heroku/rails/heroku_runner_spec.rb
|