dpl 1.8.3.travis.1078.4 → 1.8.3.travis.1087.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ODc3MTBhMzhkNDM5ZWM4MDgwM2E0MzQzOWQxN2EwMTE0NGE4NjdhNg==
4
+ NjY2YTBhMjE0MDg5NTA5YTMzZTE2MDVkZmU2NTAyMTk3NjUzNjQ4Zg==
5
5
  data.tar.gz: !binary |-
6
- MDIwOTViMWNmM2I5YmI5ZGUwODhjZDU3ZWMzZTNhOWU3YWI3YjcxNw==
6
+ NWE1YzU0ZDMwYzUwMDQxMDYyMDA4ZjFmODY5MjRmMDU1OTQ5OTY2OA==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- OTFlOTNlMDFjOTBlY2U4MTdmMDEzODRiOTg5OWMwYmUyNzlmMmI2YjZlYjFh
10
- YzhjMzM4NGMyNWJkZmZlZDA4NWIzY2E2YzI4YzVhMjZkNzJmODVkOTAzMGM2
11
- NDJiNjk1MmExYmMwNTUxZGQ2ZTYxY2MxYmFlZTRkMGVhMjRhNzM=
9
+ NjBkZDY3MzY5OTJkZGI5YWNmNjUyOGVhMjFhMGY1ZmM4ZGNkYWE2NDdiNDc4
10
+ ZjEyYzM3Njg2ZGI1NDNmMmFkOGFhMzQyOTQ0NzgxZWM4ZjQ4Y2JjNDcwNTQ4
11
+ OTM1YWM1MDNjN2Q3OWUwNTE0NThlYmIwZDM4YTQzNzkwNjljYmU=
12
12
  data.tar.gz: !binary |-
13
- NjFkY2M5MTZjNjRiZTI5YWVlZTZhMjBkNTg2OTk0ZjFkYWVhYjU2ZThlNGMz
14
- MjI1Njg5YjZjNmFhY2U2NTYxNjlkMDIwZDhlZDRjOTFhNTBkMWMzMTEzYTVl
15
- YmUwNjY1MzQyMTU1OTM0ZTMzYWFhM2VmZTkxMDI1Njc1ZmRjYjY=
13
+ Y2M3MThjMTcxZTMyZGMxNTE0MGNkMjlkMWE2ZTM1NTAxYmZmMzc3NzBmYjFi
14
+ YWIyNTZkODkwYjI3ODBhNDlhM2RiMTliMzQ1M2E0ZmNmZGIyOWQxM2EzYWNm
15
+ MGIxZjI4NmYzNGMxMGFlZDQwNjY2MDRmMTgxYTA5OTUwYzU1NmU=
@@ -1,3 +1,5 @@
1
+ require 'open3'
2
+
1
3
  module DPL
2
4
  class Provider
3
5
  class Script < Provider
@@ -15,9 +17,17 @@ module DPL
15
17
  end
16
18
 
17
19
  def push_app
18
- context.shell script
19
- if $?.exitstatus != 0
20
- raise Error, "Script #{script} failed with status #{$?.exitstatus}"
20
+ stdin, stdout, stderr, wait_thr = Open3.popen3(script)
21
+ while wait_thr.status do
22
+ sleep 1
23
+ end
24
+
25
+ log stdout.read
26
+ warn stderr.read
27
+
28
+ status = wait_thr.value
29
+ if !status.success?
30
+ raise Error, "Script #{File.join(ENV['PWD'], script)} failed with status #{status.exitstatus}"
21
31
  end
22
32
  end
23
33
 
@@ -8,15 +8,28 @@ describe DPL::Provider::Script do
8
8
 
9
9
  let(:script) { 'scripts/deploy_script' }
10
10
 
11
+ before :each do
12
+ stdin, stdout, stderr, wait_thr = double('stdin'), double('stdout'), double('stderr'), double('wait_thr')
13
+ @status = double
14
+
15
+ allow(stdout).to receive(:read)
16
+ allow(stderr).to receive(:read)
17
+ allow(wait_thr).to receive(:status).and_return(false)
18
+ allow(wait_thr).to receive(:value).and_return(@status)
19
+ allow(@status).to receive(:success?).and_return(true)
20
+
21
+ expect(Open3).to receive(:popen3).and_return([stdin, stdout, stderr, wait_thr])
22
+ end
23
+
11
24
  it 'runs command "script" given' do
12
- expect(provider.context).to receive(:shell).with(script)
13
25
  provider.push_app
14
26
  end
15
27
 
16
28
  context 'when script exits with nonzero status' do
17
29
  before :each do
18
30
  # TODO: Found a better way to test this
19
- Process::Status.any_instance.stub(:exitstatus).and_return(1)
31
+ allow(@status).to receive(:success?).and_return(false)
32
+ allow(@status).to receive(:exitstatus).and_return(1)
20
33
  end
21
34
 
22
35
  it 'raises error' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dpl
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.8.3.travis.1078.4
4
+ version: 1.8.3.travis.1087.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Konstantin Haase
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-08 00:00:00.000000000 Z
11
+ date: 2015-09-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec