Class: Bundler::LockfileParser

### Home Classes Methods

### In Files

- lib/bundler/lockfile_parser.rb

### Parent

Object

### Methods

- ::new
- #warn_for_outdated_bundler_version

### Files

- bundle
- bundle-config
- bundle-config.txt
- bundle-exec
- bundle-exec.txt
- bundle-install
- bundle-install.txt
- bundle-package
- bundle-package.txt
- bundle-platform
- bundle-platform.txt
- bundle-update
- bundle-update.txt
- bundle.txt
- gemfile.5.txt
- Executable
- Gemfile

### Class/Module Index

Quicksearch

- Bundler
- Bundler::BundlerError
- Bundler::CLI
- Bundler::CLI::Binstubs
- Bundler::CLI::Cache
- Bundler::CLI::Check
- Bundler::CLI::Clean
- Bundler::CLI::Common
- Bundler::CLI::Config
- Bundler::CLI::Console
- Bundler::CLI::Exec
- Bundler::CLI::Gem
- Bundler::CLI::Init
- Bundler::CLI::Inject
- Bundler::CLI::Install
- Bundler::CLI::Lock
- Bundler::CLI::Open
- Bundler::CLI::Outdated
- Bundler::CLI::Package
- Bundler::CLI::Platform
- Bundler::CLI::Show
- Bundler::CLI::Update
- Bundler::CLI::Viz
- Bundler::CurrentRuby
- Bundler::CyclicDependencyError
- Bundler::Definition
- Bundler::DepProxy
- Bundler::Dependency
- Bundler::Deployment
- Bundler::Deprecate
- Bundler::DeprecatedError
- Bundler::Dsl
- Bundler::Dsl::DSLError
- Bundler::EndpointSpecification
- Bundler::Env
- Bundler::Environment
- Bundler::Fetcher
- Bundler::Fetcher::AuthenticationRequiredError
- Bundler::Fetcher::BadAuthenticationError
- Bundler::Fetcher::Base
- Bundler::Fetcher::CertificateFailureError
- Bundler::Fetcher::Dependency
- Bundler::Fetcher::Downloader
- Bundler::Fetcher::FallbackError
- Bundler::Fetcher::Index
- Bundler::Fetcher::NetworkDownError
- Bundler::Fetcher::SSLError
- Bundler::GemHelper
- Bundler::GemHelpers
- Bundler::GemInstaller
- Bundler::GemNotFound
- Bundler::GemfileError
- Bundler::GemfileLockNotFound
- Bundler::GemfileNotFound
- Bundler::GemspecError
- Bundler::GitError
- Bundler::Graph
- Bundler::Graph::GraphVizClient
- Bundler::HTTPError
- Bundler::Index
- Bundler::Injector
- Bundler::InstallError
- Bundler::InstallHookError
- Bundler::Installer
- Bundler::InvalidOption
- Bundler::LazySpecification
- Bundler::LockfileError
- Bundler::LockfileParser
- Bundler::MarshalError
- Bundler::MatchPlatform
- Bundler::Molinillo
- Bundler::Molinillo::CircularDependencyError
- Bundler::Molinillo::DependencyGraph
- Bundler::Molinillo::DependencyGraph::Vertex
- Bundler::Molinillo::DependencyState
- Bundler::Molinillo::NoSuchDependencyError
- Bundler::Molinillo::PossibilityState
- Bundler::Molinillo::Resolver
- Bundler::Molinillo::Resolver::Resolution
- Bundler::Molinillo::ResolverError
- Bundler::Molinillo::SpecificationProvider
- Bundler::Molinillo::UI
- Bundler::Molinillo::VersionConflict
- Bundler::PathError
- Bundler::ProductionError
- Bundler::RemoteSpecification
- Bundler::Resolver
- Bundler::Resolver::Molinillo
- Bundler::Resolver::Molinillo::VersionConflict
- Bundler::Resolver::SpecGroup
- Bundler::Retry
- Bundler::RubyDsl
- Bundler::RubyVersion
- Bundler::RubyVersionMismatch
- Bundler::RubygemsIntegration
- Bundler::RubygemsIntegration::AlmostModern
- Bundler::RubygemsIntegration::Ancient
- Bundler::RubygemsIntegration::Future
- Bundler::RubygemsIntegration::Gem
- Bundler::RubygemsIntegration::Legacy
- Bundler::RubygemsIntegration::Legacy::Gem::SourceIndex
- Bundler::RubygemsIntegration::Modern
- Bundler::RubygemsIntegration::MoreFuture
- Bundler::RubygemsIntegration::MoreModern
- Bundler::RubygemsIntegration::Transitional
- Bundler::Runtime
- Bundler::SecurityError
- Bundler::Settings
- Bundler::SharedHelpers
- Bundler::SimilarityDetector
- Bundler::Source
- Bundler::Source::Git
- Bundler::Source::Git::GitCommandError
- Bundler::Source::Git::GitNotAllowedError
- Bundler::Source::Git::GitNotInstalledError
- Bundler::Source::Git::GitProxy
- Bundler::Source::Path
- Bundler::Source::Path::Installer
- Bundler::Source::Rubygems
- Bundler::Source::Rubygems::Remote
- Bundler::SourceList
- Bundler::SpecSet
- Bundler::StubSpecification
- Bundler::SystemRubyVersion
- Bundler::Thor
- Bundler::Thor::Actions
- Bundler::Thor::Actions::ClassMethods
- Bundler::Thor::AmbiguousCommandError
- Bundler::Thor::Base
- Bundler::Thor::Base::ClassMethods
- Bundler::Thor::Command
- Bundler::Thor::DynamicCommand
- Bundler::Thor::Error
- Bundler::Thor::Group
- Bundler::Thor::HiddenCommand
- Bundler::Thor::Invocation
- Bundler::Thor::Invocation::ClassMethods
- Bundler::Thor::InvocationError
- Bundler::Thor::LineEditor
- Bundler::Thor::LineEditor::Basic
- Bundler::Thor::LineEditor::Readline
- Bundler::Thor::LineEditor::Readline::PathCompletion
- Bundler::Thor::MalformattedArgumentError
- Bundler::Thor::RakeCompat
- Bundler::Thor::RequiredArgumentMissingError
- Bundler::Thor::Shell
- Bundler::Thor::Shell::Basic
- Bundler::Thor::Shell::Color
- Bundler::Thor::Shell::HTML
- Bundler::Thor::UndefinedCommandError
- Bundler::Thor::UnknownArgumentError
- Bundler::Thor::Util
- Bundler::UI
- Bundler::UI::RGProxy
- Bundler::UI::Shell
- Bundler::UI::Silent
- Bundler::VersionConflict
- Bundler::Worker
- Bundler::Worker::WrappedException
- Gem
- Gem::Dependency
- Gem::Platform
- Gem::Requirement
- Gem::Specification
- Net
- Net::HTTP
- Net::HTTP::Persistent
- Net::HTTP::Persistent::Error
- Net::HTTP::Persistent::SSLReuse
- ParallelInstaller
- ParallelInstaller::SpecInstallation
- Object

