mirror of
https://github.com/dkhamsing/open-source-ios-apps.git
synced 2024-12-23 06:48:33 +01:00
[script] Support archived apps
This commit is contained in:
parent
7e0cd5acf0
commit
a712134b5d
4
.github/CONTRIBUTING.md
vendored
4
.github/CONTRIBUTING.md
vendored
@ -5,6 +5,10 @@ To contribute to`open-source-ios-apps`, update the **contents.json** file (this
|
|||||||
Please [open an issue](https://github.com/dkhamsing/open-source-ios-apps/issues) and contact
|
Please [open an issue](https://github.com/dkhamsing/open-source-ios-apps/issues) and contact
|
||||||
@dkhamsing, @kvnbautista or @scribblemaniac.
|
@dkhamsing, @kvnbautista or @scribblemaniac.
|
||||||
|
|
||||||
|
## Delete app
|
||||||
|
|
||||||
|
To delete an app, add the value **archive** to the `tags` field.
|
||||||
|
|
||||||
## New app
|
## New app
|
||||||
|
|
||||||
Adding a `JSON` entry
|
Adding a `JSON` entry
|
||||||
|
46
.github/convert.rb
vendored
46
.github/convert.rb
vendored
@ -3,6 +3,9 @@ require 'json'
|
|||||||
|
|
||||||
README = 'README.md'
|
README = 'README.md'
|
||||||
|
|
||||||
|
ARCHIVE = 'ARCHIVE.md'
|
||||||
|
ARCHIVE_TAG = 'archive'
|
||||||
|
|
||||||
def output_stars(number)
|
def output_stars(number)
|
||||||
case number
|
case number
|
||||||
when 100...200
|
when 100...200
|
||||||
@ -35,8 +38,23 @@ def output_flag(lang)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def apps_archived(apps)
|
||||||
|
a = apps.select {|a| a['tags'] != nil }.select {|b| b['tags'].include?ARCHIVE_TAG}
|
||||||
|
a.sort_by { |k, v| k['title'] }
|
||||||
|
end
|
||||||
|
|
||||||
def apps_for_cat(apps, id)
|
def apps_for_cat(apps, id)
|
||||||
s = apps.select do |a|
|
f = apps.select do |a|
|
||||||
|
|
||||||
|
tags = a['tags']
|
||||||
|
if tags.nil?
|
||||||
|
true
|
||||||
|
else
|
||||||
|
!(tags.include? ARCHIVE_TAG)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
s = f.select do |a|
|
||||||
cat = a['category']
|
cat = a['category']
|
||||||
cat.class == Array ? cat.include?(id) : (cat == id)
|
cat.class == Array ? cat.include?(id) : (cat == id)
|
||||||
end
|
end
|
||||||
@ -133,7 +151,33 @@ def write_readme(j)
|
|||||||
puts "wrote #{README} ✨"
|
puts "wrote #{README} ✨"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def write_archive(j)
|
||||||
|
t = j['title']
|
||||||
|
desc = "This is an archive of the [main list](https://github.com/dkhamsing/open-source-ios-apps) for projects that are no longer maintained / old.\n\n"
|
||||||
|
f = "## Contact\n\n- [github.com/dkhamsing](https://github.com/dkhamsing)\n- [twitter.com/dkhamsing](https://twitter.com/dkhamsing)\n"
|
||||||
|
apps = j['projects']
|
||||||
|
archived = apps_archived apps
|
||||||
|
|
||||||
|
output = "\# #{t} Archive\n\n"
|
||||||
|
output << desc
|
||||||
|
|
||||||
|
archived.each do |a|
|
||||||
|
t = a['title']
|
||||||
|
s = a['source']
|
||||||
|
output << "- #{t} #{s}\n"
|
||||||
|
# output <<
|
||||||
|
end
|
||||||
|
|
||||||
|
output << "\n"
|
||||||
|
output << f
|
||||||
|
|
||||||
|
file = ARCHIVE
|
||||||
|
File.open(file, 'w') { |f| f.write output }
|
||||||
|
puts "wrote #{file} ✨"
|
||||||
|
end
|
||||||
|
|
||||||
c = File.read 'contents.json'
|
c = File.read 'contents.json'
|
||||||
j = JSON.parse c
|
j = JSON.parse c
|
||||||
|
|
||||||
write_readme(j)
|
write_readme(j)
|
||||||
|
write_archive(j)
|
||||||
|
4
.github/deploy.sh
vendored
4
.github/deploy.sh
vendored
@ -8,7 +8,9 @@ git config user.email "dkhamsing@users.noreply.github.com"
|
|||||||
#git checkout master
|
#git checkout master
|
||||||
|
|
||||||
git add README.md
|
git add README.md
|
||||||
|
|
||||||
git commit -m "[auto] [ci skip] Generate README"
|
git commit -m "[auto] [ci skip] Generate README"
|
||||||
|
|
||||||
|
git add ARCHIVE.md
|
||||||
|
git commit -m "[auto] [ci skip] Generate ARCHIVE"
|
||||||
|
|
||||||
git push --quiet "https://${GH_TOKEN}@github.com/dkhamsing/open-source-ios-apps" master:master > /dev/null 2>&1
|
git push --quiet "https://${GH_TOKEN}@github.com/dkhamsing/open-source-ios-apps" master:master > /dev/null 2>&1
|
||||||
|
Loading…
Reference in New Issue
Block a user