hrk 1.0.4 → 1.0.5
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 +4 -4
- data/lib/hrk/heroku.rb +7 -1
- data/lib/hrk/version.rb +1 -1
- data/spec/hrk/heroku_spec.rb +7 -7
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e82a2e0eb30d8875652da26fcdf54b0bf7f519f
|
4
|
+
data.tar.gz: 5e766f6247dd1ee4fe920cf2b813b7d521464cf1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ce21b01eb4c0376a1b00e7050b052ed9b755b8928324e339d50ce8f60fd6161f9dfbf356b29e154400bb55051e8fddc6d36b2439516258be0eedb58fbdee2be
|
7
|
+
data.tar.gz: cece0b61aac5be4efc4570e2944d3b3abce1c511fbaec4681840c81521c7829d089f6aca4d1d38947182ec86476ac2d874b717fb5ece20bb335b2a0b99cff5ef
|
data/lib/hrk/heroku.rb
CHANGED
@@ -7,7 +7,7 @@ module Hrk
|
|
7
7
|
def call *command
|
8
8
|
validate! command
|
9
9
|
puts "Executing `#{(['heroku'] + command + @remote).join ' '}`..."
|
10
|
-
|
10
|
+
exec 'heroku', *(command + @remote)
|
11
11
|
end
|
12
12
|
|
13
13
|
private
|
@@ -17,6 +17,12 @@ module Hrk
|
|
17
17
|
raise ExplicitApplicationError.new, "You're calling a command on remote #{@remote.join " "} yet the command explicitly references #{remote}" if remote
|
18
18
|
end
|
19
19
|
|
20
|
+
def exec *command
|
21
|
+
Signal.trap("INT") {}
|
22
|
+
Process.wait fork { Kernel.exec *command }
|
23
|
+
$?.success?.tap { Signal.trap("INT", "DEFAULT") }
|
24
|
+
end
|
25
|
+
|
20
26
|
class ExplicitApplicationError < Exception
|
21
27
|
end
|
22
28
|
end
|
data/lib/hrk/version.rb
CHANGED
data/spec/hrk/heroku_spec.rb
CHANGED
@@ -2,22 +2,22 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
RSpec.describe Hrk::Heroku do
|
4
4
|
describe '#call' do
|
5
|
-
describe 'the
|
5
|
+
describe 'the exec command ran' do
|
6
6
|
def self.calling command, on_remote: %W(-r whatever-app), starts: [], and_outputs: ''
|
7
|
-
describe "calling '#{command.join ' '}' on remote '#{on_remote}',
|
7
|
+
describe "calling '#{command.join ' '}' on remote '#{on_remote}', exec" do
|
8
8
|
subject(:heroku) { Hrk::Heroku.new(*on_remote) }
|
9
9
|
|
10
10
|
before { allow(heroku).to receive(:puts) }
|
11
11
|
|
12
12
|
specify do
|
13
13
|
heroku.call(*command)
|
14
|
-
expect(heroku).to have_received(:
|
14
|
+
expect(heroku).to have_received(:exec).with(*starts)
|
15
15
|
expect(heroku).to have_received(:puts).with(and_outputs)
|
16
16
|
end
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
-
before { allow(heroku).to receive(:
|
20
|
+
before { allow(heroku).to receive(:exec) }
|
21
21
|
|
22
22
|
%w(-a -r).each do |opt|
|
23
23
|
describe "(standard case, using #{opt})" do
|
@@ -62,17 +62,17 @@ RSpec.describe Hrk::Heroku do
|
|
62
62
|
|
63
63
|
describe 'the result of the command' do
|
64
64
|
subject(:heroku) { Hrk::Heroku.new(*%w(-r some-remote)) }
|
65
|
-
before { allow(heroku).to receive(:
|
65
|
+
before { allow(heroku).to receive(:exec).with(*%W(heroku some command -r some-remote)).and_return(exec_returns) }
|
66
66
|
before { allow(heroku).to receive(:puts) }
|
67
67
|
|
68
68
|
context 'the command result is truthy' do
|
69
|
-
let(:
|
69
|
+
let(:exec_returns) { true }
|
70
70
|
|
71
71
|
it { expect(heroku.call(*%w(some command))).to be_truthy }
|
72
72
|
end
|
73
73
|
|
74
74
|
context 'the command result is falsy' do
|
75
|
-
let(:
|
75
|
+
let(:exec_returns) { false }
|
76
76
|
|
77
77
|
it { expect(heroku.call(*%w(some command))).to be_falsy }
|
78
78
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hrk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Michel Belleville
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rspec
|