heroku_hatchet 1.1.6 → 1.1.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5858aba476c6665c554f78f1e59ff86620441b05
4
- data.tar.gz: b720257ac9ec4fef2df697eb48c36f519cdec43d
3
+ metadata.gz: 4be516b833e976ab64fc5c3701d265ed57ee7420
4
+ data.tar.gz: bf652d701b3d9fa2b7c8f8fa8cbbb164706d1531
5
5
  SHA512:
6
- metadata.gz: dc750c15ad6d24155300b83d7015b6b4c906ce5222ac730e9bd4d9ec3fac3cfb2ee2c7108becf53658e823e66491feed7c99fa08eb29146ae658fc41a1ecad01
7
- data.tar.gz: 4b67d67bc28e56613d9495f448a69447cff1fd58569b3ec1be4869eba55abc0f18513ea1bce3ad5db8a21679774bbcd114fb8e663913ae751d2c8c53f6b2bf3f
6
+ metadata.gz: ff12c2b9fab0095fc6ba59efba4d4872d63b6ce10e2a705cba23f5815a8fe4056149288fd25d3ecdd4fb96f02eaacbfd4790af605e4508aca68e9d166109334e
7
+ data.tar.gz: 794eacb79ff25a3066a3dde082f66e451402d91f7a80996cdaf5ba1ab99ff9062907f5aab4e97c22eca42f8ee156af3595999c77c59f57b2b002b0e4de205ce2
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## HEAD
2
2
 
3
+ ## 1.1.7
4
+
5
+ - Add labs methods `App#set_labs!` and `App.new(labs: "websockets")`
6
+
3
7
  ## 1.1.6
4
8
  - `App#setup!` is now idempotent
5
9
  - Added `App#get_config`
data/lib/hatchet/app.rb CHANGED
@@ -4,18 +4,20 @@ module Hatchet
4
4
 
5
5
  class FailedDeploy < StandardError
6
6
  def initialize(app, output)
7
- msg = "could not deploy #{app.name} using #{app.class} if this was expected " <<
8
- "add `allow_failure: true` to your deploy hash\n\n" <<
9
- "output : #{output.inspect}"
7
+ msg = "Could not deploy '#{app.name}' using '#{app.class}' at path: '#{app.directory}'\n" <<
8
+ " if this was expected add `allow_failure: true` to your deploy hash.\n" <<
9
+ "output:\n" <<
10
+ "#{output}"
10
11
  super(msg)
11
12
  end
12
13
  end
13
14
 
14
15
  def initialize(repo_name, options = {})
15
16
  @directory = config.path_for_name(repo_name)
16
- @name = options[:name] || "test-app-#{Time.now.to_f}".gsub('.', '-')
17
- @debug = options[:debug] || options[:debugging]
17
+ @name = options[:name] || "test-app-#{Time.now.to_f}".gsub('.', '-')
18
+ @debug = options[:debug] || options[:debugging]
18
19
  @allow_failure = options[:allow_failure] || false
20
+ @labs = ([] << options[:labs]).flatten.compact
19
21
  end
20
22
 
21
23
  # config is read only, should be threadsafe
@@ -37,6 +39,22 @@ module Hatchet
37
39
  heroku.get_config_vars(name).body
38
40
  end
39
41
 
42
+ def lab_is_installed?(lab)
43
+ get_labs.any? {|hash| hash["name"] == lab }
44
+ end
45
+
46
+ def get_labs
47
+ heroku.get_features(name).body
48
+ end
49
+
50
+ def set_labs!
51
+ @labs.each {|lab| set_lab(lab) }
52
+ end
53
+
54
+ def set_lab(lab)
55
+ heroku.post_feature(lab, name)
56
+ end
57
+
40
58
  def add_database(db_name = 'heroku-postgresql:dev', match_val = "HEROKU_POSTGRESQL_[A-Z]+_URL")
41
59
  Hatchet::RETRIES.times.retry do
42
60
  heroku.post_addon(name, db_name)
@@ -79,6 +97,7 @@ module Hatchet
79
97
  def setup!
80
98
  return self if @app_is_setup
81
99
  heroku.post_app(name: name)
100
+ set_labs!
82
101
  @app_is_setup = true
83
102
  self
84
103
  end
@@ -22,7 +22,7 @@ module Hatchet
22
22
  def push!
23
23
  output = `git push #{git_repo} master 2>&1`
24
24
  if !$?.success?
25
- raise FailedDeploy.new(self, "Buildpack: #{@buildpack.inspect}\n#{output}") unless @allow_failure
25
+ raise FailedDeploy.new(self, "Buildpack: #{@buildpack.inspect}\nRepo: #{git_repo}\n#{output}") unless @allow_failure
26
26
  end
27
27
  return output
28
28
  end
data/lib/hatchet/tasks.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  config_ssh = <<-RUBY
2
+
2
3
  Host heroku.com
3
4
  StrictHostKeyChecking no
4
5
  CheckHostIP no
@@ -10,14 +11,16 @@ RUBY
10
11
  namespace :hatchet do
11
12
  task :setup_travis do
12
13
  puts "== Setting Up Travis =="
13
- ['bundle exec hatchet install',
14
+ [
15
+ "bundle exec hatchet install",
14
16
  "echo '#{config_ssh}' >> ~/.ssh/config",
15
- 'wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh',
16
- 'yes | heroku keys:add'
17
+ "curl --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max-time 30 https://toolbelt.heroku.com/install-ubuntu.sh | sh",
18
+ "yes | heroku keys:add"
17
19
  ].each do |command|
18
20
  puts "== Running: #{command}"
19
21
  Bundler.with_clean_env do
20
22
  `#{command}`
23
+ raise "Command failed: #{command.inspect}" unless $?.success?
21
24
  end
22
25
  end
23
26
  puts "== Done =="
@@ -1,3 +1,3 @@
1
1
  module Hatchet
2
- VERSION = "1.1.6"
2
+ VERSION = "1.1.7"
3
3
  end
data/lib/hatchet.rb CHANGED
@@ -17,7 +17,9 @@ module Hatchet
17
17
  end
18
18
 
19
19
  def self.git_branch
20
- `git describe --contains --all HEAD`.strip
20
+ out = `git describe --contains --all HEAD`.strip
21
+ raise "Cannot describe git: #{out}" unless $?.success?
22
+ out
21
23
  end
22
24
 
23
25
  def self.set_deploy_strategy!
@@ -2,7 +2,7 @@ require 'test_helper'
2
2
 
3
3
  class GitAppTest < Test::Unit::TestCase
4
4
  def test_can_deploy_git_app
5
- Hatchet::GitApp.new("rails3_mri_193").deploy do |app|
5
+ Hatchet::GitApp.new("rails3_mri_193", buildpack: "https://github.com/heroku/heroku-buildpack-ruby.git").deploy do |app|
6
6
  assert true
7
7
  assert_match '1.9.3', app.run("ruby -v")
8
8
 
@@ -10,6 +10,6 @@ class HerokuApiTest < Test::Unit::TestCase
10
10
  expected = {"foo" => "bar"}
11
11
  assert_equal expected, runner.get_config
12
12
  ensure
13
- runner.teardown!
13
+ runner.teardown! if runner
14
14
  end
15
- end
15
+ end
@@ -0,0 +1,17 @@
1
+ require 'test_helper'
2
+
3
+ class LabsTest < Test::Unit::TestCase
4
+ def setup
5
+ @buildpack_path = File.expand_path 'test/fixtures/buildpacks/heroku-buildpack-ruby'
6
+ end
7
+
8
+ def test_can_deploy_git_app
9
+ lab_name = "websockets"
10
+ app = Hatchet::App.new("rails3_mri_193", labs: lab_name, buildpack: @buildpack_path)
11
+ app.setup!
12
+ assert(app.lab_is_installed?(lab_name), "Expected #{app.get_labs.inspect} to include {'name' => '#{lab_name}' } but it did not")
13
+ ensure
14
+ app.teardown! if app
15
+ end
16
+ end
17
+
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heroku_hatchet
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.6
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-10-24 00:00:00.000000000 Z
11
+ date: 2014-01-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: heroku-api
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
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
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rrrretry
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: anvil-cli
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: excon
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: thor
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: repl_runner
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: rake
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - '>='
115
+ - - ">="
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - '>='
122
+ - - ">="
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: mocha
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - '>='
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - '>='
136
+ - - ">="
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: parallel_tests
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - '>='
143
+ - - ">="
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  description: Hatchet is a an integration testing library for developing Heroku buildpacks.
@@ -158,8 +158,8 @@ executables:
158
158
  extensions: []
159
159
  extra_rdoc_files: []
160
160
  files:
161
- - .gitignore
162
- - .travis.yml
161
+ - ".gitignore"
162
+ - ".travis.yml"
163
163
  - CHANGELOG.md
164
164
  - Gemfile
165
165
  - LICENSE.txt
@@ -217,6 +217,7 @@ files:
217
217
  - test/hatchet/config_test.rb
218
218
  - test/hatchet/git_test.rb
219
219
  - test/hatchet/heroku_api_test.rb
220
+ - test/hatchet/labs_test.rb
220
221
  - test/hatchet/multi_cmd_runner_test.rb
221
222
  - test/hatchet/runner_test.rb
222
223
  - test/test_helper.rb
@@ -230,17 +231,17 @@ require_paths:
230
231
  - lib
231
232
  required_ruby_version: !ruby/object:Gem::Requirement
232
233
  requirements:
233
- - - '>='
234
+ - - ">="
234
235
  - !ruby/object:Gem::Version
235
236
  version: '0'
236
237
  required_rubygems_version: !ruby/object:Gem::Requirement
237
238
  requirements:
238
- - - '>='
239
+ - - ">="
239
240
  - !ruby/object:Gem::Version
240
241
  version: '0'
241
242
  requirements: []
242
243
  rubyforge_project:
243
- rubygems_version: 2.0.3
244
+ rubygems_version: 2.2.0
244
245
  signing_key:
245
246
  specification_version: 4
246
247
  summary: Hatchet is a an integration testing library for developing Heroku buildpacks.
@@ -287,6 +288,8 @@ test_files:
287
288
  - test/hatchet/config_test.rb
288
289
  - test/hatchet/git_test.rb
289
290
  - test/hatchet/heroku_api_test.rb
291
+ - test/hatchet/labs_test.rb
290
292
  - test/hatchet/multi_cmd_runner_test.rb
291
293
  - test/hatchet/runner_test.rb
292
294
  - test/test_helper.rb
295
+ has_rdoc: