forked from Homebrew/formulae.brew.sh
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Rakefile
58 lines (46 loc) · 1.41 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
require "date"
require "json"
require "rake"
require "rake/clean"
require "yaml"
task default: :generate
desc "Generate the API files"
task generate: %i[formulae casks analytics api_samples]
desc "Dump macOS formulae data"
task :formulae do
sh "brew", "generate-formula-api"
end
CLOBBER.include FileList[%w[_data/formula api/formula formula _data/formula_canonical.json]]
desc "Dump cask data"
task :casks do
sh "brew", "generate-cask-api"
end
CLOBBER.include FileList[%w[_data/cask api/cask api/cask-source cask]]
def setup_analytics_credentials
ga_credentials = ".homebrew_analytics.json"
return unless File.exist?(ga_credentials)
ga_credentials_home = File.expand_path("~/#{ga_credentials}")
return if File.exist?(ga_credentials_home)
FileUtils.cp ga_credentials, ga_credentials_home
end
def setup_formula_analytics_cmd
ENV["HOMEBREW_NO_AUTO_UPDATE"] = "1"
unless `brew tap`.include?("homebrew/formula-analytics")
sh "brew", "tap", "Homebrew/formula-analytics"
end
end
def setup_analytics
setup_analytics_credentials
setup_formula_analytics_cmd
end
desc "Dump analytics data"
task :analytics do
setup_analytics
sh "brew", "generate-analytics-api"
end
CLOBBER.include FileList[%w[_data/analytics _data/analytics-linux api/analytics api/analytics-linux]]
desc "Update API samples"
task :api_samples do
sh "ruby", "script/generate-api-samples.rb"
end
CLOBBER.include FileList[%w[_includes/api-sample]]