bibliothecary 6.1.0 → 6.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +2 -0
- data/lib/bibliothecary/configuration.rb +2 -0
- data/lib/bibliothecary/parsers/hackage.rb +50 -0
- data/lib/bibliothecary/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 89a98a3cdca8b4edf0a9891e783ebd83feedfdd8f303d42ac8587d8b6db80a66
|
4
|
+
data.tar.gz: 2c3b0b3af118820c5aea13279cc057a3b4e3ebe474e5831debaa723aa1025336
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cd5e09fe6f3ff0e347d697a7b29dccbbe2f4e24f0c3829e354a3acb497088d04fcbab73ec0d4ce217340c87d7aae136027f98c5c3f11f2c2c7d909bd04aecf0e
|
7
|
+
data.tar.gz: 7e785a461989b26d9309e6f9cc012a2a240402de22c6190c74b9a5178aba2f3d82effad00c353b9f72e79925777193ffc4378d0e94e6fa3e5f3b3382fc0811d5
|
data/README.md
CHANGED
@@ -7,6 +7,7 @@ module Bibliothecary
|
|
7
7
|
attr_accessor :gradle_parser_host
|
8
8
|
attr_accessor :yarn_parser_host
|
9
9
|
attr_accessor :swift_parser_host
|
10
|
+
attr_accessor :cabal_parser_host
|
10
11
|
|
11
12
|
def initialize
|
12
13
|
@ignored_files = ['.git', 'node_modules', 'bower_components', 'spec/fixtures', 'vendor', 'dist']
|
@@ -16,6 +17,7 @@ module Bibliothecary
|
|
16
17
|
@gradle_parser_host = 'https://gradle-parser.libraries.io'
|
17
18
|
@yarn_parser_host = 'https://yarn-parser.libraries.io'
|
18
19
|
@swift_parser_host = 'http://swift.libraries.io'
|
20
|
+
@cabal_parser_host = 'http://cabal.libraries.io'
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
require "json"
|
2
|
+
require 'deb_control'
|
3
|
+
|
4
|
+
module Bibliothecary
|
5
|
+
module Parsers
|
6
|
+
class Hackage
|
7
|
+
include Bibliothecary::Analyser
|
8
|
+
|
9
|
+
def self.mapping
|
10
|
+
{
|
11
|
+
/.*\.cabal$/ => {
|
12
|
+
kind: 'manifest',
|
13
|
+
parser: :parse_cabal
|
14
|
+
},
|
15
|
+
/cabal\.config$/ => {
|
16
|
+
kind: 'lockfile',
|
17
|
+
parser: :parse_cabal_config
|
18
|
+
},
|
19
|
+
}
|
20
|
+
end
|
21
|
+
|
22
|
+
def self.parse_cabal(file_contents)
|
23
|
+
headers = {
|
24
|
+
'Content-Type' => "text/plain;charset=utf-8"
|
25
|
+
}
|
26
|
+
|
27
|
+
response = Typhoeus.post("#{Bibliothecary.configuration.cabal_parser_host}/parse", headers: headers, body: file_contents)
|
28
|
+
|
29
|
+
if response.response_code == 200 then
|
30
|
+
JSON.parse(response.body, symbolize_names: true)
|
31
|
+
else
|
32
|
+
[]
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.parse_cabal_config(file_contents)
|
37
|
+
manifest = DebControl::ControlFileBase.parse(file_contents)
|
38
|
+
deps = manifest.first['constraints'].delete("\n").split(',').map(&:strip)
|
39
|
+
deps.map do |dependency|
|
40
|
+
dep = dependency.delete("==").split(' ')
|
41
|
+
{
|
42
|
+
name: dep[0],
|
43
|
+
requirement: dep[1] || '*',
|
44
|
+
type: 'runtime'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
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.
|
4
|
+
version: 6.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andrew Nesbitt
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-02-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toml-rb
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- lib/bibliothecary/parsers/dub.rb
|
193
193
|
- lib/bibliothecary/parsers/elm.rb
|
194
194
|
- lib/bibliothecary/parsers/go.rb
|
195
|
+
- lib/bibliothecary/parsers/hackage.rb
|
195
196
|
- lib/bibliothecary/parsers/haxelib.rb
|
196
197
|
- lib/bibliothecary/parsers/hex.rb
|
197
198
|
- lib/bibliothecary/parsers/julia.rb
|