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, validate
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
42 43 44 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 42 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
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 78 79 80 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 48 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
105 106 107 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 105 def flush_persisted_releaser! @_persisted_releaser = nil end |
#log_file(remote = remotes.first) ⇒ Object
97 98 99 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 97 def log_file remote=remotes.first Deployment::LogFile.new config.log_file_path, remote end |
#persisted_releaser ⇒ Object
101 102 103 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 101 def persisted_releaser @_persisted_releaser ||= releaser end |
#register_tasks ⇒ Object
82 83 84 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 82 def register_tasks RakeTasks.register self end |
#remotes ⇒ Object
86 87 88 89 90 91 92 93 94 95 |
# File 'lib/statistrano/deployment/strategy/base.rb', line 86 def remotes return @_remotes if @_remotes @_remotes = config.[:remotes].map do || Remote.new Config.new( options: config..dup.merge() ) end @_remotes.push Remote.new(config) if @_remotes.empty? return @_remotes end |