bibliothecary 0.10.0 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/bibliothecary/parsers/julia.rb +44 -0
- data/lib/bibliothecary/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7bf47b342e3e120a20a0c6e4350db00f92e0aed2
|
4
|
+
data.tar.gz: 21402eed4e826e858d5ea3e0e6bb343199089957
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f6469739fcc77d598619710296d94db027d3dc08276ec71f779aae2f754b615316decfdaf73f61b4590fd80ec7d41a60d2dc026419902e6da6a70ab215469d2f
|
7
|
+
data.tar.gz: 635c482aa015cd395d1b706ca9c1e7bdefc9cd9114769ec3f7ed68a959b60b59e05e72c06b259134312217dcdaaac7b62f777f8dfa4ae076107a2b15a094e8a3
|
@@ -1 +1,45 @@
|
|
1
1
|
# REQUIRE
|
2
|
+
module Bibliothecary
|
3
|
+
module Parsers
|
4
|
+
class Julia
|
5
|
+
PLATFORM_NAME = 'julia'
|
6
|
+
|
7
|
+
def self.parse(filename, file_contents)
|
8
|
+
if filename.match(/^REQUIRE$/i)
|
9
|
+
parse_require(file_contents)
|
10
|
+
else
|
11
|
+
[]
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.analyse(folder_path, file_list)
|
16
|
+
[analyse_json(folder_path, file_list),
|
17
|
+
analyse_yaml(folder_path, file_list)]
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.analyse_json(folder_path, file_list)
|
21
|
+
path = file_list.find{|path| path.gsub(folder_path, '').gsub(/^\//, '').match(/^REQUIRE$/i) }
|
22
|
+
return unless path
|
23
|
+
|
24
|
+
manifest = File.open(path).read
|
25
|
+
|
26
|
+
{
|
27
|
+
platform: PLATFORM_NAME,
|
28
|
+
path: path,
|
29
|
+
dependencies: parse_require(manifest)
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.parse_require(manifest)
|
34
|
+
manifest.split("\n").map do |line|
|
35
|
+
match = line.split(/\s/)
|
36
|
+
{
|
37
|
+
name: match[0],
|
38
|
+
requirement: match[1] || '*',
|
39
|
+
type: 'runtime'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|