fluent_command_builder 0.8.11 → 0.8.12

Sign up to get free protection for your applications and to get access to all the features.
Files changed (69) hide show
  1. data/lib/fluent_command_builder/command_builder_config.rb +31 -0
  2. data/lib/fluent_command_builder/command_builders/appcfg_python.rb +0 -8
  3. data/lib/fluent_command_builder/command_builders/appcfg_python_16.rb +8 -30
  4. data/lib/fluent_command_builder/command_builders/appcfg_python_17.rb +8 -30
  5. data/lib/fluent_command_builder/command_builders/aspnet_compiler.rb +1 -9
  6. data/lib/fluent_command_builder/command_builders/aspnet_compiler_20.rb +8 -30
  7. data/lib/fluent_command_builder/command_builders/aspnet_compiler_40.rb +8 -30
  8. data/lib/fluent_command_builder/command_builders/bundle.rb +0 -8
  9. data/lib/fluent_command_builder/command_builders/bundle_11.rb +8 -30
  10. data/lib/fluent_command_builder/command_builders/cucumber.rb +0 -8
  11. data/lib/fluent_command_builder/command_builders/cucumber_11.rb +8 -30
  12. data/lib/fluent_command_builder/command_builders/cucumber_12.rb +8 -30
  13. data/lib/fluent_command_builder/command_builders/dev_appserver_python.rb +0 -8
  14. data/lib/fluent_command_builder/command_builders/dev_appserver_python_16.rb +8 -30
  15. data/lib/fluent_command_builder/command_builders/dev_appserver_python_17.rb +8 -30
  16. data/lib/fluent_command_builder/command_builders/dotcover.rb +0 -8
  17. data/lib/fluent_command_builder/command_builders/dotcover_10.rb +8 -30
  18. data/lib/fluent_command_builder/command_builders/dotcover_11.rb +8 -30
  19. data/lib/fluent_command_builder/command_builders/dotcover_12.rb +8 -30
  20. data/lib/fluent_command_builder/command_builders/dotcover_20.rb +8 -30
  21. data/lib/fluent_command_builder/command_builders/fastlinkchecker.rb +0 -8
  22. data/lib/fluent_command_builder/command_builders/fastlinkchecker_21.rb +8 -30
  23. data/lib/fluent_command_builder/command_builders/installutil.rb +0 -8
  24. data/lib/fluent_command_builder/command_builders/installutil_11.rb +8 -30
  25. data/lib/fluent_command_builder/command_builders/installutil_20.rb +8 -30
  26. data/lib/fluent_command_builder/command_builders/installutil_35.rb +8 -30
  27. data/lib/fluent_command_builder/command_builders/installutil_40.rb +8 -30
  28. data/lib/fluent_command_builder/command_builders/msbuild.rb +0 -8
  29. data/lib/fluent_command_builder/command_builders/msbuild_20.rb +8 -30
  30. data/lib/fluent_command_builder/command_builders/msbuild_30.rb +8 -30
  31. data/lib/fluent_command_builder/command_builders/msbuild_35.rb +8 -30
  32. data/lib/fluent_command_builder/command_builders/msbuild_40.rb +8 -30
  33. data/lib/fluent_command_builder/command_builders/msdeploy.rb +0 -8
  34. data/lib/fluent_command_builder/command_builders/msdeploy_71.rb +8 -30
  35. data/lib/fluent_command_builder/command_builders/mstest.rb +0 -8
  36. data/lib/fluent_command_builder/command_builders/mstest_100.rb +8 -30
  37. data/lib/fluent_command_builder/command_builders/mstest_80.rb +8 -30
  38. data/lib/fluent_command_builder/command_builders/mstest_90.rb +8 -30
  39. data/lib/fluent_command_builder/command_builders/netsh.rb +0 -8
  40. data/lib/fluent_command_builder/command_builders/netsh_61.rb +8 -30
  41. data/lib/fluent_command_builder/command_builders/nuget.rb +0 -8
  42. data/lib/fluent_command_builder/command_builders/nuget_20.rb +8 -30
  43. data/lib/fluent_command_builder/command_builders/nunit.rb +0 -8
  44. data/lib/fluent_command_builder/command_builders/nunit_25.rb +8 -30
  45. data/lib/fluent_command_builder/command_builders/nunit_26.rb +8 -30
  46. data/lib/fluent_command_builder/command_builders/rake.rb +0 -8
  47. data/lib/fluent_command_builder/command_builders/rake_09.rb +8 -30
  48. data/lib/fluent_command_builder/command_builders/security_osx.rb +0 -8
  49. data/lib/fluent_command_builder/command_builders/security_osx_107.rb +13 -30
  50. data/lib/fluent_command_builder/command_builders/security_osx_108.rb +187 -0
  51. data/lib/fluent_command_builder/command_builders/sevenzip.rb +0 -8
  52. data/lib/fluent_command_builder/command_builders/sevenzip_920.rb +8 -30
  53. data/lib/fluent_command_builder/command_builders/simian.rb +0 -8
  54. data/lib/fluent_command_builder/command_builders/simian_23.rb +8 -30
  55. data/lib/fluent_command_builder/command_builders/team_foundation.rb +0 -8
  56. data/lib/fluent_command_builder/command_builders/team_foundation_100.rb +8 -30
  57. data/lib/fluent_command_builder/command_builders/team_foundation_tee.rb +0 -8
  58. data/lib/fluent_command_builder/command_builders/team_foundation_tee_100.rb +8 -30
  59. data/lib/fluent_command_builder/command_builders/team_foundation_tee_101.rb +8 -30
  60. data/lib/fluent_command_builder/command_builders/xcodebuild.rb +0 -8
  61. data/lib/fluent_command_builder/command_builders/xcodebuild_43.rb +8 -30
  62. data/lib/fluent_command_builder/command_builders/xcodebuild_44.rb +8 -30
  63. data/lib/fluent_command_builder/path_validator.rb +25 -12
  64. data/lib/fluent_command_builder/underlying_builder.rb +10 -19
  65. data/lib/fluent_command_builder/version_validator.rb +33 -21
  66. data/lib/fluent_command_builder.rb +5 -4
  67. metadata +8 -8
  68. data/lib/fluent_command_builder/command_builder_factory.rb +0 -43
  69. data/lib/fluent_command_builder/default_path_validator.rb +0 -33
