mirror of
https://github.com/dkhamsing/open-source-ios-apps.git
synced 2024-12-17 22:51:35 +03:00
[script] Cleanup
This commit is contained in:
parent
10d8469f95
commit
7e0cd5acf0
100
.github/convert.rb
vendored
100
.github/convert.rb
vendored
@ -1,7 +1,7 @@
|
||||
require 'date'
|
||||
require 'json'
|
||||
|
||||
OUTPUT = 'README.md'
|
||||
README = 'README.md'
|
||||
|
||||
def output_stars(number)
|
||||
case number
|
||||
@ -83,53 +83,57 @@ def output_apps(apps)
|
||||
o
|
||||
end
|
||||
|
||||
def write_readme(j)
|
||||
t = j['title']
|
||||
desc = j['description']
|
||||
h = j['header']
|
||||
f = j['footer']
|
||||
cats = j['categories']
|
||||
apps = j['projects']
|
||||
|
||||
date = DateTime.now
|
||||
date_display = date.strftime "%B %d, %Y"
|
||||
|
||||
output = '# ' + t
|
||||
output << "\n\n"
|
||||
output << desc
|
||||
output << "\n\nA collaborative list of **#{apps.count}** open-source iOS apps, your [contribution](https://github.com/dkhamsing/open-source-ios-apps/blob/master/.github/CONTRIBUTING.md) is welcome :smile: "
|
||||
output << "(last update *#{date_display}*)."
|
||||
|
||||
output << "\n \nJump to \n \n"
|
||||
|
||||
cats.each do |c|
|
||||
temp = "#{' ' unless c['parent']==nil }- [#{c['title']}](\##{c['id']}) \n"
|
||||
output << temp
|
||||
end
|
||||
|
||||
output << "- [Bonus](#bonus) \n"
|
||||
|
||||
output << "\n"
|
||||
output << h
|
||||
output << "\n"
|
||||
|
||||
cats.each do |c|
|
||||
temp = "\n#\##{'#' unless c['parent']==nil } #{c['title']} \n \n"
|
||||
|
||||
d = c['description']
|
||||
temp << "#{d} — " unless d.nil?
|
||||
|
||||
temp << "[back to top](#readme) \n \n"
|
||||
output << temp
|
||||
|
||||
cat_apps = apps_for_cat(apps, c['id'])
|
||||
output << output_apps(cat_apps)
|
||||
end
|
||||
|
||||
output << "\n"
|
||||
output << f
|
||||
|
||||
File.open(README, 'w') { |f| f.write output }
|
||||
puts "wrote #{README} ✨"
|
||||
end
|
||||
|
||||
c = File.read 'contents.json'
|
||||
j = JSON.parse c
|
||||
|
||||
t = j['title']
|
||||
desc = j['description']
|
||||
h = j['header']
|
||||
f = j['footer']
|
||||
cats = j['categories']
|
||||
apps = j['projects']
|
||||
|
||||
date = DateTime.now
|
||||
date_display = date.strftime "%B %d, %Y"
|
||||
|
||||
output = '# ' + t
|
||||
output << "\n\n"
|
||||
output << desc
|
||||
output << "\n\nA collaborative list of **#{apps.count}** open-source iOS apps, your [contribution](https://github.com/dkhamsing/open-source-ios-apps/blob/master/.github/CONTRIBUTING.md) is welcome :smile: "
|
||||
output << "(last update *#{date_display}*)."
|
||||
|
||||
output << "\n \nJump to \n \n"
|
||||
|
||||
cats.each do |c|
|
||||
temp = "#{' ' unless c['parent']==nil }- [#{c['title']}](\##{c['id']}) \n"
|
||||
output << temp
|
||||
end
|
||||
|
||||
output << "- [Bonus](#bonus) \n"
|
||||
|
||||
output << "\n"
|
||||
output << h
|
||||
output << "\n"
|
||||
|
||||
cats.each do |c|
|
||||
temp = "\n#\##{'#' unless c['parent']==nil } #{c['title']} \n \n"
|
||||
|
||||
d = c['description']
|
||||
temp << "#{d} — " unless d.nil?
|
||||
|
||||
temp << "[back to top](#readme) \n \n"
|
||||
output << temp
|
||||
|
||||
cat_apps = apps_for_cat(apps, c['id'])
|
||||
output << output_apps(cat_apps)
|
||||
end
|
||||
|
||||
output << "\n"
|
||||
output << f
|
||||
|
||||
File.open(OUTPUT, 'w') { |f| f.write output }
|
||||
puts "wrote #{OUTPUT} ✨"
|
||||
write_readme(j)
|
||||
|
Loading…
Reference in New Issue
Block a user