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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8efd048d47996bf9bcc3252e2c66817d4123a36208734267a6b9e84315fc4278
4
- data.tar.gz: a961e90ed80a1f9d67f7dc0d88ddd411d663a25d13a52bca3a5d96c970cc0a42
3
+ metadata.gz: 89a98a3cdca8b4edf0a9891e783ebd83feedfdd8f303d42ac8587d8b6db80a66
4
+ data.tar.gz: 2c3b0b3af118820c5aea13279cc057a3b4e3ebe474e5831debaa723aa1025336
5
5
  SHA512:
6
- metadata.gz: 27025e8a5dea37b1ad5adbc61218263c32c439f41372957a82f93be2cbed642b3cc08fe7a627345e16d6803a3af734cf8ebfd3a9b150048713b55cc0625d10ee
7
- data.tar.gz: 4439392a1558355966cbe4d3fabef5257b6192056f0021a363073337927dc7c2af179a0bcd686e23c6e83f9c0bc4cb50357daf854de177ed2a03daaa91158446
6
+ metadata.gz: cd5e09fe6f3ff0e347d697a7b29dccbbe2f4e24f0c3829e354a3acb497088d04fcbab73ec0d4ce217340c87d7aae136027f98c5c3f11f2c2c7d909bd04aecf0e
7
+ data.tar.gz: 7e785a461989b26d9309e6f9cc012a2a240402de22c6190c74b9a5178aba2f3d82effad00c353b9f72e79925777193ffc4378d0e94e6fa3e5f3b3382fc0811d5
data/README.md CHANGED
@@ -56,6 +56,8 @@ All available config options are in: https://github.com/librariesio/bibliothecar
56
56
 
57
57
  ## Supported package manager file formats
58
58
 
59
+ - Hackage
60
+ - \*.cabal
59
61
  - npm
60
62
  - package.json
61
63
  - package-lock.json
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "6.1.0"
2
+ VERSION = "6.2.0"
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.1.0
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-01-29 00:00:00.000000000 Z
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