Class: FluentCommandBuilder::AppEnginePythonVersionDetector

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_name) ⇒ AppEnginePythonVersionDetector

Returns a new instance of AppEnginePythonVersionDetector.



9
10
11
12
# File 'lib/fluent_command_builder/version_detectors/appengine_python_version_detector.rb', line 9

def initialize(command_name)
  @command_name = command_name
  @path_finder = FluentCommandBuilder.path_finder
end

Instance Attribute Details

#path_finderObject

Returns the value of attribute path_finder.



7
8
9
# File 'lib/fluent_command_builder/version_detectors/appengine_python_version_detector.rb', line 7

def path_finder
  @path_finder
end

Instance Method Details

#version(path = nil) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/fluent_command_builder/version_detectors/appengine_python_version_detector.rb', line 14

def version(path=nil)
  path ||= @path_finder.find_path @command_name
  return unless path && File.exist?(path)
  version_file = File.join path, 'VERSION'
  version_hash = YAML::load_file version_file
  version_hash['release']
end