class Gem::Tasks::Console
The ‘console` task.
def console(name=nil)
-
(Array
-)
Parameters:
-
name
(Symbol, String
) --
def console(name=nil) gemspec = @project.gemspec(name) arguments = [@command] # add -I options for lib/ or ext/ directories arguments.push(*gemspec.require_paths.map { |dir| "-I#{dir}" }) # 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
def define
Defines the `console` task.
def define @project.gemspecs.each_key do |name| namespace :console do task(name) { console(name) } end end desc "Spawns an Interactive Ruby Console" task :console => "console:#{@project.primary_gemspec}" end
def initialize(options={})
(**options)
-
:options
(Array
) -- -
:command
(String, Array
) --
Parameters:
-
options
(Hash
) --
def initialize(options={}) super() @command = options.fetch(:command,DEFAULT_COMMAND) @options = Array(options[:options]) yield self if block_given? define end