class Gem::Tasks::Task
Attributes
Project metadata.
@return [Project]
Public Class Methods
Initializes the task.
# File lib/rubygems/tasks/task.rb, line 22 def initialize @project = Project.directories[Dir.pwd] end
Protected Instance Methods
Runs a `bundle` command.
@param [String] command
The `bundle` command to run.
@param [Array<String>] arguments
Additional arguments for the command.
@return [Boolean]
Specifies whether the command was successful.
@api semipublic
# File lib/rubygems/tasks/task.rb, line 87 def bundle(command,*arguments) run 'bundler', command, *arguments end
Runs a `gem` command.
@param [String] command
The `gem` command to run.
@param [Array<String>] arguments
Additional arguments for the command.
@return [Boolean]
Specifies whether the command was successful.
@api semipublic
# File lib/rubygems/tasks/task.rb, line 69 def gem(command,*arguments) run 'gem', command, *arguments end
Defines a task that will execute tasks for each gemspec.
@param [Symbol, String] name
The name for the task.
@api semipublic
# File lib/rubygems/tasks/task.rb, line 147 def gemspec_tasks(name) multi_task name, @project.gemspecs.keys end
Explicitly invokes a task.
@param [Symbol, String] name
The name of the task.
@api semipublic
@since 0.2.2
# File lib/rubygems/tasks/task.rb, line 116 def invoke(name) Rake.application[name].invoke end
Defines a task that will invoke one or all of the specifies tasks within the namespace.
@param [String] prefix
The namespace of the sub-tasks to call.
@param [Array<Symbol>] names
The names of the sub-tasks.
@example
gemspec_tasks 'pkg:tar'
@api semipublic
# File lib/rubygems/tasks/task.rb, line 135 def multi_task(prefix,names) task prefix => names.map { |name| "#{prefix}:#{name}" } end
Runs a command.
@param [String] command
The command to run.
@param [Array<String>] arguments
Additional arguments for the command.
@return [Boolean]
Specifies whether the command was successful.
@api semipublic
# File lib/rubygems/tasks/task.rb, line 42 def run(command,*arguments) show_command = [command, *arguments].join(' ') debug show_command unless system(command,*arguments) error "Command failed: #{show_command}" abort end return true end
Determines if a task was defined.
@param [Symbol, String] name
The task name to search for.
@return [Boolean]
Specifies whether the task was defined.
@api semipublic
# File lib/rubygems/tasks/task.rb, line 102 def task?(name) Rake::Task.task_defined?(name) end