fluent_command_builder 0.7.9 → 0.8.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fluent_command_builder/command_builders/appcfg_python.rb +2 -0
- data/lib/fluent_command_builder/command_builders/appcfg_python_16.rb +2 -0
- data/lib/fluent_command_builder/command_builders/appcfg_python_17.rb +2 -0
- data/lib/fluent_command_builder/command_builders/aspnet_compiler.rb +2 -0
- data/lib/fluent_command_builder/command_builders/aspnet_compiler_20.rb +2 -0
- data/lib/fluent_command_builder/command_builders/aspnet_compiler_40.rb +2 -0
- data/lib/fluent_command_builder/command_builders/bundle.rb +2 -0
- data/lib/fluent_command_builder/command_builders/bundle_11.rb +2 -0
- data/lib/fluent_command_builder/command_builders/cucumber.rb +2 -0
- data/lib/fluent_command_builder/command_builders/cucumber_11.rb +2 -0
- data/lib/fluent_command_builder/command_builders/cucumber_12.rb +2 -0
- data/lib/fluent_command_builder/command_builders/dev_appserver_python.rb +2 -0
- data/lib/fluent_command_builder/command_builders/dev_appserver_python_16.rb +4 -2
- data/lib/fluent_command_builder/command_builders/dev_appserver_python_17.rb +4 -2
- data/lib/fluent_command_builder/command_builders/dotcover.rb +2 -0
- data/lib/fluent_command_builder/command_builders/dotcover_10.rb +2 -0
- data/lib/fluent_command_builder/command_builders/dotcover_11.rb +2 -0
- data/lib/fluent_command_builder/command_builders/dotcover_12.rb +2 -0
- data/lib/fluent_command_builder/command_builders/dotcover_20.rb +2 -0
- data/lib/fluent_command_builder/command_builders/installutil.rb +2 -0
- data/lib/fluent_command_builder/command_builders/installutil_11.rb +2 -0
- data/lib/fluent_command_builder/command_builders/installutil_20.rb +2 -0
- data/lib/fluent_command_builder/command_builders/installutil_35.rb +2 -0
- data/lib/fluent_command_builder/command_builders/installutil_40.rb +2 -0
- data/lib/fluent_command_builder/command_builders/msbuild.rb +2 -0
- data/lib/fluent_command_builder/command_builders/msbuild_20.rb +2 -0
- data/lib/fluent_command_builder/command_builders/msbuild_30.rb +2 -0
- data/lib/fluent_command_builder/command_builders/msbuild_35.rb +2 -0
- data/lib/fluent_command_builder/command_builders/msbuild_40.rb +2 -0
- data/lib/fluent_command_builder/command_builders/msdeploy.rb +2 -0
- data/lib/fluent_command_builder/command_builders/msdeploy_71.rb +2 -0
- data/lib/fluent_command_builder/command_builders/mstest.rb +2 -0
- data/lib/fluent_command_builder/command_builders/mstest_100.rb +2 -0
- data/lib/fluent_command_builder/command_builders/mstest_80.rb +2 -0
- data/lib/fluent_command_builder/command_builders/mstest_90.rb +2 -0
- data/lib/fluent_command_builder/command_builders/netsh.rb +2 -0
- data/lib/fluent_command_builder/command_builders/netsh_61.rb +2 -0
- data/lib/fluent_command_builder/command_builders/nuget.rb +2 -0
- data/lib/fluent_command_builder/command_builders/nuget_20.rb +3 -1
- data/lib/fluent_command_builder/command_builders/nunit.rb +2 -0
- data/lib/fluent_command_builder/command_builders/nunit_25.rb +2 -0
- data/lib/fluent_command_builder/command_builders/nunit_26.rb +2 -0
- data/lib/fluent_command_builder/command_builders/rake.rb +2 -0
- data/lib/fluent_command_builder/command_builders/rake_09.rb +2 -0
- data/lib/fluent_command_builder/command_builders/security_osx.rb +2 -0
- data/lib/fluent_command_builder/command_builders/security_osx_107.rb +3 -1
- data/lib/fluent_command_builder/command_builders/sevenzip.rb +2 -0
- data/lib/fluent_command_builder/command_builders/sevenzip_920.rb +9 -7
- data/lib/fluent_command_builder/command_builders/simian.rb +2 -0
- data/lib/fluent_command_builder/command_builders/simian_23.rb +2 -0
- data/lib/fluent_command_builder/command_builders/team_foundation.rb +2 -0
- data/lib/fluent_command_builder/command_builders/team_foundation_100.rb +56 -54
- data/lib/fluent_command_builder/command_builders/team_foundation_tee.rb +2 -0
- data/lib/fluent_command_builder/command_builders/team_foundation_tee_100.rb +46 -44
- data/lib/fluent_command_builder/command_builders/team_foundation_tee_101.rb +46 -44
- data/lib/fluent_command_builder/command_builders/xcodebuild.rb +2 -0
- data/lib/fluent_command_builder/command_builders/xcodebuild_43.rb +2 -0
- data/lib/fluent_command_builder/command_builders/xcodebuild_44.rb +2 -0
- data/lib/fluent_command_builder/command_executors/backticks_executor.rb +11 -0
- data/lib/fluent_command_builder/command_executors/dry_run_executor.rb +6 -0
- data/lib/fluent_command_builder/command_executors/executor_base.rb +25 -0
- data/lib/fluent_command_builder/command_executors/rake_sh_executor.rb +21 -0
- data/lib/fluent_command_builder/command_executors/system_executor.rb +11 -0
- data/lib/fluent_command_builder/command_formatters/hidden_password_formatter.rb +17 -0
- data/lib/fluent_command_builder/command_formatters/null_formatter.rb +9 -0
- data/lib/fluent_command_builder/execution_context.rb +49 -0
- data/lib/fluent_command_builder/underlying_builder.rb +73 -75
- data/lib/fluent_command_builder/version_detectors/osx_version_detector.rb +3 -0
- data/lib/fluent_command_builder/version_detectors/standard_version_detector.rb +5 -1
- metadata +14 -12
- data/lib/fluent_command_builder/executor.rb +0 -44
- data/lib/fluent_command_builder/executors/backticks_executor.rb +0 -7
- data/lib/fluent_command_builder/executors/dry_run_executor.rb +0 -7
- data/lib/fluent_command_builder/executors/rake_sh_executor.rb +0 -10
- data/lib/fluent_command_builder/executors/system_executor.rb +0 -7
- data/lib/fluent_command_builder/version_detectors/version_detector_init.rb +0 -24
@@ -0,0 +1,25 @@
|
|
1
|
+
module FluentCommandBuilder
|
2
|
+
class ExecutorBase
|
3
|
+
|
4
|
+
def execute(underlying_builder)
|
5
|
+
result = do_execute underlying_builder
|
6
|
+
yield $? if block_given?
|
7
|
+
result
|
8
|
+
end
|
9
|
+
|
10
|
+
def will_print_on_execute?
|
11
|
+
false
|
12
|
+
end
|
13
|
+
|
14
|
+
def will_fail_on_error?
|
15
|
+
false
|
16
|
+
end
|
17
|
+
|
18
|
+
protected
|
19
|
+
|
20
|
+
def do_execute(underlying_builder)
|
21
|
+
# template method
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/executor_base')
|
2
|
+
require 'rake'
|
3
|
+
include Rake::DSL
|
4
|
+
|
5
|
+
module FluentCommandBuilder
|
6
|
+
class RakeShExecutor < ExecutorBase
|
7
|
+
|
8
|
+
def do_execute(underlying_builder)
|
9
|
+
sh underlying_builder.to_s
|
10
|
+
end
|
11
|
+
|
12
|
+
def will_print_on_execute?
|
13
|
+
true
|
14
|
+
end
|
15
|
+
|
16
|
+
def will_fail_on_error?
|
17
|
+
true
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module FluentCommandBuilder
|
2
|
+
class HiddenPasswordFormatter
|
3
|
+
|
4
|
+
attr_accessor :password_replacement
|
5
|
+
|
6
|
+
def initialize
|
7
|
+
@password_replacement = '***'
|
8
|
+
end
|
9
|
+
|
10
|
+
def format(underlying_builder)
|
11
|
+
command = underlying_builder.to_s
|
12
|
+
underlying_builder.passwords.each { |p| command.gsub! p, @password_replacement }
|
13
|
+
command
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/command_executors/system_executor')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/command_formatters/null_formatter')
|
3
|
+
|
4
|
+
module FluentCommandBuilder
|
5
|
+
class ExecutionContext
|
6
|
+
|
7
|
+
attr_accessor :executor, :formatter, :should_print_on_execute, :should_fail_on_error
|
8
|
+
|
9
|
+
def initialize(executor)
|
10
|
+
@executor = executor
|
11
|
+
@formatter = NullFormatter.new
|
12
|
+
@should_print_on_execute = true
|
13
|
+
@should_fail_on_error = true
|
14
|
+
end
|
15
|
+
|
16
|
+
def execute(underlying_builder)
|
17
|
+
validate_should_print_on_execute
|
18
|
+
validate_should_fail_on_error
|
19
|
+
visible_command = @formatter.format underlying_builder
|
20
|
+
puts visible_command if @should_print_on_execute && !@executor.will_print_on_execute?
|
21
|
+
@executor.execute(underlying_builder) do |status|
|
22
|
+
raise "Command failed with status (#{status.exitstatus}): [#{visible_command}]" if @should_fail_on_error && !status.success?
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def validate_should_print_on_execute
|
29
|
+
raise "should_print_on_execute must be true for #{@executor}." if !@should_print_on_execute && @executor.will_print_on_execute?
|
30
|
+
end
|
31
|
+
|
32
|
+
def validate_should_fail_on_error
|
33
|
+
raise "should_fail_on_error must be true for #{@executor}." if !@should_fail_on_error && @executor.will_fail_on_error?
|
34
|
+
end
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
module FluentCommandBuilder
|
40
|
+
|
41
|
+
def self.execution_context
|
42
|
+
@execution_context ||= ExecutionContext.new(SystemExecutor.new)
|
43
|
+
end
|
44
|
+
|
45
|
+
def self.execution_context=(value)
|
46
|
+
@execution_context = value
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
@@ -1,76 +1,74 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/command_base')
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/path_finder')
|
4
|
-
|
5
|
-
module FluentCommandBuilder
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
executable
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
end
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/command_base')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/execution_context')
|
3
|
+
require File.expand_path(File.dirname(__FILE__) + '/path_finder')
|
4
|
+
|
5
|
+
module FluentCommandBuilder
|
6
|
+
class UnderlyingBuilder
|
7
|
+
|
8
|
+
attr_accessor :command_name, :path, :passwords
|
9
|
+
|
10
|
+
def initialize(command_name=nil)
|
11
|
+
@command_name = command_name
|
12
|
+
@path = nil
|
13
|
+
@args = ''
|
14
|
+
@passwords = []
|
15
|
+
@execution_context = FluentCommandBuilder.execution_context
|
16
|
+
end
|
17
|
+
|
18
|
+
def format(value, delimiter=' ', key_value_separator='=')
|
19
|
+
case
|
20
|
+
when value.kind_of?(CommandBase)
|
21
|
+
value.to_s
|
22
|
+
when value.kind_of?(Hash)
|
23
|
+
format_hash value, delimiter, key_value_separator
|
24
|
+
when value.kind_of?(Array)
|
25
|
+
format_array value, delimiter
|
26
|
+
else
|
27
|
+
quote_if_includes_space value.to_s
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def format_password(value)
|
32
|
+
password = quote_if_includes_space value.to_s
|
33
|
+
@passwords << password
|
34
|
+
password
|
35
|
+
end
|
36
|
+
|
37
|
+
def append(value)
|
38
|
+
@args << value.to_s
|
39
|
+
end
|
40
|
+
|
41
|
+
def to_s
|
42
|
+
"#{quote_if_includes_space executable} #{args}".strip
|
43
|
+
end
|
44
|
+
|
45
|
+
def args
|
46
|
+
@args.strip
|
47
|
+
end
|
48
|
+
|
49
|
+
def executable
|
50
|
+
executable = @path ? File.join(@path, @command_name) : @command_name
|
51
|
+
executable.gsub! '/', '\\' if executable.include? '\\'
|
52
|
+
executable
|
53
|
+
end
|
54
|
+
|
55
|
+
def execute
|
56
|
+
@execution_context.execute self
|
57
|
+
end
|
58
|
+
|
59
|
+
private
|
60
|
+
|
61
|
+
def format_hash(hash, delimiter, key_value_separator)
|
62
|
+
hash.map { |k, v| quote_if_includes_space(k.to_s) + key_value_separator + quote_if_includes_space(v.to_s) }.join delimiter
|
63
|
+
end
|
64
|
+
|
65
|
+
def format_array(array, delimiter)
|
66
|
+
array.map { |v| quote_if_includes_space v }.join delimiter
|
67
|
+
end
|
68
|
+
|
69
|
+
def quote_if_includes_space(value)
|
70
|
+
value.to_s.include?(' ') ? %Q["#{value}"] : value
|
71
|
+
end
|
72
|
+
|
73
|
+
end
|
76
74
|
end
|
@@ -3,8 +3,11 @@ require File.expand_path(File.dirname(__FILE__) + '/standard_version_detector')
|
|
3
3
|
module FluentCommandBuilder
|
4
4
|
class OsxVersionDetector
|
5
5
|
|
6
|
+
attr_accessor :backticks_executor
|
7
|
+
|
6
8
|
def version(path=nil)
|
7
9
|
d = StandardVersionDetector.new 'sw_vers', '-productVersion'
|
10
|
+
d.backticks_executor = @backticks_executor if @backticks_executor
|
8
11
|
d.version
|
9
12
|
end
|
10
13
|
|
@@ -1,11 +1,15 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../version')
|
2
|
+
require File.expand_path(File.dirname(__FILE__) + '/../command_executors/backticks_executor')
|
2
3
|
|
3
4
|
module FluentCommandBuilder
|
4
5
|
class StandardVersionDetector
|
5
6
|
|
7
|
+
attr_accessor :backticks_executor
|
8
|
+
|
6
9
|
def initialize(command_name, command_arg=nil)
|
7
10
|
@command_name = command_name
|
8
11
|
@command_arg = command_arg
|
12
|
+
@backticks_executor = BackticksExecutor.new
|
9
13
|
end
|
10
14
|
|
11
15
|
def version(path=nil)
|
@@ -13,7 +17,7 @@ module FluentCommandBuilder
|
|
13
17
|
return unless path
|
14
18
|
executable = File.join path, @command_name
|
15
19
|
command = %Q["#{executable}" #{@command_arg} 2>&1]
|
16
|
-
output =
|
20
|
+
output = @backticks_executor.execute command
|
17
21
|
v = Version.match(output)
|
18
22
|
v ? v.version : nil
|
19
23
|
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.
|
4
|
+
version: 0.8.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
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: &70350655361380 !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: *70350655361380
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: term-ansicolor
|
27
|
-
requirement: &
|
27
|
+
requirement: &70350655360940 !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: *70350655360940
|
36
36
|
description: Fluent Command Builder makes building command lines easy and clean.
|
37
37
|
email: matthew-github@matthewriley.name
|
38
38
|
executables: []
|
@@ -98,11 +98,14 @@ files:
|
|
98
98
|
- lib/fluent_command_builder/command_builders/xcodebuild.rb
|
99
99
|
- lib/fluent_command_builder/command_builders/xcodebuild_43.rb
|
100
100
|
- lib/fluent_command_builder/command_builders/xcodebuild_44.rb
|
101
|
-
- lib/fluent_command_builder/
|
102
|
-
- lib/fluent_command_builder/
|
103
|
-
- lib/fluent_command_builder/
|
104
|
-
- lib/fluent_command_builder/
|
105
|
-
- lib/fluent_command_builder/
|
101
|
+
- lib/fluent_command_builder/command_executors/backticks_executor.rb
|
102
|
+
- lib/fluent_command_builder/command_executors/dry_run_executor.rb
|
103
|
+
- lib/fluent_command_builder/command_executors/executor_base.rb
|
104
|
+
- lib/fluent_command_builder/command_executors/rake_sh_executor.rb
|
105
|
+
- lib/fluent_command_builder/command_executors/system_executor.rb
|
106
|
+
- lib/fluent_command_builder/command_formatters/hidden_password_formatter.rb
|
107
|
+
- lib/fluent_command_builder/command_formatters/null_formatter.rb
|
108
|
+
- lib/fluent_command_builder/execution_context.rb
|
106
109
|
- lib/fluent_command_builder/path_finder.rb
|
107
110
|
- lib/fluent_command_builder/path_finders/unix_path_finder.rb
|
108
111
|
- lib/fluent_command_builder/path_finders/windows_path_finder.rb
|
@@ -113,7 +116,6 @@ files:
|
|
113
116
|
- lib/fluent_command_builder/version_detectors/default_version_detector.rb
|
114
117
|
- lib/fluent_command_builder/version_detectors/osx_version_detector.rb
|
115
118
|
- lib/fluent_command_builder/version_detectors/standard_version_detector.rb
|
116
|
-
- lib/fluent_command_builder/version_detectors/version_detector_init.rb
|
117
119
|
- lib/fluent_command_builder/version_detectors/windows_version_detector.rb
|
118
120
|
- lib/fluent_command_builder/version_validator.rb
|
119
121
|
- lib/fluent_command_builder.rb
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/executors/backticks_executor')
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/executors/dry_run_executor')
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/executors/rake_sh_executor')
|
4
|
-
require File.expand_path(File.dirname(__FILE__) + '/executors/system_executor')
|
5
|
-
|
6
|
-
module FluentCommandBuilder
|
7
|
-
class Executor
|
8
|
-
|
9
|
-
attr_accessor :backticks_executor, :dry_run_executor, :rake_sh_executor, :system_executor
|
10
|
-
|
11
|
-
def initialize
|
12
|
-
@backticks_executor = BackticksExecutor.new
|
13
|
-
@dry_run_executor = DryRunExecutor.new
|
14
|
-
@rake_sh_executor = RakeShExecutor.new
|
15
|
-
@system_executor = SystemExecutor.new
|
16
|
-
end
|
17
|
-
|
18
|
-
def execute_backticks(command)
|
19
|
-
@backticks_executor.execute command
|
20
|
-
end
|
21
|
-
|
22
|
-
def execute_dry_run(command)
|
23
|
-
@dry_run_executor.execute command
|
24
|
-
end
|
25
|
-
|
26
|
-
def execute_rake_sh(command)
|
27
|
-
@rake_sh_executor.execute command
|
28
|
-
end
|
29
|
-
|
30
|
-
def execute_system(command)
|
31
|
-
@system_executor.execute command
|
32
|
-
end
|
33
|
-
|
34
|
-
end
|
35
|
-
|
36
|
-
def self.executor
|
37
|
-
@executor ||= Executor.new
|
38
|
-
end
|
39
|
-
|
40
|
-
def self.executor=(value)
|
41
|
-
@executor = value
|
42
|
-
end
|
43
|
-
|
44
|
-
end
|