bibliothecary 4.0.4 → 5.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.codeclimate.yml +25 -0
- data/.github/CONTRIBUTING.md +165 -0
- data/.github/ISSUE_TEMPLATE.md +18 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +10 -0
- data/.rubocop.yml +1156 -0
- data/.travis.yml +4 -1
- data/Gemfile +5 -0
- data/README.md +7 -1
- data/bibliothecary.gemspec +1 -1
- data/lib/bibliothecary.rb +16 -2
- data/lib/bibliothecary/analyser.rb +28 -4
- data/lib/bibliothecary/parsers/bower.rb +7 -10
- data/lib/bibliothecary/parsers/cargo.rb +9 -31
- data/lib/bibliothecary/parsers/carthage.rb +13 -34
- data/lib/bibliothecary/parsers/clojars.rb +4 -7
- data/lib/bibliothecary/parsers/cocoapods.rb +19 -30
- data/lib/bibliothecary/parsers/cpan.rb +10 -15
- data/lib/bibliothecary/parsers/cran.rb +7 -10
- data/lib/bibliothecary/parsers/dub.rb +7 -12
- data/lib/bibliothecary/parsers/elm.rb +7 -47
- data/lib/bibliothecary/parsers/go.rb +47 -52
- data/lib/bibliothecary/parsers/hex.rb +5 -14
- data/lib/bibliothecary/parsers/julia.rb +4 -7
- data/lib/bibliothecary/parsers/maven.rb +12 -18
- data/lib/bibliothecary/parsers/meteor.rb +6 -9
- data/lib/bibliothecary/parsers/npm.rb +15 -14
- data/lib/bibliothecary/parsers/nuget.rb +18 -28
- data/lib/bibliothecary/parsers/packagist.rb +9 -14
- data/lib/bibliothecary/parsers/pub.rb +9 -14
- data/lib/bibliothecary/parsers/pypi.rb +8 -10
- data/lib/bibliothecary/parsers/rubygems.rb +16 -23
- data/lib/bibliothecary/parsers/shard.rb +9 -14
- data/lib/bibliothecary/parsers/swift_pm.rb +4 -7
- data/lib/bibliothecary/version.rb +1 -1
- data/lib/sdl_parser.rb +0 -4
- metadata +9 -5
- data/CONTRIBUTING.md +0 -10
@@ -5,21 +5,15 @@ module Bibliothecary
|
|
5
5
|
class Packagist
|
6
6
|
include Bibliothecary::Analyser
|
7
7
|
|
8
|
-
def self.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
elsif filename.match(/^composer\.lock$/)
|
14
|
-
file_contents = File.open(path).read
|
15
|
-
json = JSON.parse(file_contents)
|
16
|
-
parse_lockfile(json)
|
17
|
-
else
|
18
|
-
[]
|
19
|
-
end
|
8
|
+
def self.mapping
|
9
|
+
{
|
10
|
+
/^composer\.json$/ => :parse_manifest,
|
11
|
+
/^composer\.lock$/ => :parse_lockfile
|
12
|
+
}
|
20
13
|
end
|
21
14
|
|
22
|
-
def self.parse_lockfile(
|
15
|
+
def self.parse_lockfile(file_contents)
|
16
|
+
manifest = JSON.parse file_contents
|
23
17
|
manifest.fetch('packages',[]).map do |dependency|
|
24
18
|
{
|
25
19
|
name: dependency["name"],
|
@@ -29,7 +23,8 @@ module Bibliothecary
|
|
29
23
|
end
|
30
24
|
end
|
31
25
|
|
32
|
-
def self.parse_manifest(
|
26
|
+
def self.parse_manifest(file_contents)
|
27
|
+
manifest = JSON.parse file_contents
|
33
28
|
map_dependencies(manifest, 'require', 'runtime') +
|
34
29
|
map_dependencies(manifest, 'require-dev', 'development')
|
35
30
|
end
|
@@ -5,26 +5,21 @@ module Bibliothecary
|
|
5
5
|
class Pub
|
6
6
|
include Bibliothecary::Analyser
|
7
7
|
|
8
|
-
def self.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
elsif filename.match(/^pubspec\.lock$/i)
|
14
|
-
file_contents = File.open(path).read
|
15
|
-
yaml = YAML.load file_contents
|
16
|
-
parse_yaml_lockfile(yaml)
|
17
|
-
else
|
18
|
-
[]
|
19
|
-
end
|
8
|
+
def self.mapping
|
9
|
+
{
|
10
|
+
/^pubspec\.yaml$/i => :parse_yaml_manifest,
|
11
|
+
/^pubspec\.lock$/i => :parse_yaml_lockfile
|
12
|
+
}
|
20
13
|
end
|
21
14
|
|
22
|
-
def self.parse_yaml_manifest(
|
15
|
+
def self.parse_yaml_manifest(file_contents)
|
16
|
+
manifest = YAML.load file_contents
|
23
17
|
map_dependencies(manifest, 'dependencies', 'runtime') +
|
24
18
|
map_dependencies(manifest, 'dev_dependencies', 'development')
|
25
19
|
end
|
26
20
|
|
27
|
-
def self.parse_yaml_lockfile(
|
21
|
+
def self.parse_yaml_lockfile(file_contents)
|
22
|
+
manifest = YAML.load file_contents
|
28
23
|
manifest.fetch('packages', []).map do |name, dep|
|
29
24
|
{
|
30
25
|
name: name,
|
@@ -7,19 +7,18 @@ module Bibliothecary
|
|
7
7
|
REQUIRE_REGEXP = /([a-zA-Z0-9]+[a-zA-Z0-9\-_\.]+)([><=\d\.,]+)?/
|
8
8
|
REQUIREMENTS_REGEXP = /^#{REQUIRE_REGEXP}/
|
9
9
|
|
10
|
-
def self.
|
11
|
-
|
12
|
-
|
13
|
-
file_contents = File.open(path).read
|
14
|
-
parse_requirements_txt(file_contents)
|
10
|
+
def self.parse_file(filename, contents)
|
11
|
+
if is_requirements_file(filename)
|
12
|
+
parse_requirements_txt(contents)
|
15
13
|
elsif filename.match(/setup\.py$/)
|
16
|
-
|
17
|
-
parse_setup_py(file_contents)
|
18
|
-
else
|
19
|
-
[]
|
14
|
+
parse_setup_py(contents)
|
20
15
|
end
|
21
16
|
end
|
22
17
|
|
18
|
+
def self.match?(filename)
|
19
|
+
is_requirements_file(filename) || filename.match(/setup\.py$/)
|
20
|
+
end
|
21
|
+
|
23
22
|
def self.parse_setup_py(manifest)
|
24
23
|
match = manifest.match(INSTALL_REGEXP)
|
25
24
|
return [] unless match
|
@@ -52,7 +51,6 @@ module Bibliothecary
|
|
52
51
|
end
|
53
52
|
|
54
53
|
def self.is_requirements_file(filename)
|
55
|
-
is_requirements_file = filename.match(/require.*\.(txt|pip)$/)
|
56
54
|
if filename.match(/require.*\.(txt|pip)$/) and !filename.match(/^node_modules/)
|
57
55
|
return true
|
58
56
|
else
|
@@ -8,21 +8,12 @@ module Bibliothecary
|
|
8
8
|
NAME_VERSION = '(?! )(.*?)(?: \(([^-]*)(?:-(.*))?\))?'.freeze
|
9
9
|
NAME_VERSION_4 = /^ {4}#{NAME_VERSION}$/
|
10
10
|
|
11
|
-
def self.
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
file_contents = File.open(path).read
|
18
|
-
manifest = Gemnasium::Parser.send(:gemspec, file_contents)
|
19
|
-
parse_manifest(manifest)
|
20
|
-
elsif filename.match(/^Gemfile\.lock$|^gems\.locked$/)
|
21
|
-
file_contents = File.open(path).read
|
22
|
-
parse_gemfile_lock(file_contents)
|
23
|
-
else
|
24
|
-
[]
|
25
|
-
end
|
11
|
+
def self.mapping
|
12
|
+
{
|
13
|
+
/^Gemfile$|^gems\.rb$/ => :parse_gemfile,
|
14
|
+
/[A-Za-z0-9_-]+\.gemspec$/ => :parse_gemspec,
|
15
|
+
/^Gemfile\.lock$|^gems\.locked$/ => :parse_gemfile_lock
|
16
|
+
}
|
26
17
|
end
|
27
18
|
|
28
19
|
def self.parse_gemfile_lock(manifest)
|
@@ -39,15 +30,17 @@ module Bibliothecary
|
|
39
30
|
end.compact
|
40
31
|
end
|
41
32
|
|
42
|
-
def self.
|
43
|
-
manifest.
|
44
|
-
|
45
|
-
name: dep.name,
|
46
|
-
requirement: dep.requirement.to_s,
|
47
|
-
type: dep.type
|
48
|
-
})
|
49
|
-
end.uniq
|
33
|
+
def self.parse_gemfile(file_contents)
|
34
|
+
manifest = Gemnasium::Parser.send(:gemfile, file_contents)
|
35
|
+
parse_ruby_manifest(manifest)
|
50
36
|
end
|
37
|
+
|
38
|
+
def self.parse_gemspec(file_contents)
|
39
|
+
manifest = Gemnasium::Parser.send(:gemspec, file_contents)
|
40
|
+
parse_ruby_manifest(manifest)
|
41
|
+
end
|
42
|
+
|
43
|
+
|
51
44
|
end
|
52
45
|
end
|
53
46
|
end
|
@@ -5,25 +5,20 @@ module Bibliothecary
|
|
5
5
|
class Shard
|
6
6
|
include Bibliothecary::Analyser
|
7
7
|
|
8
|
-
def self.
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
elsif filename.match(/^shard\.lock$/i)
|
14
|
-
file_contents = File.open(path).read
|
15
|
-
yaml = YAML.load file_contents
|
16
|
-
parse_yaml_lockfile(yaml)
|
17
|
-
else
|
18
|
-
[]
|
19
|
-
end
|
8
|
+
def self.mapping
|
9
|
+
{
|
10
|
+
/^shard\.yml$/i => :parse_yaml_manifest,
|
11
|
+
/^shard\.lock$/i => :parse_yaml_lockfile
|
12
|
+
}
|
20
13
|
end
|
21
14
|
|
22
|
-
def self.parse_yaml_lockfile(
|
15
|
+
def self.parse_yaml_lockfile(file_contents)
|
16
|
+
manifest = YAML.load file_contents
|
23
17
|
map_dependencies(manifest, 'shards', 'runtime')
|
24
18
|
end
|
25
19
|
|
26
|
-
def self.parse_yaml_manifest(
|
20
|
+
def self.parse_yaml_manifest(file_contents)
|
21
|
+
manifest = YAML.load file_contents
|
27
22
|
map_dependencies(manifest, 'dependencies', 'runtime') +
|
28
23
|
map_dependencies(manifest, 'development_dependencies', 'runtime')
|
29
24
|
end
|
@@ -3,13 +3,10 @@ module Bibliothecary
|
|
3
3
|
class SwiftPM
|
4
4
|
include Bibliothecary::Analyser
|
5
5
|
|
6
|
-
def self.
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
else
|
11
|
-
[]
|
12
|
-
end
|
6
|
+
def self.mapping
|
7
|
+
{
|
8
|
+
/^Package\.swift$/i => :parse_package_swift
|
9
|
+
}
|
13
10
|
end
|
14
11
|
|
15
12
|
def self.parse_package_swift(manifest)
|
data/lib/sdl_parser.rb
CHANGED
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:
|
4
|
+
version: 5.0.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:
|
11
|
+
date: 2017-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: toml-rb
|
@@ -114,14 +114,14 @@ dependencies:
|
|
114
114
|
requirements:
|
115
115
|
- - "~>"
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version: '
|
117
|
+
version: '12.0'
|
118
118
|
type: :development
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version: '
|
124
|
+
version: '12.0'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
@@ -143,11 +143,15 @@ executables: []
|
|
143
143
|
extensions: []
|
144
144
|
extra_rdoc_files: []
|
145
145
|
files:
|
146
|
+
- ".codeclimate.yml"
|
147
|
+
- ".github/CONTRIBUTING.md"
|
148
|
+
- ".github/ISSUE_TEMPLATE.md"
|
149
|
+
- ".github/PULL_REQUEST_TEMPLATE.md"
|
146
150
|
- ".gitignore"
|
147
151
|
- ".rspec"
|
152
|
+
- ".rubocop.yml"
|
148
153
|
- ".travis.yml"
|
149
154
|
- CODE_OF_CONDUCT.md
|
150
|
-
- CONTRIBUTING.md
|
151
155
|
- Gemfile
|
152
156
|
- LICENSE.txt
|
153
157
|
- README.md
|
data/CONTRIBUTING.md
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
# Contributing
|
2
|
-
|
3
|
-
* Fork the project.
|
4
|
-
* Make your feature addition or bug fix.
|
5
|
-
* Add tests for it. This is important so I don't break it in a future version unintentionally.
|
6
|
-
* Send a pull request. Bonus points for topic branches.
|
7
|
-
|
8
|
-
## Code of Conduct
|
9
|
-
|
10
|
-
Please note that this project is released with a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in this project you agree to abide by its terms.
|