# File lib/bundler/definition.rb, line 15
    def self.from_lock(lockfile)
      begin
        locked_definition = Locked.new(YAML.load_file(lockfile))
      rescue ArgumentError
        raise GemfileError, "Your Gemfile.lock was generated by Bundler 0.10.\n" +
          "You must delete it if you wish to use Bundler 0.9."
      end

      hash = Digest::SHA1.hexdigest(File.read("#{Bundler.root}/Gemfile"))
      unless locked_definition.hash == hash
        raise GemfileChanged, "You changed your Gemfile after locking. Please relock using `bundle lock`"
      end

      locked_definition
    end