@@ -1,47 +1,25 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../command_base')
4
- require File.expand_path(File.dirname(__FILE__) + '/../default_path_validator')
4
+ require File.expand_path(File.dirname(__FILE__) + '/../command_builder_config')
5
5
  require File.expand_path(File.dirname(__FILE__) + '/../underlying_builder')
6
6
 
7
7
  module FluentCommandBuilder
8
- def team_foundation_100
9
- FluentCommandBuilder::TeamFoundation::V100.create { |b| yield b if block_given? }
10
- end
11
8
  module TeamFoundation
12
9
  module V100
13
10
  VERSION = '10.0'
14
- def self.exact_version
15
- @exact_version ||= VERSION
16
- end
17
- def self.exact_version=(value)
18
- @exact_version = value
19
- end
20
- def self.default_path
21
- @default_path ||= nil
22
- end
23
- def self.default_path=(value)
24
- validator = DefaultPathValidator.new value, FluentCommandBuilder::TeamFoundation::COMMAND_NAME, exact_version
25
- validator.validate
26
- @default_path = value
11
+ @@config = CommandBuilderConfig.new FluentCommandBuilder::TeamFoundation::COMMAND_NAME, VERSION
12
+ @@config.version_detector = FluentCommandBuilder::TeamFoundation.version_detector
13
+ def configure_team_foundation
14
+ yield @@config
15
+ @@config.validate_path :warn
27
16
  end
