hrk 1.0.4 → 1.0.5

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: c0e96c9119e9ab6760b61ed413b194342492abe0
4
- data.tar.gz: d724167d86311058927c2f23071ecabbd660f773
3
+ metadata.gz: 6e82a2e0eb30d8875652da26fcdf54b0bf7f519f
4
+ data.tar.gz: 5e766f6247dd1ee4fe920cf2b813b7d521464cf1
5
5
  SHA512:
6
- metadata.gz: 8e31139f91797f411a26d4e1c845841d2610bccd1cb89cba0313ea4c2ce44b75072fb4de90f86bdeb5de9721d877a220573dcfa8579ba4fe32ed95d00a142a42
7
- data.tar.gz: e275e2ec264e95371275d171cea050ba64c5f0ef1357437f6d835f621e84a950052396b48b78249cfa4ffc26bc4ba067583255716aaf650627edf010e7955c7b
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
- system 'heroku', *(command + @remote)
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
@@ -1,3 +1,3 @@
1
1
  module Hrk
2
- VERSION = '1.0.4'
2
+ VERSION = '1.0.5'
3
3
  end
@@ -2,22 +2,22 @@ require 'spec_helper'
2
2
 
3
3
  RSpec.describe Hrk::Heroku do
4
4
  describe '#call' do
5
- describe 'the system command ran' do
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}', system" do
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(:system).with(*starts)
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(:system) }
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(:system).with(*%W(heroku some command -r some-remote)).and_return(system_returns) }
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(:system_returns) { true }
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(:system_returns) { false }
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
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-01-17 00:00:00.000000000 Z
11
+ date: 2015-02-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec