mikoshi 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 66ad04d55f747d3091c3cd1f31a223864561eaea
4
- data.tar.gz: 15f22a4a24d5e8cbbb5b10689676a6bcb3571966
3
+ metadata.gz: 56bb8fdf71e768f178771479a4cd619c69393ff3
4
+ data.tar.gz: 1db7396f7a154aa01873b9a0d120be26895c131d
5
5
  SHA512:
6
- metadata.gz: 2b9ff8154a87ff40e3039e625b2612362733f8f132d4d580b8ffdb356feb24f42b4df03df0d4ecdf54ed993695df88eecf5848e8e7ad7bf44eb3efbe37db3b18
7
- data.tar.gz: c793828dfc4816c89900db56f442661329064827736b9583fef1e9e840f225d87c5c02b8d0debd47364955124a222348d2a3c9bb881764e7c461a53ba8514c81
6
+ metadata.gz: 2e26bed49e82178f2e09e6b909c5532823c6430b5d778e52d5e2e786fcab8d4dec1badf6a7c5e441918bbb42c1e5f99138108aad9db688d021c99ffe8912c87e
7
+ data.tar.gz: 4ac04275fc78b7bda44b91cefebfc1cacfe333fc3ccc4260413421820c61bb44e620c2b0e70895125087157f93b3c5973b0261fa6ff158bc702b6b76399ae66a
@@ -11,3 +11,6 @@ Metrics/BlockLength:
11
11
  Exclude:
12
12
  - 'spec/**/*_spec.rb'
13
13
  - 'mikoshi.gemspec'
14
+
15
+ Metrics/CyclomaticComplexity:
16
+ Max: 8
data/README.md CHANGED
@@ -80,6 +80,9 @@ Waiting for 10 sec...
80
80
  Waiting for 10 sec...
81
81
  Update service success
82
82
 
83
+ # if task definition and service are same name, you can use -g option
84
+ $ mikoshi deploy -g ping2googledns
85
+
83
86
  # show help
84
87
  $ mikoshi help
85
88
  Commands:
@@ -41,9 +41,14 @@ module Mikoshi
41
41
  desc 'deploy', 'Deploy task definition and service'
42
42
  method_option :task_definition, type: :string, desc: 'task_definition name', aliases: '-t'
43
43
  method_option :service, type: :string, desc: 'service name', aliases: '-s'
44
+ method_option :group, type: :string, desc: 'service and task definition name(if both are same)', aliases: '-g'
45
+
44
46
  def deploy
45
- update_task_definition(options[:task_definition]) unless options[:task_definition].nil?
46
- update_service(options[:service]) unless options[:service].nil?
47
+ task_definition = options[:group] || options[:task_definition] || nil
48
+ service = options[:group] || options[:service] || nil
49
+
50
+ update_task_definition(task_definition) if task_definition
51
+ update_service(service) if service
47
52
  end
48
53
 
49
54
  no_tasks do
@@ -1,12 +1,14 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support/core_ext/hash/except'
4
3
  require 'mikoshi/plan'
4
+ require 'mikoshi/util/except_keys'
5
5
 
6
6
  module Mikoshi
7
7
  class Plan
8
8
  class Service < Base
9
9
  TASK_DEFINITION_WITH_REVISION = %r{\A\S+:\d+\z}
10
+ IGNORE_OPTIONS_WHEN_UPDATE =
11
+ %i[client_token load_balancers placement_constraints placement_strategy role service_name].freeze
10
12
 
11
13
  def initialize(yaml_path: nil, client: nil)
12
14
  super
@@ -30,7 +32,7 @@ module Mikoshi
30
32
  def update_service
31
33
  invoke_before_update_hooks
32
34
 
33
- @client.update_service(@data[:service].except(:service_name, :placement_strategy, :placement_constraints))
35
+ @client.update_service(@data[:service].except_keys(IGNORE_OPTIONS_WHEN_UPDATE))
34
36
  wait_until_services_stable
35
37
 
36
38
  invoke_after_update_hooks
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'active_support/core_ext/hash/except'
4
+
5
+ class Hash
6
+ def except_keys(keys_enum)
7
+ return dup.except!(keys_enum) unless keys_enum.respond_to?(:each)
8
+
9
+ clone = dup
10
+ keys_enum.each do |key|
11
+ clone.except!(key)
12
+ end
13
+
14
+ clone
15
+ end
16
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Mikoshi
4
- VERSION = '0.3.0'
4
+ VERSION = '0.4.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mikoshi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yusuke Nakamura
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-31 00:00:00.000000000 Z
11
+ date: 2017-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -160,6 +160,7 @@ files:
160
160
  - lib/mikoshi/plan.rb
161
161
  - lib/mikoshi/plan/service.rb
162
162
  - lib/mikoshi/plan/task_definition.rb
163
+ - lib/mikoshi/util/except_keys.rb
163
164
  - lib/mikoshi/version.rb
164
165
  - mikoshi.gemspec
165
166
  homepage: https://github.com/unasuke/mikoshi