No matching classes.

# Bundler::LockfileParser

### Constants

BUNDLED
DEPENDENCIES
GEM
GIT
NAME_VERSION
NAME_VERSION_2
NAME_VERSION_4
NAME_VERSION_6
OPTIONS
PATH
PLATFORMS
SOURCE
SPECS
TYPES

### Attributes

bundler_version[R]
dependencies[R]
platforms[R]
sources[R]
specs[R]

### Public Class Methods

new(lockfile) click to toggle source

    # File lib/bundler/lockfile_parser.rb, line 27
    def initialize(lockfile)
      @platforms    = []
      @sources      = []
      @dependencies = []
      @state        = nil
      @specs        = {}

      @rubygems_aggregate = Source::Rubygems.new

      if lockfile.match(/<<<<<<<|=======|>>>>>>>|\|\|\|\|\|\|\|/)
        raise LockfileError, "Your Gemfile.lock contains merge conflicts.\n"            "Run `git checkout HEAD -- Gemfile.lock` first to get a clean lock."
      end

      lockfile.split(/(?:\r?\n)+/).each do |line|
        if SOURCE.include?(line)
          @state = :source
          parse_source(line)
        elsif line == DEPENDENCIES
          @state = :dependency
        elsif line == PLATFORMS
          @state = :platform
        elsif line == BUNDLED
          @state = :bundled_with
        elsif line =~ /^[^\s]/
          @state = nil
        elsif @state
          send("parse_#{@state}", line)
        end
      end
      @sources << @rubygems_aggregate
      @specs = @specs.values
      warn_for_outdated_bundler_version
    rescue ArgumentError => e
      Bundler.ui.debug(e)
      raise LockfileError, "Your lockfile is unreadable. Run `rm Gemfile.lock` "          "and then `bundle install` to generate a new lockfile."
    end

### Public Instance Methods

warn_for_outdated_bundler_version() click to toggle source

    # File lib/bundler/lockfile_parser.rb, line 66
    def warn_for_outdated_bundler_version
      return unless bundler_version
      prerelease_text = bundler_version.prerelease? ? " --pre" : ""
      current_version = Gem::Version.create(Bundler::VERSION)
      case current_version.segments.first <=> bundler_version.segments.first
      when -1
        raise LockfileError, "You must use Bundler #{bundler_version.segments.first} or greater with this lockfile."
      when 0
        if current_version < bundler_version
          Bundler.ui.warn "Warning: the running version of Bundler is older "                 "than the version that created the lockfile. We suggest you "                 "upgrade to the latest version of Bundler by running `gem "                 "install bundler#{prerelease_text}`.\n"
        end
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.