bibliothecary 5.3.4 → 5.4.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
  SHA1:
3
- metadata.gz: 063b544e4ac6eebc896b7c302661ae0ffcbc75a3
4
- data.tar.gz: 126b6165dcfe0fe5ce21eb98b81e745a24b166cf
3
+ metadata.gz: 55f3b8b100c7062b5bf99ae28ed96a3ec829d84b
4
+ data.tar.gz: c0335df69f289ad093a836bf594283a59e135928
5
5
  SHA512:
6
- metadata.gz: 9dc6f7227c16bcf3f013776b822df9fd1302c4834855fd9fb4b3c96a54b9e93903dd1a4e96039c3914e3edcab727c25fe2146b685c9ec804627c93b81ed04fc0
7
- data.tar.gz: 6e65bbe8c730a5fd4ede8db52eb163d000752262c3018ea77ac2faf1b069db31e403278c7caca2f6ced08788e473039076574bc0760f41a4514500787413ebca
6
+ metadata.gz: 030ed2e020f7d72a8ef1ea37ad5d709a080d04f7d8ee7b6fb36de87d1b6a583a0ce6235c777ce726f3b150be7b5b835e0a22bd8ac7c39a03669cfa9ac6d12f75
7
+ data.tar.gz: c16e95e0eec887b7972c56e02d91de4b62747d4bb89bf7e72826755cb42040073ed8686dc16989bc318596317554b463df9c283c821de20bdd160d506d488bb8
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency "toml-rb", "~> 0.3.9"
21
+ spec.add_dependency "toml-rb", "~> 1.0"
22
22
  spec.add_dependency "librariesio-gem-parser"
23
23
  spec.add_dependency "ox"
24
24
  spec.add_dependency "typhoeus"
@@ -21,6 +21,26 @@ module Bibliothecary
21
21
  self.name.to_s.split('::').last.downcase
22
22
  end
23
23
 
24
+ def parse_json_runtime_manifest(file_contents)
25
+ JSON.parse(file_contents).fetch('dependencies',[]).map do |name, requirement|
26
+ {
27
+ name: name,
28
+ requirement: requirement,
29
+ type: 'runtime'
30
+ }
31
+ end
32
+ end
33
+
34
+ def map_dependencies(hash, key, type)
35
+ hash.fetch(key,[]).map do |name, requirement|
36
+ {
37
+ name: name,
38
+ requirement: requirement,
39
+ type: type
40
+ }
41
+ end
42
+ end
43
+
24
44
  def analyse(folder_path, file_list)
25
45
  file_list.map do |path|
