Class: Statistrano::Deployment::Strategy::Base
- Inherits:
-
Object
- Object
- Statistrano::Deployment::Strategy::Base
- Extended by:
- Config::Configurable, Registerable
- Includes:
- CheckGit, InvokeTasks
- Defined in:
- lib/statistrano/deployment/strategy/base.rb
Overview
A Base Deployment Instance it holds the common methods needed to create a deployment
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#deploy ⇒ Void
Standard deployment flow.
- #flush_persisted_releaser! ⇒ Object
-
#initialize(name) ⇒ Void
constructor
create a new deployment instance.
- #log_file(remote = remotes.first) ⇒ Object
- #persisted_releaser ⇒ Object
- #register_tasks ⇒ Object
- #remotes ⇒ Object
Methods included from Registerable
Methods included from Config::Configurable
configuration, extended, inherited, option, options, task
Methods included from CheckGit
Methods included from InvokeTasks
#call_or_invoke_task, #invoke_build_task, #invoke_post_deploy_task, #invoke_pre_symlink_task
Constructor Details
#initialize(name) ⇒ Void
create a new deployment instance
39 40 41 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 39 def initialize name @name = name end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
14 15 16 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 14 def name @name end |
Instance Method Details
#deploy ⇒ Void
Standard deployment flow
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 45 def deploy unless safe_to_deploy? Log.error "exiting due to git check failing" abort() end build_data = invoke_build_task build_data = ensure_data_is_hash build_data unless safe_to_deploy? Log.error "exiting due to git check failing", "your build task modified checked in files" abort() end remotes.each do |remote| persisted_releaser.create_release remote, build_data end post_deploy_data = invoke_post_deploy_task post_deploy_data = ensure_data_is_hash post_deploy_data if config.log_file_path log_entry = config.log_file_entry.call self, persisted_releaser, build_data, post_deploy_data remotes.each do |remote| log_file(remote).append! log_entry end end flush_persisted_releaser! end |
#flush_persisted_releaser! ⇒ Object
102 103 104 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 102 def flush_persisted_releaser! @_persisted_releaser = nil end |
#log_file(remote = remotes.first) ⇒ Object
94 95 96 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 94 def log_file remote=remotes.first Deployment::LogFile.new config.log_file_path, remote end |
#persisted_releaser ⇒ Object
98 99 100 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 98 def persisted_releaser @_persisted_releaser ||= releaser end |
#register_tasks ⇒ Object
79 80 81 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 79 def register_tasks RakeTasks.register self end |
#remotes ⇒ Object
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 83 def remotes return @_remotes if @_remotes @_remotes = config.[:remotes].map do || Remote.new Config.new( config..dup.merge() ) end @_remotes.push Remote.new(config) if @_remotes.empty? return @_remotes end |