1
0
mirror of https://github.com/dkhamsing/open-source-ios-apps.git synced 2025-02-22 22:57:44 +01:00

[script] user helper

This commit is contained in:
Travis CI 2016-05-16 10:29:04 -07:00
parent 4908b2a77a
commit 1fcfdc240b
6 changed files with 51 additions and 51 deletions

View File

@ -1,8 +1,6 @@
require 'json' require_relative 'osia_helper'
c = File.read 'contents.json'
j = JSON.parse c
j = get_json
c = j['categories'] c = j['categories']
c.sort_by { |h| h['title']} c.sort_by { |h| h['title']}

View File

@ -1,45 +1,11 @@
require_relative 'osia_helper'
require 'date' require 'date'
require 'json'
README = 'README.md' README = 'README.md'
ARCHIVE = 'ARCHIVE.md' ARCHIVE = 'ARCHIVE.md'
ARCHIVE_TAG = 'archive' ARCHIVE_TAG = 'archive'
def output_stars(number)
case number
when 100...200
'🔥'
when 200...500
'🔥🔥'
when 500...1000
'🔥🔥🔥'
when 1000...2000
'🔥🔥🔥🔥'
when 2000...100000
'🔥🔥🔥🔥🔥'
else
''
end
end
def output_flag(lang)
case lang
when 'jpn'
'🇯🇵'
when 'ltz'
'🇱🇺'
when 'por'
'🇧🇷'
when 'spa'
'🇪🇸'
when 'zho'
'🇨🇳'
else
''
end
end
def apps_archived(apps) def apps_archived(apps)
a = apps.select {|a| a['tags'] != nil }.select {|b| b['tags'].include?ARCHIVE_TAG} a = apps.select {|a| a['tags'] != nil }.select {|b| b['tags'].include?ARCHIVE_TAG}
a.sort_by { |k, v| k['title'] } a.sort_by { |k, v| k['title'] }
@ -103,6 +69,40 @@ def output_apps(apps)
o o
end end
def output_flag(lang)
case lang
when 'jpn'
'🇯🇵'
when 'ltz'
'🇱🇺'
when 'por'
'🇧🇷'
when 'spa'
'🇪🇸'
when 'zho'
'🇨🇳'
else
''
end
end
def output_stars(number)
case number
when 100...200
'🔥'
when 200...500
'🔥🔥'
when 500...1000
'🔥🔥🔥'
when 1000...2000
'🔥🔥🔥🔥'
when 2000...100000
'🔥🔥🔥🔥🔥'
else
''
end
end
def write_readme(j) def write_readme(j)
t = j['title'] t = j['title']
desc = j['description'] desc = j['description']
@ -178,8 +178,7 @@ def write_archive(j)
puts "wrote #{file}" puts "wrote #{file}"
end end
c = File.read 'contents.json' j = get_json
j = JSON.parse c
write_readme(j) write_readme(j)
write_archive(j) write_archive(j)

7
.github/osia_helper.rb vendored Normal file
View File

@ -0,0 +1,7 @@
require 'json'
FILE = 'contents.json'
def get_json
JSON.parse(File.read FILE)
end

View File

@ -1,15 +1,11 @@
require 'json' require_relative 'osia_helper'
require 'octokit' require 'octokit'
require 'netrc' require 'netrc'
FILE = 'contents.json'
c = File.read FILE
j = JSON.parse c
client = Octokit::Client.new(:netrc => true) client = Octokit::Client.new(:netrc => true)
j = get_json
apps = j['projects'] apps = j['projects']
updated = [] updated = []

View File

@ -1,6 +1,6 @@
require 'json' require_relative 'osia_helper'
j = JSON.parse(File.read 'contents.json') j = get_json
c = j['categories'] c = j['categories']
a = j['projects'] a = j['projects']

View File

@ -8,7 +8,7 @@ test:
override: override:
- awesome_bot contents.json --white-list developer.apple - awesome_bot contents.json --white-list developer.apple
- json validate --schema-file=.github/schema.json --document-file=contents.json - json validate --schema-file=.github/schema.json --document-file=contents.json
- ruby .github/validate_categories.rb - ruby .github/osia_validate_categories.rb
general: general:
artifacts: artifacts:
- "ab-results.json" - "ab-results.json"
@ -16,5 +16,5 @@ deployment:
master: master:
branch: master branch: master
commands: commands:
- ruby .github/convert.rb - ruby .github/osia_convert.rb
- ./.github/deploy.sh - ./.github/deploy.sh