Class: Minestrone::Deploy::Strategy::Base
- Inherits:
-
Object
- Object
- Minestrone::Deploy::Strategy::Base
- Defined in:
- lib/minestrone/recipes/deploy/strategy/base.rb
Overview
This class defines the abstract interface for all Minestrone deployment strategies. Subclasses must implement at least the #deploy! method.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#configuration ⇒ Object
readonly
Returns the value of attribute configuration.
Instance Method Summary collapse
-
#check! ⇒ Object
Performs a check on the remote hosts to determine whether everything is setup such that a deploy could succeed.
-
#deploy! ⇒ Object
Executes the necessary commands to deploy the revision of the source code identified by the
revisionvariable. -
#initialize(config = {}) ⇒ Base
constructor
Instantiates a strategy with a reference to the given configuration.
Constructor Details
#initialize(config = {}) ⇒ Base
Instantiates a strategy with a reference to the given configuration.
18 19 20 |
# File 'lib/minestrone/recipes/deploy/strategy/base.rb', line 18 def initialize(config = {}) @configuration = config end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object (protected)
This is to allow helper methods like “run” and “put” to be more easily accessible to strategy implementations.
51 52 53 54 55 56 57 |
# File 'lib/minestrone/recipes/deploy/strategy/base.rb', line 51 def method_missing(sym, *args, &block) if configuration.respond_to?(sym) configuration.send(sym, *args, &block) else super end end |
Instance Attribute Details
#configuration ⇒ Object (readonly)
Returns the value of attribute configuration.
15 16 17 |
# File 'lib/minestrone/recipes/deploy/strategy/base.rb', line 15 def configuration @configuration end |
Instance Method Details
#check! ⇒ Object
Performs a check on the remote hosts to determine whether everything is setup such that a deploy could succeed.
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/minestrone/recipes/deploy/strategy/base.rb', line 35 def check! Dependencies.new(configuration) do |d| d.remote.directory(configuration[:releases_path]) .or("`#{configuration[:releases_path]}' does not exist. Please run `min deploy:setup'.") d.remote.writable(configuration[:deploy_to]) .or("You do not have permissions to write to `#{configuration[:deploy_to]}'.") d.remote.writable(configuration[:releases_path]) .or("You do not have permissions to write to `#{configuration[:releases_path]}'.") end end |
#deploy! ⇒ Object
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.
28 29 30 |
# File 'lib/minestrone/recipes/deploy/strategy/base.rb', line 28 def deploy! raise NotImplementedError, "`deploy!' is not implemented by #{self.class.name}" end |