Class: Capistrano::SCM Abstract

Inherits:
Object
  • Object
show all
Defined in:
lib/capistrano/scm.rb

Overview

This class is abstract.

Base class for SCM strategy providers.

Author:

  • Hartog de Mik

Defined Under Namespace

Classes: Git, Hg, Plugin, Svn

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, strategy) ⇒ SCM

Provide a wrapper for the SCM that loads a strategy for the user.

Parameters:

  • context (Rake)

    The context in which the strategy should run

  • strategy (Module)

    A module to include into the SCM instance. The module should provide the abstract methods of Capistrano::SCM



19
20
21
22
23
# File 'lib/capistrano/scm.rb', line 19

def initialize(context, strategy)
  @context = context
  singleton = class << self; self; end
  singleton.send(:include, strategy)
end

Instance Attribute Details

#contextRake (readonly)

Returns the current value of context.

Returns:

  • (Rake)

    the current value of context



10
11
12
# File 'lib/capistrano/scm.rb', line 10

def context
  @context
end

Instance Method Details

#checkBoolean

This method is abstract.

Your implementation should check if the specified remote-repository is available.

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


71
72
73
# File 'lib/capistrano/scm.rb', line 71

def check
  raise NotImplementedError, "Your SCM strategy module should provide a #check method"
end

#cloneObject

This method is abstract.

Create a (new) clone of the remote-repository on the deployment target

Returns:

  • void

Raises:

  • (NotImplementedError)


81
82
83
# File 'lib/capistrano/scm.rb', line 81

def clone
  raise NotImplementedError, "Your SCM strategy module should provide a #clone method"
end

#fetch(*args) ⇒ Object

Fetch a var from the context

Parameters:

  • variable (Symbol)

    The variable to fetch

  • default (Object)

    The default value if not found



49
50
51
# File 'lib/capistrano/scm.rb', line 49

def fetch(*args)
  context.fetch(*args)
end

#fetch_revisionObject

This method is abstract.

Identify the SHA of the commit that will be deployed. This will most likely involve SshKit’s capture method.

Returns:

  • void

Raises:

  • (NotImplementedError)


111
112
113
# File 'lib/capistrano/scm.rb', line 111

def fetch_revision
  raise NotImplementedError, "Your SCM strategy module should provide a #fetch_revision method"
end

#releaseObject

This method is abstract.

Copy the contents of the cache-repository onto the release path

Returns:

  • void

Raises:

  • (NotImplementedError)


101
102
103
# File 'lib/capistrano/scm.rb', line 101

def release
  raise NotImplementedError, "Your SCM strategy module should provide a #release method"
end

#release_pathObject

The release path according to the context



41
42
43
# File 'lib/capistrano/scm.rb', line 41

def release_path
  context.release_path
end

#repo_pathObject

The repository path according to the context



36
37
38
# File 'lib/capistrano/scm.rb', line 36

def repo_path
  context.repo_path
end

#repo_urlObject

The repository URL according to the context



31
32
33
# File 'lib/capistrano/scm.rb', line 31

def repo_url
  context.repo_url
end

#testBoolean

This method is abstract.

Your implementation should check the existence of a cache repository on the deployment target

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


60
61
62
# File 'lib/capistrano/scm.rb', line 60

def test
  raise NotImplementedError, "Your SCM strategy module should provide a #test method"
end

#test!(*args) ⇒ Object

Call test in context



26
27
28
# File 'lib/capistrano/scm.rb', line 26

def test!(*args)
  context.test(*args)
end

#updateObject

This method is abstract.

Update the clone on the deployment target

Returns:

  • void

Raises:

  • (NotImplementedError)


91
92
93
# File 'lib/capistrano/scm.rb', line 91

def update
  raise NotImplementedError, "Your SCM strategy module should provide a #update method"
end