Class: EY::Serverside::LockfileParser::Parse106

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

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



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/engineyard-serverside/lockfile_parser.rb', line 74

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

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

  result = meta_section.scan(/^\s*version:\s*(.*)$/).first
  bundler_version = result ? result.first : nil
  [:bundler10, bundler_version]
end