-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild
executable file
·48 lines (37 loc) · 1.16 KB
/
build
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
#!/usr/bin/env ruby
require "optparse"
require_relative 'cli/settingskit.rb'
options = {}
OptionParser.new do |opts|
opts.banner = "Run script build phase tool for rendering a Settings swift file for use with SettingsKit.\n"
opts.banner += "\n"
opts.banner += "Usage: build [options]"
opts.separator ""
opts.separator "Options:"
opts.on("-o", "--outfile PATH", "Output location for the generated Settings swift file, relative to the .xcodeproj") do |path|
options[:outfile] = path
end
opts.on("-p", "--project PATH", "Path to .xcodeproj") do |path|
options[:project] = path
end
opts.on("-s", "--settings PATH", "Path to Settings.bundle/Root.plist") do |path|
options[:settings] = path
end
opts.on("-h", "--help", "Prints this help") do
puts opts
exit
end
end.parse!
def verify(options, option)
unless options[option]
puts "Missing required option: --#{option}"
exit
end
end
# check for required options
verify(options, :outfile)
verify(options, :project)
verify(options, :settings)
SettingsKit::Parser.parse(options[:settings])
.render(options[:outfile])
.integrate(options[:project])