-
Notifications
You must be signed in to change notification settings - Fork 5.6k
/
plugin_scores.rb
72 lines (59 loc) 路 2.18 KB
/
plugin_scores.rb
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
module Fastlane
module Actions
class PluginScoresAction < Action
def self.run(params)
require_relative '../helper/plugin_scores_helper.rb'
require "erb"
plugins = fetch_plugins(params[:cache_path]).sort_by { |v| v.data[:overall_score] }.reverse
result = "<!--\nAuto generated, please only modify https://github.com/fastlane/fastlane/blob/master/fastlane/actions/plugin_scores.rb\n-->\n"
result += "{!docs/includes/setup-fastlane-header.md!}\n"
result += "# Available Plugins\n\n\n"
result += plugins.collect do |current_plugin|
@plugin = current_plugin
result = ERB.new(File.read(params[:template_path]), 0, '-').result(binding) # https://web.archive.org/web/20160430190141/www.rrn.dk/rubys-erb-templating-system
end.join("\n")
File.write(File.join("docs", params[:output_path]), result)
end
def self.fetch_plugins(cache_path)
require 'open-uri'
page = 1
plugins = []
loop do
url = "https://rubygems.org/api/v1/search.json?query=fastlane-plugin-&page=#{page}"
puts("RubyGems API Request: #{url}")
results = JSON.parse(URI.open(url).read)
break if results.count == 0
plugins += results.collect do |current|
next if self.hidden_plugins.include?(current['name'])
Fastlane::Helper::PluginScoresHelper::FastlanePluginScore.new(current, cache_path)
end.compact
page += 1
end
return plugins
end
# Metadata
def self.available_options
[
FastlaneCore::ConfigItem.new(key: :output_path),
FastlaneCore::ConfigItem.new(key: :template_path),
FastlaneCore::ConfigItem.new(key: :cache_path)
]
end
def self.authors
["KrauseFx"]
end
def self.is_supported?(platform)
true
end
def self.category
:misc
end
# Those are plugins that are now part of fastlane core actions, so we don't want to show them in the directory
def self.hidden_plugins
[
"fastlane-plugin-update_project_codesigning"
]
end
end
end
end