lapidarius 4.3.0 → 4.4.2
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 +4 -4
- data/README.md +20 -8
- data/lib/lapidarius/cutter.rb +7 -4
- data/lib/lapidarius/gem.rb +8 -2
- data/lib/lapidarius/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 76cd8f0dce486128e152542e0802d96d25b2694f7ea6dcc269aef71b9d901a83
|
4
|
+
data.tar.gz: 953a22c2c81aa421503f0369d6c9f24ac0d5d82698f486b7d0ea189f9349b692
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 420ae3a989f76ff12d6725a9763d686799faccb42a05ccd085de80ddc80766ad28fff86112d1f342873d84f3e5bad4f3aa91ddd0bbd0fa0b77f41368567eb7a1
|
7
|
+
data.tar.gz: 901d8cc8e5942bce1cd387d1f21baeb51f7e4be97ad049e92fed04a33e2b8f6b1dfdc97a0c3e36b6708d7bf068f2df6fdd7fc55de91520727ba138da83797c82
|
data/README.md
CHANGED
@@ -63,23 +63,35 @@ sinatra (1.4.7)
|
|
63
63
|
### Remote
|
64
64
|
By default this library scan for local gems, warning if the gem is not found:
|
65
65
|
```shell
|
66
|
-
lapidarius
|
67
|
-
No gems found matching
|
66
|
+
lapidarius rails -v 2.3.6
|
67
|
+
No gems found matching rails (= 2.3.6)
|
68
68
|
```
|
69
69
|
|
70
70
|
If you want to scan for remote gems specify the `-r` option (be aware of slowness):
|
71
71
|
```shell
|
72
|
-
lapidarius
|
73
|
-
|
74
|
-
|
72
|
+
lapidarius rails -v 2.3.6 -r
|
73
|
+
rails (2.3.6)
|
74
|
+
├── actionmailer (= 2.3.6)
|
75
|
+
│ └── actionpack (= 2.3.6)
|
76
|
+
│ ├── activesupport (= 2.3.6)
|
77
|
+
│ └── rack (~> 1.1.0)
|
78
|
+
├── actionpack (= 2.3.6)
|
79
|
+
│ ├── activesupport (= 2.3.6)
|
80
|
+
│ └── rack (~> 1.1.0)
|
81
|
+
├── activerecord (= 2.3.6)
|
82
|
+
│ └── activesupport (= 2.3.6)
|
83
|
+
├── activeresource (= 2.3.6)
|
84
|
+
│ └── activesupport (= 2.3.6)
|
85
|
+
├── activesupport (= 2.3.6)
|
86
|
+
└── rake (>= 0.8.3)
|
75
87
|
|
76
|
-
|
88
|
+
7 runtime, 6 development
|
77
89
|
```
|
78
90
|
|
79
91
|
### Quiet
|
80
|
-
Some gems
|
92
|
+
Some gems have several interdependencies that results in a multitude of tree branches.
|
81
93
|
In case you just dare to count dependencies without the visual noise, you can pass the `-q` option:
|
82
94
|
```shell
|
83
95
|
lapidarius rails -v 5.1.4 -r -q
|
84
|
-
|
96
|
+
42 runtime, 48 development
|
85
97
|
```
|
data/lib/lapidarius/cutter.rb
CHANGED
@@ -14,6 +14,7 @@ module Lapidarius
|
|
14
14
|
@version = version
|
15
15
|
@remote = remote
|
16
16
|
@dev_deps = []
|
17
|
+
@cache = {}
|
17
18
|
end
|
18
19
|
|
19
20
|
def call
|
@@ -22,14 +23,16 @@ module Lapidarius
|
|
22
23
|
end
|
23
24
|
end
|
24
25
|
|
25
|
-
private def recurse(name: @name, gem: nil, version: @version
|
26
|
-
tokens = tokenize(name, version, remote)
|
26
|
+
private def recurse(name: @name, gem: nil, version: @version)
|
27
|
+
tokens = tokenize(name, version, @remote)
|
27
28
|
token = tokens.shift
|
28
29
|
gem ||= Gem.factory(token)
|
29
30
|
tokens.each do |t|
|
30
31
|
next unless dep = Gem.factory(t)
|
31
|
-
gem <<
|
32
|
-
|
32
|
+
gem << @cache.fetch(t) do
|
33
|
+
recurse(name: dep.name, gem: dep, version: dep.version)
|
34
|
+
@cache[t] = dep
|
35
|
+
end
|
33
36
|
end
|
34
37
|
gem
|
35
38
|
end
|
data/lib/lapidarius/gem.rb
CHANGED
@@ -3,6 +3,8 @@ require "lapidarius/tree"
|
|
3
3
|
|
4
4
|
module Lapidarius
|
5
5
|
class Gem
|
6
|
+
VER_STRIP_CHARS = %w[> < = ~]
|
7
|
+
|
6
8
|
extend Forwardable
|
7
9
|
|
8
10
|
def_delegators :@deps, :size, :each_with_index
|
@@ -22,7 +24,7 @@ module Lapidarius
|
|
22
24
|
end
|
23
25
|
end
|
24
26
|
|
25
|
-
attr_reader :name, :
|
27
|
+
attr_reader :name, :deps
|
26
28
|
attr_accessor :dev_count
|
27
29
|
|
28
30
|
def initialize(name:, version:, deps: [])
|
@@ -42,13 +44,17 @@ module Lapidarius
|
|
42
44
|
end
|
43
45
|
|
44
46
|
def to_s
|
45
|
-
"#{name} (#{version})"
|
47
|
+
"#{name} (#{@version})"
|
46
48
|
end
|
47
49
|
|
48
50
|
def count
|
49
51
|
flatten_deps.size
|
50
52
|
end
|
51
53
|
|
54
|
+
def version
|
55
|
+
@version.gsub(/#{VER_STRIP_CHARS.join("|")}/, "").split(",").map(&:strip).min
|
56
|
+
end
|
57
|
+
|
52
58
|
protected def flatten_deps
|
53
59
|
deps.reduce(deps) do |acc, dep|
|
54
60
|
acc.concat dep.flatten_deps
|
data/lib/lapidarius/version.rb
CHANGED