Class: FluentCommandBuilder::DotNetFrameworkVersionDetector
- Inherits:
-
Object
- Object
- FluentCommandBuilder::DotNetFrameworkVersionDetector
- Defined in:
- lib/fluent_command_builder/version_detectors/dot_net_framework_version_detector.rb
Instance Attribute Summary collapse
-
#backticks_executor ⇒ Object
Returns the value of attribute backticks_executor.
-
#path_finder ⇒ Object
Returns the value of attribute path_finder.
Instance Method Summary collapse
-
#initialize ⇒ DotNetFrameworkVersionDetector
constructor
A new instance of DotNetFrameworkVersionDetector.
- #version(path = nil) ⇒ Object
Constructor Details
#initialize ⇒ DotNetFrameworkVersionDetector
Returns a new instance of DotNetFrameworkVersionDetector.
8 9 10 11 |
# File 'lib/fluent_command_builder/version_detectors/dot_net_framework_version_detector.rb', line 8 def initialize @path_finder = FluentCommandBuilder.path_finder @backticks_executor = BackticksExecutor.new end |
Instance Attribute Details
#backticks_executor ⇒ Object
Returns the value of attribute backticks_executor.
6 7 8 |
# File 'lib/fluent_command_builder/version_detectors/dot_net_framework_version_detector.rb', line 6 def backticks_executor @backticks_executor end |
#path_finder ⇒ Object
Returns the value of attribute path_finder.
6 7 8 |
# File 'lib/fluent_command_builder/version_detectors/dot_net_framework_version_detector.rb', line 6 def path_finder @path_finder end |
Instance Method Details
#version(path = nil) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/fluent_command_builder/version_detectors/dot_net_framework_version_detector.rb', line 13 def version(path=nil) path ||= @path_finder.find_path 'msbuild' return unless path && File.exist?(path) Dir.chdir path do command = 'msbuild /version' output = @backticks_executor.execute command output.scan(/\[Microsoft .NET Framework, Version (.+)\]/).first end end |