class Capistrano::Distribution

A list of distributors to run.

Constants

VERSION

The release version of this gem.

Attributes

context[R]

The Capistrano context object.

distributors[R]

The list of distributors.

Public Class Methods

new(context) click to toggle source

Creates the list of distributors to run based on the definition found in the :distribution key of context. The value associated the distribution can be 1 of 3 types:

  • String

  • Array of Arrays of distributor initialization arguments

  • Array of distributor instances

@param context [{#fetch, repo_path, release_path}] a Capistrano deployment

context.

@return [Distribution] an instance of this class.

# File lib/capistrano/distribution.rb, line 27
def initialize(context)
  @context = context
  distributor_list = context.fetch(:distribution)

  case distributor_list
  when String
    distributor_list = [[distributor_list]]
  when Array
    unless distributor_list.all? { |distributor| Array === distributor }
      distributor_list = [distributor_list]
    end
  end

  @distributors = distributor_list.map do |distributor|
    Distributor.create(context, distributor)
  end
end

Public Instance Methods

check() click to toggle source

Calls the check method of each distributor in the list.

# File lib/capistrano/distribution.rb, line 53
def check
  distributors.all? { |distributor| distributor.check }
end
distribute() click to toggle source

Calls the distribute method of each distributor in the list.

# File lib/capistrano/distribution.rb, line 59
def distribute
  distributors.each { |distributor| distributor.distribute }
end
release_id() click to toggle source

An identifier for a release.

# File lib/capistrano/distribution.rb, line 47
def release_id
  context.fetch(:release_id)
end