fluent_command_builder 0.8.6 → 0.8.7
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.
- data/lib/fluent_command_builder.rb +1 -0
- data/lib/fluent_command_builder/argument_formatter.rb +38 -0
- data/lib/fluent_command_builder/command_base.rb +0 -20
- data/lib/fluent_command_builder/command_builders/appcfg_python_16.rb +4 -3
- data/lib/fluent_command_builder/command_builders/appcfg_python_17.rb +4 -3
- data/lib/fluent_command_builder/command_builders/aspnet_compiler_20.rb +4 -3
- data/lib/fluent_command_builder/command_builders/aspnet_compiler_40.rb +4 -3
- data/lib/fluent_command_builder/command_builders/bundle_11.rb +4 -3
- data/lib/fluent_command_builder/command_builders/cucumber_11.rb +4 -3
- data/lib/fluent_command_builder/command_builders/cucumber_12.rb +4 -3
- data/lib/fluent_command_builder/command_builders/dev_appserver_python_16.rb +4 -3
- data/lib/fluent_command_builder/command_builders/dev_appserver_python_17.rb +4 -3
- data/lib/fluent_command_builder/command_builders/dotcover_10.rb +4 -3
- data/lib/fluent_command_builder/command_builders/dotcover_11.rb +4 -3
- data/lib/fluent_command_builder/command_builders/dotcover_12.rb +4 -3
- data/lib/fluent_command_builder/command_builders/dotcover_20.rb +4 -3
- data/lib/fluent_command_builder/command_builders/fastlinkchecker_21.rb +4 -3
- data/lib/fluent_command_builder/command_builders/installutil_11.rb +4 -3
- data/lib/fluent_command_builder/command_builders/installutil_20.rb +4 -3
- data/lib/fluent_command_builder/command_builders/installutil_35.rb +4 -3
- data/lib/fluent_command_builder/command_builders/installutil_40.rb +4 -3
- data/lib/fluent_command_builder/command_builders/msbuild_20.rb +4 -3
- data/lib/fluent_command_builder/command_builders/msbuild_30.rb +4 -3
- data/lib/fluent_command_builder/command_builders/msbuild_35.rb +4 -3
- data/lib/fluent_command_builder/command_builders/msbuild_40.rb +4 -3
- data/lib/fluent_command_builder/command_builders/msdeploy_71.rb +4 -3
- data/lib/fluent_command_builder/command_builders/mstest_100.rb +4 -3
- data/lib/fluent_command_builder/command_builders/mstest_80.rb +4 -3
- data/lib/fluent_command_builder/command_builders/mstest_90.rb +4 -3
- data/lib/fluent_command_builder/command_builders/netsh_61.rb +4 -3
- data/lib/fluent_command_builder/command_builders/nuget_20.rb +4 -3
- data/lib/fluent_command_builder/command_builders/nunit_25.rb +4 -3
- data/lib/fluent_command_builder/command_builders/nunit_26.rb +4 -3
- data/lib/fluent_command_builder/command_builders/rake_09.rb +4 -3
- data/lib/fluent_command_builder/command_builders/security_osx_107.rb +4 -3
- data/lib/fluent_command_builder/command_builders/sevenzip_920.rb +4 -3
- data/lib/fluent_command_builder/command_builders/simian_23.rb +4 -3
- data/lib/fluent_command_builder/command_builders/team_foundation_100.rb +4 -3
- data/lib/fluent_command_builder/command_builders/team_foundation_tee_100.rb +4 -3
- data/lib/fluent_command_builder/command_builders/team_foundation_tee_101.rb +4 -3
- data/lib/fluent_command_builder/command_builders/xcodebuild_43.rb +4 -3
- data/lib/fluent_command_builder/command_builders/xcodebuild_44.rb +4 -3
- data/lib/fluent_command_builder/execution_context.rb +10 -5
- data/lib/fluent_command_builder/path_validator.rb +35 -0
- data/lib/fluent_command_builder/underlying_builder.rb +19 -47
- data/lib/fluent_command_builder/version_validator.rb +17 -28
- metadata +8 -6
@@ -0,0 +1,35 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/printer')
|
2
|
+
|
3
|
+
module FluentCommandBuilder
|
4
|
+
class PathValidator
|
5
|
+
|
6
|
+
def initialize(underlying_builder)
|
7
|
+
@underlying_builder = underlying_builder
|
8
|
+
@printer = Printer.new
|
9
|
+
end
|
10
|
+
|
11
|
+
def validate
|
12
|
+
return unless can_validate?
|
13
|
+
return if is_valid?
|
14
|
+
version = @underlying_builder.version || '(unknown)'
|
15
|
+
message = %Q[Path for command "#{@underlying_builder.command_name}", version "#{version}" does not exist. Path: #{path}]
|
16
|
+
@printer.print_error message
|
17
|
+
raise message
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
|
22
|
+
def can_validate?
|
23
|
+
!path.nil?
|
24
|
+
end
|
25
|
+
|
26
|
+
def is_valid?
|
27
|
+
File.exist? path
|
28
|
+
end
|
29
|
+
|
30
|
+
def path
|
31
|
+
@underlying_builder.path
|
32
|
+
end
|
33
|
+
|
34
|
+
end
|
35
|
+
end
|
@@ -1,73 +1,45 @@
|
|
1
|
-
require File.expand_path(File.dirname(__FILE__) + '/
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/argument_formatter')
|
2
2
|
require File.expand_path(File.dirname(__FILE__) + '/execution_context')
|
3
|
-
require File.expand_path(File.dirname(__FILE__) + '/path_finder')
|
4
3
|
|
5
4
|
module FluentCommandBuilder
|
6
5
|
class UnderlyingBuilder
|
6
|
+
include ArgumentFormatter
|
7
7
|
|
8
|
-
|
8
|
+
attr_reader :command_name, :version, :args, :passwords
|
9
|
+
attr_accessor :path, :actual_version_lambda
|
9
10
|
|
10
|
-
def initialize(command_name=nil)
|
11
|
+
def initialize(command_name, version=nil)
|
11
12
|
@command_name = command_name
|
12
|
-
@
|
13
|
-
@args =
|
13
|
+
@version = version
|
14
|
+
@args = nil
|
14
15
|
@passwords = []
|
16
|
+
@path = nil
|
17
|
+
@actual_version_lambda = nil
|
15
18
|
@execution_context = FluentCommandBuilder.execution_context
|
16
19
|
end
|
17
20
|
|
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
21
|
def append(value)
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
def to_s
|
42
|
-
"#{quote_if_includes_space executable} #{args}".strip
|
43
|
-
end
|
44
|
-
|
45
|
-
def args
|
46
|
-
@args.strip
|
22
|
+
v = value.to_s
|
23
|
+
v = @args ? v : v.lstrip
|
24
|
+
@args = @args.to_s + v
|
47
25
|
end
|
48
26
|
|
49
27
|
def executable
|
50
|
-
|
51
|
-
|
52
|
-
|
28
|
+
e = @path ? File.join(@path, @command_name) : @command_name
|
29
|
+
e.gsub! '/', '\\' if e.include? '\\'
|
30
|
+
e
|
53
31
|
end
|
54
32
|
|
55
33
|
def execute
|
56
34
|
@execution_context.execute self
|
57
35
|
end
|
58
36
|
|
59
|
-
|
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
|
37
|
+
def actual_version
|
38
|
+
@actual_version_lambda.call @path if @actual_version_lambda
|
63
39
|
end
|
64
40
|
|
65
|
-
def
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
def quote_if_includes_space(value)
|
70
|
-
value.to_s.include?(' ') ? %Q["#{value}"] : value
|
41
|
+
def to_s
|
42
|
+
"#{quote_if_includes_space executable} #{@args}".strip
|
71
43
|
end
|
72
44
|
|
73
45
|
end
|
@@ -1,57 +1,46 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/printer')
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + '/version')
|
3
2
|
|
4
3
|
module FluentCommandBuilder
|
5
|
-
|
6
4
|
class VersionValidator
|
7
5
|
|
8
|
-
def initialize(
|
9
|
-
@
|
10
|
-
@path = path
|
6
|
+
def initialize(underlying_builder)
|
7
|
+
@underlying_builder = underlying_builder
|
11
8
|
@printer = Printer.new
|
12
9
|
end
|
13
10
|
|
14
11
|
def validate
|
15
|
-
unless can_validate?
|
16
|
-
|
12
|
+
return unless can_validate?
|
13
|
+
|
14
|
+
unless actual_version
|
15
|
+
print_warning 'unable to determine actual version'
|
17
16
|
return
|
18
17
|
end
|
19
18
|
|
20
19
|
unless is_valid?
|
21
|
-
|
20
|
+
print_warning actual_version.to_s(2)
|
22
21
|
end
|
23
22
|
end
|
24
23
|
|
24
|
+
private
|
25
|
+
|
25
26
|
def can_validate?
|
26
|
-
|
27
|
-
is_valid?
|
28
|
-
return true
|
29
|
-
rescue
|
30
|
-
return false
|
31
|
-
end
|
27
|
+
@underlying_builder.version && @underlying_builder.actual_version_lambda
|
32
28
|
end
|
33
29
|
|
34
30
|
def is_valid?
|
35
|
-
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
def version_in_use
|
41
|
-
@version_in_use ||= Version.new(module_at_index(2)::VERSION)
|
31
|
+
actual_version.compact == expected_version.compact
|
42
32
|
end
|
43
33
|
|
44
|
-
def
|
45
|
-
|
34
|
+
def expected_version
|
35
|
+
Version.new(@underlying_builder.version)
|
46
36
|
end
|
47
37
|
|
48
|
-
def
|
49
|
-
@
|
38
|
+
def actual_version
|
39
|
+
Version.new(@underlying_builder.actual_version) if @underlying_builder.actual_version
|
50
40
|
end
|
51
41
|
|
52
|
-
def
|
53
|
-
|
54
|
-
eval module_name
|
42
|
+
def print_warning(message)
|
43
|
+
@printer.print_warning %Q[Version validation for command "#{@underlying_builder.command_name}" failed. Expected version #{expected_version} but was #{message}.]
|
55
44
|
end
|
56
45
|
|
57
46
|
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.7
|
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-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rake
|
16
|
-
requirement: &
|
16
|
+
requirement: &70347631048860 !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: *70347631048860
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: term-ansicolor
|
27
|
-
requirement: &
|
27
|
+
requirement: &70347631048420 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,13 +32,14 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70347631048420
|
36
36
|
description: Fluent Command Builder makes building command lines easy and clean.
|
37
37
|
email: matthew-github@matthewriley.name
|
38
38
|
executables: []
|
39
39
|
extensions: []
|
40
40
|
extra_rdoc_files: []
|
41
41
|
files:
|
42
|
+
- lib/fluent_command_builder/argument_formatter.rb
|
42
43
|
- lib/fluent_command_builder/command_base.rb
|
43
44
|
- lib/fluent_command_builder/command_builders/appcfg_python.rb
|
44
45
|
- lib/fluent_command_builder/command_builders/appcfg_python_16.rb
|
@@ -111,6 +112,7 @@ files:
|
|
111
112
|
- lib/fluent_command_builder/path_finder.rb
|
112
113
|
- lib/fluent_command_builder/path_finders/unix_path_finder.rb
|
113
114
|
- lib/fluent_command_builder/path_finders/windows_path_finder.rb
|
115
|
+
- lib/fluent_command_builder/path_validator.rb
|
114
116
|
- lib/fluent_command_builder/printer.rb
|
115
117
|
- lib/fluent_command_builder/underlying_builder.rb
|
116
118
|
- lib/fluent_command_builder/version.rb
|