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