1
0
mirror of https://github.com/github/choosealicense.com synced 2024-12-22 12:50:24 +01:00

Merge pull request #575 from github/opencop

Rubocop 0.53 doesn't like kernel#open use more specific OpenURI.open_…
This commit is contained in:
Mike Linksvayer 2018-03-15 14:26:17 -07:00 committed by GitHub
commit 23ecca3aca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -54,7 +54,7 @@ describe 'license meta' do
example_url = example.values[0] example_url = example.values[0]
context "the #{example_url} URL" do context "the #{example_url} URL" do
let(:content) { open(example_url).read } let(:content) { OpenURI.open_uri(example_url).read }
let(:detected) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE').license } let(:detected) { Licensee::ProjectFiles::LicenseFile.new(content, 'LICENSE').license }
if example_url.start_with?('https://github.com/') if example_url.start_with?('https://github.com/')

View File

@ -73,7 +73,7 @@ end
def spdx_list def spdx_list
SpecHelper.spdx ||= begin SpecHelper.spdx ||= begin
url = 'https://spdx.org/licenses/licenses.json' url = 'https://spdx.org/licenses/licenses.json'
list = JSON.parse(open(url).read)['licenses'] list = JSON.parse(OpenURI.open_uri(url).read)['licenses']
list.each_with_object({}) do |values, memo| list.each_with_object({}) do |values, memo|
memo[values['licenseId']] = values memo[values['licenseId']] = values
end end
@ -102,7 +102,7 @@ end
def fsf_approved_licenses def fsf_approved_licenses
SpecHelper.fsf_approved_licenses ||= begin SpecHelper.fsf_approved_licenses ||= begin
url = 'https://wking.github.io/fsf-api/licenses-full.json' url = 'https://wking.github.io/fsf-api/licenses-full.json'
object = JSON.parse(open(url).read) object = JSON.parse(OpenURI.open_uri(url).read)
licenses = {} licenses = {}
object.each_value do |meta| object.each_value do |meta|
next unless (meta.include? 'identifiers') && (meta['identifiers'].include? 'spdx') && (meta.include? 'tags') && (meta['tags'].include? 'libre') next unless (meta.include? 'identifiers') && (meta['identifiers'].include? 'spdx') && (meta.include? 'tags') && (meta['tags'].include? 'libre')
@ -117,7 +117,7 @@ end
def od_approved_licenses def od_approved_licenses
SpecHelper.od_approved_licenses ||= begin SpecHelper.od_approved_licenses ||= begin
url = 'http://licenses.opendefinition.org/licenses/groups/od.json' url = 'http://licenses.opendefinition.org/licenses/groups/od.json'
data = open(url).read data = OpenURI.open_uri(url).read
data = JSON.parse(data) data = JSON.parse(data)
licenses = {} licenses = {}
data.each do |id, meta| data.each do |id, meta|