Class: Cloud::Deploy::Artifact
- Inherits:
-
Object
- Object
- Cloud::Deploy::Artifact
- Defined in:
- lib/cloud/deploy/artifact.rb
Instance Attribute Summary collapse
-
#force ⇒ Object
Returns the value of attribute force.
-
#local_paths ⇒ Object
Returns the value of attribute local_paths.
-
#name ⇒ Object
Returns the value of attribute name.
-
#unzip ⇒ Object
Returns the value of attribute unzip.
-
#uri ⇒ Object
Returns the value of attribute uri.
-
#use_etags ⇒ Object
Returns the value of attribute use_etags.
Instance Method Summary collapse
- #deploy! ⇒ Object
-
#initialize ⇒ Artifact
constructor
A new instance of Artifact.
- #outdated? ⇒ Boolean
Constructor Details
#initialize ⇒ Artifact
Returns a new instance of Artifact.
31 32 33 |
# File 'lib/cloud/deploy/artifact.rb', line 31 def initialize = true end |
Instance Attribute Details
#force ⇒ Object
Returns the value of attribute force.
29 30 31 |
# File 'lib/cloud/deploy/artifact.rb', line 29 def force @force end |
#local_paths ⇒ Object
Returns the value of attribute local_paths.
29 30 31 |
# File 'lib/cloud/deploy/artifact.rb', line 29 def local_paths @local_paths end |
#name ⇒ Object
Returns the value of attribute name.
29 30 31 |
# File 'lib/cloud/deploy/artifact.rb', line 29 def name @name end |
#unzip ⇒ Object
Returns the value of attribute unzip.
29 30 31 |
# File 'lib/cloud/deploy/artifact.rb', line 29 def unzip @unzip end |
#uri ⇒ Object
Returns the value of attribute uri.
28 29 30 |
# File 'lib/cloud/deploy/artifact.rb', line 28 def uri @uri end |
#use_etags ⇒ Object
Returns the value of attribute use_etags.
29 30 31 |
# File 'lib/cloud/deploy/artifact.rb', line 29 def end |
Instance Method Details
#deploy! ⇒ Object
44 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 |
# File 'lib/cloud/deploy/artifact.rb', line 44 def deploy! load_md5sums do |md5sums| hash = md5sums[@name] if !@force and !hash.nil? and hash == @hash $log.info(@name) { "MD5 sums match. No need to deploy." } else @local_paths.each do |path| FileUtils.mkdir_p(path) if @unzip $log.info(@name) { "Unzipping #{@name} to #{path}" } if @uri.request_uri[-6..-1] == "tar.gz" `tar -zxf #{@temp_file} -C #{path}` else `unzip -o -d #{path} #{@temp_file}` end else $log.info(@name) { "Copying #{@name} to #{path}" } FileUtils.cp(@temp_file, path) end end md5sums[@name] = @hash save_md5sums(md5sums) end # Clean up temp file if !@temp_file.nil? FileUtils.rm(@temp_file) end # We did a deployment return true end # Default return return false end |
#outdated? ⇒ Boolean
40 41 42 |
# File 'lib/cloud/deploy/artifact.rb', line 40 def outdated? download end |