summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2015-05-28 22:45:54 -0600
committermo khan <mo@mokhan.ca>2015-05-28 22:45:54 -0600
commit52c23bccde077dcd797da2c1abf1d9f3a2a511b7 (patch)
tree37fab6317969531fb5d173df6158af6ceba8e103 /lib
parent63b930b414061a81ec31fbe4b8a183a7b56e6033 (diff)
extract bucket name.
Diffstat (limited to 'lib')
-rw-r--r--lib/capistrano/s3.rb20
-rw-r--r--lib/tasks/s3.rake2
2 files changed, 15 insertions, 7 deletions
diff --git a/lib/capistrano/s3.rb b/lib/capistrano/s3.rb
index aa456ca..5df2b29 100644
--- a/lib/capistrano/s3.rb
+++ b/lib/capistrano/s3.rb
@@ -17,7 +17,7 @@ class Capistrano::S3 < Capistrano::SCM
end
def check
- s3 'ls stronglifters'
+ s3 "ls #{bucket_name}"
end
def clone
@@ -25,14 +25,24 @@ class Capistrano::S3 < Capistrano::SCM
end
def update
- build = "stronglifters-2015-05-29-03-07-33.tar.gz"
- s3 "cp s3://stronglifters/production/#{build} #{repo_path}/#{build}"
+ s3 "cp s3://#{bucket_name}/#{rails_env}/#{build_revision} #{repo_path}/#{build_revision}"
end
def release
- build = "stronglifters-2015-05-29-03-07-33.tar.gz"
context.execute("mkdir -p #{release_path}")
- context.execute("tar -xvzf #{repo_path}/#{build} --strip-components=1 -C #{release_path}")
+ context.execute("tar -xvzf #{repo_path}/#{build_revision} --strip-components=1 -C #{release_path}")
+ end
+
+ def bucket_name
+ fetch(:bucket_name)
+ end
+
+ def rails_env
+ fetch(:rails_env)
+ end
+
+ def build_revision
+ "stronglifters-2015-05-29-03-07-33.tar.gz"
end
end
end
diff --git a/lib/tasks/s3.rake b/lib/tasks/s3.rake
index 461cade..4a29781 100644
--- a/lib/tasks/s3.rake
+++ b/lib/tasks/s3.rake
@@ -5,8 +5,6 @@ namespace :s3 do
set :s3_environmental_variables, ->() {
{
- aws_access_key_id: fetch(:aws_access_key_id),
- aws_secret_access_key: fetch(:aws_secret_access_key),
bucket_name: fetch(:s3_bucket),
build_revision: fetch(:build_revision),
}