capistrano-s3_archive 1.0.0 → 1.0.2

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
  SHA256:
3
- metadata.gz: af4eb25b90c60b6a5ef6f072ff01024706128c1924e051424191f3d1f535ff50
4
- data.tar.gz: 523ba94440f350ae342fd2b73b45f0d9b593cbf7e9d3935c4e239c100649d03b
3
+ metadata.gz: 1210ac80b01f28cf4cd2c22deeabf5cf35f66e9c68b5867f2b1be67fddca7346
4
+ data.tar.gz: 285abded5a2e47063f3517811cdd19b12bc181f80e1ffdd60eedd099e1f057be
5
5
  SHA512:
6
- metadata.gz: cfe3e1ac51a0dac8ef600e2a313feb4e3a665120c3ee1df0e46292e6e455c8ea428e50cdec7c8d5437c9bdc699259bbd5cc232b909cc4e0a4d5bec02cdda2a80
7
- data.tar.gz: 7c2bb15d6493e9e2f82704c5d0e544679f27ea69c920501b81f5e1701d9a4b7c88dec4180a096b192675decf6bdde70fe7e20ce74f996281f2bb4c0c8fdc0dcd
6
+ metadata.gz: 6d6b6e0ac4c0a7d75e76fecb5c4735d76e49ab4523010e5ffb2162f33a95552073ced675544611cea57d39976900d194398ba2a1157807fa71a0bff3020c6b88
7
+ data.tar.gz: 07056ae9a786875a197e2a0cd1a323a255d654e962e75b35d411735ddc8cd97c86115c50a91c36a13af888777bda058aaf9cb020e79ce2b559133ef2224d5182
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module S3Archive
3
- VERSION = "1.0.0".freeze
3
+ VERSION = "1.0.2".freeze
4
4
  end
5
5
  end
@@ -47,11 +47,13 @@ module Capistrano
47
47
  end
48
48
 
49
49
  def cleanup(keep: 0)
50
- downloaded_files = Dir.glob(download_dir).sort_by(&File.method(:mtime))
50
+ downloaded_files = Dir.glob(File.join(download_dir, '*')).sort_by(&File.method(:mtime))
51
51
  return if downloaded_files.count <= keep
52
52
 
53
- to_be_removes = (downloaded_files - downloaded_files.last(keep)).flat_map { |f| [f, ".#{f}.etag"] }
54
- remove(to_be_removes, force: true)
53
+ remove_keys = (downloaded_files - downloaded_files.last(keep)).map { |f| File.basename(f, '.*') }.flat_map { |f| ["#{f}*", ".#{f}*"] }
54
+ to_be_removes = Dir.glob(remove_keys, base: download_dir)
55
+
56
+ remove(to_be_removes, force: true, verbose: true)
55
57
  end
56
58
 
57
59
  def target_file
@@ -11,7 +11,6 @@ module Capistrano
11
11
  end
12
12
 
13
13
  def download
14
- tmp_file = "#{target_file}.part"
15
14
  etag_file = File.join(download_dir, ".#{archive_object.key_basename}.etag")
16
15
  if backend.test("[ -f #{target_file} -a -f #{etag_file} ]") &&
17
16
  backend.capture(:cat, etag_file) == archive_object.etag
@@ -19,8 +18,8 @@ module Capistrano
19
18
  else
20
19
  backend.info "Download s3://#{archive_object.bucket}/#{archive_object.key} to #{target_file}"
21
20
  backend.execute(:mkdir, "-p", download_dir)
22
- backend.execute(:aws, *['s3api', 'get-object', "--bucket #{archive_object.bucket}", "--key #{archive_object.key}", archive_object.version_id ? "--version-id #{archive_object.version_id}" : nil, tmp_file].compact)
23
- backend.execute(:mv, tmp_file, target_file)
21
+ backend.execute(:aws, *['s3api', 'get-object', "--bucket #{archive_object.bucket}", "--key #{archive_object.key}", archive_object.version_id ? "--version-id #{archive_object.version_id}" : nil, target_file].compact)
22
+
24
23
  backend.execute(:echo, "-n", "'#{archive_object.etag}'", "|tee", etag_file)
25
24
  end
