applicaster-capistrano3-aws 0.1.2 → 0.2.0

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: 4eaffe4960dcc2563802a4f32bac71ff37c1bdf1
4
- data.tar.gz: ed380c9d591d80ff76e7876b812fde0b5e2350ac
3
+ metadata.gz: 03bfeba2c63f751ebc2256c1126f4a0cff18f60c
4
+ data.tar.gz: 4e6fc9bbd6c394442d0be6fea23dde3157359e75
5
5
  SHA512:
6
- metadata.gz: 889418feedce88ed421de6c38cf13fcb38daecd103089377d81f6614a9330083a5974fb2c5b1dcdfae9a9068aea18d0c5a3d12217ccb658dcfc095a27f1715aa
7
- data.tar.gz: 469496d86856b333f744c2b85fe37a6d2ad505d5000b5c3b9c3bb653df82e1808edef79d4a0b69de1eb6b010cf4658de01466022c91774f2cac828ab6bcef661
6
+ metadata.gz: a49d0e79600ecf1f789c6a906f3e94d10216c631b29b0fce204e388f3fa2a059e13721302301c085fb254e4b50eec552423ed79466f31dcffa266d757c9fbe75
7
+ data.tar.gz: a2622f1b90e8e657c084557777e5248da39bab0aa6e4125ebb24b7daddb101b4ecd02c2eee28d59b037848da76604c74630cf41490d00c5f83569fb17a7ebfa6
@@ -8,7 +8,8 @@ module Capistrano3
8
8
  module Aws
9
9
  def ec2_instances(filters, map_attribute = :private_ip_address)
10
10
  filters = filters.push({ name: 'instance-state-name', values: %w(running) })
11
- ec2.describe_instances(filters: filters)
11
+ Capistrano3::Aws::Client.ec2
12
+ .describe_instances(filters: filters)
12
13
  .reservations
13
14
  .map(&:instances)
14
15
  .map(&:first)
@@ -16,7 +17,7 @@ module Capistrano3
16
17
  end
17
18
 
18
19
  def update_ssm_parameter(name, value)
19
- ssm.put_parameter({
20
+ Capistrano3::Aws::Client.ssm.put_parameter({
20
21
  name: name,
21
22
  value: value,
22
23
  type: "String",
@@ -24,6 +25,4 @@ module Capistrano3
24
25
  })
25
26
  end
26
27
  end
27
- end
28
-
29
- self.extend Capistrano::Aws
28
+ end
@@ -1,13 +1,15 @@
1
- module Capistrano
1
+ module Capistrano3
2
2
  module Aws
3
- module_function
3
+ module Client
4
+ module_function
4
5
 
5
- def ec2
6
- @ec2 ||= ::Aws::EC2::Client.new(region: fetch(:aws_region))
7
- end
6
+ def ec2
7
+ @ec2 ||= ::Aws::EC2::Client.new(region: fetch(:aws_region, ENV["AWS_REGION"]))
8
+ end
8
9
 
9
- def ssm
10
- @ssm ||= ::Aws::SSM::Client.new(region: fetch(:aws_region))
10
+ def ssm
11
+ @ssm ||= ::Aws::SSM::Client.new(region: fetch(:aws_region, ENV["AWS_REGION"]))
12
+ end
11
13
  end
12
14
  end
13
15
  end
@@ -1,5 +1,5 @@
1
1
  module Capistrano3
2
2
  module Aws
3
- VERSION = "0.1.2"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -1,7 +1,10 @@
1
1
  namespace :load do
2
2
  task :defaults do
3
- set :ssm_params_prefix, -> { "/environments/#{fetch(:stage)}/services/#{fetch(:application)}/deployment" }
4
3
  set :aws_region, "us-east-1"
4
+
5
+ set :ssm_params_prefix, -> do
6
+ "/environments/#{fetch(:stage)}/services/#{fetch(:application)}/deployment"
7
+ end
5
8
  end
6
9
  end
7
10
 
@@ -18,9 +21,10 @@ namespace :deploy do
18
21
  end
19
22
  end
20
23
 
21
- update_ssm_parameter("#{fetch(:ssm_params_prefix)}/revision", current_revision)
22
- update_ssm_parameter("#{fetch(:ssm_params_prefix)}/release_slug", release_name)
23
- puts "UPDATED:: AWS SSM parameters to REVISION: #{current_revision}, RELEASE: #{release_name}"
24
+ Capistrano3::Aws.update_ssm_parameter("#{fetch(:ssm_params_prefix)}/revision", current_revision)
25
+ Capistrano3::Aws.update_ssm_parameter("#{fetch(:ssm_params_prefix)}/release_slug", release_name)
26
+
27
+ puts "UPDATED:: AWS SSM parameters to REVISION: #{current_revision}, RELEASE: #{release_name}"
24
28
  end
25
29
  end
26
30
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: applicaster-capistrano3-aws
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Vitaly Gorodetsky
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-09 00:00:00.000000000 Z
11
+ date: 2017-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk