Class: Gem::Tasks

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/tasks.rb,
lib/rubygems/tasks/scm.rb,
lib/rubygems/tasks/push.rb,
lib/rubygems/tasks/sign.rb,
lib/rubygems/tasks/task.rb,
lib/rubygems/tasks/build.rb,
lib/rubygems/tasks/console.rb,
lib/rubygems/tasks/install.rb,
lib/rubygems/tasks/project.rb,
lib/rubygems/tasks/release.rb,
lib/rubygems/tasks/scm/tag.rb,
lib/rubygems/tasks/printing.rb,
lib/rubygems/tasks/scm/push.rb,
lib/rubygems/tasks/sign/pgp.rb,
lib/rubygems/tasks/build/gem.rb,
lib/rubygems/tasks/build/tar.rb,
lib/rubygems/tasks/build/zip.rb,
lib/rubygems/tasks/sign/task.rb,
lib/rubygems/tasks/build/task.rb,
lib/rubygems/tasks/scm/status.rb,
lib/rubygems/tasks/sign/checksum.rb

Overview

Defines basic Rake tasks for managing and releasing projects:

Defined Under Namespace

Modules: Printing Classes: Build, Console, Install, Project, Push, Release, SCM, Sign, Task

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(build: {}, scm: {}, sign: {}, console: true, install: true, push: true, release: true) {|tasks| ... } ⇒ Tasks

Initializes the project tasks.

Examples:

Enables building of .gem and .tar.gz packages:

Gem::Tasks.new(build: {gem: true, tar: true})

Disables pushing .gem packages to rubygems.org:

Gem::Tasks.new(push: false)

Configures the version tag format:

Gem::Tasks.new do |tasks|
  tasks.scm.tag.format = "release-%s"
end

Options Hash (build:):

  • :gem (Boolean) — default: true

    Enables or disables the build:gem task.

  • :tar (Boolean)

    Enables or disables the build:tar task.

  • :zip (Boolean)

    Enables or disables the build:zip task.

Options Hash (scm:):

  • :status (Boolean) — default: true

    Enables or disables the scm:status task.

  • :tag (Boolean) — default: true

    Enables or disables the scm:tag task.

  • :push (Boolean) — default: true

    Enables or disables the scm:push task.

Options Hash (sign:):

  • :checksum (Boolean)

    Enables or disables the sign:checksum task.

  • :pgp (Boolean)

    Enables or disables the sign:pgp task.

Yields:

  • (tasks)

    If a block is given, it will be passed the newly created tasks, before they are fully defined.

Yield Parameters:

  • tasks (Tasks)

    The newly created tasks.



128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/rubygems/tasks.rb', line 128

def initialize(build:   {},
               scm:     {},
               sign:    {},
               console: true,
               install: true,
               push:    true,
               release: true)
  @scm   = SCM.new(**scm)
  @build = Build.new(**build)
  @sign  = Sign.new(**sign)

  @console = (Console.new if console)
  @install = (Install.new if install)
  @push    = (Push.new    if push)
  @release = (Release.new if release)

  yield self if block_given?
end

Instance Attribute Details

#buildBuild (readonly)

The build:* tasks.



35
36
37
# File 'lib/rubygems/tasks.rb', line 35

def build
  @build
end

#consoleObject (readonly)

The console task.



48
49
50
# File 'lib/rubygems/tasks.rb', line 48

def console
  @console
end

#installObject (readonly)

The install task.



51
52
53
# File 'lib/rubygems/tasks.rb', line 51

def install
  @install
end

#pushObject (readonly)

The push task.



54
55
56
# File 'lib/rubygems/tasks.rb', line 54

def push
  @push
end

#releaseObject (readonly)

The release task.



57
58
59
# File 'lib/rubygems/tasks.rb', line 57

def release
  @release
end

#scmSCM (readonly)

The scm:* tasks.



40
41
42
# File 'lib/rubygems/tasks.rb', line 40

def scm
  @scm
end

#signSign (readonly)

The sign:* tasks.



45
46
47
# File 'lib/rubygems/tasks.rb', line 45

def sign
  @sign
end