heroku_hatchet 4.0.8 → 4.0.9

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
- SHA1:
3
- metadata.gz: 2757fc3e39814bfab066c368f2dd365e5252f4b9
4
- data.tar.gz: 86bb1d5c5ed24462ccd99556420f327c8baceeac
2
+ SHA256:
3
+ metadata.gz: aa8c793ec7b05a43ab97534009134ad65766e064affb0627879cfb87b0888171
4
+ data.tar.gz: f9daf304c274174ed187428db840a3db58d59576463f05f29739a8b134316d4b
5
5
  SHA512:
6
- metadata.gz: bd74e5705b78273eb133189a1c807133a0840c1161ce478deb4a699a5641a69c81bd072f62b3531245780a421d0d127cd5f3643fe6e41aab38e7f8ea93e8ac38
7
- data.tar.gz: de5f809bcd7b0f4ac6f121ebbb852057eb73b89e6370398e43635a5de6edee2cbffb05ece7b76d50751479152a7b1850fa54c765e787c004fb43067e1a57c670
6
+ metadata.gz: 85f82bb542f17d5af0630cb598edbeebf2f421de5d05f2226ddcfa90bfea94e274f9511e84cc4bcc6e8622bddd536b3dd981ab1fc4792882b5c085a88a0033ac
7
+ data.tar.gz: bd85ea35febfcc92381bf1c6570a82f58ba89d86b256c3092198ddf462e76c839e99f6aee81b19ea6ac4a99d826b8eb08f66eab9c02ae4847be31195d507fd31
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## HEAD
2
2
 
3
+ ## 4.0.9
4
+
5
+ - Allow overriding of all App#run options, including option removal (by passing `Hatchet::App::SkipDefaultOption` as the value)
6
+
3
7
  ## 4.0.8
4
8
 
5
9
  - Fix `hatchet destroy` calling class from wrong module
data/lib/hatchet/app.rb CHANGED
@@ -21,6 +21,8 @@ module Hatchet
21
21
  end
22
22
  end
23
23
 
24
+ SkipDefaultOption = Object.new
25
+
24
26
  def initialize(repo_name,
25
27
  stack: "",
26
28
  name: default_name,
@@ -108,12 +110,14 @@ module Hatchet
108
110
  # but programatically and with more control
109
111
  def run(cmd_type, command = nil, options = {}, &block)
110
112
  command = cmd_type.to_s if command.nil?
111
- heroku_options = (options.delete(:heroku) || {}).map do |k,v|
113
+ default_options = { "app" => name, "exit-code" => nil }
114
+ heroku_options = (default_options.merge(options.delete(:heroku) || {})).map do |k,v|
115
+ next if v == Hatchet::App::SkipDefaultOption # for forcefully removing e.g. --exit-code, a user can pass this
112
116
  arg = "--#{k.to_s.shellescape}"
113
- arg << "=#{v.to_s.shellescape}" unless v.nil?
117
+ arg << "=#{v.to_s.shellescape}" unless v.nil? # nil means we include the option without an argument
114
118
  arg
115
119
  end.join(" ")
116
- heroku_command = "heroku run -a #{name} #{heroku_options} --exit-code -- #{command}"
120
+ heroku_command = "heroku run #{heroku_options} -- #{command}"
117
121
  bundle_exec do
118
122
  if block_given?
119
123
  ReplRunner.new(cmd_type, heroku_command, options).run(&block)
@@ -1,3 +1,3 @@
1
1
  module Hatchet
2
- VERSION = "4.0.8"
2
+ VERSION = "4.0.9"
3
3
  end
@@ -68,6 +68,16 @@ class AppTest < Minitest::Test
68
68
  app.deploy do
69
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
70
  assert (0 != $?.exitstatus) # $? is from the app.run use of backticks
71
+ sleep(3)
72
+ app.run("ls erpderp", nil, { :heroku => { "exit-code" => Hatchet::App::SkipDefaultOption } } )
73
+ assert (0 == $?.exitstatus) # $? is from the app.run use of backticks, but we asked the CLI not to return the program exit status by skipping the default "exit-code" option
74
+ sleep(3)
75
+ app.run("ls erpderp", nil, { :heroku => { "no-tty" => nil } } )
76
+ assert (0 != $?.exitstatus) # $? is from the app.run use of backticks
77
+ sleep(3)
78
+ assert_match /ohai world/, app.run('echo \$HELLO \$NAME', nil, { :heroku => { "env" => "HELLO=ohai;NAME=world" } } )
79
+ sleep(3)
80
+ refute_match /ohai world/, app.run('echo \$HELLO \$NAME', nil, { :heroku => { "env" => "" } } )
71
81
  end
72
82
  end
73
83
  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.8
4
+ version: 4.0.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Richard Schneeman
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-04-03 00:00:00.000000000 Z
11
+ date: 2019-05-22 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.6.14
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.