Skip to content

Commit

Permalink
turns out tar remembers the folder structure!
Browse files Browse the repository at this point in the history
  • Loading branch information
seanlinsley committed Apr 22, 2014
1 parent beb64e2 commit 3a68e66
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions script/travis_cache
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def download_app
s3 :save, file: 'app.sha2', as: 'remote_app.sha2'
if !digest_changed?('Gemfile.lock', 'remote_bundle.sha2', 'bundle.sha2') &&
!digest_changed?('spec/support', 'remote_app.sha2', 'app.sha2')
s3 :save, file: 'app.tgz', as: 'remote_app.tgz', untar: 'spec'
s3 :save, file: 'app.tgz', as: 'remote_app.tgz', untar: true
end
end

Expand Down Expand Up @@ -69,18 +69,14 @@ end
# s3 :find, file: 'foo'
# s3 :save, file: 'foo', as: 'bar'
# s3 :save, file: 'foo', untar: true
# s3 :save, file: 'foo', untar: 'another_directory'
def s3(action, options = {})
verb = {list: :get, upload: :put, find: :get, save: :get}.fetch action
file = PREFIX + options.fetch(:file) unless action == :list
extra_arg = {
upload: ->{ %[-T "#{file}"] },
save: ->{ %[-o "#{options[:as]}"] if options[:as] }
}[action].call
if options[:untar]
do_after = "&& tar -xf #{options[:as] || file}"
do_after << " -C #{options[:untar]}" if options[:untar].is_a? String
end
do_after = "&& tar -xf #{options[:as] || file}" if options[:untar]

now = Time.now.strftime "%a, %d %b %Y %H:%M:%S %z"
signature = sign SECRET, "#{verb.upcase}\n\n\n#{now}\n/ActiveAdmin/#{file}"
Expand Down

0 comments on commit 3a68e66

Please sign in to comment.