28
- def self.version_validation_options
29
- @version_validation_options ||= {}
30
- yield @version_validation_options if block_given?
31
- @version_validation_options
32
- end
33
- def self.create
34
- b = UnderlyingBuilder.new FluentCommandBuilder::TeamFoundation::COMMAND_NAME, self.exact_version
35
- b.path = self.default_path
36
- b.version_validation_options = self.version_validation_options
37
- b.version_detector = FluentCommandBuilder::TeamFoundation.version_detector
17
+ def team_foundation
18
+ b = UnderlyingBuilder.new @@config
38
19
  c = TeamFoundation.new(b)
39
20
  yield b if block_given?
40
21
  c
41
22
  end
42
- def team_foundation
43
- FluentCommandBuilder::TeamFoundation::V100.create { |b| yield b if block_given? }
44
- end
45
23
  class TeamFoundation < CommandBase
46
24
  def initialize(underlying_builder)
47
25
  super underlying_builder
@@ -1,12 +1,8 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../command_builder_factory')
4
3
  require File.expand_path(File.dirname(__FILE__) + '/../underlying_builder')
5
4
 
6
5
  module FluentCommandBuilder
7
- def team_foundation_tee(&block)
8
- TeamFoundationTEE.create &block
9
- end
10
6
  module TeamFoundationTEE
11
7
  COMMAND_NAME = 'tf'
12
8
  def self.version_detector
@@ -18,9 +14,5 @@ module FluentCommandBuilder
18
14
  def self.version(path=nil)
19
15
  self.version_detector.version path
20
16
  end
21
- def self.create(&block)
22
- f = CommandBuilderFactory.new TeamFoundationTEE
23
- f.create &block
24
- end
25
17
  end
26
18
  end
@@ -1,47 +1,25 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../command_base')
4
- require File.expand_path(File.dirname(__FILE__) + '/../default_path_validator')
4
+ require File.expand_path(File.dirname(__FILE__) + '/../command_builder_config')
5
5
  require File.expand_path(File.dirname(__FILE__) + '/../underlying_builder')
6
6
 
7
7
  module FluentCommandBuilder
8
- def team_foundation_tee_100
9
- FluentCommandBuilder::TeamFoundationTEE::V100.create { |b| yield b if block_given? }
10
- end
11
8
  module TeamFoundationTEE
12
9
  module V100
13
10
  VERSION = '10.0'
14
- def self.exact_version
15
- @exact_version ||= VERSION
16
- end
17
- def self.exact_version=(value)
18
- @exact_version = value
19
- end
20
- def self.default_path
21
- @default_path ||= nil
22
- end
23
- def self.default_path=(value)
24
- validator = DefaultPathValidator.new value, FluentCommandBuilder::TeamFoundationTEE::COMMAND_NAME, exact_version
25
- validator.validate
26
- @default_path = value
11
+ @@config = CommandBuilderConfig.new FluentCommandBuilder::TeamFoundationTEE::COMMAND_NAME, VERSION
12
+ @@config.version_detector = FluentCommandBuilder::TeamFoundationTEE.version_detector
13
+ def configure_team_foundation_tee
14
+ yield @@config
15
+ @@config.validate_path :warn
27
16
  end
28
- def self.version_validation_options
29
- @version_validation_options ||= {}
30
- yield @version_validation_options if block_given?
31
- @version_validation_options
32
- end
33
- def self.create
34
- b = UnderlyingBuilder.new FluentCommandBuilder::TeamFoundationTEE::COMMAND_NAME, self.exact_version
35
- b.path = self.default_path
36
- b.version_validation_options = self.version_validation_options
37
- b.version_detector = FluentCommandBuilder::TeamFoundationTEE.version_detector
17
+ def team_foundation_tee
18
+ b = UnderlyingBuilder.new @@config
38
19
  c = TeamFoundationTEE.new(b)
39
20
  yield b if block_given?
40
21
  c
41
22
  end
42
- def team_foundation_tee
43
- FluentCommandBuilder::TeamFoundationTEE::V100.create { |b| yield b if block_given? }
44
- end
45
23
  class TeamFoundationTEE < CommandBase
46
24
  def initialize(underlying_builder)
47
25
  super underlying_builder
@@ -1,47 +1,25 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../command_base')
4
- require File.expand_path(File.dirname(__FILE__) + '/../default_path_validator')
4
+ require File.expand_path(File.dirname(__FILE__) + '/../command_builder_config')
5
5
  require File.expand_path(File.dirname(__FILE__) + '/../underlying_builder')
6
6
 
7
7
  module FluentCommandBuilder
8
- def team_foundation_tee_101
9
- FluentCommandBuilder::TeamFoundationTEE::V101.create { |b| yield b if block_given? }
10
- end
11
8
  module TeamFoundationTEE
12
9
  module V101
13
10
  VERSION = '10.1'
14
- def self.exact_version
15
- @exact_version ||= VERSION
16
- end
17
- def self.exact_version=(value)
18
- @exact_version = value
19
- end
20
- def self.default_path
21
- @default_path ||= nil
22
- end
23
- def self.default_path=(value)
24
- validator = DefaultPathValidator.new value, FluentCommandBuilder::TeamFoundationTEE::COMMAND_NAME, exact_version
25
- validator.validate
26
- @default_path = value
11
+ @@config = CommandBuilderConfig.new FluentCommandBuilder::TeamFoundationTEE::COMMAND_NAME, VERSION
12
+ @@config.version_detector = FluentCommandBuilder::TeamFoundationTEE.version_detector
13
+ def configure_team_foundation_tee
14
+ yield @@config
15
+ @@config.validate_path :warn
27
16
  end
28
- def self.version_validation_options
29
- @version_validation_options ||= {}
30
- yield @version_validation_options if block_given?
31
- @version_validation_options
32
- end
33
- def self.create
34
- b = UnderlyingBuilder.new FluentCommandBuilder::TeamFoundationTEE::COMMAND_NAME, self.exact_version
35
- b.path = self.default_path
36
- b.version_validation_options = self.version_validation_options
37
- b.version_detector = FluentCommandBuilder::TeamFoundationTEE.version_detector
17
+ def team_foundation_tee
18
+ b = UnderlyingBuilder.new @@config
38
19
  c = TeamFoundationTEE.new(b)
39
20
  yield b if block_given?
40
21
  c
41
22
  end
42
- def team_foundation_tee
43
- FluentCommandBuilder::TeamFoundationTEE::V101.create { |b| yield b if block_given? }
44
- end
45
23
  class TeamFoundationTEE < CommandBase
46
24
  def initialize(underlying_builder)
47
25
  super underlying_builder
@@ -1,12 +1,8 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
- require File.expand_path(File.dirname(__FILE__) + '/../command_builder_factory')
4
3
  require File.expand_path(File.dirname(__FILE__) + '/../underlying_builder')
5
4
 
6
5
  module FluentCommandBuilder
7
- def xcodebuild(&block)
8
- XCodeBuild.create &block
9
- end
10
6
  module XCodeBuild
11
7
  COMMAND_NAME = 'xcodebuild'
12
8
  def self.version_detector
@@ -18,9 +14,5 @@ module FluentCommandBuilder
18
14
  def self.version(path=nil)
19
15
  self.version_detector.version path
20
16
  end
21
- def self.create(&block)
22
- f = CommandBuilderFactory.new XCodeBuild
23
- f.create &block
24
- end
25
17
  end
26
18
  end
@@ -1,47 +1,25 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../command_base')
4
- require File.expand_path(File.dirname(__FILE__) + '/../default_path_validator')
4
+ require File.expand_path(File.dirname(__FILE__) + '/../command_builder_config')
5
5
  require File.expand_path(File.dirname(__FILE__) + '/../underlying_builder')
6
6
 
7
7
  module FluentCommandBuilder
8
- def xcodebuild_43
9
- FluentCommandBuilder::XCodeBuild::V43.create { |b| yield b if block_given? }
10
- end
11
8
  module XCodeBuild
12
9
  module V43
13
10
  VERSION = '4.3'
