transdeps 1.0.0 → 1.1.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
  SHA256:
3
- metadata.gz: 9185862ab7bb088217ca22ec6b5776c3d697f296ad91c30497e031915b96fcc7
4
- data.tar.gz: ea2b1a60f405fd025e8b7d02631c2baa286776c61e7d43ee8cfe3226fd82d1d5
3
+ metadata.gz: 424fd5c08dbbe5e2be8c78fe735f42b11f6cf5f4e9815ccdcb2563da0fc35716
4
+ data.tar.gz: '09227ca9a21522f29ab1123593e51940c0fef41ff7419bc0a7d80c6a049a7775'
5
5
  SHA512:
6
- metadata.gz: 07e5251e839211262e1e81fbf97cb50396fbec48c2a7627e4b5d7b5ffce3738ed66c627940c606f1abdb3588fc65d73f2070865ce839c55e961dc365bd052b39
7
- data.tar.gz: 1dd826ed58d198832966af84b9cbae2e01d4d4f6e35ea0fe5ee4e7128227ad1673f6d47378a51b262a2d1dc00502ac1711b9f449d3d443ba50eeb11d04714467
6
+ metadata.gz: a061b7a670c4ada708de3ae02157a0cf3fd2bd892155d888a0b4aa240bc8368f1725f1f0acdccd6c0a49fe087667c2cf2716ade05a5752c2864b37ab6202699f
7
+ data.tar.gz: 9011b3d7012d3b6874507a36cb6ee7750c479ad4946ab59ff7689300ceb74ba34ac308d627aae18d410df1914c71c29453a9410431f28fc1d2cb096a31bbe17f
@@ -0,0 +1,9 @@
1
+ module Transdeps
2
+ class DefaultComponentDiscoverer
3
+ def call(component_dir)
4
+ component_dir
5
+ .children
6
+ .select { |filename| File.directory?(filename) }
7
+ end
8
+ end
9
+ end
@@ -1,9 +1,10 @@
1
+ require 'transdeps/default_component_discoverer'
1
2
  require 'transdeps/spec_list_factory'
2
3
  require 'transdeps/inconsistency'
3
4
 
4
5
  module Transdeps
5
- class Reconciler < Struct.new(:factory)
6
- def initialize(factory=SpecListFactory.new)
6
+ class Reconciler < Struct.new(:spec_list_factory, :component_discoverer)
7
+ def initialize(spec_list_factory=SpecListFactory.new, component_discoverer=DefaultComponentDiscoverer.new)
7
8
  super
8
9
  end
9
10
 
@@ -17,13 +18,12 @@ module Transdeps
17
18
  private
18
19
 
19
20
  def specs_for(dir)
20
- factory.call(dir)
21
+ spec_list_factory.call(dir)
21
22
  end
22
23
 
23
24
  def all_component_specs(component_dir)
24
- component_dir
25
- .children
26
- .select { |filename| File.directory?(filename) }
25
+ component_discoverer
26
+ .call(component_dir)
27
27
  .map { |dir| specs_for(dir) }
28
28
  end
29
29
 
@@ -1,3 +1,3 @@
1
1
  module Transdeps
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
@@ -0,0 +1,47 @@
1
+ require 'spec_helper'
2
+ require 'tmpdir'
3
+ require 'transdeps/default_component_discoverer'
4
+
5
+ module Transdeps
6
+ describe DefaultComponentDiscoverer do
7
+ subject { Transdeps::DefaultComponentDiscoverer.new }
8
+
9
+ around(:each) do |example|
10
+ Dir.mktmpdir do |dir|
11
+ Dir.chdir(dir) do
12
+ Dir.mkdir('components')
13
+ Dir.mkdir(component_a)
14
+ Dir.mkdir(component_b)
15
+
16
+ File.open(dummy_file, 'w') { }
17
+
18
+ example.run
19
+ end
20
+ end
21
+ end
22
+
23
+ let (:component_a) { File.join('components', 'componentA') }
24
+ let (:component_b) { File.join('components', 'componentB') }
25
+ let (:dummy_file) { File.join('README.md') }
26
+
27
+ it 'returns Pathnames to directories inside a given component_dir' do
28
+ component_dir = double(
29
+ Dir,
30
+ children: [
31
+ Pathname.new(component_a),
32
+ Pathname.new(dummy_file),
33
+ Pathname.new(component_b)
34
+ ]
35
+ )
36
+
37
+ components = subject.call(component_dir)
38
+
39
+ expect(components).to match_array(
40
+ [
41
+ Pathname.new(component_a),
42
+ Pathname.new(component_b)
43
+ ]
44
+ )
45
+ end
46
+ end
47
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: transdeps
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - TJ Taylor
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-11 00:00:00.000000000 Z
11
+ date: 2018-05-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -67,6 +67,7 @@ files:
67
67
  - Rakefile
68
68
  - lib/transdeps.rb
69
69
  - lib/transdeps/cli.rb
70
+ - lib/transdeps/default_component_discoverer.rb
70
71
  - lib/transdeps/inconsistency.rb
71
72
  - lib/transdeps/reconciler.rb
72
73
  - lib/transdeps/spec_list.rb
@@ -95,6 +96,7 @@ files:
95
96
  - spec/dummy/lib/dummy.rb
96
97
  - spec/spec_helper.rb
97
98
  - spec/transdeps/cli_spec.rb
99
+ - spec/transdeps/default_component_discoverer_spec.rb
98
100
  - spec/transdeps/reconciler_spec.rb
99
101
  - spec/transdeps/spec_list_factory_spec.rb
100
102
  - spec/transdeps/spec_list_spec.rb
@@ -147,6 +149,7 @@ test_files:
147
149
  - spec/dummy/lib/dummy.rb
148
150
  - spec/spec_helper.rb
149
151
  - spec/transdeps/cli_spec.rb
152
+ - spec/transdeps/default_component_discoverer_spec.rb
150
153
  - spec/transdeps/reconciler_spec.rb
151
154
  - spec/transdeps/spec_list_factory_spec.rb
152
155
  - spec/transdeps/spec_list_spec.rb