gems-license-finder 0.0.8 → 0.0.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/gems-license-finder.rb +4 -4
- data/lib/gems-license-finder/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03c98880e76df17e93ea9530abbc891b3c4f9f30
|
4
|
+
data.tar.gz: 5b7c68491b7d8c3c841ed9652eab6f75580e4508
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ffbfe5c7c79e5745104c4a1b14e52d78590895a1e7c0cfe970f8b78eb52a9e1ccb6b80dc4bc9339422caa0d8e4ea1526a45865a39f7840f495ea2c44ac816fde
|
7
|
+
data.tar.gz: 0399d1f8c81c4a6f8d86a438b0747e347ecd0986ee2dd60ccbb6583872d122a6f679b65fc06338f99567aac579a81761b4ae4e199cff2c82a6719d09ff2a2cd3
|
data/lib/gems-license-finder.rb
CHANGED
@@ -45,7 +45,7 @@ module GemsLicenseFinder
|
|
45
45
|
end
|
46
46
|
|
47
47
|
def find name
|
48
|
-
normalize(
|
48
|
+
normalize github_info(name , rubygems_info(name))
|
49
49
|
end
|
50
50
|
|
51
51
|
private
|
@@ -57,18 +57,18 @@ module GemsLicenseFinder
|
|
57
57
|
raise e.io.status.first == "404" ? GemNotFound.new(e) : e
|
58
58
|
end
|
59
59
|
|
60
|
-
info = Hash[content.scan(/<a href
|
60
|
+
info = Hash[content.scan(/<a rel=\"nofollow\".*?href=\"(.*?)\".*?>(.*?)</)].invert
|
61
61
|
type, url = normalize_licence(
|
62
62
|
(utf8_match(content,'<h5>Licenses<\/h5>.*?<p>(.*?)<')[1] rescue ""))
|
63
63
|
description = (CGI.unescapeHTML utf8_match(content,'gem__desc.*?<p>(.*?)<')[1].
|
64
64
|
strip.squeeze(" ").gsub(/\n/,"") rescue nil)
|
65
65
|
|
66
|
-
info.merge
|
66
|
+
info.merge license_type: type, license_url: url, description: description
|
67
67
|
end
|
68
68
|
|
69
69
|
def github_info name, rubygems
|
70
70
|
url = rubygems["Source Code"] || rubygems["Homepage"]
|
71
|
-
if url.to_s =~
|
71
|
+
if url.to_s =~ /github\.com/
|
72
72
|
# Sometimes the homepage in rubygems.org is old, e.g:
|
73
73
|
# carlhuda/bundler => bundler/bundler
|
74
74
|
open(url.sub("http:","https:")) { |o| url = o.base_uri.to_s } # follow redirects
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gems-license-finder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eran Barak Levi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|