Merge pull request #389 from dkhamsing/history

History [ci skip]
This commit is contained in:
dkhamsing 2016-07-27 22:04:02 -07:00 committed by GitHub
commit b6152841a2
5 changed files with 1948 additions and 699 deletions

24
.github/osia_get_history.rb vendored Normal file
View File

@ -0,0 +1,24 @@
require_relative 'osia_helper'
HISTORY = 'git_history'
j = get_json
apps = j['projects']
h = {}
apps.each_with_index do |a, i|
t = a['title']
puts "#{i + 1}/#{apps.count}. checking #{t}"
command = "git log --all --grep='#{t}'"
begin
r = `#{command}`
rescue e
r = e
end
h[t] = r
end
File.open(HISTORY, 'w') { |f| f.write JSON.pretty_generate h }
puts "wrote #{HISTORY}"

12
.github/osia_history_missing.rb vendored Normal file
View File

@ -0,0 +1,12 @@
require_relative 'osia_helper'
j = get_json
apps = j['projects']
i = 0
apps.each do |a|
if a['date_added'].nil?
puts "#{i + 1}. History missing for #{a['title']}"
i = i + 1
end
end

74
.github/osia_update_history.rb vendored Normal file
View File

@ -0,0 +1,74 @@
require_relative 'osia_helper'
require 'awesome_print'
require 'colored'
HISTORY = 'git_history'
def get_author(a)
a = a.gsub 'Author:', ''
u =
if a.include? 'users.noreply.github.com>'
m = /<.*?@/.match a
'@' + m[0].sub('@','')
else
m = /.*</.match a
m[0]
end
t = u.sub('<', '').strip
t
end
j = get_json
apps = j['projects']
updated = []
c = File.read HISTORY
history = JSON.parse c
apps.each_with_index do |a, i|
t = a['title']
puts "#{i + 1}/#{apps.count}. Updating #{t}".yellow
h = history[t]
# TODO: skip entries with history
if h.size==0
updated.push a
else
lines = h.split "\n"
d=''
u=''
lines.reverse.each do |x|
# puts x
if d=='' || u==''
if x.include? 'Date:'
d = x.gsub('Date:','').strip
# d = x.gsub 'Date:',''
# puts d
end
if x.include? 'Author:'
u = get_author(x)
end
end
end
a['date_added'] = d
a['suggested_by'] = u
updated.push a
end
end
j['projects'] = updated
File.open(FILE, 'w') { |f| f.write JSON.pretty_generate(j) }
puts "\nUpdated #{FILE} ⭐️"

11
.github/schema.json vendored
View File

@ -137,8 +137,17 @@
"description": "A place to put any metadata for a project. The items can be any type.",
"type": "array",
"default": []
},
"suggested_by": {
"title": "Suggested By",
"description": "Name of person who suggested project.",
"type": "string"
},
"date_added": {
"title": "Date Added",
"description": "Date when project was added.",
"type": "string"
}
},
"required": ["title", "category", "source"],
"additionalProperties": false

File diff suppressed because it is too large Load Diff