bibliothecary 6.6.0 → 6.7.1

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: 34c770ef3ea9fb2cc8cb2a360871f67c2ad1b7007d92644558df16f975d70a2f
4
- data.tar.gz: bf68d3358b128c107266c2c3d27b9e78578cf669731d54fb7511aeda7048d76b
3
+ metadata.gz: 49fa537a10ec86b1e5ea5e98a309809ce5d48f86d6446f4b7594c4336f093fba
4
+ data.tar.gz: 3114585dbb5202247403c9935f805666313f5e721d10a0ce7afdeb11bc22c725
5
5
  SHA512:
6
- metadata.gz: 86c784d59fae0d7096d10066dc270017b8eb8acece490d124eef7c64fa31367f50bbc069f56f62b49bb89703b90af30412a3baccc56cce624f885752f28a932d
7
- data.tar.gz: 53cfeccce209501b909f9b132971ca80226b7b1ea34f20a3a5334c803c5ad53979c536aac10a7696bea82e2a7a96846b44a997da4b020c463e0e941fb9c3a764
6
+ metadata.gz: a022471cd15a016c117fb44ccd599431b1795551ca084a2e114d7ffb5a13b33c9eba9c83c56c2748237ff00a6e0a512fa090cec684c08fb09b5ddb304959d87e
7
+ data.tar.gz: 555ae7a41a2757ce8a119f74fe9975aa9b40b75e8089ca2a9e18863b69bba93757e0f83236651893a8ba8356170d20242ac433be6873c91acabdf351564fadfc
data/README.md CHANGED
@@ -135,6 +135,8 @@ All available config options are in: https://github.com/librariesio/bibliothecar
135
135
  - vendor/vendor.json
136
136
  - Gopkg.toml
137
137
  - Gopkg.lock
138
+ - go.mod
139
+ - go.sum
138
140
  - Elm
139
141
  - elm-package.json
140
142
  - elm_dependencies.json
@@ -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
  {
@@ -29,7 +29,7 @@ module Bibliothecary
29
29
  end
30
30
 
31
31
  def self.parse_gemfile_lock(manifest)
32
- manifest.split("\n").map do |line|
32
+ manifest.lines(chomp: true).map do |line|
33
33
  match = line.match(NAME_VERSION_4)
34
34
  next unless match
35
35
  name = match[1]
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "6.6.0"
2
+ VERSION = "6.7.1"
3
3
  end
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.6.0
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-03 00:00:00.000000000 Z
11
+ date: 2019-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: toml-rb