Class: Capistrano::SCM Abstract
- Inherits:
-
Object
- Object
- Capistrano::SCM
- Defined in:
- lib/capistrano/scm.rb
Overview
Base class for SCM strategy providers.
Instance Attribute Summary collapse
-
#context ⇒ Rake
readonly
The current value of context.
Instance Method Summary collapse
-
#check ⇒ Boolean
abstract
Your implementation should check if the specified remote-repository is available.
-
#clone ⇒ Object
abstract
Create a (new) clone of the remote-repository on the deployment target.
-
#fetch(*args) ⇒ Object
Fetch a var from the context.
-
#fetch_revision ⇒ Object
abstract
Identify the SHA of the commit that will be deployed.
-
#initialize(context, strategy) ⇒ SCM
constructor
Provide a wrapper for the SCM that loads a strategy for the user.
-
#release ⇒ Object
abstract
Copy the contents of the cache-repository onto the release path.
-
#release_path ⇒ Object
The release path according to the context.
-
#repo_path ⇒ Object
The repository path according to the context.
-
#repo_url ⇒ Object
The repository URL according to the context.
-
#test ⇒ Boolean
abstract
Your implementation should check the existence of a cache repository on the deployment target.
-
#test!(*args) ⇒ Object
Call test in context.
-
#update ⇒ Object
abstract
Update the clone on the deployment target.
Constructor Details
#initialize(context, strategy) ⇒ SCM
Provide a wrapper for the SCM that loads a strategy for the user.
20 21 22 23 24 |
# File 'lib/capistrano/scm.rb', line 20 def initialize(context, strategy) @context = context singleton = class << self; self; end singleton.send(:include, strategy) end |
Instance Attribute Details
#context ⇒ Rake (readonly)
Returns the current value of context.
11 12 13 |
# File 'lib/capistrano/scm.rb', line 11 def context @context end |
Instance Method Details
#check ⇒ Boolean
Your implementation should check if the specified remote-repository is available.
74 75 76 77 78 |
# File 'lib/capistrano/scm.rb', line 74 def check raise NotImplementedError.new( "Your SCM strategy module should provide a #check method" ) end |
#clone ⇒ Object
Create a (new) clone of the remote-repository on the deployment target
86 87 88 89 90 |
# File 'lib/capistrano/scm.rb', line 86 def clone raise NotImplementedError.new( "Your SCM strategy module should provide a #clone method" ) end |
#fetch(*args) ⇒ Object
Fetch a var from the context
50 51 52 |
# File 'lib/capistrano/scm.rb', line 50 def fetch(*args) context.fetch(*args) end |
#fetch_revision ⇒ Object
Identify the SHA of the commit that will be deployed. This will most likely involve SshKit’s capture method.
122 123 124 125 126 |
# File 'lib/capistrano/scm.rb', line 122 def fetch_revision raise NotImplementedError.new( "Your SCM strategy module should provide a #fetch_revision method" ) end |
#release ⇒ Object
Copy the contents of the cache-repository onto the release path
110 111 112 113 114 |
# File 'lib/capistrano/scm.rb', line 110 def release raise NotImplementedError.new( "Your SCM strategy module should provide a #release method" ) end |
#release_path ⇒ Object
The release path according to the context
42 43 44 |
# File 'lib/capistrano/scm.rb', line 42 def release_path context.release_path end |
#repo_path ⇒ Object
The repository path according to the context
37 38 39 |
# File 'lib/capistrano/scm.rb', line 37 def repo_path context.repo_path end |
#repo_url ⇒ Object
The repository URL according to the context
32 33 34 |
# File 'lib/capistrano/scm.rb', line 32 def repo_url context.repo_url end |
#test ⇒ Boolean
Your implementation should check the existence of a cache repository on the deployment target
61 62 63 64 65 |
# File 'lib/capistrano/scm.rb', line 61 def test raise NotImplementedError.new( "Your SCM strategy module should provide a #test method" ) end |
#test!(*args) ⇒ Object
Call test in context
27 28 29 |
# File 'lib/capistrano/scm.rb', line 27 def test!(*args) context.test *args end |
#update ⇒ Object
Update the clone on the deployment target
98 99 100 101 102 |
# File 'lib/capistrano/scm.rb', line 98 def update raise NotImplementedError.new( "Your SCM strategy module should provide a #update method" ) end |