class Gem::Tasks::Console

def console(name=nil)

Returns:
  • (Array) -

Parameters:
  • name (Symbol, String) --
def console(name=nil)
  gemspec = @project.gemspec(name)
  require_paths = gemspec.require_paths
  require_file  = gemspec.files.find { |path| path.start_with?('lib/') }
  arguments = [@command]
  # add -I options for lib/ or ext/ directories
  arguments.push(*require_paths.map { |dir| "-I#{dir}" })
  # add a -rrubygems to explicitly load rubygems on Ruby 1.8
  arguments.push('-rrubygems') if RUBY_VERSION < '1.9'
  # add an -r option to require the library
  arguments.push('-r' + require_file.sub('lib/','')) if require_file
  # push on additional options
  arguments.push(*@options)
  if @project.bundler?
    # use `bundle console` unless were were using custom command/options
    if (@command == DEFAULT_CONSOLE && @options.empty?)
      arguments = ['bundle', 'console']
    else
      arguments.unshift('bundle', 'exec')
    end
  end
  return run(*arguments)
end