Commit 4ad1c27

mo khan <mo@mokhan.ca>
2015-05-29 04:52:29
remove unused environment variables and work towards defining revision in a single location.
1 parent 52c23bc
Changed files (3)
config
lib
capistrano
tasks
config/deploy.rb
@@ -16,6 +16,7 @@ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
 #set :scm, :git
 set :scm, :s3
 set :bucket_name, "stronglifters"
+set :build_revision, "stronglifters-2015-05-29-03-07-33.tar.gz"
 
 # Default value for :format is :pretty
 # set :format, :pretty
lib/capistrano/s3.rb
@@ -42,7 +42,7 @@ class Capistrano::S3 < Capistrano::SCM
     end
 
     def build_revision
-      "stronglifters-2015-05-29-03-07-33.tar.gz"
+      fetch(:build_revision)
     end
   end
 end
lib/tasks/s3.rake
@@ -3,13 +3,6 @@ namespace :s3 do
     @strategy ||= Capistrano::S3.new(self, Capistrano::S3::DefaultStrategy)
   end
 
-  set :s3_environmental_variables, ->() {
-    {
-      bucket_name: fetch(:s3_bucket),
-      build_revision: fetch(:build_revision),
-    }
-  }
-
   task :wrapper do
     on release_roles :all do
     end
@@ -19,9 +12,7 @@ namespace :s3 do
   task check: :'s3:wrapper' do
     fetch(:branch)
     on release_roles :all do
-      with fetch(:s3_environmental_variables) do
-        strategy.check
-      end
+      strategy.check
     end
   end
 
@@ -32,9 +23,7 @@ namespace :s3 do
         info t(:mirror_exists, at: repo_path)
       else
         within deploy_path do
-          with fetch(:s3_environmental_variables) do
-            strategy.clone
-          end
+          strategy.clone
         end
       end
     end
@@ -44,9 +33,7 @@ namespace :s3 do
   task update: :'s3:clone' do
     on release_roles :all do
       within repo_path do
-        with fetch(:s3_environmental_variables) do
-          strategy.update
-        end
+        strategy.update
       end
     end
   end
@@ -54,11 +41,9 @@ namespace :s3 do
   desc 'Copy repo to releases'
   task create_release: :'s3:update' do
     on release_roles :all do
-      with fetch(:s3_environmental_variables) do
-        within repo_path do
-          execute :mkdir, '-p', release_path
-          strategy.release
-        end
+      within repo_path do
+        execute :mkdir, '-p', release_path
+        strategy.release
       end
     end
   end
@@ -67,9 +52,7 @@ namespace :s3 do
   task :set_current_revision do
     on release_roles :all do
       within repo_path do
-        with fetch(:s3_environmental_variables) do
-          set :current_revision, fetch(:build_revision)
-        end
+        set :current_revision, fetch(:build_revision)
       end
     end
   end