masamune 0.11.2 → 0.11.3

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: dfbc2a3764c6ed9c4a5cb1b82bfa0f7ca22aac53
4
- data.tar.gz: fd95120e7e1a26b847af62c09ce7b0fdcc30b736
3
+ metadata.gz: 56a5dbe4b4256757b5283c3df6dc9493b128b3f3
4
+ data.tar.gz: bb4f40e8d8b94bdea7479e01c3c42a5f6cf01204
5
5
  SHA512:
6
- metadata.gz: 601caddfc1aadb966c05010a0f833cfc70051a965d60cda3c59ceacde696109536bf02c422695ee2ec0d159b74f55ceda83cc863d2b2a6c03ce4156010f07a25
7
- data.tar.gz: e35f201ff313c4a3d9a98a069ace3cc8ba2e1d425d93ae7ffbbda802fdca968a892b19ce078f2c03bf24ca1e1549b4fe456d30ba66a7dfe8a8f86c69627e66d7
6
+ metadata.gz: d1a80a035977edb527b81081bc281d599d1a34e1c173e17fd202c0e476818d3327a484da07e7f16122001c43a32785e0625f60f720ccb0ca2d6e959e337259a0
7
+ data.tar.gz: 38fb039356f2818a729b52ead4301d5e89680f4c77df63bf2f446a25acfd9fcc08f0e53586d2a450915c60cca089908076bf2f50468fcc5a3ee5edd33428ce3a
@@ -51,18 +51,21 @@ module Masamune::Actions
51
51
  extra.empty?
52
52
  end
53
53
 
54
+ def validate_jobflow!
55
+ return unless jobflow_required?
56
+ jobflow = configuration.elastic_mapreduce[:jobflow]
57
+ raise ::Thor::RequiredArgumentMissingError, "No value provided for required options '--jobflow'" unless jobflow
58
+ raise ::Thor::RequiredArgumentMissingError, %Q(Value '#{jobflow}' for '--jobflow' doesn't exist) unless elastic_mapreduce(extra: '--list', jobflow: jobflow, fail_fast: false).success?
59
+ end
60
+
54
61
  included do |base|
55
62
  base.class_option :jobflow, :aliases => '-j', :desc => 'Elastic MapReduce jobflow ID (Hint: elastic-mapreduce --list)' if defined?(base.class_option)
56
63
  base.after_initialize(:early) do |thor, options|
57
- next unless options[:initialize]
58
- next if thor.configuration.elastic_mapreduce.empty?
64
+ next unless thor.configuration.elastic_mapreduce.any?
59
65
  next unless thor.configuration.elastic_mapreduce.fetch(:enabled, true)
60
- jobflow = thor.resolve_jobflow(options[:jobflow] || thor.configuration.elastic_mapreduce[:jobflow])
61
- if thor.jobflow_required?
62
- raise ::Thor::RequiredArgumentMissingError, "No value provided for required options '--jobflow'" unless jobflow
63
- raise ::Thor::RequiredArgumentMissingError, %Q(Value '#{jobflow}' for '--jobflow' doesn't exist) unless thor.elastic_mapreduce(extra: '--list', jobflow: jobflow, fail_fast: false).success?
64
- end
65
- thor.configuration.elastic_mapreduce[:jobflow] = jobflow
66
+ thor.configuration.elastic_mapreduce[:jobflow] = thor.resolve_jobflow(options[:jobflow] || thor.configuration.elastic_mapreduce[:jobflow])
67
+ next unless options[:initialize]
68
+ thor.validate_jobflow!
66
69
  end if defined?(base.after_initialize)
67
70
  end
68
71
  end
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Masamune
24
- VERSION = '0.11.2'
24
+ VERSION = '0.11.3'
25
25
  end
@@ -78,7 +78,10 @@ describe Masamune::Actions::ElasticMapreduce do
78
78
  before do
79
79
  expect(instance).to_not receive(:elastic_mapreduce)
80
80
  end
81
- it { expect { subject }.to_not raise_error }
81
+ it do
82
+ expect { subject }.to_not raise_error
83
+ expect(instance.configuration.elastic_mapreduce[:jobflow]).to eq('j-XYZ')
84
+ end
82
85
  end
83
86
 
84
87
  context 'when jobflow does not exist' do
@@ -98,7 +101,7 @@ describe Masamune::Actions::ElasticMapreduce do
98
101
  end
99
102
  it do
100
103
  expect { subject }.to_not raise_error
101
- expect(configuration[:jobflow]).to eq('j-XYZ')
104
+ expect(instance.configuration.elastic_mapreduce[:jobflow]).to eq('j-XYZ')
102
105
  end
103
106
  end
104
107
 
@@ -110,7 +113,7 @@ describe Masamune::Actions::ElasticMapreduce do
110
113
  end
111
114
  it do
112
115
  expect { subject }.to_not raise_error
113
- expect(configuration[:jobflow]).to eq('j-XYZ')
116
+ expect(instance.configuration.elastic_mapreduce[:jobflow]).to eq('j-XYZ')
114
117
  end
115
118
  end
116
119
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: masamune
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.2
4
+ version: 0.11.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Andrews
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-20 00:00:00.000000000 Z
11
+ date: 2015-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor