Class: FluentCommandBuilder::DotNetFrameworkVersionDetector

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent_command_builder/version_detectors/dot_net_framework_version_detector.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDotNetFrameworkVersionDetector

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_executorObject

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_finderObject

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