lib/dockly/deb.rb in dockly-1.12.3 vs lib/dockly/deb.rb in dockly-1.13.0
- old
+ new
@@ -46,10 +46,18 @@
def build
create_package!
upload_to_s3
end
+ def copy_from_s3(sha)
+ ensure_present! :s3_bucket
+ object = s3_object_name_for(sha)
+ info "Copying s3://#{s3_bucket}/#{object} to s3://#{s3_bucket}/#{s3_object_name}"
+ Dockly::AWS.s3.copy_object(s3_bucket, object, s3_bucket, s3_object_name)
+ info "Successfully copied s3://#{s3_bucket}/#{object} to s3://#{s3_bucket}/#{s3_object_name}"
+ end
+
def build_path
ensure_present! :build_dir, :deb_build_dir
File.join(build_dir, deb_build_dir, output_filename)
end
@@ -57,12 +65,11 @@
debug "#{name}: checking for package: #{s3_url}"
Dockly::AWS.s3.head_object(s3_bucket, s3_object_name)
info "#{name}: found package: #{s3_url}"
true
rescue
- info "#{name}: could not find package: " +
- "#{s3_url}"
+ info "#{name}: could not find package: #{s3_url}"
false
end
def upload_to_s3
info "uploading to s3"
@@ -76,10 +83,14 @@
def s3_url
"s3://#{s3_bucket}/#{s3_object_name}"
end
def s3_object_name
- "#{package_name}/#{Dockly::Util::Git.git_sha}/#{output_filename}"
+ s3_object_name_for(Dockly::Util::Git.git_sha)
+ end
+
+ def s3_object_name_for(sha)
+ "#{package_name}/#{sha}/#{output_filename}"
end
def output_filename
"#{package_name}_#{version}.#{release}_#{arch}.deb"
end