fulmar-shell 1.3.0 → 1.4.0
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/fulmar/shell.rb +17 -2
- 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: d7ee1f834b78193c9007227b8388222fcf4a7f24
|
4
|
+
data.tar.gz: 82d0f09080b98ac7c8be68671ec3119ebf7f88f9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eabf95f05e15df887b532fa5f75018767ea6b05a30d4bb8a6a06d2eb7ae726f663418a0f9c51a878d5b39231344dc5c5dabd2eae1fbef66a80c10f00752231b2
|
7
|
+
data.tar.gz: 2570d005d648dc7089286478460abc27807f204c25c3eb32322e75072bb3e42c96cfc2c72c9604dbb15d8952acaf0aa7d95d9666d5b8c3f910ed4e998e881bdb
|
data/lib/fulmar/shell.rb
CHANGED
@@ -5,9 +5,9 @@ require 'open3'
|
|
5
5
|
module Fulmar
|
6
6
|
# Implements simple access to shell commands
|
7
7
|
class Shell
|
8
|
-
VERSION = '1.
|
8
|
+
VERSION = '1.4.0'
|
9
9
|
|
10
|
-
attr_accessor :debug, :last_output, :last_error, :quiet
|
10
|
+
attr_accessor :debug, :last_output, :last_error, :quiet, :strict
|
11
11
|
attr_reader :path
|
12
12
|
|
13
13
|
def initialize(path = '.', host = 'localhost')
|
@@ -19,6 +19,7 @@ module Fulmar
|
|
19
19
|
@debug = false
|
20
20
|
@quiet = false
|
21
21
|
@environment = {}
|
22
|
+
@strict = false
|
22
23
|
end
|
23
24
|
|
24
25
|
def run(command, options = {})
|
@@ -72,11 +73,25 @@ module Fulmar
|
|
72
73
|
|
73
74
|
@last_error.each { |line| puts line } unless @quiet
|
74
75
|
|
76
|
+
if @strict and wait_thr.value != 0
|
77
|
+
dump_error_message(command)
|
78
|
+
fail 'Last shell command returned an error.'
|
79
|
+
end
|
80
|
+
|
75
81
|
wait_thr.value == 0
|
76
82
|
end
|
77
83
|
|
78
84
|
def escape_for_sh(text)
|
79
85
|
text.gsub('\\', '\\\\').gsub("'", "'\\\\''")
|
80
86
|
end
|
87
|
+
|
88
|
+
def dump_error_message(command)
|
89
|
+
STDERR.puts command unless @debug
|
90
|
+
STDERR.puts 'Command output (stdout):'
|
91
|
+
@last_output.each { |line| STDERR.puts line }
|
92
|
+
STDERR.puts ''
|
93
|
+
STDERR.puts 'Command error message (stderr):'
|
94
|
+
@last_error.each { |line| STDERR.puts line }
|
95
|
+
end
|
81
96
|
end
|
82
97
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fulmar-shell
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerrit Visscher
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03-
|
11
|
+
date: 2015-03-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|