masamune 0.15.2 → 0.15.3

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: b6b1e378ec9d528e71798e37eaf92a28e39ce275
4
- data.tar.gz: a715c4524d5320cb579053f940419bfebd783036
3
+ metadata.gz: 104f7e365e635e684f6a1e955bcb5d86af5ffe3a
4
+ data.tar.gz: 5f4d61e0c5934fb9b9af59b1a72cad20c1fc1173
5
5
  SHA512:
6
- metadata.gz: 5593ffbea50e048d74cf341afc34757a0e951df67528a7acdc5603a55fd2c4ed1c563ebebe3f396e41340af67d19ac9f9fcb5f3efb7ad03b902ea43a008bb602
7
- data.tar.gz: 9b6cf17acce30109400902d6769ef72c90355542fa985e2b145e4a40aa9dd345f0054e17518f133d95ef950ba4e3e4f8975ce2eb0b0719a579eb1f9f6be95e92
6
+ metadata.gz: 55bac4af92f58e7af91d4d2aeae1a670e415287538e784f7ccbe0d1b2ec30e2fca9d907b938c507bd96265babb31bd643d418fb9434e598001d0343c8cf4723e
7
+ data.tar.gz: 508a833ca5711b4af150fb9f54e68ca91cf6e1faf69704a43e6e03288758b68365d9a69526c29f06a4d319f6338404412fa4543bfd4a4582a519ff080e38e65e
@@ -135,11 +135,8 @@ module Masamune::Commands
135
135
  end
136
136
 
137
137
  def load_setup_files
138
- files = []
139
- @setup_files.each do |path|
140
- filesystem.glob_sort(path, order: :basename).each do |file|
141
- files << file
142
- end
138
+ files = @setup_files.map do |path|
139
+ filesystem.glob_sort(path, order: :basename)
143
140
  end
144
141
  files.flatten.compact.map { |file| {'-i' => file} }
145
142
  end
@@ -89,7 +89,7 @@ class Masamune::Configuration
89
89
 
90
90
  def load_catalog(paths = [])
91
91
  paths.each do |path|
92
- filesystem.glob_sort(path, order: :basename).each do |file|
92
+ filesystem.glob_sort(path, order: :basename) do |file|
93
93
  configuration.with_quiet do
94
94
  catalog.load(file)
95
95
  end
@@ -256,12 +256,16 @@ module Masamune
256
256
  end
257
257
 
258
258
  def glob_sort(pattern, options = {})
259
- result = glob(pattern)
259
+ return to_enum(:glob_sort, pattern, options).to_a unless block_given?
260
260
  case options[:order]
261
261
  when :basename
262
- result.sort { |x,y| File.basename(x) <=> File.basename(y) }
262
+ glob(pattern).sort { |x,y| File.basename(x) <=> File.basename(y) }.each do |result|
263
+ yield result
264
+ end
263
265
  else
264
- result
266
+ glob(pattern) do |result|
267
+ yield result
268
+ end
265
269
  end
266
270
  end
267
271
 
@@ -21,5 +21,5 @@
21
21
  # THE SOFTWARE.
22
22
 
23
23
  module Masamune
24
- VERSION = '0.15.2'
24
+ VERSION = '0.15.3'
25
25
  end
@@ -737,6 +737,7 @@ shared_examples_for 'Filesystem' do
737
737
  end
738
738
 
739
739
  it { is_expected.to eq(%w(/tmp/c/00.txt /tmp/b/01.txt /tmp/a/02.txt)) }
740
+ it { expect { |b| instance.glob_sort('/tmp/*', order: :basename, &b) }.to yield_successive_args(*%w(/tmp/c/00.txt /tmp/b/01.txt /tmp/a/02.txt)) }
740
741
  end
741
742
 
742
743
  describe '#copy_file_to_file' do
@@ -140,11 +140,13 @@ describe Masamune::JobFixture do
140
140
  }
141
141
  end
142
142
 
143
- let(:other_data) { {} }
143
+ let(:reference_data) { {} }
144
+ let(:another_reference_data) { {} }
144
145
 
145
146
  before do