14
- def self.exact_version
15
- @exact_version ||= VERSION
16
- end
17
- def self.exact_version=(value)
18
- @exact_version = value
19
- end
20
- def self.default_path
21
- @default_path ||= nil
22
- end
23
- def self.default_path=(value)
24
- validator = DefaultPathValidator.new value, FluentCommandBuilder::XCodeBuild::COMMAND_NAME, exact_version
25
- validator.validate
26
- @default_path = value
11
+ @@config = CommandBuilderConfig.new FluentCommandBuilder::XCodeBuild::COMMAND_NAME, VERSION
12
+ @@config.version_detector = FluentCommandBuilder::XCodeBuild.version_detector
13
+ def configure_xcodebuild
14
+ yield @@config
15
+ @@config.validate_path :warn
27
16
  end
28
- def self.version_validation_options
29
- @version_validation_options ||= {}
30
- yield @version_validation_options if block_given?
31
- @version_validation_options
32
- end
33
- def self.create
34
- b = UnderlyingBuilder.new FluentCommandBuilder::XCodeBuild::COMMAND_NAME, self.exact_version
35
- b.path = self.default_path
36
- b.version_validation_options = self.version_validation_options
37
- b.version_detector = FluentCommandBuilder::XCodeBuild.version_detector
17
+ def xcodebuild
18
+ b = UnderlyingBuilder.new @@config
38
19
  c = XCodeBuild.new(b)
39
20
  yield b if block_given?
40
21
  c
41
22
  end
42
- def xcodebuild
43
- FluentCommandBuilder::XCodeBuild::V43.create { |b| yield b if block_given? }
44
- end
45
23
  class XCodeBuild < CommandBase
46
24
  def initialize(underlying_builder)
47
25
  super underlying_builder
@@ -1,47 +1,25 @@
1
1
  # Generated code. Do not modify.
2
2
 
3
3
  require File.expand_path(File.dirname(__FILE__) + '/../command_base')
4
- require File.expand_path(File.dirname(__FILE__) + '/../default_path_validator')
4
+ require File.expand_path(File.dirname(__FILE__) + '/../command_builder_config')
5
5
  require File.expand_path(File.dirname(__FILE__) + '/../underlying_builder')
6
6
 
7
7
  module FluentCommandBuilder
8
- def xcodebuild_44
9
- FluentCommandBuilder::XCodeBuild::V44.create { |b| yield b if block_given? }
10
- end
11
8
  module XCodeBuild
12
9
  module V44
13
10
  VERSION = '4.4'
14
- def self.exact_version
15
- @exact_version ||= VERSION
16
- end
17
- def self.exact_version=(value)
18
- @exact_version = value
19
- end
20
- def self.default_path
21
- @default_path ||= nil
22
- end
23
- def self.default_path=(value)
24
- validator = DefaultPathValidator.new value, FluentCommandBuilder::XCodeBuild::COMMAND_NAME, exact_version
25
- validator.validate
26
- @default_path = value
11
+ @@config = CommandBuilderConfig.new FluentCommandBuilder::XCodeBuild::COMMAND_NAME, VERSION
12
+ @@config.version_detector = FluentCommandBuilder::XCodeBuild.version_detector
13
+ def configure_xcodebuild
14
+ yield @@config
15
+ @@config.validate_path :warn
27
16
  end
28
- def self.version_validation_options
29
- @version_validation_options ||= {}
30
- yield @version_validation_options if block_given?
31
- @version_validation_options
32
- end
33
- def self.create
34
- b = UnderlyingBuilder.new FluentCommandBuilder::XCodeBuild::COMMAND_NAME, self.exact_version
35
- b.path = self.default_path
36
- b.version_validation_options = self.version_validation_options
37
- b.version_detector = FluentCommandBuilder::XCodeBuild.version_detector
17
+ def xcodebuild
18
+ b = UnderlyingBuilder.new @@config
38
19
  c = XCodeBuild.new(b)
39
20
  yield b if block_given?
40
21
  c
41
22
  end
