fluent_command_builder 0.8.1 → 0.8.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,8 +1,10 @@
|
|
1
|
+
require 'term/ansicolor'
|
1
2
|
require File.expand_path(File.dirname(__FILE__) + '/command_executors/system_executor')
|
2
3
|
require File.expand_path(File.dirname(__FILE__) + '/command_formatters/null_formatter')
|
3
4
|
|
4
5
|
module FluentCommandBuilder
|
5
6
|
class ExecutionContext
|
7
|
+
include Term::ANSIColor
|
6
8
|
|
7
9
|
attr_accessor :executor, :formatter, :should_print_on_execute, :should_fail_on_error
|
8
10
|
|
@@ -17,7 +19,7 @@ module FluentCommandBuilder
|
|
17
19
|
validate_should_print_on_execute
|
18
20
|
validate_should_fail_on_error
|
19
21
|
visible_command = @formatter.format underlying_builder
|
20
|
-
|
22
|
+
print_command_on_execute(visible_command)
|
21
23
|
@executor.execute(underlying_builder) do |status|
|
22
24
|
raise "Command failed with status (#{status.exitstatus}): [#{visible_command}]" if @should_fail_on_error && !status.success?
|
23
25
|
end
|
@@ -25,6 +27,10 @@ module FluentCommandBuilder
|
|
25
27
|
|
26
28
|
private
|
27
29
|
|
30
|
+
def print_command_on_execute(visible_command)
|
31
|
+
print magenta, visible_command, reset, "\n" if @should_print_on_execute && !@executor.will_print_on_execute?
|
32
|
+
end
|
33
|
+
|
28
34
|
def validate_should_print_on_execute
|
29
35
|
raise "should_print_on_execute must be true for #{@executor}." if !@should_print_on_execute && @executor.will_print_on_execute?
|
30
36
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: fluent_command_builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -13,7 +13,7 @@ date: 2012-08-26 00:00:00.000000000 Z
|
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70251388673840 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70251388673840
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: term-ansicolor
|
27
|
-
requirement: &
|
27
|
+
requirement: &70251388673400 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,7 +32,7 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70251388673400
|
36
36
|
description: Fluent Command Builder makes building command lines easy and clean.
|
37
37
|
email: matthew-github@matthewriley.name
|
38
38
|
executables: []
|