146
147
  described_class.new(path: fixture_path, name: 'basic', data: basic_data).save
147
- described_class.new(path: fixture_path, name: 'other', data: other_data).save
148
+ described_class.new(path: fixture_path, name: 'reference', data: reference_data).save
149
+ described_class.new(path: fixture_path, name: 'another_reference', data: another_reference_data).save
148
150
  end
149
151
 
150
152
  context 'with basic fixture from path' do
@@ -178,7 +180,7 @@ describe Masamune::JobFixture do
178
180
  end
179
181
 
180
182
  context 'with reference fixture' do
181
- let(:other_data) do
183
+ let(:reference_data) do
182
184
  {
183
185
  'inputs' => [
184
186
  {
@@ -200,17 +202,17 @@ describe Masamune::JobFixture do
200
202
  }
201
203
  end
202
204
 
203
- subject(:instance) { described_class.load(path: fixture_path, name: 'other') }
205
+ subject(:instance) { described_class.load(path: fixture_path, name: 'reference') }
204
206
 
205
207
  it 'loads referenced fixture' do
206
- expect(instance.inputs).to include(other_data['inputs'].first)
208
+ expect(instance.inputs).to include(reference_data['inputs'].first)
207
209
  expect(instance.inputs).to include(basic_data['outputs'].first)
208
- expect(instance.outputs).to eq(other_data['outputs'])
210
+ expect(instance.outputs).to eq(reference_data['outputs'])
209
211
  end
210
212
  end
211
213
 
212
214
  context 'with reference fixture and path' do
213
- let(:other_data) do
215
+ let(:reference_data) do
214
216
  {
215
217
  'inputs' => [
216
218
  {
@@ -233,17 +235,17 @@ describe Masamune::JobFixture do
233
235
  }
234
236
  end
235
237
 
236
- subject(:instance) { described_class.load(path: fixture_path, name: 'other') }
238
+ subject(:instance) { described_class.load(path: fixture_path, name: 'reference') }
237
239
 
238
240
  it 'loads referenced fixture' do
239
- expect(instance.inputs).to include(other_data['inputs'].first)
241
+ expect(instance.inputs).to include(reference_data['inputs'].first)
240
242
  expect(instance.inputs).to include(basic_data['outputs'].first)
241
- expect(instance.outputs).to eq(other_data['outputs'])
243
+ expect(instance.outputs).to eq(reference_data['outputs'])
242
244
  end
243
245
  end
244
246
 
245
247
  context 'with reference fixture from file' do
246
- let(:other_data) do
248
+ let(:reference_data) do
247
249
  {
248
250
  'inputs' => [
249
251
  {
@@ -265,18 +267,18 @@ describe Masamune::JobFixture do
265
267
  }
266
268
  end
267
269
 
268
- subject(:instance) { described_class.load(path: fixture_path, name: 'other') }
270
+ subject(:instance) { described_class.load(path: fixture_path, name: 'reference') }
269
271
 
270
272
  it 'loads referenced fixture' do
271
- expect(instance.inputs).to include(other_data['inputs'].first)
273
+ expect(instance.inputs).to include(reference_data['inputs'].first)
272
274
  expect(instance.inputs).to include(basic_data['outputs'].first)
273
- expect(instance.outputs).to eq(other_data['outputs'])
275
+ expect(instance.outputs).to eq(reference_data['outputs'])
274
276
  end
275
277
  end
276
278
 
277
279
 
278
280
  context 'with reference fixture and section' do
279
- let(:other_data) do
281
+ let(:reference_data) do
280
282
  {
281
283
  'inputs' => [
282
284
  {
@@ -299,17 +301,17 @@ describe Masamune::JobFixture do
299
301
  }
300
302
  end
301
303
 
302
- subject(:instance) { described_class.load(path: fixture_path, name: 'other') }
304
+ subject(:instance) { described_class.load(path: fixture_path, name: 'reference') }
303
305
 
304
306
  it 'loads referenced fixture' do
305
- expect(instance.inputs).to include(other_data['inputs'].first)
307
+ expect(instance.inputs).to include(reference_data['inputs'].first)
306
308
  expect(instance.inputs).to include(basic_data['inputs'].first)
307
- expect(instance.outputs).to eq(other_data['outputs'])
309
+ expect(instance.outputs).to eq(reference_data['outputs'])
308
310
  end
309
311
  end
310
312
 
311
313
  context 'with reference fixture that does not exist' do
312
- let(:other_data) do
314
+ let(:reference_data) do
313
315
  {
314
316
  'inputs' => [
315
317
  {
@@ -331,13 +333,13 @@ describe Masamune::JobFixture do
331
333
  }
332
334
  end
333
335
 
334
- subject(:instance) { described_class.load(path: fixture_path, name: 'other') }
336
+ subject(:instance) { described_class.load(path: fixture_path, name: 'reference') }
335
337
 
336
338
  it { expect { instance.inputs }.to raise_error(ArgumentError) }
337
339
  end
338
340
 
339
341
  context 'with invalid reference fixture' do
340
- let(:other_data) do
342
+ let(:reference_data) do
341
343
  {
342
344
  'inputs' => [
343
345
  {
@@ -357,9 +359,66 @@ describe Masamune::JobFixture do
357
359
  }
358
360
  end
359
361
 
360
- subject(:instance) { described_class.load(path: fixture_path, name: 'other') }
362
+ subject(:instance) { described_class.load(path: fixture_path, name: 'reference') }
361
363
 
362
364
  it { expect { instance.inputs }.to raise_error(ArgumentError) }
363
365
  end
366
+
367
+ context 'with reference fixture that includes reference' do
368
+ let(:another_reference_data) do
369
+ {
370
+ 'inputs' => [
371
+ {
372
+ 'file' => 'another_input_file',
373
+ 'data' => 'another_input_data'
374
+ },
375
+ {
376
+ 'reference' => {
377
+ 'fixture' => 'basic',
378
+ 'section' => 'inputs'
379
+ }
380
+ }
381
+ ],
382
+ 'outputs' => [
383
+ {
384
+ 'file' => 'another_output_file',
385
+ 'data' => 'another_output_data'
386
+ }
387
+ ]
388
+ }
389
+ end
390
+
391
+ let(:reference_data) do
392
+ {
393
+ 'inputs' => [
394
+ {
395
+ 'file' => 'other_input_file',
396
+ 'data' => 'other_input_data'
397
+ },
398
+ {
399
+ 'reference' => {
400
+ 'fixture' => 'another_reference',
401
+ 'section' => 'inputs'
402
+ }
403
+ }
404
+ ],
405
+ 'outputs' => [
406
+ {
407
+ 'file' => 'other_output_file',
408
+ 'data' => 'other_output_data'
409
+ }
410
+ ]
411
+ }
412
+ end
413
+
414
+ subject(:instance) { described_class.load(path: fixture_path, name: 'reference') }
415
+
416
+ it 'loads both referenced fixtures' do
417
+ expect(instance.inputs).to include(reference_data['inputs'].first)
418
+ expect(instance.inputs).to include(basic_data['inputs'].first)
419
+ expect(instance.inputs).to include(another_reference_data['inputs'].first)
420
+ expect(instance.outputs).to eq(reference_data['outputs'])
421
+ end
422
+ end
364
423
  end
365
424
  end
@@ -49,7 +49,10 @@ class Masamune::MockFilesystem < Delegator
49
49
  end
50
50
 
51
51
  def glob_sort(pattern, options = {})
52
- glob(pattern)
52
+ return to_enum(:glob_sort, pattern, options).to_a unless block_given?
53
+ glob(pattern) do |file|
54
+ yield file
55
+ end
53
56
  end
54
57
 
55
58
  def glob_stat(pattern)
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.15.2
4
+ version: 0.15.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-11-13 00:00:00.000000000 Z
11
+ date: 2015-11-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -435,7 +435,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
435
435
  version: '0'
436
436
  requirements: []
437
437
  rubyforge_project:
438
- rubygems_version: 2.4.8
438
+ rubygems_version: 2.4.5.1
439
439
  signing_key:
440
440
  specification_version: 4
441
441
  summary: Hybrid Data & Work Flow