heroku_hatchet 4.0.6 → 4.0.7

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d083ce00b13be495fe3c6e2d19d66a75d4e390aa960d668edc2355f333653bdf
4
- data.tar.gz: 2c3033b15be7d3a375ff4f8565f19f7b74da9269bd3f0d79a9b94d58db305810
3
+ metadata.gz: 2d62240ccab36896f21d254213e96976f8efbcb9294dd79c9a614f6167926a0d
4
+ data.tar.gz: 9b56fff4dc3217e079fb7e47ce43cd96c56632f72501a12cfbd476bda6be3acf
5
5
  SHA512:
6
- metadata.gz: 8740ec9d580dbe263b393dea890c243dce35b062f08ade6a20d232ebc3b212cdd53f44f7d83d1c0102d693564fcbd840a4b5bc736fcb61628354a1a0ad7b6d4d
7
- data.tar.gz: 11a08221b229977aebdb8be2f403ee4b93b45ab48c66ba0a6a8db5b06ed90379cdfdfa139724a948dfba75101f53357a094ff0d453e8105a7b7a56dd5090f225
6
+ metadata.gz: e31bbcca0a7e163acfe5c8ae66a0f7e9aa4296095bbf5e43e9fb53df852b6fc628bb428519c5939b566ed3fa047d9e8a670cba786cc3d97fd8191592f2432de2
7
+ data.tar.gz: bd9f296e0f5b2f28728f09b7d4aca5795f22659ab738e49d6cc88a438b49fcd3bb7a3524da8389f81d73377322ef012551542fcdef45cfa34d42d029dc6a75e5
data/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  ## HEAD
2
2
 
3
+ ## 4.0.7
4
+
5
+ - Exit code is now returned from `app.run` commands (https://github.com/heroku/hatchet/pull/58)
6
+ - ci_setup.rb no longer emits an error when run on `sh` (https://github.com/heroku/hatchet/pull/57)
7
+
3
8
  ## 4.0.6
4
9
 
5
10
  - Setup script `hatchet ci:setup` added (https://github.com/heroku/hatchet/pull/55)
data/README.md CHANGED
@@ -41,17 +41,11 @@ $ travis encrypt HEROKU_API_USER=<example@example.com> --add
41
41
 
42
42
  If you're running locally, your system credentials will be pulled from `heroku auth:token`
43
43
 
44
- You'll also need to trigger a "setup" step for CI tasks. There is a setup task you can use first you need to require it, likely in your Rakefile:
45
-
46
- ```ruby
47
- require 'hatchet/tasks'
48
- ```
49
-
50
- Then execute the script `hatchet:setup_ci`. You can do it on Travis CI like this:
44
+ You'll also need to trigger a "setup" step for CI tasks. You can do it on Travis CI like this:
51
45
 
52
46
  ```
53
47
  # .travis.yml
54
- before_script: bundle exec rake hatchet:setup_ci
48
+ before_script: bundle exec hatchet ci:setup
55
49
  ```
56
50
 
57
51
  and on Heroku CI like this:
@@ -61,7 +55,7 @@ and on Heroku CI like this:
61
55
  "environments": {
62
56
  "test": {
63
57
  "scripts": {
64
- "test-setup": "bundle exec rake hatchet:setup_ci",
58
+ "test-setup": "bundle exec hatchet ci:setup",
65
59
  }
66
60
  }
67
61
  }
@@ -321,42 +315,21 @@ To run on travis you will need to configure your `.travis.yml` to run the approp
321
315
 
322
316
  For reference see the `.travis.yml` from [hatchet](https://github.com/heroku/hatchet/blob/master/.travis.yml) and the [heroku-ruby-buildpack](https://github.com/heroku/heroku-buildpack-ruby/blob/master/.travis.yml). To make running on travis easier there is a rake task in Hatchet that can be run before your tests are executed
323
317
 
324
- ```
325
- before_script: bundle exec rake hatchet:setup_ci
318
+ ```yml
319
+ before_script: bundle exec hatchet ci:setup
326
320
  ```
327
321
 
328
322
  I recommend signing up for a new heroku account for running your tests on travis, otherwise you will quickly excede your API limit. Once you have the new api token you can use this technique to [securely send travis the data](http://docs.travis-ci.com/user/environment-variables/#Secure-Variables).
329
323
 
330
-
331
- ```
324
+ ```sh
332
325
  $ travis encrypt HEROKU_API_KEY=<token> --add
333
326
  ```
334
327
 
335
- You'll also need to download the Heroku CLI. Add the executable `etc/ci_setup.sh` to your project, with contents:
336
-
337
- ```
338
- #!/usr/bin/env bash
339
-
340
- sudo apt-get -qq update
341
- sudo apt-get install software-properties-common
342
- curl --fail --retry 3 --retry-delay 1 --connect-timeout 3 --max-time 30 https://cli-assets.heroku.com/install-ubuntu.sh | sh
343
- ```
344
-
345
- Be sure to change the file permissions with `chmod u+x etc/ci_setup.sh` so that the file is executable.
346
-
347
- To run this and download the Heroku cli, you will need to add this step before your install or script depending on your Travis setup process.
348
-
349
- ```
350
- before_script:
351
- - bash etc/ci_setup.sh
352
- ```
353
-
354
328
  If your Travis tests are containerized, you may need sudo to complete this successfully. In that case, you'll need to add the following:
355
329
 
356
- ```
330
+ ```yml
331
+ before_script: bundle exec hatchet ci:setup
357
332
  sudo: required
358
- before_install:
359
- - sudo bash etc/ci_setup.sh
360
333
  ```
361
334
 
362
335
  ## Extra App Commands
data/etc/ci_setup.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'bundler'
3
+ require 'shellwords'
3
4
  puts "== Setting Up CI =="
4
5
 
5
6
  netrc_file = "#{ENV['HOME']}/.netrc"
@@ -16,8 +17,8 @@ end
16
17
  [
17
18
  "bundle exec hatchet ci:install_heroku",
18
19
  "bundle exec hatchet install",
19
- "if [ `git config --get user.email` ]; then echo 'already set'; else `git config --global user.email '#{ENV.fetch('HEROKU_API_USER')}'`; fi",
20
- "if [ `git config --get user.name` ]; then echo 'already set'; else `git config --global user.name 'BuildpackTester'` ; fi",
20
+ "git config --get user.email > /dev/null || git config --global user.email #{ENV.fetch('HEROKU_API_USER').shellescape}",
21
+ "git config --get user.name > /dev/null || git config --global user.name 'BuildpackTester'",
21
22
  ].each do |command|
22
23
  puts "== Running: #{command}"
23
24
  Bundler.with_clean_env do
data/lib/hatchet/app.rb CHANGED
@@ -108,8 +108,12 @@ module Hatchet
108
108
  # but programatically and with more control
109
109
  def run(cmd_type, command = nil, options = {}, &block)
110
110
  command = cmd_type.to_s if command.nil?
111
- heroku_options = (options.delete(:heroku) || {}).map {|k,v| "--#{k.to_s.shellescape}=#{v.to_s.shellescape}"}.join(" ")
112
- heroku_command = "heroku run #{command.to_s.shellescape} -a #{name} #{ heroku_options }"
111
+ heroku_options = (options.delete(:heroku) || {}).map do |k,v|
112
+ arg = "--#{k.to_s.shellescape}"
113
+ arg << "=#{v.to_s.shellescape}" unless v.nil?
114
+ arg
115
+ end.join(" ")
116
+ heroku_command = "heroku run -a #{name} #{heroku_options} --exit-code -- #{command}"
113
117
  bundle_exec do
114
118
  if block_given?
115
119
  ReplRunner.new(cmd_type, heroku_command, options).run(&block)
@@ -1,3 +1,3 @@
1
1
  module Hatchet
2
- VERSION = "4.0.6"
2
+ VERSION = "4.0.7"
3
3
  end
@@ -62,4 +62,12 @@ class AppTest < Minitest::Test
62
62
  end
63
63
  end
64
64
  end
65
+
66
+ def test_run
67
+ app = Hatchet::GitApp.new("default_ruby")
68
+ app.deploy do
69
+ assert_match /ls: cannot access 'foo bar #baz': No such file or directory\s+Gemfile/, app.run("ls -a Gemfile 'foo bar #baz'")
70
+ assert (0 != $?.exitstatus) # $? is from the app.run use of backticks
71
+ end
72
+ end
65
73
  end
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.0.6
4
+ version: 4.0.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: 2018-10-10 00:00:00.000000000 Z
11
+ date: 2019-03-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: platform-api
@@ -247,8 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
247
247
  - !ruby/object:Gem::Version
248
248
  version: '0'
249
249
  requirements: []
250
- rubyforge_project:
251
- rubygems_version: 2.7.6
250
+ rubygems_version: 3.0.3
252
251
  signing_key:
253
252
  specification_version: 4
254
253
  summary: Hatchet is a an integration testing library for developing Heroku buildpacks.