26
25
  end
@@ -36,7 +35,7 @@ module Capistrano
36
35
  end
37
36
 
38
37
  def target_file
39
- basename = [archive_object.key_basename, archive_object.version_id].join('?')
38
+ basename = [archive_object.key_basename, archive_object.version_id].join('__')
40
39
  File.join(download_dir, basename)
41
40
  end
42
41
  end
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: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takuto Komazaki
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-08 00:00:00.000000000 Z
11
+ date: 2023-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-s3
@@ -146,7 +146,6 @@ files:
146
146
  - example/config/deploy.rb
147
147
  - example/config/deploy/localtest.rb
148
148
  - example/config/deploy/production.rb
149
- - example/config/deploy/staging.rb
150
149
  - img/s3_archive-direct.png
151
150
  - img/s3_archive-repo-branch.png
152
151
  - img/s3_archive-rsync.png
@@ -163,7 +162,7 @@ files:
163
162
  homepage: https://github.com/komazarari/capistrano-s3_archive
164
163
  licenses: []
165
164
  metadata: {}
166
- post_install_message:
165
+ post_install_message:
167
166
  rdoc_options: []
168
167
  require_paths:
169
168
  - lib
@@ -178,8 +177,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
178
177
  - !ruby/object:Gem::Version
179
178
  version: '0'
180
179
  requirements: []
181
- rubygems_version: 3.0.3
182
- signing_key:
180
+ rubygems_version: 3.3.26
181
+ signing_key:
183
182
  specification_version: 4
184
183
  summary: Capistrano deployment from an archive on Amazon S3.
185
184
  test_files: []
@@ -1,65 +0,0 @@
1
- server 'koma-bionic.dev-inf.gree-dev.net', roles: [:app]
2
-
3
- set :deploy_to, '/var/tmp/testmyapp'
4
-
5
- # server-based syntax
6
- # ======================
7
- # Defines a single server with a list of roles and multiple properties.
8
- # You can define all roles on a single server, or split them:
9
-
10
- # server "example.com", user: "deploy", roles: %w{app db web}, my_property: :my_value
11
- # server "example.com", user: "deploy", roles: %w{app web}, other_property: :other_value
12
- # server "db.example.com", user: "deploy", roles: %w{db}
13
-
14
-
15
-
16
- # role-based syntax
17
- # ==================
18
-
19
- # Defines a role with one or multiple servers. The primary server in each
20
- # group is considered to be the first unless any hosts have the primary
21
- # property set. Specify the username and a domain or IP for the server.
22
- # Don't use `:all`, it's a meta role.
23
-
24
- # role :app, %w{deploy@example.com}, my_property: :my_value
25
- # role :web, %w{user1@primary.com user2@additional.com}, other_property: :other_value
26
- # role :db, %w{deploy@example.com}
27
-
28
-
29
-
30
- # Configuration
31
- # =============
32
- # You can set any configuration variable like in config/deploy.rb
33
- # These variables are then only loaded and set in this stage.
34
- # For available Capistrano configuration variables see the documentation page.
35
- # http://capistranorb.com/documentation/getting-started/configuration/
36
- # Feel free to add new variables to customise your setup.
37
-
38
-
39
-
40
- # Custom SSH Options
41
- # ==================
42
- # You may pass any option but keep in mind that net/ssh understands a
43
- # limited set of options, consult the Net::SSH documentation.
44
- # http://net-ssh.github.io/net-ssh/classes/Net/SSH.html#method-c-start
45
- #
46
- # Global options
47
- # --------------
48
- # set :ssh_options, {
49
- # keys: %w(/home/rlisowski/.ssh/id_rsa),
50
- # forward_agent: false,
51
- # auth_methods: %w(password)
52
- # }
53
- #
54
- # The server-based syntax can be used to override options:
55
- # ------------------------------------
56
- # server "example.com",
57
- # user: "user_name",
58
- # roles: %w{web app},
59
- # ssh_options: {
60
- # user: "user_name", # overrides user setting above
61
- # keys: %w(/home/user_name/.ssh/id_rsa),
62
- # forward_agent: false,
63
- # auth_methods: %w(publickey password)
64
- # # password: "please use keys"
65
- # }