Class Capistrano::Deploy::Strategy::Base
In: lib/capistrano/recipes/deploy/strategy/base.rb
lib/capistrano/recipes/deploy/strategy/base.rb
Parent: Object

This class defines the abstract interface for all Capistrano deployment strategies. Subclasses must implement at least the deploy! method.

Methods

check!   check!   deploy!   deploy!   method_missing   method_missing   new   new   system   system  

Attributes

configuration  [R] 
configuration  [R] 

Public Class methods

Instantiates a strategy with a reference to the given configuration.

[Source]

    # File lib/capistrano/recipes/deploy/strategy/base.rb, line 14
14:         def initialize(config={})
15:           @configuration = config
16:         end

Instantiates a strategy with a reference to the given configuration.

[Source]

    # File lib/capistrano/recipes/deploy/strategy/base.rb, line 14
14:         def initialize(config={})
15:           @configuration = config
16:         end

Public Instance methods

Performs a check on the remote hosts to determine whether everything is setup such that a deploy could succeed.

[Source]

    # File lib/capistrano/recipes/deploy/strategy/base.rb, line 29
29:         def check!
30:           Dependencies.new(configuration) do |d|
31:             d.remote.directory(configuration[:releases_path]).or("`#{configuration[:releases_path]}' does not exist. Please run `cap deploy:setup'.")
32:             d.remote.writable(configuration[:deploy_to]).or("You do not have permissions to write to `#{configuration[:deploy_to]}'.")
33:             d.remote.writable(configuration[:releases_path]).or("You do not have permissions to write to `#{configuration[:releases_path]}'.")
34:           end
35:         end

Performs a check on the remote hosts to determine whether everything is setup such that a deploy could succeed.

[Source]

    # File lib/capistrano/recipes/deploy/strategy/base.rb, line 29
29:         def check!
30:           Dependencies.new(configuration) do |d|
31:             d.remote.directory(configuration[:releases_path]).or("`#{configuration[:releases_path]}' does not exist. Please run `cap deploy:setup'.")
32:             d.remote.writable(configuration[:deploy_to]).or("You do not have permissions to write to `#{configuration[:deploy_to]}'.")
33:             d.remote.writable(configuration[:releases_path]).or("You do not have permissions to write to `#{configuration[:releases_path]}'.")
34:           end
35:         end

Executes the necessary commands to deploy the revision of the source code identified by the revision variable. Additionally, this should write the value of the revision variable to a file called REVISION, in the base of the deployed revision. This file is used by other tasks, to perform diffs and such.

[Source]

    # File lib/capistrano/recipes/deploy/strategy/base.rb, line 23
23:         def deploy!
24:           raise NotImplementedError, "`deploy!' is not implemented by #{self.class.name}"
25:         end

Executes the necessary commands to deploy the revision of the source code identified by the revision variable. Additionally, this should write the value of the revision variable to a file called REVISION, in the base of the deployed revision. This file is used by other tasks, to perform diffs and such.

[Source]

    # File lib/capistrano/recipes/deploy/strategy/base.rb, line 23
23:         def deploy!
24:           raise NotImplementedError, "`deploy!' is not implemented by #{self.class.name}"
25:         end

Protected Instance methods

This is to allow helper methods like "run" and "put" to be more easily accessible to strategy implementations.

[Source]

    # File lib/capistrano/recipes/deploy/strategy/base.rb, line 41
41:           def method_missing(sym, *args, &block)
42:             if configuration.respond_to?(sym)
43:               configuration.send(sym, *args, &block)
44:             else
45:               super
46:             end
47:           end

This is to allow helper methods like "run" and "put" to be more easily accessible to strategy implementations.

[Source]

    # File lib/capistrano/recipes/deploy/strategy/base.rb, line 41
41:           def method_missing(sym, *args, &block)
42:             if configuration.respond_to?(sym)
43:               configuration.send(sym, *args, &block)
44:             else
45:               super
46:             end
47:           end

A wrapper for Kernel#system that logs the command being executed.

[Source]

    # File lib/capistrano/recipes/deploy/strategy/base.rb, line 50
50:           def system(*args)
51:             logger.trace "executing locally: #{args.join(' ')}"
52:             super
53:           end

A wrapper for Kernel#system that logs the command being executed.

[Source]

    # File lib/capistrano/recipes/deploy/strategy/base.rb, line 50
50:           def system(*args)
51:             logger.trace "executing locally: #{args.join(' ')}"
52:             super
53:           end

[Validate]