fulmar-shell 1.6.7 → 1.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/fulmar/shell.rb +23 -3
- 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: a1fa025a53a5a243c1a09e6ccc7a16f52d0e1eca
|
4
|
+
data.tar.gz: 1de351f532709ae3bcbbbfd66839bea21ddf38b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f78b94683dac6ab31e4e42af9525f447c0568bd74f67bdb2bb47b3271b6d96d23087d9e0b3ffa67b94a0adae0b007074a9b38bad82f6f0e2a60fa96cff2badb5
|
7
|
+
data.tar.gz: 0fd1a8e0734e32d4fe756ab28979615bd75d6e57974cdc43cf0cdd1e4fe6a31f73417bab0a7afa506b2701195b80f3ac8b330a095f17756ce735d6ff5e050703
|
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.7.0'
|
9
9
|
|
10
|
-
attr_accessor :debug, :last_output, :last_error, :quiet, :strict
|
10
|
+
attr_accessor :debug, :last_output, :last_error, :quiet, :strict, :interactive
|
11
11
|
attr_reader :path
|
12
12
|
|
13
13
|
DEFAULT_OPTIONS = {
|
@@ -24,9 +24,15 @@ module Fulmar
|
|
24
24
|
@debug = false
|
25
25
|
@quiet = true
|
26
26
|
@strict = false
|
27
|
+
@interactive = false
|
27
28
|
@clean_environment = [] # list of things to clean from environment variables
|
28
29
|
end
|
29
30
|
|
31
|
+
def interactive=(interactive)
|
32
|
+
@interactive = interactive
|
33
|
+
@quiet = false if interactive
|
34
|
+
end
|
35
|
+
|
30
36
|
def run(command, options = DEFAULT_OPTIONS)
|
31
37
|
reset_output
|
32
38
|
command = [command] if command.class == String
|
@@ -91,8 +97,22 @@ module Fulmar
|
|
91
97
|
ENV['PATH'].split(':').reject { |path| path.include?('ruby') || path.include?('gems') }.join(':')
|
92
98
|
end
|
93
99
|
|
94
|
-
# Run the command and capture the output
|
95
100
|
def execute(command, error_message)
|
101
|
+
if @interactive
|
102
|
+
execute_interactive(command, error_message)
|
103
|
+
else
|
104
|
+
execute_quiet(command, error_message)
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
108
|
+
def execute_interactive(command, error_message)
|
109
|
+
unless system(command)
|
110
|
+
puts "\n\n#{error_message}"
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
# Run the command and capture the output
|
115
|
+
def execute_quiet(command, error_message)
|
96
116
|
# Ladies and gentleman: More debug, please!
|
97
117
|
puts command if @debug
|
98
118
|
return_value = -1
|
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.7.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: 2016-
|
11
|
+
date: 2016-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|