fulmar-shell 1.6.7 → 1.7.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/fulmar/shell.rb +23 -3
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e5924806aaa5f04075d0479988e0afae308225bb
4
- data.tar.gz: 1bb2d3fa1c547a92732e8ccbcdf607e042c5bfeb
3
+ metadata.gz: a1fa025a53a5a243c1a09e6ccc7a16f52d0e1eca
4
+ data.tar.gz: 1de351f532709ae3bcbbbfd66839bea21ddf38b8
5
5
  SHA512:
6
- metadata.gz: 891228db781860614a508b73984b2295fcad2f8f009eb2866e911edc8f9bcf11dc6e9bb808d926d48b5c3a4e2d236d7f84f10c5696b7a722b14fd15e1ccd2009
7
- data.tar.gz: e90984ae0b33f5e371d7d8d36aa462e3585c29685a2bbef3c30c3251a1ffc8f42e1b12d4c89e50ece8c7ffe03b7faef1251cc6ec0e6b82eb2fcb9953b502d56a
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.6.7'
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.6.7
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-09-23 00:00:00.000000000 Z
11
+ date: 2016-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler