transdeps 0.1.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +29 -6
- data/lib/transdeps/reconciler.rb +16 -4
- data/lib/transdeps/version.rb +1 -1
- data/spec/dummy/components/a-file +0 -0
- data/spec/transdeps/reconciler_spec.rb +10 -0
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9185862ab7bb088217ca22ec6b5776c3d697f296ad91c30497e031915b96fcc7
|
4
|
+
data.tar.gz: ea2b1a60f405fd025e8b7d02631c2baa286776c61e7d43ee8cfe3226fd82d1d5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 07e5251e839211262e1e81fbf97cb50396fbec48c2a7627e4b5d7b5ffce3738ed66c627940c606f1abdb3588fc65d73f2070865ce839c55e961dc365bd052b39
|
7
|
+
data.tar.gz: 1dd826ed58d198832966af84b9cbae2e01d4d4f6e35ea0fe5ee4e7128227ad1673f6d47378a51b262a2d1dc00502ac1711b9f449d3d443ba50eeb11d04714467
|
data/README.md
CHANGED
@@ -21,6 +21,8 @@ Or install it yourself as:
|
|
21
21
|
|
22
22
|
## Usage
|
23
23
|
|
24
|
+
### Using `rake`
|
25
|
+
|
24
26
|
Add this line to application's Rakefile:
|
25
27
|
|
26
28
|
```ruby
|
@@ -30,7 +32,7 @@ require 'transdeps/tasks'
|
|
30
32
|
Then run:
|
31
33
|
|
32
34
|
```bash
|
33
|
-
bundle exec rake[/path/to/my/components,/path/to/my/project]
|
35
|
+
bundle exec rake transdeps[/path/to/my/components,/path/to/my/project]
|
34
36
|
```
|
35
37
|
|
36
38
|
Since you are presumably running this task from the root of your project,
|
@@ -38,13 +40,34 @@ you can leave the second argument to the Rake task off, and the
|
|
38
40
|
first argument would be a relative path. Something like:
|
39
41
|
|
40
42
|
```bash
|
41
|
-
bundle exec rake[components]
|
43
|
+
bundle exec rake transdeps[components]
|
44
|
+
```
|
45
|
+
|
46
|
+
### Using `rspec`
|
47
|
+
|
48
|
+
Add this spec:
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
require "transdeps/cli"
|
52
|
+
|
53
|
+
RSpec.describe "Component" do
|
54
|
+
it "uses the same version of dependencies as the ones in the container application" do
|
55
|
+
results = Transdeps::Cli.new("components").run
|
56
|
+
expect(results).to be_empty, failure_message(results)
|
57
|
+
end
|
58
|
+
|
59
|
+
def failure_message(results)
|
60
|
+
(["❌ Dependency inconsistencies found:"] + results).join("\n")
|
61
|
+
end
|
62
|
+
end
|
42
63
|
```
|
43
64
|
|
44
65
|
## Contributing
|
45
66
|
|
46
67
|
1. Fork it ( https://github.com/dugancathal/transdeps/fork )
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
68
|
+
1. Create your feature branch (`git checkout -b my-new-feature`)
|
69
|
+
1. Install gems (`gem install bundler && bundle`)
|
70
|
+
1. Run tests (`rspec`)
|
71
|
+
1. Commit your changes (`git commit -am 'Add some feature'`)
|
72
|
+
1. Push to the branch (`git push origin my-new-feature`)
|
73
|
+
1. Create a new Pull Request
|
data/lib/transdeps/reconciler.rb
CHANGED
@@ -9,10 +9,9 @@ module Transdeps
|
|
9
9
|
|
10
10
|
def call(component_dir, project_dir)
|
11
11
|
project_specs = specs_for(project_dir)
|
12
|
-
all_component_specs = component_dir
|
13
|
-
|
14
|
-
|
15
|
-
end.compact
|
12
|
+
all_component_specs = all_component_specs(component_dir)
|
13
|
+
|
14
|
+
spec_differences(project_specs, all_component_specs)
|
16
15
|
end
|
17
16
|
|
18
17
|
private
|
@@ -20,5 +19,18 @@ module Transdeps
|
|
20
19
|
def specs_for(dir)
|
21
20
|
factory.call(dir)
|
22
21
|
end
|
22
|
+
|
23
|
+
def all_component_specs(component_dir)
|
24
|
+
component_dir
|
25
|
+
.children
|
26
|
+
.select { |filename| File.directory?(filename) }
|
27
|
+
.map { |dir| specs_for(dir) }
|
28
|
+
end
|
29
|
+
|
30
|
+
def spec_differences(project_specs, all_component_specs)
|
31
|
+
all_component_specs.flat_map do |component_specs|
|
32
|
+
project_specs - component_specs
|
33
|
+
end.compact
|
34
|
+
end
|
23
35
|
end
|
24
36
|
end
|
data/lib/transdeps/version.rb
CHANGED
File without changes
|
@@ -25,5 +25,15 @@ module Transdeps
|
|
25
25
|
|
26
26
|
expect(result).to eq [Inconsistency.new(ten_dot_oh, ten_dot_one)]
|
27
27
|
end
|
28
|
+
|
29
|
+
it 'ignores files in components directory' do
|
30
|
+
factory = SpecListFactory.new
|
31
|
+
rec = Reconciler.new(factory)
|
32
|
+
component_dir = double(Dir, children: [DUMMY_APP_PATH + 'components/a-file'])
|
33
|
+
|
34
|
+
result = rec.call(component_dir, DUMMY_APP_PATH)
|
35
|
+
|
36
|
+
expect(result).to be_empty
|
37
|
+
end
|
28
38
|
end
|
29
39
|
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:
|
4
|
+
version: 1.0.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:
|
11
|
+
date: 2018-03-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -76,6 +76,7 @@ files:
|
|
76
76
|
- lib/transdeps/version.rb
|
77
77
|
- spec/dummy/Gemfile
|
78
78
|
- spec/dummy/Gemfile.lock
|
79
|
+
- spec/dummy/components/a-file
|
79
80
|
- spec/dummy/components/invalid-sub-dependencies/Gemfile
|
80
81
|
- spec/dummy/components/invalid-sub-dependencies/Gemfile.lock
|
81
82
|
- spec/dummy/components/invalid-sub-dependencies/invalid-sub-dependencies.gemspec
|
@@ -120,13 +121,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
120
121
|
version: '0'
|
121
122
|
requirements: []
|
122
123
|
rubyforge_project:
|
123
|
-
rubygems_version: 2.
|
124
|
+
rubygems_version: 2.7.3
|
124
125
|
signing_key:
|
125
126
|
specification_version: 4
|
126
127
|
summary: ''
|
127
128
|
test_files:
|
128
129
|
- spec/dummy/Gemfile
|
129
130
|
- spec/dummy/Gemfile.lock
|
131
|
+
- spec/dummy/components/a-file
|
130
132
|
- spec/dummy/components/invalid-sub-dependencies/Gemfile
|
131
133
|
- spec/dummy/components/invalid-sub-dependencies/Gemfile.lock
|
132
134
|
- spec/dummy/components/invalid-sub-dependencies/invalid-sub-dependencies.gemspec
|