master
 1namespace :s3 do
 2  def strategy
 3    @strategy ||= Capistrano::S3.new(self, Capistrano::S3::DefaultStrategy)
 4  end
 5
 6  desc 'Check that the repository is reachable'
 7  task :check do
 8    on release_roles :all do
 9      strategy.check
10    end
11  end
12
13  desc 'Clone the repo to the cache'
14  task :clone do
15    on release_roles :all do
16      if strategy.test
17        info t(:mirror_exists, at: repo_path)
18      else
19        within deploy_path do
20          strategy.clone
21        end
22      end
23    end
24  end
25
26  desc 'Update the repo mirror to reflect the origin state'
27  task update: :'s3:clone' do
28    on release_roles :all do
29      within repo_path do
30        strategy.update
31      end
32    end
33  end
34
35  desc 'Copy repo to releases'
36  task create_release: :'s3:update' do
37    on release_roles :all do
38      within repo_path do
39        execute :mkdir, '-p', release_path
40        strategy.release
41      end
42    end
43  end
44
45  desc 'Determine the revision that will be deployed'
46  task :set_current_revision do
47    on release_roles :all do
48      within repo_path do
49        set :current_revision, strategy.build_revision
50      end
51    end
52  end
53end