bibliothecary 6.0.0 → 6.1.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 +14 -0
- data/lib/bibliothecary.rb +18 -1
- data/lib/bibliothecary/configuration.rb +21 -0
- data/lib/bibliothecary/parsers/carthage.rb +1 -1
- data/lib/bibliothecary/parsers/clojars.rb +1 -1
- data/lib/bibliothecary/parsers/hex.rb +2 -2
- data/lib/bibliothecary/parsers/maven.rb +1 -1
- data/lib/bibliothecary/parsers/npm.rb +1 -1
- data/lib/bibliothecary/parsers/swift_pm.rb +1 -1
- 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: 8efd048d47996bf9bcc3252e2c66817d4123a36208734267a6b9e84315fc4278
|
4
|
+
data.tar.gz: a961e90ed80a1f9d67f7dc0d88ddd411d663a25d13a52bca3a5d96c970cc0a42
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 27025e8a5dea37b1ad5adbc61218263c32c439f41372957a82f93be2cbed642b3cc08fe7a627345e16d6803a3af734cf8ebfd3a9b150048713b55cc0625d10ee
|
7
|
+
data.tar.gz: 4439392a1558355966cbe4d3fabef5257b6192056f0021a363073337927dc7c2af179a0bcd686e23c6e83f9c0bc4cb50357daf854de177ed2a03daaa91158446
|
data/README.md
CHANGED
@@ -44,6 +44,16 @@ Search a directory for manifest files and parse the contents:
|
|
44
44
|
Bibliothecary.analyse('./')
|
45
45
|
```
|
46
46
|
|
47
|
+
There are a number of parsers that rely on web services to parse the file formats, those urls can be configured like so:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
Bibliothecary.configure do |config|
|
51
|
+
config.carthage_parser_host = 'http://my-carthage-parsing-service.com'
|
52
|
+
end
|
53
|
+
```
|
54
|
+
|
55
|
+
All available config options are in: https://github.com/librariesio/bibliothecary/blob/master/lib/bibliothecary/configuration.rb
|
56
|
+
|
47
57
|
## Supported package manager file formats
|
48
58
|
|
49
59
|
- npm
|
@@ -124,10 +134,14 @@ Bibliothecary.analyse('./')
|
|
124
134
|
- Godeps/Godeps.json
|
125
135
|
- vendor/manifest
|
126
136
|
- vendor/vendor.json
|
137
|
+
- Gopkg.toml
|
138
|
+
- Gopkg.lock
|
127
139
|
- Elm
|
128
140
|
- elm-package.json
|
129
141
|
- elm_dependencies.json
|
130
142
|
- elm-stuff/exact-dependencies.json
|
143
|
+
- Haxelib
|
144
|
+
- haxelib.json
|
131
145
|
|
132
146
|
## Development
|
133
147
|
|
data/lib/bibliothecary.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
require "bibliothecary/version"
|
2
2
|
require "bibliothecary/analyser"
|
3
|
+
require "bibliothecary/configuration"
|
3
4
|
|
4
5
|
Dir[File.expand_path('../bibliothecary/parsers/*.rb', __FILE__)].each do |file|
|
5
6
|
require file
|
@@ -32,10 +33,26 @@ module Bibliothecary
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def self.ignored_files
|
35
|
-
|
36
|
+
configuration.ignored_files
|
36
37
|
end
|
37
38
|
|
38
39
|
def self.ignored_files_regex
|
39
40
|
ignored_files.join('|')
|
40
41
|
end
|
42
|
+
|
43
|
+
class << self
|
44
|
+
attr_writer :configuration
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.configuration
|
48
|
+
@configuration ||= Configuration.new
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.reset
|
52
|
+
@configuration = Configuration.new
|
53
|
+
end
|
54
|
+
|
55
|
+
def self.configure
|
56
|
+
yield(configuration)
|
57
|
+
end
|
41
58
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Bibliothecary
|
2
|
+
class Configuration
|
3
|
+
attr_accessor :ignored_files
|
4
|
+
attr_accessor :carthage_parser_host
|
5
|
+
attr_accessor :clojars_parser_host
|
6
|
+
attr_accessor :mix_parser_host
|
7
|
+
attr_accessor :gradle_parser_host
|
8
|
+
attr_accessor :yarn_parser_host
|
9
|
+
attr_accessor :swift_parser_host
|
10
|
+
|
11
|
+
def initialize
|
12
|
+
@ignored_files = ['.git', 'node_modules', 'bower_components', 'spec/fixtures', 'vendor', 'dist']
|
13
|
+
@carthage_parser_host = 'https://carthage.libraries.io'
|
14
|
+
@clojars_parser_host = 'https://clojars.libraries.io'
|
15
|
+
@mix_parser_host = 'https://mix.libraries.io'
|
16
|
+
@gradle_parser_host = 'https://gradle-parser.libraries.io'
|
17
|
+
@yarn_parser_host = 'https://yarn-parser.libraries.io'
|
18
|
+
@swift_parser_host = 'http://swift.libraries.io'
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -33,7 +33,7 @@ module Bibliothecary
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def self.map_dependencies(manifest, path)
|
36
|
-
response = Typhoeus.post("
|
36
|
+
response = Typhoeus.post("#{Bibliothecary.configuration.carthage_parser_host}/#{path}", params: {body: manifest})
|
37
37
|
json = JSON.parse(response.body)
|
38
38
|
|
39
39
|
json.map do |dependency|
|
@@ -16,7 +16,7 @@ module Bibliothecary
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def self.parse_manifest(manifest)
|
19
|
-
response = Typhoeus.post("
|
19
|
+
response = Typhoeus.post("#{Bibliothecary.configuration.clojars_parser_host}/project.clj", body: manifest)
|
20
20
|
json = JSON.parse response.body
|
21
21
|
index = json.index("dependencies")
|
22
22
|
|
@@ -19,7 +19,7 @@ module Bibliothecary
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def self.parse_mix(manifest)
|
22
|
-
response = Typhoeus.post("
|
22
|
+
response = Typhoeus.post("#{Bibliothecary.configuration.mix_parser_host}/", body: manifest)
|
23
23
|
json = JSON.parse response.body
|
24
24
|
|
25
25
|
json.map do |name, version|
|
@@ -32,7 +32,7 @@ module Bibliothecary
|
|
32
32
|
end
|
33
33
|
|
34
34
|
def self.parse_mix_lock(manifest)
|
35
|
-
response = Typhoeus.post("
|
35
|
+
response = Typhoeus.post("#{Bibliothecary.configuration.mix_parser_host}/lock", body: manifest)
|
36
36
|
json = JSON.parse response.body
|
37
37
|
|
38
38
|
json.map do |name, info|
|
@@ -56,7 +56,7 @@ module Bibliothecary
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def self.parse_gradle(manifest)
|
59
|
-
response = Typhoeus.post("
|
59
|
+
response = Typhoeus.post("#{Bibliothecary.configuration.gradle_parser_host}/parse", body: manifest)
|
60
60
|
json = JSON.parse(response.body)
|
61
61
|
return [] unless json['dependencies']
|
62
62
|
json['dependencies'].map do |dependency|
|
@@ -55,7 +55,7 @@ module Bibliothecary
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def self.parse_yarn_lock(file_contents)
|
58
|
-
response = Typhoeus.post("
|
58
|
+
response = Typhoeus.post("#{Bibliothecary.configuration.yarn_parser_host}/parse", body: file_contents)
|
59
59
|
return [] unless response.response_code == 200
|
60
60
|
json = JSON.parse(response.body, symbolize_names: true)
|
61
61
|
json.uniq.map do |dep|
|
@@ -13,7 +13,7 @@ module Bibliothecary
|
|
13
13
|
end
|
14
14
|
|
15
15
|
def self.parse_package_swift(manifest)
|
16
|
-
response = Typhoeus.post("
|
16
|
+
response = Typhoeus.post("#{Bibliothecary.configuration.swift_parser_host}/to-json", body: manifest)
|
17
17
|
json = JSON.parse(response.body)
|
18
18
|
json["dependencies"].map do |dependency|
|
19
19
|
name = dependency['url'].gsub(/^https?:\/\//, '').gsub(/\.git$/,'')
|
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.1.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-
|
11
|
+
date: 2018-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toml-rb
|
@@ -181,6 +181,7 @@ files:
|
|
181
181
|
- lib/bibliothecary.rb
|
182
182
|
- lib/bibliothecary/analyser.rb
|
183
183
|
- lib/bibliothecary/cli.rb
|
184
|
+
- lib/bibliothecary/configuration.rb
|
184
185
|
- lib/bibliothecary/parsers/bower.rb
|
185
186
|
- lib/bibliothecary/parsers/cargo.rb
|
186
187
|
- lib/bibliothecary/parsers/carthage.rb
|