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

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

Constant Summary

Constants inherited from Parse10

EY::Serverside::LockfileParser::Parse10::DEFAULT

Constants inherited from Parse09

EY::Serverside::LockfileParser::Parse09::DEFAULT

Instance Method Summary collapse

Methods inherited from Parse10

#fetch_version, #scan_bundler

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



101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/engineyard-serverside/lockfile_parser.rb', line 101

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 : DEFAULT
  [:bundler10, bundler_version]
end