capistrano-s3_archive 0.3.3 → 0.3.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4470bc36543de70d7119abb6d2e69da4b87de585
4
- data.tar.gz: 97a1f2c84899380bef2cc2082dcd0ac08ae0a6a7
3
+ metadata.gz: ff7aa63f69e0331804503575b7a0f22ae530e769
4
+ data.tar.gz: 378dc767657fbaf94fcc9d3614b63c5de742442a
5
5
  SHA512:
6
- metadata.gz: e98c02ea48791873244267e0ad3e3ca74c9a68e75af2376f63d9ba12483d5843ee40ec02c2fbb5b9b85c6997d09c46fe9a37b0535a412f91bccf63f30b3d9419
7
- data.tar.gz: c490a0f20d5acad828e42d405ebc0c9022134f43666049162312c0bc8a570f38220aa488c43de556800326290f3473f3b676512c9dac0cb3b9ac0e4f979780a0
6
+ metadata.gz: 4d28fb64ce1f708b1282e7a8b50461bddc6a26249704cb1609b5f49db0d9120b26deaa8ac07ec369d1ab35e1df7d1d23bb910a67d67ddc0b1a2ae91bbd751c52
7
+ data.tar.gz: d59244e38ad90d614ce90f5f9bc3bc3c04bc6913e8076f886df1bc881bb0f0cfb9ea543e11fd52119904d72f3156c61edb864a4cf9f3ee54e33b6a849f00304d
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module S3Archive
3
- VERSION = "0.3.3"
3
+ VERSION = "0.3.4"
4
4
  end
5
5
  end
@@ -110,6 +110,22 @@ module Capistrano
110
110
  end
111
111
  end
112
112
 
113
+ def cleanup
114
+ run_locally do
115
+ archives_dir = File.join(fetch(:s3_archive), fetch(:stage).to_s)
116
+ archives = capture(:ls, '-xtr', archives_dir).split
117
+ if archives.count >= fetch(:keep_releases)
118
+ tobe_removes = (archives - archives.last(fetch(:keep_releases)))
119
+ if tobe_removes.any?
120
+ tobe_removes_str = tobe_removes.map do |file|
121
+ File.join(archives_dir, file)
122
+ end.join(' ')
123
+ execute :rm, tobe_removes_str
124
+ end
125
+ end
126
+ end
127
+ end
128
+
113
129
  def release(server = context.host)
114
130
  user = server.user + '@' unless server.user.nil?
115
131
  key = server.keys.first || Array(server.ssh_options[:keys]).first
@@ -22,6 +22,12 @@ namespace :s3_archive do
22
22
  end
23
23
  end
24
24
 
25
+ after :stage, :cleanup do
26
+ run_locally do
27
+ strategy.cleanup
28
+ end
29
+ end
30
+
25
31
  desc 'Copy repo to releases'
26
32
  task :create_release => :stage do
27
33
  on release_roles :all do |server|
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-s3_archive
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takuto Komazaki
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-10-05 00:00:00.000000000 Z
11
+ date: 2015-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano