1
0
mirror of https://github.com/dkhamsing/open-source-ios-apps.git synced 2024-12-22 21:38:44 +01:00

[script] update license [ci skip]

This commit is contained in:
Travis CI 2016-06-03 08:11:57 -07:00
parent 78b8610c0e
commit 065fa8abba

43
.github/osia_update_lic.rb vendored Normal file
View File

@ -0,0 +1,43 @@
require_relative 'osia_helper'
require 'octokit'
require 'netrc'
client = Octokit::Client.new(:netrc => true)
j = get_json
apps = j['projects']
updated = []
apps.each do |a|
s = a['source']
if s.nil?
updated.push a
elsif !(s.include? 'github')
updated.push a
else
begin
g = s.gsub('https://github.com/', '')
r = client.repo g, accept: 'application/vnd.github.drax-preview+json'
lic = r[:license][:key]
print lic
print ':'
a['license'] = lic
puts a['license']
updated.push a
rescue => e
a['license'] = 'other'
puts a['license']
updated.push a
next
end
end
end
j['projects'] = updated
File.open(FILE, 'w') { |f| f.write JSON.pretty_generate(j) }
puts "\nUpdated #{FILE} ⭐️"