heroku_san 2.1.4 → 2.2.2
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/CHANGELOG.md +4 -0
- data/README.rdoc +3 -0
- data/cucumber.yml +2 -2
- data/features/remote.feature +1 -0
- data/features/step_definitions/remote_steps.rb +18 -0
- data/lib/heroku_san/stage.rb +16 -0
- data/lib/heroku_san/version.rb +1 -1
- data/lib/tasks.rb +20 -0
- data/spec/heroku_san/stage_spec.rb +50 -3
- metadata +2 -2
data/CHANGELOG.md
CHANGED
data/README.rdoc
CHANGED
@@ -69,6 +69,8 @@ Need to add remotes for each app?
|
|
69
69
|
|
70
70
|
A full list of tasks provided:
|
71
71
|
|
72
|
+
rake heroku:addons # Install addons for the application.
|
73
|
+
rake heroku:addons:local # List configured addons, without installing them
|
72
74
|
rake heroku:apps # Lists configured apps
|
73
75
|
rake heroku:apps:local # Lists configured apps without hitting heroku
|
74
76
|
rake heroku:config # Add config:vars to each application.
|
@@ -133,6 +135,7 @@ Issue Tracker:: http://github.com/fastestforward/heroku_san/issues
|
|
133
135
|
* Mat Schaffer (mat@schaffer.me)
|
134
136
|
* Jonathan Hironaga (jonathan.hironaga@halogennetwork.com)
|
135
137
|
* Ken Mayer (ken@bitwrangler.com)
|
138
|
+
* Matt Burke (https://github.com/spraints)
|
136
139
|
|
137
140
|
== License
|
138
141
|
|
data/cucumber.yml
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
default: --tags ~@slow_process
|
2
|
-
remote: --tags @slow_process
|
1
|
+
default: --tags ~@slow_process --no-source
|
2
|
+
remote: --tags @slow_process --no-source
|
data/features/remote.feature
CHANGED
@@ -131,6 +131,24 @@ When /^I list all apps on Heroku$/ do
|
|
131
131
|
assert_partial_output "@ #{sha} master", output
|
132
132
|
end
|
133
133
|
|
134
|
+
When /^I install an addon$/ do
|
135
|
+
# Install the campfire addon.
|
136
|
+
overwrite_file 'config/heroku.yml', <<END_CONFIG
|
137
|
+
test_app:
|
138
|
+
app: #{@app}
|
139
|
+
addons:
|
140
|
+
- deployhooks:campfire
|
141
|
+
END_CONFIG
|
142
|
+
run_simple 'rake test_app heroku:addons'
|
143
|
+
output = stdout_from 'rake test_app heroku:addons'
|
144
|
+
# The output should show the default addons...
|
145
|
+
assert_partial_output "shared-database:5mb", output
|
146
|
+
# ... and the new one ...
|
147
|
+
assert_partial_output "deployhooks:campfire", output
|
148
|
+
# ... with a note about needing to configure it.
|
149
|
+
assert_partial_output "https://api.heroku.com/myapps/#{@app}/addons/deployhooks:campfire", output
|
150
|
+
end
|
151
|
+
|
134
152
|
Then /^heroku_san is green$/ do
|
135
153
|
run_simple "heroku apps:destroy #{@app} --confirm #{@app}"
|
136
154
|
end
|
data/lib/heroku_san/stage.rb
CHANGED
@@ -37,6 +37,10 @@ module HerokuSan
|
|
37
37
|
def config
|
38
38
|
@options['config'] ||= {}
|
39
39
|
end
|
40
|
+
|
41
|
+
def addons
|
42
|
+
(@options['addons'] ||= []).flatten
|
43
|
+
end
|
40
44
|
|
41
45
|
def run(command, args = nil)
|
42
46
|
if stack =~ /cedar/
|
@@ -99,6 +103,18 @@ module HerokuSan
|
|
99
103
|
heroku.put_config_vars(app, params).body
|
100
104
|
end
|
101
105
|
|
106
|
+
def installed_addons
|
107
|
+
heroku.get_addons(app).body
|
108
|
+
end
|
109
|
+
|
110
|
+
def install_addons
|
111
|
+
addons_to_install = addons - installed_addons.map{|a|a['name']}
|
112
|
+
addons_to_install.each do |addon|
|
113
|
+
heroku.post_addon(app, addon)
|
114
|
+
end
|
115
|
+
installed_addons
|
116
|
+
end
|
117
|
+
|
102
118
|
def restart
|
103
119
|
"restarted" if heroku.post_ps_restart(app).body == 'ok'
|
104
120
|
end
|
data/lib/heroku_san/version.rb
CHANGED
data/lib/tasks.rb
CHANGED
@@ -86,6 +86,26 @@ namespace :heroku do
|
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
desc 'Install addons for the application.'
|
90
|
+
task :addons do
|
91
|
+
each_heroku_app do |stage|
|
92
|
+
addons = stage.install_addons
|
93
|
+
puts y("#{stage.name} addons" => addons.map { |addon| addon['configured'] ? addon['name'] : { addon['name'] => "Configure at https://api.heroku.com/myapps/#{stage.app}/addons/#{addon['name']}" } })
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
namespace :addons do
|
98
|
+
desc 'List configured addons, without installing them'
|
99
|
+
task :local do
|
100
|
+
each_heroku_app do |stage|
|
101
|
+
puts "Configured addons for #{stage.name}:"
|
102
|
+
stage.addons.each do |addon|
|
103
|
+
puts " - #{addon}"
|
104
|
+
end
|
105
|
+
end
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
89
109
|
desc 'Creates an example configuration file'
|
90
110
|
task :create_config do
|
91
111
|
filename = %Q{#{@heroku_san.config_file.to_s}}
|
@@ -14,7 +14,8 @@ describe HerokuSan::Stage do
|
|
14
14
|
{"stack" => "cedar",
|
15
15
|
"app" => "awesomeapp-demo",
|
16
16
|
"tag" => "demo/*",
|
17
|
-
"config"=> {"BUNDLE_WITHOUT"=>"development:test"}
|
17
|
+
"config"=> {"BUNDLE_WITHOUT"=>"development:test"},
|
18
|
+
"addons"=> ['one:addon', 'two:addons'],
|
18
19
|
})}
|
19
20
|
|
20
21
|
its(:name) { should == 'production' }
|
@@ -23,6 +24,7 @@ describe HerokuSan::Stage do
|
|
23
24
|
its(:tag) { should == "demo/*" }
|
24
25
|
its(:config) { should == {"BUNDLE_WITHOUT"=>"development:test"} }
|
25
26
|
its(:repo) { should == 'git@heroku.com:awesomeapp-demo.git' }
|
27
|
+
its(:addons) { should == ['one:addon', 'two:addons'] }
|
26
28
|
end
|
27
29
|
|
28
30
|
describe "#app" do
|
@@ -38,7 +40,7 @@ describe HerokuSan::Stage do
|
|
38
40
|
describe "#stack" do
|
39
41
|
it "returns the name of the stack from Heroku" do
|
40
42
|
subject = HerokuSan::Stage.new('production', {"app" => "awesomeapp"})
|
41
|
-
with_app(subject, 'name' =>
|
43
|
+
with_app(subject, 'name' => subject.app) do |app_data|
|
42
44
|
subject.stack.should == 'bamboo-mri-1.9.2'
|
43
45
|
end
|
44
46
|
end
|
@@ -49,6 +51,26 @@ describe HerokuSan::Stage do
|
|
49
51
|
end
|
50
52
|
end
|
51
53
|
|
54
|
+
describe '#addons' do
|
55
|
+
subject { HerokuSan::Stage.new('production', {'addons' => addons}) }
|
56
|
+
context 'default' do
|
57
|
+
let(:addons) { nil }
|
58
|
+
its(:addons) { should == [] }
|
59
|
+
end
|
60
|
+
context 'nested' do
|
61
|
+
# This is for when you do:
|
62
|
+
# default_addons: &default_addons
|
63
|
+
# - a
|
64
|
+
# - b
|
65
|
+
# env:
|
66
|
+
# addons:
|
67
|
+
# - *default_addons
|
68
|
+
# - other
|
69
|
+
let(:addons) { [ ['a', 'b'], 'other' ] }
|
70
|
+
its(:addons) { should == [ 'a', 'b', 'other' ] }
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
52
74
|
describe "#run" do
|
53
75
|
it "runs commands using the pre-cedar format" do
|
54
76
|
subject.should_receive(:sh).with("heroku run:rake foo bar bleh --app awesomeapp")
|
@@ -223,4 +245,29 @@ describe HerokuSan::Stage do
|
|
223
245
|
subject.revision.should == ''
|
224
246
|
end
|
225
247
|
end
|
226
|
-
|
248
|
+
|
249
|
+
describe "#installed_addons" do
|
250
|
+
it "returns the list of installed addons" do
|
251
|
+
with_app(subject, 'name' => subject.app) do |app_data|
|
252
|
+
subject.installed_addons.map{|a|a['name']}.should =~ %w[logging:basic shared-database:5mb]
|
253
|
+
end
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
describe '#install_addons' do
|
258
|
+
subject { HerokuSan::Stage.new('production', {"app" => "awesomeapp", "stack" => "bamboo-ree-1.8.7", "addons" => ["custom_domains:basic", "ssl:piggyback"]})}
|
259
|
+
|
260
|
+
it "installs the addons" do
|
261
|
+
with_app(subject, 'name' => subject.app) do |app_data|
|
262
|
+
subject.install_addons.map{|a| a['name']}.should =~ %w[logging:basic shared-database:5mb custom_domains:basic ssl:piggyback]
|
263
|
+
subject.installed_addons.map{|a|a['name']}.should =~ subject.install_addons.map{|a| a['name']}
|
264
|
+
end
|
265
|
+
end
|
266
|
+
it "only installs missing addons" do
|
267
|
+
subject = HerokuSan::Stage.new('production', {"app" => "awesomeapp", "stack" => "bamboo-ree-1.8.7", "addons" => ["logging:basic","custom_domains:basic", "ssl:piggyback"]})
|
268
|
+
with_app(subject, 'name' => subject.app) do |app_data|
|
269
|
+
subject.install_addons.map{|a| a['name']}.should =~ %w[logging:basic shared-database:5mb custom_domains:basic ssl:piggyback]
|
270
|
+
end
|
271
|
+
end
|
272
|
+
end
|
273
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku_san
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.2.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-04-
|
15
|
+
date: 2012-04-24 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: rails
|