pups 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +1 -1
- data/lib/pups.rb +4 -0
- data/lib/pups/cli.rb +0 -1
- data/lib/pups/config.rb +23 -10
- data/lib/pups/exec_command.rb +10 -2
- data/lib/pups/version.rb +1 -1
- data/test/exec_command_test.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 981fde4b2d6a70bad81c500abd0f9a11c8ec8161601f919765fbe8ac55fec3ab
|
4
|
+
data.tar.gz: fc29d1fdecf62a137f37f32f570e7ce635ec95c6fa817e166c022b701052cce7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fb37fb5c1e2f88d18a1d8a2f307cae341b0d4a7780363c7338acd8f891b3b0d21c9ba47333be3cf06760073d40aa30cb988c262649ad88d373cb54a1027beb4
|
7
|
+
data.tar.gz: 6f71a5c0684e80623eb7d10612fd0aa6b93950d31d42fa018d3db6c0689f1109077fbd89797f0d0ce9b88608a667aeae0bad48dde51b27976d2518a67b580095
|
data/README.md
CHANGED
@@ -28,7 +28,7 @@ params:
|
|
28
28
|
hello: hello world
|
29
29
|
|
30
30
|
run:
|
31
|
-
- exec: /bin/bash -c 'echo $hello
|
31
|
+
- exec: /bin/bash -c 'echo $hello >> hello'
|
32
32
|
```
|
33
33
|
|
34
34
|
Running: `pups somefile.yaml` will execute the shell script resulting in a file called "hello" with the contents "hello world".
|
data/lib/pups.rb
CHANGED
data/lib/pups/cli.rb
CHANGED
data/lib/pups/config.rb
CHANGED
@@ -3,7 +3,14 @@ class Pups::Config
|
|
3
3
|
attr_reader :config, :params
|
4
4
|
|
5
5
|
def self.load_file(config_file)
|
6
|
-
|
6
|
+
begin
|
7
|
+
new YAML.load_file(config_file)
|
8
|
+
rescue Exception
|
9
|
+
STDERR.puts "Failed to parse #{config_file}"
|
10
|
+
STDERR.puts "This is probably a formatting error in #{config_file}"
|
11
|
+
STDERR.puts "Cannot continue. Edit #{config_file} and try again."
|
12
|
+
raise
|
13
|
+
end
|
7
14
|
end
|
8
15
|
|
9
16
|
def self.load_config(config)
|
@@ -70,16 +77,22 @@ class Pups::Config
|
|
70
77
|
def run
|
71
78
|
run_commands
|
72
79
|
rescue => e
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
puts "
|
80
|
+
exit_code = 1
|
81
|
+
if Pups::ExecError === e
|
82
|
+
exit_code = e.exit_code
|
83
|
+
end
|
84
|
+
unless exit_code == 77
|
85
|
+
puts
|
86
|
+
puts
|
87
|
+
puts "FAILED"
|
88
|
+
puts "-" * 20
|
89
|
+
puts "#{e.class}: #{e}"
|
90
|
+
puts "Location of failure: #{e.backtrace[0]}"
|
91
|
+
if @last_command
|
92
|
+
puts "#{@last_command[:command]} failed with the params #{@last_command[:params].inspect}"
|
93
|
+
end
|
81
94
|
end
|
82
|
-
exit
|
95
|
+
exit exit_code
|
83
96
|
end
|
84
97
|
|
85
98
|
def run_commands
|
data/lib/pups/exec_command.rb
CHANGED
@@ -85,7 +85,11 @@ class Pups::ExecCommand < Pups::Command
|
|
85
85
|
pid = Process.spawn(command)
|
86
86
|
(@@asyncs ||= []) << {pid: pid, command: command, stop_signal: (stop_signal || "TERM")}
|
87
87
|
Thread.new do
|
88
|
-
|
88
|
+
begin
|
89
|
+
Process.wait(pid)
|
90
|
+
rescue Errno::ECHILD
|
91
|
+
# already exited so skip
|
92
|
+
end
|
89
93
|
@@asyncs.delete_if{|async| async[:pid] == pid}
|
90
94
|
end
|
91
95
|
return pid
|
@@ -102,7 +106,11 @@ class Pups::ExecCommand < Pups::Command
|
|
102
106
|
end
|
103
107
|
end
|
104
108
|
|
105
|
-
|
109
|
+
unless $? == 0
|
110
|
+
err = Pups::ExecError.new("#{command} failed with return #{$?.inspect}")
|
111
|
+
err.exit_code = $?.exitstatus
|
112
|
+
raise err
|
113
|
+
end
|
106
114
|
|
107
115
|
nil
|
108
116
|
|
data/lib/pups/version.rb
CHANGED
data/test/exec_command_test.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pups
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Saffron
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-06-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -132,7 +132,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
132
132
|
version: '0'
|
133
133
|
requirements: []
|
134
134
|
rubyforge_project:
|
135
|
-
rubygems_version: 2.
|
135
|
+
rubygems_version: 2.7.6
|
136
136
|
signing_key:
|
137
137
|
specification_version: 4
|
138
138
|
summary: Process orchestrator
|