Class: Statistrano::Deployment::Strategy::Branches
- Defined in:
- lib/statistrano/deployment/strategy/branches.rb,
lib/statistrano/deployment/strategy/branches/index.rb,
lib/statistrano/deployment/strategy/branches/release.rb
Overview
Branches is for deployments that depend upon the current git branch, eg. doing feature branch deployments
Defined Under Namespace
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#generate_index ⇒ Void
generate an index file for releases in the manifest.
-
#list_releases ⇒ Void
output a list of the releases in manifest.
-
#prune_releases ⇒ Void
trim releases not in the manifest, get user input for removal of other releases.
-
#push_current_release_to_manifest ⇒ Void
push the current release into the manifest.
Methods inherited from Base
#deploy, #flush_persisted_releaser!, #initialize, #log_file, #persisted_releaser, #register_tasks, #remotes
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
This class inherits a constructor from Statistrano::Deployment::Strategy::Base
Instance Method Details
#generate_index ⇒ Void
generate an index file for releases in the manifest
60 61 62 63 64 65 66 67 |
# File 'lib/statistrano/deployment/strategy/branches.rb', line 60 def generate_index remotes.each do |remote| index_dir = File.join( remote.config.remote_dir, "index" ) index_path = File.join( index_dir, "index.html" ) remote.create_remote_dir index_dir remote.run "touch #{index_path} && echo '#{release_list_html(remote)}' > #{index_path}" end end |
#list_releases ⇒ Void
output a list of the releases in manifest
30 31 32 33 34 35 36 37 38 |
# File 'lib/statistrano/deployment/strategy/branches.rb', line 30 def list_releases remotes.each do |remote| releases_data = sorted_release_data(remote) releases_data.map! do |release| "#{release[:name]} created at #{Time.at(release[:time]).strftime('%a %b %d, %Y at %l:%M %P')}" end Log.info remote.config.hostname.to_sym, *releases_data end end |
#prune_releases ⇒ Void
trim releases not in the manifest, get user input for removal of other releases
43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/statistrano/deployment/strategy/branches.rb', line 43 def prune_releases candidate_releases = [] remotes.each do |remote| prune_untracked_releases(remote) candidate_releases.push *get_releases(remote) candidate_releases.uniq! end if candidate_releases.length > 0 pick_and_remove_release candidate_releases else Log.warn "no releases to prune" end end |
#push_current_release_to_manifest ⇒ Void
push the current release into the manifest
71 72 73 74 75 76 77 |
# File 'lib/statistrano/deployment/strategy/branches.rb', line 71 def push_current_release_to_manifest remotes.each do |remote| mnfst = manifest(remote) mnfst.put Release.new( config.public_dir, config ).to_hash, :name mnfst.save! end end |