forked from fastlane/fastlane
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
93 lines (75 loc) · 2.75 KB
/
Rakefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
require "bundler/gem_tasks"
GEMS = %w(fastlane danger-device_grid)
SECONDS_PER_DAY = 60 * 60 * 24
task(:rubygems_admins) do
names = ["KrauseFx", "joshdholtz", "snatchev", "powerivq"]
(GEMS + ["krausefx-shenzhen", "commander-fastlane", "fastlane-plugin-firebase_test_lab"]).each do |gem_name|
names.each do |name|
puts(`gem owner #{gem_name} -a #{name}`)
end
end
end
task(:test_all) do
formatter = "--format progress"
formatter += " -r rspec_junit_formatter --format RspecJunitFormatter -o #{ENV['CIRCLE_TEST_REPORTS']}/rspec/fastlane-junit-results.xml" if ENV["CIRCLE_TEST_REPORTS"]
sh("rspec --pattern ./**/*_spec.rb #{formatter}")
end
# Overwrite the default rake task
# since we use fastlane to deploy fastlane
task(:push) do
sh("bundle exec fastlane release")
end
task(:generate_team_table) do
require 'json'
content = ["<table id='team'>"]
contributors = JSON.parse(File.read("team.json"))
counter = 0
number_of_rows = 5
contributors.keys.shuffle.each do |github_user|
user_content = contributors[github_user]
github_user_name = user_content['name']
github_user_id = github_user_name.downcase.gsub(' ', '-')
github_profile_url = "https://github.com/#{github_user}"
content << "<tr>" if counter % number_of_rows == 0
content << "<td id='#{github_user_id}'>"
content << "<a href='#{github_profile_url}'>"
content << "<img src='#{github_profile_url}.png?size=140'>"
content << "</a>"
if user_content['twitter']
content << "<h4 align='center'><a href='https://twitter.com/#{user_content['twitter']}'>#{github_user_name}</a></h4>"
else
content << "<h4 align='center'>#{github_user_name}</h4>"
end
# content << "<p align='center'>#{user_content['slogan']}</p>" if user_content['slogan'].to_s.length > 0
content << "</td>"
content << "</tr>" if counter % number_of_rows == number_of_rows - 1
counter += 1
end
content << "</table>"
readme = File.read("README.md")
readme.gsub!(%r{\<table id='team'\>.*\<\/table\>}m, content.join("\n"))
File.write("README.md", readme)
puts("All done")
end
task(:update_gem_spec_authors) do
require 'json'
contributors = JSON.parse(File.read("team.json"))
names = contributors.values.collect do |current|
current["name"]
end.shuffle
gemspec = File.read("fastlane.gemspec")
names = names.join("\",\n \"")
gemspec.gsub!(/spec.authors\s+\=\s.*?\]/m, "spec.authors = [\"#{names}\"]")
File.write("fastlane.gemspec", gemspec)
end
#####################################################
# @!group Helper Methods
#####################################################
def box(str)
l = str.length + 4
puts('')
puts('=' * l)
puts('| ' + str + ' |')
puts('=' * l)
end
task(default: :test_all)