bibliothecary 0.14.1 → 0.15.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: 503d92831beea6d895ffa71988660250ca17d939
4
- data.tar.gz: d3e6a6d3025c289efd78f2f55720aa0b179062c0
3
+ metadata.gz: b092f733939c50c7d5d10f1f9e9354f542bab34c
4
+ data.tar.gz: 8c2f5354c5a25d71128e22e865bc0a384c930728
5
5
  SHA512:
6
- metadata.gz: a62dd70d17c2b7ca5d2ec13c0370a32b584dcc5af0d2fd111535f438536d63337a8826afebbc7d10be129513c48710ff617e4322be13524f4b2b1898fd0222ea
7
- data.tar.gz: dcdeb33cf447f31689d4c652ea3e94bdd9cf49713dd8a119d2419c23316c5110c31b1d5ba62a8f6cd5f58809b80206c78bc1f8a9d61d578bd82a985f142117ce
6
+ metadata.gz: fa31c0a393a9c02496f6a8626a3d21d31a8c01a2c61711efd63d88c4e64f783c90fc08ce96eac8cf2958c4f637a128ae6bebaf77dec86893fec4ed43a8f89f0b
7
+ data.tar.gz: 06f3a436681bf61b0219b498ce5071c04d4f25c5809942770e8a17e80d41213ec5b8fe8cc0c8bc76ace1a8764f20741f5747f1c8fe5f25e1e5a0336f41732a53
@@ -20,7 +20,6 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_dependency "toml-rb", "~> 0.3.9"
22
22
  spec.add_dependency "librariesio-gem-parser"
23
- spec.add_dependency "rogdl"
24
23
  spec.add_dependency "ox"
25
24
  spec.add_dependency "typhoeus"
26
25
  spec.add_dependency "deb_control"
@@ -1,5 +1,3 @@
1
- require 'cartfile_parser'
2
-
3
1
  module Bibliothecary
4
2
  module Parsers
5
3
  class Carthage
@@ -7,11 +5,11 @@ module Bibliothecary
7
5
 
8
6
  def self.parse(filename, file_contents)
9
7
  if filename.match(/^Cartfile$/)
10
- manifest = CartfileParser.new(:runtime, file_contents).dependencies
8
+ parse_cartfile(file_contents)
11
9
  elsif filename.match(/^Cartfile\.private$/)
12
- manifest = CartfileParser.new(:runtime, file_contents).dependencies
10
+ parse_cartfile_private(file_contents)
13
11
  elsif filename.match(/^Cartfile\.resolved$/)
14
- manifest = CartfileParser.new(:runtime, file_contents).dependencies
12
+ parse_cartfile_resolved(file_contents)
15
13
  else
16
14
  []
17
15
  end
@@ -29,7 +27,7 @@ module Bibliothecary
29
27
  path = file_list.find{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/^Cartfile$/) }
30
28
  return unless path
31
29
 
32
- manifest = CartfileParser.new(:runtime, File.open(path).read)
30
+ manifest = parse_cartfile(File.open(path).read)
33
31
 
34
32
  {
35
33
  platform: PLATFORM_NAME,
@@ -42,7 +40,7 @@ module Bibliothecary
42
40
  path = file_list.find{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/^Cartfile\.private$/) }
43
41
  return unless path
44
42
 
45
- manifest = CartfileParser.new(:runtime, File.open(path).read)
43
+ manifest = parse_cartfile_private(File.open(path).read)
46
44
 
47
45
  {
48
46
  platform: PLATFORM_NAME,
@@ -55,7 +53,7 @@ module Bibliothecary
55
53
  path = file_list.find{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/^Cartfile\.resolved$/) }
56
54
  return unless path
57
55
 
58
- manifest = CartfileParser.new(:runtime, File.open(path).read)
56
+ manifest = parse_cartfile_resolved(File.open(path).read)
59
57
 
60
58
  {
61
59
  platform: PLATFORM_NAME,
@@ -64,6 +62,44 @@ module Bibliothecary
64
62
  }
65
63
  end
66
64
 
65
+ def self.parse_cartfile(manifest)
66
+ response = Typhoeus.post("https://carthageparser.herokuapp.com/cartfile", params: {body: manifest})
67
+ json = JSON.parse(response.body)
68
+
69
+ json.map do |dependency|
70
+ {
71
+ name: dependency['name'],
72
+ version: dependency['version'],
73
+ type: dependency["type"]
74
+ }
75
+ end
76
+ end
77
+
78
+ def self.parse_cartfile_private(manifest)
79
+ response = Typhoeus.post("https://carthageparser.herokuapp.com/cartfile.private", params: {body: manifest})
80
+ json = JSON.parse(response.body)
81
+
82
+ json.map do |dependency|
83
+ {
84
+ name: dependency['name'],
85
+ version: dependency['version'],
86
+ type: dependency["type"]
87
+ }
88
+ end
89
+ end
90
+
91
+ def self.parse_cartfile_resolved(manifest)
92
+ response = Typhoeus.post("https://carthageparser.herokuapp.com/cartfile.resolved", params: {body: manifest})
93
+ json = JSON.parse(response.body)
94
+
95
+ json.map do |dependency|
96
+ {
97
+ name: dependency['name'],
98
+ version: dependency['version'],
99
+ type: dependency["type"]
100
+ }
101
+ end
102
+ end
67
103
  end
68
104
  end
69
105
  end
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "0.14.1"
2
+ VERSION = "0.15.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: 0.14.1
4
+ version: 0.15.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: 2016-06-27 00:00:00.000000000 Z
11
+ date: 2016-07-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: toml-rb
@@ -38,20 +38,6 @@ dependencies:
38
38
  - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
- - !ruby/object:Gem::Dependency
42
- name: rogdl
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
41
  - !ruby/object:Gem::Dependency
56
42
  name: ox
57
43
  requirement: !ruby/object:Gem::Requirement
@@ -192,7 +178,6 @@ files:
192
178
  - lib/bibliothecary/parsers/rubygems.rb
193
179
  - lib/bibliothecary/parsers/shard.rb
194
180
  - lib/bibliothecary/version.rb
195
- - lib/cartfile_parser.rb
196
181
  - lib/sdl_parser.rb
197
182
  homepage: https://github.com/librariesio/bibliothecary
198
183
  licenses:
@@ -1,29 +0,0 @@
1
- require 'rogdl'
2
-
3
- class CartfileParser
4
- attr_reader :contents, :type
5
- def initialize(type, contents)
6
- @contents = contents
7
- @type = type || 'runtime'
8
- end
9
-
10
- def to_json
11
- Oj.dump(dependencies, mode: :compat) unless contents.nil?
12
- end
13
-
14
- def dependencies
15
- parse.inject([]) do |deps, dep|
16
- deps.push({
17
- name: dep[1],
18
- version: [dep[2],dep[3]].join(' ') || ">= 0",
19
- type: type,
20
- })
21
- end.uniq
22
- end
23
-
24
- def parse
25
- parser = Rogdl::Parser.new
26
- parser.translate(contents)
27
- parser.lines.reject { |line| line.empty? }
28
- end
29
- end