bibliothecary 0.9.0 → 0.10.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: eddfd25683329b1ec4fab2722149b748d675665a
4
- data.tar.gz: 926c0cd2605b2ac595806600e3041e2f487d7c0e
3
+ metadata.gz: 039e2f6d6eff1f2b5e3eb34ed33bddfae48f0019
4
+ data.tar.gz: acf89339c17c694405c6d19e4872fb12eeb119e0
5
5
  SHA512:
6
- metadata.gz: 60aa852cfd3ba7419db049a61d77a5db16776a05b31b4fbcf6376d58abc08b93d38c53047ac5517e00620aa65bdebc064a2847f57797a28544d922671ca2074c
7
- data.tar.gz: 60f66903eea1682d1a0ad3308a3cbf251691852d8ae021d390849f6b53af0a74475b6af292d10e8ff58f56d20a01543d2232170b24929c7a51ca7e1e77e33d56
6
+ metadata.gz: c07e252c8d613ea0faa5ea0328ab186ea3d834f1d914ff910e356cde64783ca56d95407ee002134dd69b9adc5218bb971ce8719557b543c93535a21938aab29d
7
+ data.tar.gz: cec68617e4a36ce2b36069d50babef3c169bf71b256ad71b2b13a426cd668d90a5d7231389429a3198b04e2a82a70cd6738d9b26ab13dde5b4304702b2713504
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_dependency "rogdl"
24
24
  spec.add_dependency "ox"
25
25
  spec.add_dependency "typhoeus"
26
+ spec.add_dependency "deb_control"
26
27
 
27
28
  spec.add_development_dependency "bundler", "~> 1.11"
28
29
  spec.add_development_dependency "rake", "~> 11.0"
@@ -1 +1,55 @@
1
- # DESCRIPTION
1
+ require 'deb_control'
2
+
3
+ module Bibliothecary
4
+ module Parsers
5
+ class CRAN
6
+ PLATFORM_NAME = 'cran'
7
+ REQUIRE_REGEXP = /([a-zA-Z0-9\-_\.]+)\s?\(?([><=\s\d\.,]+)?\)?/
8
+
9
+ def self.parse(filename, file_contents)
10
+ if filename.match(/^DESCRIPTION$/i)
11
+ control = DebControl::ControlFileBase.parse(file_contents)
12
+ parse_description(control)
13
+ else
14
+ []
15
+ end
16
+ end
17
+
18
+ def self.analyse(folder_path, file_list)
19
+ [analyse_description(folder_path, file_list)]
20
+ end
21
+
22
+ def self.analyse_description(folder_path, file_list)
23
+ path = file_list.find{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/^DESCRIPTION$/i) }
24
+ return unless path
25
+
26
+ manifest = DebControl::ControlFileBase.parse File.open(path).read
27
+
28
+ {
29
+ platform: PLATFORM_NAME,
30
+ path: path,
31
+ dependencies: parse_description(manifest)
32
+ }
33
+ end
34
+
35
+ def self.parse_description(manifest)
36
+ parse_section(manifest, 'Depends') +
37
+ parse_section(manifest, 'Imports') +
38
+ parse_section(manifest, 'Suggests') +
39
+ parse_section(manifest, 'Enhances')
40
+ end
41
+
42
+ def self.parse_section(manifest, name)
43
+ deps = manifest.first[name].gsub("\n", '').split(',').map(&:strip)
44
+ deps.map do |dependency|
45
+ dep = dependency.match(REQUIRE_REGEXP)
46
+ {
47
+ name: dep[1],
48
+ version: dep[2] || '*',
49
+ type: name.downcase
50
+ }
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -1,3 +1,3 @@
1
1
  module Bibliothecary
2
- VERSION = "0.9.0"
2
+ VERSION = "0.10.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.9.0
4
+ version: 0.10.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-26 00:00:00.000000000 Z
11
+ date: 2016-06-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: toml-rb
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: deb_control
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: bundler
85
99
  requirement: !ruby/object:Gem::Requirement