42
- def xcodebuild
43
- FluentCommandBuilder::XCodeBuild::V44.create { |b| yield b if block_given? }
44
- end
45
23
  class XCodeBuild < CommandBase
46
24
  def initialize(underlying_builder)
47
25
  super underlying_builder
@@ -3,25 +3,38 @@ require File.expand_path(File.dirname(__FILE__) + '/printer')
3
3
  module FluentCommandBuilder
4
4
  class PathValidator
5
5
 
6
- def initialize(path, command_name, version)
7
- @path = path
8
- @command_name = command_name
9
- @version = version
6
+ def initialize(command_builder_config)
7
+ @command_builder_config = command_builder_config
10
8
  @printer = Printer.new
11
9
  end
12
10
 
13
- def validate
14
- return if is_valid?
15
- version = @version || '(unknown)'
16
- message = %Q[Path for command "#{@command_name}", version "#{version}" does not exist. Path: #{@path}]
17
- @printer.print_error message
18
- raise message
11
+ def validate(validation_level=:warn)
12
+ return if File.exist? path
13
+ message = %Q[Path for command "#{command_name}", version "#{version}" does not exist. Path: #{path}]
14
+
15
+ case validation_level
16
+ when :warn
17
+ @printer.print_warning message
18
+ when :fatal
19
+ @printer.print_error message
20
+ abort
21
+ else
22
+ @printer.print_warning %Q[Path validation failed. Validation level "#{validation_level}" is not supported.]
23
+ end
19
24
  end
20
25
 
21
26
  private
22
27
 
23
- def is_valid?
24
- File.exist? @path
28
+ def path
29
+ @command_builder_config.path
30
+ end
31
+
32
+ def command_name
33
+ @command_builder_config.command_name
34
+ end
35
+
36
+ def version
37
+ @command_builder_config.version
25
38
  end
26
39
 
27
40
  end
@@ -1,23 +1,16 @@
1
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_validator')
4
- require File.expand_path(File.dirname(__FILE__) + '/version_validator')
5
3
 
6
4
  module FluentCommandBuilder
7
5
  class UnderlyingBuilder
8
6
  include ArgumentFormatter
9
7
 
10
- attr_reader :command_name, :version, :args, :passwords
11
- attr_accessor :path, :version_detector, :version_validation_options
8
+ attr_reader :command_builder_config, :args, :passwords
12
9
 
13
- def initialize(command_name, version=nil)
14
- @command_name = command_name
15
- @version = version
10
+ def initialize(command_builder_config)
11
+ @command_builder_config = command_builder_config
16
12
  @args = nil
17
13
  @passwords = []
18
- @version_validation_options = {}
19
- @path = nil
20
- @version_detector = nil
21
14
  @execution_context = FluentCommandBuilder.execution_context
22
15
  end
23
16
 
@@ -28,14 +21,14 @@ module FluentCommandBuilder
28
21
  end
29
22
 
30
23
  def executable
31
- e = @path ? File.join(@path, @command_name) : @command_name
24
+ e = path ? File.join(path, command_name) : command_name
32
25
  e.gsub! '/', '\\' if e.include? '\\'
33
26
  e
34
27
  end
35
28
 
36
29
  def execute
37
- validate_path if @path
38
- validate_version if @version_detector
30
+ @command_builder_config.validate_path :fatal
31
+ @command_builder_config.validate_version
39
32
  visible_command = @execution_context.formatter.format self
40
33
  @execution_context.execute to_s, visible_command
41
34
  end
@@ -46,14 +39,12 @@ module FluentCommandBuilder
46
39
 
47
40
  private
48
41
 
49
- def validate_path
50
- v = PathValidator.new @path, @command_name, @version
51
- v.validate
42
+ def path
43
+ @command_builder_config.path
52
44
  end
53
45
 
54
- def validate_version
55
- v = VersionValidator.new @command_name, @path, @version, @version_detector, @version_validation_options
56
- v.validate
46
+ def command_name
47
+ @command_builder_config.command_name
57
48
  end
58
49
 
59
50
  end
@@ -3,19 +3,15 @@ require File.expand_path(File.dirname(__FILE__) + '/printer')
3
3
  module FluentCommandBuilder
4
4
  class VersionValidator
5
5
 
6
- def initialize(command_name, path, expected_version, version_detector, options={})
7
- @command_name = command_name
8
- @path = path
9
- @expected_version_string = expected_version
10
- @version_detector = version_detector
11
- @options = { enabled: true, warn_only: false }.merge options
6
+ def initialize(command_builder_config)
7
+ @command_builder_config = command_builder_config
12
8
  @printer = Printer.new
13
9
  end
14
10
 
15
- def validate
16
- return unless enabled?
11
+ def validate(validation_level)
12
+ return if validation_level == :off
17
13
 
18
- @actual_version_string = @version_detector.version(@path)
14
+ @actual_version_string = version_detector.version(path)
19
15
 
20
16
  unless actual_version
21
17
  @printer.print_warning error_message('unable to determine actual version')
@@ -24,27 +20,27 @@ module FluentCommandBuilder
24
20
 
25
21
  unless is_valid?
26
22
  message = error_message actual_version.to_s(expected_version.to_a.length)
27
- warn_only? ? @printer.print_warning(message) : @printer.print_error(message)
28
- raise message unless warn_only?
23
+
24
+ case validation_level
25
+ when :warn
26
+ @printer.print_warning message
27
+ when :fatal
28
+ @printer.print_error message
29
+ abort
30
+ else
31
+ @printer.print_warning %Q[Version validation failed. Validation level "#{validation_level}" is not supported.]
32
+ end
29
33
  end
30
34
  end
31
35
 
32
36
  private
33
37
 
34
- def enabled?
35
- @options[:enabled]
36
- end
37
-
38
- def warn_only?
39
- @options[:warn_only]
40
- end
41
-
42
38
  def is_valid?
43
39
  actual_version.to_a.first(expected_version.to_a.length) == expected_version.to_a
44
40
  end
45
41
 
46
42
  def expected_version
47
- @expected_version ||= Version.new(@expected_version_string)
43
+ @expected_version ||= Version.new(expected_version_string)
48
44
  end
49
45
 
50
46
  def actual_version
@@ -52,7 +48,23 @@ module FluentCommandBuilder
52
48
  end
53
49
 
54
50
  def error_message(actual_version)
55
- %Q[Version validation for command "#{@command_name}" failed. Expected version #{expected_version} but was #{actual_version}.]
51
+ %Q[Version validation for command "#{command_name}" failed. Expected version #{expected_version} but was #{actual_version}.]
52
+ end
53
+
54
+ def path
55
+ @command_builder_config.path
56
+ end
57
+
58
+ def command_name
59
+ @command_builder_config.command_name
60
+ end
61
+
62
+ def expected_version_string
63
+ @command_builder_config.version
64
+ end
65
+
66
+ def version_detector
67
+ @command_builder_config.version_detector
56
68
  end
57
69
 
58
70
  end
@@ -1,3 +1,7 @@
1
+ Dir[File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/version_detectors/*.rb')].each { |f| require f }
2
+ Dir[File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_executors/*.rb')].each { |f| require f }
3
+ Dir[File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_formatters/*.rb')].each { |f| require f }
4
+ require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/path_finder')
1
5
  require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/appcfg_python.rb')
2
6
  require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/appcfg_python_16.rb')
3
7
  require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/appcfg_python_17.rb')
@@ -46,6 +50,7 @@ require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/comma
46
50
  require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/rake_09.rb')
47
51
  require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/security_osx.rb')
48
52
  require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/security_osx_107.rb')
53
+ require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/security_osx_108.rb')
49
54
  require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/sevenzip.rb')
50
55
  require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/sevenzip_920.rb')
51
56
  require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/simian.rb')
@@ -58,7 +63,3 @@ require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/comma
58
63
  require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/xcodebuild.rb')
59
64
  require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/xcodebuild_43.rb')
60
65
  require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_builders/xcodebuild_44.rb')
61
- Dir[File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/version_detectors/*.rb')].each { |f| require f }
62
- Dir[File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_executors/*.rb')].each { |f| require f }
63
- Dir[File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/command_formatters/*.rb')].each { |f| require f }
64
- require File.expand_path(File.dirname(__FILE__) + '/fluent_command_builder/path_finder')
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.11
4
+ version: 0.8.12
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-09-16 00:00:00.000000000 Z
12
+ date: 2012-09-20 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake
16
- requirement: &70213703390440 !ruby/object:Gem::Requirement
16
+ requirement: &70319504655360 !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: *70213703390440
24
+ version_requirements: *70319504655360
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: term-ansicolor
27
- requirement: &70213703390000 !ruby/object:Gem::Requirement
27
+ requirement: &70319504654920 !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: *70213703390000
35
+ version_requirements: *70319504654920
36
36
  description: Fluent Command Builder makes building command lines easy and clean.
37
37
  email: matthew-github@matthewriley.name
38
38
  executables: []
@@ -41,7 +41,7 @@ extra_rdoc_files: []
41
41
  files:
42
42
  - lib/fluent_command_builder/argument_formatter.rb
43
43
  - lib/fluent_command_builder/command_base.rb
44
- - lib/fluent_command_builder/command_builder_factory.rb
44
+ - lib/fluent_command_builder/command_builder_config.rb
45
45
  - lib/fluent_command_builder/command_builders/appcfg_python.rb
46
46
  - lib/fluent_command_builder/command_builders/appcfg_python_16.rb
47
47
  - lib/fluent_command_builder/command_builders/appcfg_python_17.rb
@@ -90,6 +90,7 @@ files:
90
90
  - lib/fluent_command_builder/command_builders/rake_09.rb
91
91
  - lib/fluent_command_builder/command_builders/security_osx.rb
92
92
  - lib/fluent_command_builder/command_builders/security_osx_107.rb
93
+ - lib/fluent_command_builder/command_builders/security_osx_108.rb
93
94
  - lib/fluent_command_builder/command_builders/sevenzip.rb
94
95
  - lib/fluent_command_builder/command_builders/sevenzip_920.rb
95
96
  - lib/fluent_command_builder/command_builders/simian.rb
@@ -109,7 +110,6 @@ files:
109
110
  - lib/fluent_command_builder/command_executors/system_executor.rb
110
111
  - lib/fluent_command_builder/command_formatters/hidden_password_formatter.rb
111
112
  - lib/fluent_command_builder/command_formatters/null_formatter.rb
112
- - lib/fluent_command_builder/default_path_validator.rb
113
113
  - lib/fluent_command_builder/execution_context.rb
114
114
  - lib/fluent_command_builder/path_finder.rb
115
115
  - lib/fluent_command_builder/path_finders/unix_path_finder.rb
@@ -1,43 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/printer')
2
- require File.expand_path(File.dirname(__FILE__) + '/version')
3
-
4
- module FluentCommandBuilder
5
- class CommandBuilderFactory
6
-
7
- def initialize(command_module)
8
- @command_module = command_module
9
- @printer = Printer.new
10
- end
11
-
12
- def create(&block)
13
- validate_version
14
-
15
- begin
16
- version_module.create &block
17
- rescue
18
- message = %Q[Builder for command "#{@command_module::COMMAND_NAME}", version "#{version.to_s(2)}" does not exist. Please consider contributing.]
19
- @printer.print_error message
20
- raise message
21
- end
22
- end
23
-
24
- private
25
-
26
- def validate_version
27
- unless version
28
- message = %Q[Failed to create builder for command "#{@command_module::COMMAND_NAME}". Unable to determine required version.]
29
- @printer.print_error message
30
- raise message
31
- end
32
- end
33
-
34
- def version
35
- @version ||= Version.version_or_nil(@command_module.version)
36
- end
37
-
38
- def version_module
39
- eval "#{@command_module.name}::V#{version.compact}"
40
- end
41
-
42
- end
43
- end