26
46
  filename = path.gsub(folder_path, '').gsub(/^\//, '')
@@ -19,16 +19,6 @@ module Bibliothecary
19
19
  map_dependencies(json, 'dependencies', 'runtime') +
20
20
  map_dependencies(json, 'devDependencies', 'development')
21
21
  end
22
-
23
- def self.map_dependencies(hash, key, type)
24
- hash.fetch(key,[]).map do |name, requirement|
25
- {
26
- name: name,
27
- requirement: requirement,
28
- type: type
29
- }
30
- end
31
- end
32
22
  end
33
23
  end
34
24
  end
@@ -1,4 +1,4 @@
1
- require 'toml'
1
+ require 'toml-rb'
2
2
 
3
3
  module Bibliothecary
4
4
  module Parsers
@@ -19,7 +19,7 @@ module Bibliothecary
19
19
  end
20
20
 
21
21
  def self.parse_manifest(file_contents)
22
- manifest = TOML.parse(file_contents)
22
+ manifest = TomlRB.parse(file_contents)
23
23
  manifest.fetch('dependencies', []).map do |name, requirement|
24
24
  if requirement.respond_to?(:fetch)
25
25
  requirement = requirement['version'] or next
@@ -34,7 +34,7 @@ module Bibliothecary
34
34
  end
35
35
 
36
36
  def self.parse_lockfile(file_contents)
37
- manifest = TOML.parse(file_contents)
37
+ manifest = TomlRB.parse(file_contents)
38
38
  manifest.fetch('package',[]).map do |dependency|
39
39
  next if not dependency['source'] or not dependency['source'].start_with?('registry+')
40
40
  {
@@ -30,16 +30,6 @@ module Bibliothecary
30
30
  manifest = YAML.load file_contents
31
31
  map_dependencies(manifest, 'requires', 'runtime')
32
32
  end
33
-
34
- def self.map_dependencies(hash, key, type)
35
- hash.fetch(key,[]).map do |name, requirement|
36
- {
37
- name: name,
38
- requirement: requirement,
39
- type: type
40
- }
41
- end
42
- end
43
33
  end
44
34
  end
45
35
  end
@@ -10,7 +10,7 @@ module Bibliothecary
10
10
  {
11
11
  /^dub\.json$/ => {
12
12
  kind: 'manifest',
13
- parser: :parse_manifest
13
+ parser: :parse_json_runtime_manifest
14
14
  },
15
15
  /^dub\.sdl$/ => {
16
16
  kind: 'manifest',
@@ -19,24 +19,9 @@ module Bibliothecary
19
19
  }
20
20
  end
21
21
 
22
- def self.parse_manifest(file_contents)
23
- manifest = JSON.parse(file_contents)
24
- map_dependencies(manifest, 'dependencies', 'runtime')
25
- end
26
-
27
22
  def self.parse_sdl_manifest(manifest)
28
23
  SdlParser.new(:runtime, manifest).dependencies
29
24
  end
30
-
31
- def self.map_dependencies(hash, key, type)
32
- hash.fetch(key,[]).map do |name, requirement|
33
- {
34
- name: name,
35
- requirement: requirement,
36
- type: type
37
- }
38
- end
39
- end
40
25
  end
41
26
  end
42
27
  end
@@ -9,7 +9,7 @@ module Bibliothecary
9
9
  {
10
10
  /^elm-package\.json$|^elm_dependencies\.json$/ => {
11
11
  kind: 'manifest',
12
- parser: :parse_json_manifest
12
+ parser: :parse_json_runtime_manifest
13
13
  },
14
14
  /^elm-stuff\/exact-dependencies\.json$/ => {
15
15
  kind: 'lockfile',
@@ -18,11 +18,6 @@ module Bibliothecary
18
18
  }
19
19
  end
20
20
 
21
- def self.parse_json_manifest(file_contents)
22
- manifest = JSON.parse file_contents
23
- map_dependencies(manifest, 'dependencies', 'runtime')
24
- end
25
-
26
21
  def self.parse_json_lock(file_contents)
27
22
  manifest = JSON.parse file_contents
28
23
  manifest.map do |name, requirement|
@@ -33,16 +28,6 @@ module Bibliothecary
33
28
  }
34
29
  end
35
30
  end
36
-
37
- def self.map_dependencies(hash, key, type)
38
- hash.fetch(key,[]).map do |name, requirement|
39
- {
40
- name: name,
41
- requirement: requirement,
42
- type: type
43
- }
44
- end
45
- end
46
31
  end
47
32
  end
48
33
  end
@@ -0,0 +1,18 @@
1
+ require 'json'
2
+
3
+ module Bibliothecary
4
+ module Parsers
5
+ class Haxelib
6
+ include Bibliothecary::Analyser
7
+
8
+ def self.mapping
9
+ {
10
+ /^haxelib\.json$/ => {
11
+ kind: 'manifest',
12
+ parser: :parse_json_runtime_manifest
13
+ }
14
+ }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -9,25 +9,10 @@ module Bibliothecary
9
9
  {
10
10
  /^versions\.json$/ => {
11
11
  kind: 'manifest',
12
- parser: :parse_manifest
12
+ parser: :parse_json_runtime_manifest
13
13
  }
14
14
  }
15
15
  end
16
-
17
- def self.parse_manifest(file_contents)
18
- manifest = JSON.parse(file_contents)
19
- map_dependencies(manifest, 'dependencies', 'runtime')
20
- end
21
-
22
- def self.map_dependencies(hash, key, type)
23
- hash.fetch(key,[]).map do |name, requirement|
24
- {
25
- name: name,
26
- requirement: requirement,
27
- type: type
28
- }
29
- end
30
- end
31
16
  end
32
17
  end
33
18
  end
@@ -59,16 +59,6 @@ module Bibliothecary
59
59
  return [] unless response.response_code == 200
60
60
  JSON.parse(response.body)
61
61
  end
62
-
63
- def self.map_dependencies(hash, key, type)
64
- hash.fetch(key,[]).map do |name, requirement|
65
- {
66
- name: name,
67
- requirement: requirement,
68
- type: type
69
- }
70
- end
71
- end
72
62
  end
73
63
  end
74
64
  end
@@ -10,7 +10,7 @@ module Bibliothecary
10
10
  {
11
11
  /Project\.json$/ => {
12
12
  kind: 'manifest',
13
- parser: :parse_project_json
13
+ parser: :parse_json_runtime_manifest
14
14
  },
15
15
  /Project\.lock\.json$/ => {
16
16
  kind: 'lockfile',
@@ -35,17 +35,6 @@ module Bibliothecary
35
35
  }
36
36
  end
37
37
 
38
- def self.parse_project_json(file_contents)
39
- manifest = JSON.parse file_contents
40
- manifest.fetch('dependencies',[]).map do |name, requirement|
41
- {
42
- name: name,
43
- requirement: requirement,
44
- type: 'runtime'
45
- }
46
- end
47
- end
48
-
49
38
  def self.parse_project_lock_json(file_contents)
50
39
  manifest = JSON.parse file_contents
51
40
  manifest.fetch('libraries',[]).map do |name, _requirement|
@@ -34,16 +34,6 @@ module Bibliothecary
34
34
  map_dependencies(manifest, 'require', 'runtime') +
35
35
  map_dependencies(manifest, 'require-dev', 'development')
36
36
  end
37
-
38
- def self.map_dependencies(hash, key, type)
39
- hash.fetch(key,[]).map do |name, requirement|
40
- {
41
- name: name,
42
- requirement: requirement,
43
- type: type
44
- }
45
- end
46
- end
47
37
  end
48
38
  end
49
39
  end
@@ -34,16 +34,6 @@ module Bibliothecary
34
34
  }
35
35
  end
36
36
  end
37
-
38
- def self.map_dependencies(hash, key, type)
39
- hash.fetch(key,[]).map do |name, requirement|
40
- {
41
- name: name,
42
- requirement: requirement,
43
- type: type
44
- }
45
- end
46
- end
47
37
  end
48
38
  end
49
39
  end
@@ -29,7 +29,7 @@ module Bibliothecary
29
29
  end
30
30
 
31
31
  def self.parse_pipfile(file_contents)
32
- manifest = TOML.parse(file_contents)
32
+ manifest = TomlRB.parse(file_contents)
33
33
  map_dependencies(manifest['packages'], 'runtime') + map_dependencies(manifest['dev-packages'], 'develop')
34
34
  end
35
35
 
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "5.3.4"
2
+ VERSION = "5.4.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: 5.3.4
4
+ version: 5.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Nesbitt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-05-26 00:00:00.000000000 Z
11
+ date: 2017-07-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: toml-rb
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.3.9
19
+ version: '1.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.3.9
26
+ version: '1.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: librariesio-gem-parser
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -172,6 +172,7 @@ files:
172
172
  - lib/bibliothecary/parsers/dub.rb
173
173
  - lib/bibliothecary/parsers/elm.rb
174
174
  - lib/bibliothecary/parsers/go.rb
175
+ - lib/bibliothecary/parsers/haxelib.rb
175
176
  - lib/bibliothecary/parsers/hex.rb
176
177
  - lib/bibliothecary/parsers/julia.rb
177
178
  - lib/bibliothecary/parsers/maven.rb