Class: Bundler::Dsl::DSLError

### Home Classes Methods

### In Files

- lib/bundler/dsl.rb

### Parent

Bundler::GemfileError

### Methods

- ::new
- #contents
- #status_code
- #to_s

### 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::Dsl::DSLError

### Attributes

backtrace[R]

@return [Exception] the backtrace of the exception raised by the

    evaluation of the dsl file.

description[R]

@return [String] the description that should be presented to the user.

dsl_path[R]

@return [String] the path of the dsl file that raised the exception.

### Public Class Methods

new(description, dsl_path, backtrace, contents = nil) click to toggle source

@param [Exception] backtrace @see backtrace @param [String] dsl_path @see dsl_path

    # File lib/bundler/dsl.rb, line 385
    def initialize(description, dsl_path, backtrace, contents = nil)
      @status_code = $!.respond_to?(:status_code) && $!.status_code

      @description = description
      @dsl_path    = dsl_path
      @backtrace   = backtrace
      @contents    = contents
    end

### Public Instance Methods

contents() click to toggle source

@return [String] the contents of the DSL that cause the exception to

    be raised.

    # File lib/bundler/dsl.rb, line 401
    def contents
      @contents ||= begin
        dsl_path && File.exist?(dsl_path) && File.read(dsl_path)
      end
    end

status_code() click to toggle source

    # File lib/bundler/dsl.rb, line 394
    def status_code
      @status_code || super
    end

to_s() click to toggle source

The message of the exception reports the content of podspec for the line that generated the original exception.

@example Output

    Invalid podspec at `RestKit.podspec` - undefined method
    `exclude_header_search_paths=' for #<Pod::Specification for
    `RestKit/Network (0.9.3)`>

        from spec-repos/master/RestKit/0.9.3/RestKit.podspec:36
        -------------------------------------------
            # because it would break: #import <CoreData/CoreData.h>
     >      ns.exclude_header_search_paths = 'Code/RestKit.h'
          end
        -------------------------------------------

@return [String] the message of the exception.

    # File lib/bundler/dsl.rb, line 425
    def to_s
      @to_s ||= begin
        trace_line, description = parse_line_number_from_description

        m = "\n[!] "
        m << description
        m << ". Bundler cannot continue.\n"

        return m unless backtrace && dsl_path && contents

        trace_line = backtrace.find { |l| l.include?(dsl_path.to_s) } || trace_line
        return m unless trace_line
        line_numer = trace_line.split(':')[1].to_i - 1
        return m unless line_numer

        lines      = contents.lines.to_a
        indent     = ' #  '
        indicator  = indent.gsub('#', '>')
        first_line = (line_numer.zero?)
        last_line  = (line_numer == (lines.count - 1))

        m << "\n"
        m << "#{indent}from #{trace_line.gsub(/:in.*$/, '')}\n"
        m << "#{indent}-------------------------------------------\n"
        m << "#{indent}#{    lines[line_numer - 1] }" unless first_line
        m << "#{indicator}#{ lines[line_numer] }"
        m << "#{indent}#{    lines[line_numer + 1] }" unless last_line
        m << "\n" unless m.end_with?("\n")
        m << "#{indent}-------------------------------------------\n"
      end
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.