capistrano-ec2 0.1.4 → 0.1.6

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
- SHA1:
3
- metadata.gz: 9d49bd03dc7164feac8b3857fc6aefd82c845aa0
4
- data.tar.gz: 96ae1cca4d6c6330dc9e5469f7e204d8ccd07e83
2
+ SHA256:
3
+ metadata.gz: b222df552df15569ef0071f8a71172ce9d9e799b5a8b01246d248bdda72d27ce
4
+ data.tar.gz: bdf09ac3c2af7d067a6a9a2e541c5145c01ceef7859dbd8bfc96aa417df0dbc8
5
5
  SHA512:
6
- metadata.gz: '0292e3718d4f1afd8e2c3e57fa59bd66f4d55f542f5d215d43f33d9d3bdfc37ceffe33bf75485426fc9846d3835156577205d780162d8d8618f1049620f9b2bd'
7
- data.tar.gz: c5e233c40c7324e753e02dad5d862231f1006dcca57c1c7b0734ff1ac6b561333fd8c93021326a44b17dc6649a01b764582d68096dc61579fc70ef7ba5048cc7
6
+ metadata.gz: c28fcc0ec1a49060f3c7c7ea4f630bbd96c7016d0a248a585d56de559b15bac8947fe3ead0a010edb6192be42bd7cf2e9d0065b25b0c9f6d8f49635ad7608fe2
7
+ data.tar.gz: 84707d796f9a3b637a918d3f0351ccbe3210d38ee23ee8a4f83fe3226cea7924dd1dcbb5a7335bb6f12c094174ccdec778f8767fb814e69e871d5aee2c95fb85
@@ -27,10 +27,10 @@ Gem::Specification.new do |spec|
27
27
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
28
28
  spec.require_paths = ["lib"]
29
29
 
30
- spec.add_dependency "capistrano", "~> 3.0"
31
- spec.add_dependency "fog-aws", "~> 0.13.0"
30
+ spec.add_dependency "capistrano", "~> 3.15"
31
+ spec.add_dependency "fog-aws", "~> 3.6"
32
32
 
33
- spec.add_development_dependency "bundler", "~> 1.12"
34
- spec.add_development_dependency "rake", "~> 10.0"
35
- spec.add_development_dependency "rspec", "~> 3.0"
33
+ spec.add_development_dependency "bundler", "~> 2.4"
34
+ spec.add_development_dependency "rake", "~> 13.0"
35
+ spec.add_development_dependency "rspec", "~> 3.10"
36
36
  end
@@ -1,17 +1,13 @@
1
1
  require 'fog/aws'
2
+ require 'forwardable'
2
3
 
3
4
  module Capistrano
4
5
  class Configuration
5
6
  def for_each_ec2_server(ec2_env:, ec2_role:, &block)
6
- ec2 = Fog::Compute.new \
7
- provider: 'AWS',
8
- region: fetch(:region),
9
- use_iam_profile: fetch(:use_iam_profile, false)
10
-
11
- filters = {
12
- "tag:ec2_env" => ec2_env,
13
- "tag:role" => ec2_role,
14
- 'instance-state-name': 'running'
7
+ filters = {
8
+ 'tag:ec2_env' => ec2_env,
9
+ 'tag:role' => ec2_role,
10
+ 'instance-state-name': 'running'
15
11
  }
16
12
 
17
13
  ec2.servers.all(filters).map.with_index do |ec2_server, index|
@@ -20,10 +16,50 @@ module Capistrano
20
16
  yield ec2_server, index
21
17
  end
22
18
  end
19
+
20
+ private
21
+
22
+ def ec2
23
+ @ec2 ||= Fog::Compute.new(fog_arguments)
24
+ end
25
+
26
+ def fog_arguments
27
+ default_options = {
28
+ provider: 'AWS',
29
+ region: region,
30
+ }
31
+
32
+ if use_iam_profile
33
+ default_options.merge(iam_profile_options)
34
+ else
35
+ default_options.merge(access_key_options)
36
+ end
37
+ end
38
+
39
+ def region
40
+ fetch(:region)
41
+ end
42
+
43
+ def use_iam_profile
44
+ fetch(:use_iam_profile, false)
45
+ end
46
+
47
+ def iam_profile_options
48
+ { use_iam_profile: true }
49
+ end
50
+
51
+ def access_key_options
52
+ {
53
+ aws_access_key_id: ENV['AWS_ACCESS_KEY_ID'],
54
+ aws_secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
55
+ aws_session_token: ENV['AWS_SESSION_TOKEN'],
56
+ }
57
+ end
23
58
  end
24
59
 
25
60
  module DSL
26
61
  module Env
62
+ extend Forwardable
27
63
  def_delegators :env, :for_each_ec2_server
28
64
  end
29
65
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano
2
2
  module Ec2
3
- VERSION = "0.1.4"
3
+ VERSION = "0.1.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: capistrano-ec2
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom de Vries
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-08-14 00:00:00.000000000 Z
11
+ date: 2023-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: capistrano
@@ -16,70 +16,70 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.0'
19
+ version: '3.15'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.0'
26
+ version: '3.15'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: fog-aws
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: 0.13.0
33
+ version: '3.6'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: 0.13.0
40
+ version: '3.6'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: bundler
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.12'
47
+ version: '2.4'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.12'
54
+ version: '2.4'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: '10.0'
61
+ version: '13.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: '10.0'
68
+ version: '13.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rspec
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: '3.0'
75
+ version: '3.10'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: '3.0'
82
+ version: '3.10'
83
83
  description: A Capistrano patch to simplify deployment to Amazon EC2.
84
84
  email:
85
85
  - tom@hackerone.com
@@ -106,7 +106,7 @@ licenses:
106
106
  - MIT
107
107
  metadata:
108
108
  allowed_push_host: https://rubygems.org
109
- post_install_message:
109
+ post_install_message:
110
110
  rdoc_options: []
111
111
  require_paths:
112
112
  - lib
@@ -121,9 +121,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
121
  - !ruby/object:Gem::Version
122
122
  version: '0'
123
123
  requirements: []
124
- rubyforge_project:
125
- rubygems_version: 2.6.14.3
126
- signing_key:
124
+ rubygems_version: 3.4.10
125
+ signing_key:
127
126
  specification_version: 4
128
127
  summary: A Capistrano patch to simplify deployment to Amazon EC2.
129
128
  test_files: []