heroku_hatchet 2.0.3 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -1
- data/CHANGELOG.md +4 -0
- data/Gemfile +2 -0
- data/hatchet.gemspec +2 -4
- data/lib/hatchet/app.rb +24 -11
- data/lib/hatchet/git_app.rb +0 -6
- data/lib/hatchet/reaper.rb +19 -15
- data/lib/hatchet/tasks.rb +4 -4
- data/lib/hatchet/version.rb +1 -1
- data/lib/hatchet.rb +0 -2
- data/test/hatchet/allow_failure_git_test.rb +1 -2
- data/test/hatchet/app_test.rb +4 -3
- data/test/hatchet/ci_test.rb +1 -1
- data/test/hatchet/config_test.rb +1 -1
- data/test/hatchet/edit_repo_test.rb +1 -1
- data/test/hatchet/git_test.rb +4 -4
- data/test/hatchet/heroku_api_test.rb +1 -1
- data/test/hatchet/labs_test.rb +1 -1
- data/test/hatchet/multi_cmd_runner_test.rb +2 -3
- data/test/test_helper.rb +12 -2
- metadata +6 -24
- data/test/hatchet/allow_failure_anvil_test.rb +0 -4
- data/test/hatchet/reaper_test.rb +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7fac9a7bda1bf9b9ee01876740f59342084d594
|
4
|
+
data.tar.gz: 26c04c978734810553e0d6fb67ecd5b0ab2dc47b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d4ade0ea4eb6be0cac69f1b434652ce9f08fd578309cb4c5fa68e969b75483b1cf7dbe8250ea5db4134aeee0e999cafeee06861786ea975649393687ccc2b8dc
|
7
|
+
data.tar.gz: d6b04a0aaf3fc458f32ed5d872ebff3ec4a385da6e95be8e5145740fd858111eaf30e791c12575a0b6512e97f985f5d08f71f8dad2dfd6c0fb22796c0cfbfd6b
|
data/.travis.yml
CHANGED
@@ -9,8 +9,10 @@ env:
|
|
9
9
|
- HATCHET_BUILDPACK_BRANCH=master
|
10
10
|
- HATCHET_RETRIES=3
|
11
11
|
- HATCHET_APP_LIMIT=80
|
12
|
-
- secure:
|
12
|
+
- secure: KvuEChRTZYrWd1Q4PKt3YM5FkfuCAOtsKgjC4HDGjCYVNee3793XGwAr0e5LiQqrvHDmbJS7ZPelV3ptor2QJTdmZjPhu/tZKPMLQg7wm8vTcrJflkJDqJl6ECxd40zbUgmo+wSPSvx+K3ZGKqLF4D43vvFJaqBUoAVOGdt66c8=
|
13
|
+
- secure: XuJ4XUraWzNlfY9a+6Mh9lVlLuRY988YAaA8LKQOe2KAT5MRqcZzqlKOwDeTWK0tas68bzK7T8RT/L+6/nck0u5VrPHMhkc8QDBSqcle8kFcBxf/64EnCzB40lZoxvcdQ3wm8E41DRwsI7hAHLdVVNXC8f1/wQOAm77nOEvPdvM=
|
13
14
|
sudo: false
|
15
|
+
dist: trusty
|
14
16
|
addons:
|
15
17
|
apt:
|
16
18
|
sources:
|
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
data/hatchet.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |gem|
|
|
18
18
|
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
|
-
gem.add_dependency "platform-api", "~>
|
21
|
+
gem.add_dependency "platform-api", "~> 2"
|
22
22
|
gem.add_dependency "heroku-api", "~> 0"
|
23
23
|
gem.add_dependency "activesupport", "~> 4"
|
24
24
|
gem.add_dependency "rrrretry", "~> 1"
|
@@ -29,11 +29,9 @@ Gem::Specification.new do |gem|
|
|
29
29
|
gem.add_dependency "threaded", "~> 0"
|
30
30
|
|
31
31
|
|
32
|
-
gem.add_development_dependency "
|
33
|
-
gem.add_development_dependency "minitest", "~> 4.0"
|
32
|
+
gem.add_development_dependency "minitest", "~> 4.2"
|
34
33
|
gem.add_development_dependency "rake", "~> 10"
|
35
34
|
gem.add_development_dependency "mocha", "~> 1"
|
36
35
|
gem.add_development_dependency "parallel_tests", "~> 0"
|
37
36
|
gem.add_development_dependency "travis", "~> 1"
|
38
37
|
end
|
39
|
-
|
data/lib/hatchet/app.rb
CHANGED
@@ -28,7 +28,7 @@ module Hatchet
|
|
28
28
|
@allow_failure = options[:allow_failure] || false
|
29
29
|
@labs = ([] << options[:labs]).flatten.compact
|
30
30
|
@buildpack = options[:buildpack] || options[:buildpack_url] || [HATCHET_BUILDPACK_BASE, HATCHET_BUILDPACK_BRANCH.call].join("#")
|
31
|
-
@reaper = Reaper.new(
|
31
|
+
@reaper = Reaper.new(platform_api: platform_api)
|
32
32
|
end
|
33
33
|
|
34
34
|
def allow_failure?
|
@@ -46,12 +46,14 @@ module Hatchet
|
|
46
46
|
|
47
47
|
def set_config(options = {})
|
48
48
|
options.each do |key, value|
|
49
|
-
heroku.put_config_vars(name, key => value)
|
49
|
+
# heroku.put_config_vars(name, key => value)
|
50
|
+
platform_api.config_var.update(name, key => value)
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
53
54
|
def get_config
|
54
|
-
heroku.get_config_vars(name).body
|
55
|
+
# heroku.get_config_vars(name).body
|
56
|
+
platform_api.config_var.info_for_app(name)
|
55
57
|
end
|
56
58
|
|
57
59
|
def lab_is_installed?(lab)
|
@@ -59,7 +61,8 @@ module Hatchet
|
|
59
61
|
end
|
60
62
|
|
61
63
|
def get_labs
|
62
|
-
heroku.get_features(name).body
|
64
|
+
# heroku.get_features(name).body
|
65
|
+
platform_api.app_feature.list(name)
|
63
66
|
end
|
64
67
|
|
65
68
|
def set_labs!
|
@@ -67,12 +70,14 @@ module Hatchet
|
|
67
70
|
end
|
68
71
|
|
69
72
|
def set_lab(lab)
|
70
|
-
heroku.post_feature(lab, name)
|
73
|
+
# heroku.post_feature(lab, name)
|
74
|
+
platform_api.app_feature.update(name, lab, enabled: true)
|
71
75
|
end
|
72
76
|
|
73
|
-
def add_database(
|
77
|
+
def add_database(plan_name = 'heroku-postgresql:dev', match_val = "HEROKU_POSTGRESQL_[A-Z]+_URL")
|
74
78
|
Hatchet::RETRIES.times.retry do
|
75
|
-
heroku.post_addon(name,
|
79
|
+
# heroku.post_addon(name, plan_name)
|
80
|
+
platform_api.addon.create(name, plan: plan_name )
|
76
81
|
_, value = get_config.detect {|k, v| k.match(/#{match_val}/) }
|
77
82
|
set_config('DATABASE_URL' => value)
|
78
83
|
end
|
@@ -107,13 +112,17 @@ module Hatchet
|
|
107
112
|
alias :no_debug? :not_debugging?
|
108
113
|
|
109
114
|
def deployed?
|
110
|
-
!heroku.get_ps(name).body.detect {|ps| ps["process"].include?("web") }.nil?
|
115
|
+
# !heroku.get_ps(name).body.detect {|ps| ps["process"].include?("web") }.nil?
|
116
|
+
platform_api.formation.list(name).detect {|ps| ps["type"] == "web"}
|
111
117
|
end
|
112
118
|
|
113
119
|
def create_app
|
114
120
|
3.times.retry do
|
115
121
|
begin
|
116
|
-
heroku.post_app({ name: name, stack: stack }.delete_if {|k,v| v.nil? })
|
122
|
+
# heroku.post_app({ name: name, stack: stack }.delete_if {|k,v| v.nil? })
|
123
|
+
hash = { name: name, stack: stack }
|
124
|
+
hash.delete_if { |k,v| v.nil? }
|
125
|
+
platform_api.app.create(hash)
|
117
126
|
rescue Heroku::API::Errors::RequestFailed => e
|
118
127
|
@reaper.cycle if e.message.match(/app limit/)
|
119
128
|
raise e
|
@@ -127,6 +136,8 @@ module Hatchet
|
|
127
136
|
puts "Hatchet setup: #{name.inspect} for #{repo_name.inspect}"
|
128
137
|
create_app
|
129
138
|
set_labs!
|
139
|
+
# heroku.put_config_vars(name, 'BUILDPACK_URL' => @buildpack)
|
140
|
+
platform_api.buildpack_installation.update(name, updates: [{buildpack: @buildpack}])
|
130
141
|
@app_is_setup = true
|
131
142
|
self
|
132
143
|
end
|
@@ -162,7 +173,7 @@ module Hatchet
|
|
162
173
|
in_directory do
|
163
174
|
self.setup!
|
164
175
|
self.push_with_retry!
|
165
|
-
block.call(self,
|
176
|
+
block.call(self, platform_api, output) if block_given?
|
166
177
|
end
|
167
178
|
ensure
|
168
179
|
self.teardown!
|
@@ -201,6 +212,7 @@ module Hatchet
|
|
201
212
|
end
|
202
213
|
|
203
214
|
def heroku
|
215
|
+
raise "Not supported, use `platform_api` instead."
|
204
216
|
@heroku ||= Heroku::API.new(api_key: api_key)
|
205
217
|
end
|
206
218
|
|
@@ -253,7 +265,8 @@ module Hatchet
|
|
253
265
|
end
|
254
266
|
|
255
267
|
def platform_api
|
256
|
-
|
268
|
+
# We have to not use a cache due to https://github.com/heroku/platform-api/issues/73
|
269
|
+
@platform_api ||= PlatformAPI.connect_oauth(api_key, cache: Moneta.new(:Null))
|
257
270
|
end
|
258
271
|
|
259
272
|
private
|
data/lib/hatchet/git_app.rb
CHANGED
data/lib/hatchet/reaper.rb
CHANGED
@@ -11,19 +11,20 @@ module Hatchet
|
|
11
11
|
attr_accessor :apps
|
12
12
|
|
13
13
|
|
14
|
-
def initialize(
|
15
|
-
@
|
16
|
-
@regex
|
14
|
+
def initialize(platform_api:, regex: DEFAULT_REGEX)
|
15
|
+
@platform_api = platform_api
|
16
|
+
@regex = regex
|
17
17
|
end
|
18
18
|
|
19
19
|
# Ascending order, oldest is last
|
20
20
|
def get_apps
|
21
|
-
|
22
|
-
@
|
23
|
-
@apps
|
21
|
+
apps = @platform_api.app.list.sort_by { |app| DateTime.parse(app["created_at"]) }.reverse
|
22
|
+
@app_count = apps.count
|
23
|
+
@hatchet_apps = apps.select {|app| app["name"].match(@regex) }
|
24
24
|
end
|
25
25
|
|
26
|
-
def cycle
|
26
|
+
def cycle
|
27
|
+
get_apps
|
27
28
|
if over_limit?
|
28
29
|
if @hatchet_apps.count > 1
|
29
30
|
destroy_oldest
|
@@ -37,28 +38,31 @@ module Hatchet
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def destroy_oldest
|
40
|
-
|
41
|
-
|
42
|
-
rescue Heroku::API::Errors::NotFound
|
41
|
+
oldest = @hatchet_apps.pop
|
42
|
+
destroy_by_id(name: oldest["name"], id: oldest["id"], details: "Hatchet app limit: #{HATCHET_APP_LIMT}")
|
43
|
+
rescue Heroku::API::Errors::NotFound, Excon::Error::NotFound => e
|
44
|
+
puts "Error while destroying an app, maybe it's already deleted?"
|
45
|
+
puts oldest.inspect
|
46
|
+
puts e.inspect
|
43
47
|
# app already deleted, cycle will catch if there's still too many
|
44
48
|
end
|
45
49
|
|
46
50
|
def destroy_all
|
47
51
|
get_apps
|
48
52
|
@hatchet_apps.each do |app|
|
49
|
-
|
53
|
+
destroy_by_id(name: app["name"], id: app["id"])
|
50
54
|
end
|
51
55
|
end
|
52
56
|
|
53
|
-
def
|
54
|
-
puts "Destroying #{name.inspect}. #{details}"
|
55
|
-
@
|
57
|
+
def destroy_by_id(name:, id:, details: "")
|
58
|
+
puts "Destroying #{name.inspect}: #{id}. #{details}"
|
59
|
+
@platform_api.app.delete(id)
|
56
60
|
end
|
57
61
|
|
58
62
|
private
|
59
63
|
|
60
64
|
def over_limit?
|
61
|
-
@
|
65
|
+
@app_count > HEROKU_APP_LIMIT || @hatchet_apps.count > HATCHET_APP_LIMT
|
62
66
|
end
|
63
67
|
end
|
64
68
|
end
|
data/lib/hatchet/tasks.rb
CHANGED
@@ -16,18 +16,18 @@ namespace :hatchet do
|
|
16
16
|
File.open(netrc, 'w') do |file|
|
17
17
|
file.write <<EOF
|
18
18
|
machine git.heroku.com
|
19
|
-
login #{ENV
|
20
|
-
password #{ENV
|
19
|
+
login #{ENV.fetch('HEROKU_API_USER')}
|
20
|
+
password #{ENV.fetch('HEROKU_API_KEY')}
|
21
21
|
EOF
|
22
22
|
end
|
23
23
|
end
|
24
24
|
[
|
25
25
|
"bundle exec hatchet install",
|
26
|
-
"if [ `git config --get user.email` ]; then echo 'already set'; else `git config --global user.email '#{ENV
|
26
|
+
"if [ `git config --get user.email` ]; then echo 'already set'; else `git config --global user.email '#{ENV.fetch('HEROKU_API_USER')}'`; fi",
|
27
27
|
"if [ `git config --get user.name` ]; then echo 'already set'; else `git config --global user.name 'BuildpackTester'` ; fi",
|
28
28
|
"echo '#{config_ssh}' >> ~/.ssh/config",
|
29
29
|
"ssh-keygen -f ~/.ssh/id_rsa -t rsa -N ''",
|
30
|
-
"yes | heroku keys:add"
|
30
|
+
"yes | heroku keys:add -y"
|
31
31
|
].each do |command|
|
32
32
|
puts "== Running: #{command}"
|
33
33
|
Bundler.with_clean_env do
|
data/lib/hatchet/version.rb
CHANGED
data/lib/hatchet.rb
CHANGED
data/test/hatchet/app_test.rb
CHANGED
@@ -1,9 +1,10 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class AppTest < Test
|
3
|
+
class AppTest < Minitest::Test
|
4
4
|
def test_create_app_with_stack
|
5
|
-
|
5
|
+
stack = "heroku-16"
|
6
|
+
app = Hatchet::App.new("default_ruby", stack: stack)
|
6
7
|
app.create_app
|
7
|
-
assert_equal
|
8
|
+
assert_equal stack, app.platform_api.app.info(app.name)["build_stack"]["name"]
|
8
9
|
end
|
9
10
|
end
|
data/test/hatchet/ci_test.rb
CHANGED
data/test/hatchet/config_test.rb
CHANGED
data/test/hatchet/git_test.rb
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class GitAppTest < Test
|
3
|
+
class GitAppTest < Minitest::Test
|
4
4
|
def test_can_deploy_git_app
|
5
|
-
Hatchet::GitApp.new("
|
5
|
+
Hatchet::GitApp.new("rails5_ruby_schema_format").deploy do |app|
|
6
6
|
assert true
|
7
|
-
assert_match '
|
7
|
+
assert_match '2.4.1', app.run("ruby -v")
|
8
8
|
|
9
9
|
app.run("bash") do |cmd|
|
10
10
|
# cmd.run("cd public/assets")
|
11
|
-
cmd.run("ls public/
|
11
|
+
cmd.run("ls public/") {|r| assert_match("assets", r) }
|
12
12
|
end
|
13
13
|
end
|
14
14
|
end
|
data/test/hatchet/labs_test.rb
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
require 'test_helper'
|
2
2
|
|
3
|
-
class MultiCmdRunnerTest < Test
|
3
|
+
class MultiCmdRunnerTest < Minitest::Test
|
4
4
|
# slow but needed, there are ghosts in the machine
|
5
5
|
# by running common command multiple times we can find them
|
6
6
|
def test_multi_repl_commands
|
7
7
|
Hatchet::GitApp.new("default_ruby").deploy do |app|
|
8
|
-
app.add_database
|
9
8
|
|
10
|
-
assert_raise
|
9
|
+
assert_raise(ReplRunner::UnregisteredCommand) do
|
11
10
|
app.run("ls", 2) do |ls| # will return right away, should raise error
|
12
11
|
ls.run("cat")
|
13
12
|
end
|
data/test/test_helper.rb
CHANGED
@@ -1,12 +1,22 @@
|
|
1
1
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
2
2
|
require 'hatchet'
|
3
3
|
|
4
|
+
require 'bundler'
|
4
5
|
Bundler.require
|
5
6
|
|
6
|
-
require 'test/unit'
|
7
|
+
# require 'test/unit'
|
8
|
+
|
9
|
+
require 'minitest/autorun'
|
7
10
|
require "mocha/setup"
|
8
11
|
|
9
|
-
|
12
|
+
# Not needed if you're using the most recent version
|
13
|
+
if defined?(MiniTest::Unit::TestCase)
|
14
|
+
Minitest::Test = MiniTest::Unit::TestCase
|
15
|
+
end
|
16
|
+
|
17
|
+
def assert_raise(*args, &block)
|
18
|
+
assert_raises(*args, &block)
|
10
19
|
end
|
11
20
|
|
12
21
|
|
22
|
+
ENV['HATCHET_BUILDPACK_BRANCH'] = "master"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: heroku_hatchet
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 3.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Richard Schneeman
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: platform-api
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '2'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '2'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: heroku-api
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,34 +136,20 @@ dependencies:
|
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
138
|
version: '0'
|
139
|
-
- !ruby/object:Gem::Dependency
|
140
|
-
name: test-unit
|
141
|
-
requirement: !ruby/object:Gem::Requirement
|
142
|
-
requirements:
|
143
|
-
- - "~>"
|
144
|
-
- !ruby/object:Gem::Version
|
145
|
-
version: '3.0'
|
146
|
-
type: :development
|
147
|
-
prerelease: false
|
148
|
-
version_requirements: !ruby/object:Gem::Requirement
|
149
|
-
requirements:
|
150
|
-
- - "~>"
|
151
|
-
- !ruby/object:Gem::Version
|
152
|
-
version: '3.0'
|
153
139
|
- !ruby/object:Gem::Dependency
|
154
140
|
name: minitest
|
155
141
|
requirement: !ruby/object:Gem::Requirement
|
156
142
|
requirements:
|
157
143
|
- - "~>"
|
158
144
|
- !ruby/object:Gem::Version
|
159
|
-
version: '4.
|
145
|
+
version: '4.2'
|
160
146
|
type: :development
|
161
147
|
prerelease: false
|
162
148
|
version_requirements: !ruby/object:Gem::Requirement
|
163
149
|
requirements:
|
164
150
|
- - "~>"
|
165
151
|
- !ruby/object:Gem::Version
|
166
|
-
version: '4.
|
152
|
+
version: '4.2'
|
167
153
|
- !ruby/object:Gem::Dependency
|
168
154
|
name: rake
|
169
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -252,7 +238,6 @@ files:
|
|
252
238
|
- test/fixtures/buildpacks/null-buildpack/bin/release
|
253
239
|
- test/fixtures/buildpacks/null-buildpack/hatchet.json
|
254
240
|
- test/fixtures/buildpacks/null-buildpack/readme.md
|
255
|
-
- test/hatchet/allow_failure_anvil_test.rb
|
256
241
|
- test/hatchet/allow_failure_git_test.rb
|
257
242
|
- test/hatchet/app_test.rb
|
258
243
|
- test/hatchet/ci_test.rb
|
@@ -262,7 +247,6 @@ files:
|
|
262
247
|
- test/hatchet/heroku_api_test.rb
|
263
248
|
- test/hatchet/labs_test.rb
|
264
249
|
- test/hatchet/multi_cmd_runner_test.rb
|
265
|
-
- test/hatchet/reaper_test.rb
|
266
250
|
- test/test_helper.rb
|
267
251
|
homepage: https://github.com/heroku/hatchet
|
268
252
|
licenses:
|
@@ -294,7 +278,6 @@ test_files:
|
|
294
278
|
- test/fixtures/buildpacks/null-buildpack/bin/release
|
295
279
|
- test/fixtures/buildpacks/null-buildpack/hatchet.json
|
296
280
|
- test/fixtures/buildpacks/null-buildpack/readme.md
|
297
|
-
- test/hatchet/allow_failure_anvil_test.rb
|
298
281
|
- test/hatchet/allow_failure_git_test.rb
|
299
282
|
- test/hatchet/app_test.rb
|
300
283
|
- test/hatchet/ci_test.rb
|
@@ -304,5 +287,4 @@ test_files:
|
|
304
287
|
- test/hatchet/heroku_api_test.rb
|
305
288
|
- test/hatchet/labs_test.rb
|
306
289
|
- test/hatchet/multi_cmd_runner_test.rb
|
307
|
-
- test/hatchet/reaper_test.rb
|
308
290
|
- test/test_helper.rb
|
data/test/hatchet/reaper_test.rb
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
class ReaperTest < Test::Unit::TestCase
|
4
|
-
|
5
|
-
def test_destroy_by_name
|
6
|
-
heroku = mock('heroku')
|
7
|
-
reaper = Hatchet::Reaper.new(heroku)
|
8
|
-
heroku.expects(:delete_app).with("my-app-name")
|
9
|
-
reaper.destroy_by_name("my-app-name")
|
10
|
-
end
|
11
|
-
|
12
|
-
def test_destroy_all
|
13
|
-
heroku = stub(:get_apps =>
|
14
|
-
stub(:body => [{
|
15
|
-
'name' => 'hatchet-t-123',
|
16
|
-
'created_at' => DateTime.new.to_s
|
17
|
-
},{
|
18
|
-
'name' => 'hatchet-t-abc',
|
19
|
-
'created_at' => DateTime.new.to_s
|
20
|
-
},{
|
21
|
-
'name' => 'my-app-name',
|
22
|
-
'created_at' => DateTime.new.to_s
|
23
|
-
}
|
24
|
-
])
|
25
|
-
)
|
26
|
-
reaper = Hatchet::Reaper.new(heroku)
|
27
|
-
heroku.expects(:delete_app).with('hatchet-t-123')
|
28
|
-
heroku.expects(:delete_app).with('hatchet-t-abc')
|
29
|
-
reaper.destroy_all
|
30
|
-
end
|
31
|
-
end
|