Class: EY::Serverside::LockfileParser::Parse10

Inherits:
Parse09 show all
Defined in:
lib/engineyard-serverside/lockfile_parser.rb

Direct Known Subclasses

Parse106

Instance Method Summary collapse

Methods inherited from Parse09

#safe_yaml_load

Methods inherited from BaseParser

#initialize

Constructor Details

This class inherits a constructor from EY::Serverside::LockfileParser::BaseParser

Instance Method Details

#parseObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/engineyard-serverside/lockfile_parser.rb', line 46

def parse
  unless @contents.index(/^DEPENDENCIES/)
    return super
  end
  dep_section = ""
  in_dependencies_section = false
  @contents.each_line do |line|
    if line =~ /^DEPENDENCIES/
      in_dependencies_section = true
    elsif line =~ /^\S/
      in_dependencies_section = false
    elsif in_dependencies_section
      dep_section << line
    end
  end

  unless dep_section.length > 0
    raise "Couldn't parse #{@contents}; exiting"
    exit(1)
  end

  result = dep_section.scan(/^\s*bundler\s*\(=\s*([^\)]+)\)/).first
  bundler_version = result ? result.first : nil
  [:bundler10, bundler_version]
end