Class: FluentCommandBuilder::CommandBuilderConfig
- Inherits:
-
Object
- Object
- FluentCommandBuilder::CommandBuilderConfig
- Defined in:
- lib/fluent_command_builder/internal/command_builder_config.rb
Instance Attribute Summary collapse
-
#command_name ⇒ Object
Returns the value of attribute command_name.
-
#is_windows ⇒ Object
Returns the value of attribute is_windows.
-
#path ⇒ Object
Returns the value of attribute path.
-
#path_validation_level ⇒ Object
Returns the value of attribute path_validation_level.
-
#path_validator ⇒ Object
Returns the value of attribute path_validator.
-
#version ⇒ Object
Returns the value of attribute version.
-
#version_detector ⇒ Object
Returns the value of attribute version_detector.
-
#version_validation_level ⇒ Object
Returns the value of attribute version_validation_level.
-
#version_validator ⇒ Object
Returns the value of attribute version_validator.
Instance Method Summary collapse
- #executable ⇒ Object
-
#initialize(command_name, version = nil) ⇒ CommandBuilderConfig
constructor
A new instance of CommandBuilderConfig.
- #validate_path ⇒ Object
- #validate_version ⇒ Object
Constructor Details
#initialize(command_name, version = nil) ⇒ CommandBuilderConfig
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 14 def initialize(command_name, version=nil) @path = nil @command_name = command_name @version = version @version_detector = DefaultVersionDetector.new command_name @path_validation_level = :fatal @version_validation_level = :fatal @path_validator = PathValidator.new self @version_validator = nil @is_windows = !ENV['WINDIR'].nil? end |
Instance Attribute Details
#command_name ⇒ Object
Returns the value of attribute command_name.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def command_name @command_name end |
#is_windows ⇒ Object
Returns the value of attribute is_windows.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def is_windows @is_windows end |
#path ⇒ Object
Returns the value of attribute path.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def path @path end |
#path_validation_level ⇒ Object
Returns the value of attribute path_validation_level.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def path_validation_level @path_validation_level end |
#path_validator ⇒ Object
Returns the value of attribute path_validator.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def path_validator @path_validator end |
#version ⇒ Object
Returns the value of attribute version.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def version @version end |
#version_detector ⇒ Object
Returns the value of attribute version_detector.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def version_detector @version_detector end |
#version_validation_level ⇒ Object
Returns the value of attribute version_validation_level.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def version_validation_level @version_validation_level end |
#version_validator ⇒ Object
Returns the value of attribute version_validator.
9 10 11 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9 def version_validator @version_validator end |
Instance Method Details
#executable ⇒ Object
37 38 39 40 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 37 def executable p = Path.new @path.to_s, @command_name p.normalised_path end |
#validate_path ⇒ Object
26 27 28 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 26 def validate_path @path_validator.validate end |
#validate_version ⇒ Object
30 31 32 33 34 35 |
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 30 def validate_version return unless @version v = @version_validator || VersionValidator.new(@command_name, @version_detector) p = Path.new @path v.validate @version, p.evaluated_path end |