class EY::Serverside::Source::Archive
Deploy source for archive sourced deploy.
Public Instance Methods
create_revision_file_command(revision_file_path)
click to toggle source
# File lib/engineyard-serverside/source/archive.rb, line 7 def create_revision_file_command(revision_file_path) "echo #{escape(@checksum || filename)} > #{escape(revision_file_path.to_s)}" end
gc_repository_cache()
click to toggle source
# File lib/engineyard-serverside/source/archive.rb, line 11 def gc_repository_cache # If files are uploaded to the server, we should clean them up here probably. end
same?(previous_rev, current_rev, paths=nil)
click to toggle source
# File lib/engineyard-serverside/source/archive.rb, line 15 def same?(previous_rev, current_rev, paths=nil) previous_rev == current_rev end
short_log_message(rev)
click to toggle source
# File lib/engineyard-serverside/source/archive.rb, line 19 def short_log_message(rev) rev end
update_repository_cache()
click to toggle source
# File lib/engineyard-serverside/source/archive.rb, line 23 def update_repository_cache clean_cache in_source_cache do unless fetch && checksum shell.fatal "archive fetch from #{URI.parse(uri).hostname} failed." raise "archive fetch from #{URI.parse(uri).hostname} failed." end unless unarchive shell.fatal "unarchive of #{filename} failed." raise "unarchive of #{filename} failed." end end end
Protected Instance Methods
checksum()
click to toggle source
# File lib/engineyard-serverside/source/archive.rb, line 40 def checksum @checksum = run_and_output("shasum #{File.join(source_cache, escaped_filename)}").strip end
clean_cache()
click to toggle source
# File lib/engineyard-serverside/source/archive.rb, line 44 def clean_cache run "rm -rf #{source_cache} && mkdir -p #{source_cache}" end
escaped_filename()
click to toggle source
# File lib/engineyard-serverside/source/archive.rb, line 65 def escaped_filename escape(filename) end
fetch()
click to toggle source
# File lib/engineyard-serverside/source/archive.rb, line 52 def fetch run_and_success?(fetch_command) end
fetch_command()
click to toggle source
# File lib/engineyard-serverside/source/archive.rb, line 48 def fetch_command "curl --location --silent --show-error --fail -o #{escaped_filename} --user-agent #{escape("EngineYardDeploy/#{EY::Serverside::VERSION}")} #{escape(uri)}" end
filename()
click to toggle source
# File lib/engineyard-serverside/source/archive.rb, line 56 def filename @filename ||= File.basename(URI.parse(uri).path) end
unarchive()
click to toggle source
TODO: configurable via flag
# File lib/engineyard-serverside/source/archive.rb, line 61 def unarchive run_and_success? "unzip #{escaped_filename} && rm #{escaped_filename}" end