This repository has been archived by the owner on Jan 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
/
Rakefile
99 lines (77 loc) · 2.77 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
94
95
96
97
98
99
task :run_tests_ios do
sh("#{BUILD_TOOL} #{BUILD_FLAGS_TEST_IOS} | #{PRETTIFY}")
end
task :run_tests_osx do
sh("#{BUILD_TOOL} #{BUILD_FLAGS_TEST_OSX} | #{PRETTIFY}")
end
task :run_tests => [
:run_tests_osx,
:run_tests_ios,
]
task :build_cli do
sh("#{BUILD_TOOL} #{BUILD_FLAGS_BUILD_CLI} | #{PRETTIFY}")
end
task :build_buttons_example do
sh("#{BUILD_TOOL} #{BUILD_FLAGS_BUTTONS_EXAMPLE} | #{PRETTIFY}")
end
task :build_swift_buttons_example do
sh("#{BUILD_TOOL} #{BUILD_FLAGS_SWIFT_BUTTONS_EXAMPLE} | #{PRETTIFY}")
end
task :build_dynamic_themes_example do
sh("#{BUILD_TOOL} #{BUILD_FLAGS_DYNAMIC_THEMES_EXAMPLE} | #{PRETTIFY}")
end
task :build_screen_brightness_example do
sh("#{BUILD_TOOL} #{BUILD_FLAGS_SCREEN_BRIGHTNESS_EXAMPLE} | #{PRETTIFY}")
end
task :build_examples => [
:build_buttons_example,
:build_swift_buttons_example,
:build_dynamic_themes_example,
:build_screen_brightness_example,
]
task :lint_podspec do
sh("#{POD_LINT_TOOL} #{POD_LINT_FLAGS}")
end
task :carthage_build do
sh("carthage build --no-skip-current")
end
task :slather do
sh('bundle exec slather coverage')
end
task :ci => [
:run_tests,
:slather,
:build_examples,
:build_cli,
:lint_podspec,
:carthage_build,
]
private
# Xcodebuild
LIBRARY_NAME = 'Motif'
WORKSPACE_PATH = "#{LIBRARY_NAME}.xcworkspace"
SCHEME_CLI = 'MotifCLI'
SCHEME_BUTTONS_EXAMPLE = 'ButtonsExample'
SCHEME_SWIFT_BUTTONS_EXAMPLE = 'SwiftButtonsExample'
SCHEME_DYNAMIC_THEMING_EXAMPLE = 'DynamicThemingExample'
SCHEME_SCREEN_BRIGHTNESS_THEMING_EXAMPLE = 'ScreenBrightnessThemingExample'
DERIVED_DATA_PATH = "#{ENV['HOME']}/Library/Developer/Xcode/DerivedData"
TEST_SDK = 'iphonesimulator'
BUILD_TOOL = 'xcodebuild'
BUILD_FLAGS = "-workspace '#{WORKSPACE_PATH}' "
BUILD_FLAGS_IOS =
"-destination 'platform=iOS Simulator,OS=latest,name=iPhone 6' "\
"ONLY_ACTIVE_ARCH=YES "\
"CODE_SIGNING_REQUIRED=NO " + BUILD_FLAGS
BUILD_FLAGS_TEST_IOS = "test -scheme '#{LIBRARY_NAME}-iOS' " + BUILD_FLAGS_IOS
BUILD_FLAGS_TEST_OSX = "test -scheme '#{LIBRARY_NAME}-OSX' " + BUILD_FLAGS
BUILD_FLAGS_BUILD_CLI = "build -scheme #{SCHEME_CLI} " + BUILD_FLAGS
BUILD_FLAGS_BUTTONS_EXAMPLE = "build -scheme '#{SCHEME_BUTTONS_EXAMPLE}' " + BUILD_FLAGS_IOS
BUILD_FLAGS_SWIFT_BUTTONS_EXAMPLE = "build -scheme '#{SCHEME_SWIFT_BUTTONS_EXAMPLE}' " + BUILD_FLAGS_IOS
BUILD_FLAGS_DYNAMIC_THEMES_EXAMPLE = "build -scheme '#{SCHEME_DYNAMIC_THEMING_EXAMPLE}' " + BUILD_FLAGS_IOS
BUILD_FLAGS_SCREEN_BRIGHTNESS_EXAMPLE = "build -scheme '#{SCHEME_SCREEN_BRIGHTNESS_THEMING_EXAMPLE}' " + BUILD_FLAGS_IOS
PRETTIFY = "xcpretty --color; exit ${PIPESTATUS[0]}"
# CocoaPods
PODSPEC_PATH = "#{LIBRARY_NAME}.podspec"
POD_LINT_TOOL = 'bundle exec pod lib lint'
POD_LINT_FLAGS = "#{PODSPEC_PATH} --allow-warnings"