bibliothecary 6.6.0 → 6.7.1
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 +2 -0
- data/lib/bibliothecary/parsers/go.rb +40 -0
- data/lib/bibliothecary/parsers/rubygems.rb +1 -1
- data/lib/bibliothecary/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 49fa537a10ec86b1e5ea5e98a309809ce5d48f86d6446f4b7594c4336f093fba
|
|
4
|
+
data.tar.gz: 3114585dbb5202247403c9935f805666313f5e721d10a0ce7afdeb11bc22c725
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a022471cd15a016c117fb44ccd599431b1795551ca084a2e114d7ffb5a13b33c9eba9c83c56c2748237ff00a6e0a512fa090cec684c08fb09b5ddb304959d87e
|
|
7
|
+
data.tar.gz: 555ae7a41a2757ce8a119f74fe9975aa9b40b75e8089ca2a9e18863b69bba93757e0f83236651893a8ba8356170d20242ac433be6873c91acabdf351564fadfc
|
data/README.md
CHANGED
|
@@ -7,9 +7,20 @@ module Bibliothecary
|
|
|
7
7
|
include Bibliothecary::Analyser
|
|
8
8
|
|
|
9
9
|
GPM_REGEXP = /^(.+)\s+(.+)$/
|
|
10
|
+
GOMOD_REGEX = /^(.+)\s+(.+)$/
|
|
11
|
+
GOMOD_IGNORABLE_REGEX = /^(module\s|require\s+\(|go\s|\))/m
|
|
12
|
+
GOSUM_REGEX = /^(.+)\s+(.+)\s+(.+)$/
|
|
10
13
|
|
|
11
14
|
def self.mapping
|
|
12
15
|
{
|
|
16
|
+
match_filename("go.mod") => {
|
|
17
|
+
kind: 'manifest',
|
|
18
|
+
parser: :parse_go_mod
|
|
19
|
+
},
|
|
20
|
+
match_filename("go.sum") => {
|
|
21
|
+
kind: 'lockfile',
|
|
22
|
+
parser: :parse_go_sum
|
|
23
|
+
},
|
|
13
24
|
match_filename("glide.yaml") => {
|
|
14
25
|
kind: 'manifest',
|
|
15
26
|
parser: :parse_glide_yaml
|
|
@@ -95,6 +106,35 @@ module Bibliothecary
|
|
|
95
106
|
map_dependencies(manifest, 'projects', 'name', 'revision', 'runtime')
|
|
96
107
|
end
|
|
97
108
|
|
|
109
|
+
def self.parse_go_mod(file_contents)
|
|
110
|
+
deps = []
|
|
111
|
+
file_contents.lines.map(&:strip).each do |line|
|
|
112
|
+
next if line.match(GOMOD_IGNORABLE_REGEX)
|
|
113
|
+
if match = line.gsub(/(\/\/(.*))/, '').match(GOMOD_REGEX)
|
|
114
|
+
deps << {
|
|
115
|
+
name: match[1].strip,
|
|
116
|
+
requirement: match[2].strip || '*',
|
|
117
|
+
type: 'runtime'
|
|
118
|
+
}
|
|
119
|
+
end
|
|
120
|
+
end
|
|
121
|
+
deps
|
|
122
|
+
end
|
|
123
|
+
|
|
124
|
+
def self.parse_go_sum(file_contents)
|
|
125
|
+
deps = []
|
|
126
|
+
file_contents.lines.map(&:strip).each do |line|
|
|
127
|
+
if match = line.match(GOSUM_REGEX)
|
|
128
|
+
deps << {
|
|
129
|
+
name: match[1].strip,
|
|
130
|
+
requirement: match[2].strip.split('/').first || '*',
|
|
131
|
+
type: 'runtime'
|
|
132
|
+
}
|
|
133
|
+
end
|
|
134
|
+
end
|
|
135
|
+
deps.uniq
|
|
136
|
+
end
|
|
137
|
+
|
|
98
138
|
def self.map_dependencies(manifest, attr_name, dep_attr_name, version_attr_name, type)
|
|
99
139
|
manifest.fetch(attr_name,[]).map do |dependency|
|
|
100
140
|
{
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: bibliothecary
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 6.
|
|
4
|
+
version: 6.7.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Andrew Nesbitt
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-05-
|
|
11
|
+
date: 2019-05-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: toml-rb
|