branch_io_cli 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/assets/patches/ContinueUserActivity.m +4 -0
- data/lib/assets/patches/ContinueUserActivity.swift +4 -0
- data/lib/assets/patches/ContinueUserActivityNew.m +6 -0
- data/lib/assets/patches/ContinueUserActivityNew.swift +5 -0
- data/lib/assets/patches/DidFinishLaunching.m +4 -0
- data/lib/assets/patches/DidFinishLaunching.swift +5 -0
- data/lib/assets/patches/DidFinishLaunchingNew.m +9 -0
- data/lib/assets/patches/DidFinishLaunchingNew.swift +9 -0
- data/lib/assets/patches/DidFinishLaunchingNewTest.m +13 -0
- data/lib/assets/patches/DidFinishLaunchingNewTest.swift +13 -0
- data/lib/assets/patches/DidFinishLaunchingTest.m +8 -0
- data/lib/assets/patches/DidFinishLaunchingTest.swift +9 -0
- data/lib/assets/patches/OpenUrl.m +4 -0
- data/lib/assets/patches/OpenUrl.swift +4 -0
- data/lib/assets/patches/OpenUrlNew.m +6 -0
- data/lib/assets/patches/OpenUrlNew.swift +5 -0
- data/lib/assets/patches/OpenUrlSourceApplication.m +4 -0
- data/lib/assets/patches/OpenUrlSourceApplication.swift +4 -0
- data/lib/assets/patches/cartfile.yml +3 -0
- data/lib/assets/patches/continue_user_activity_new_objc.yml +2 -0
- data/lib/assets/patches/continue_user_activity_new_swift.yml +2 -0
- data/lib/assets/patches/continue_user_activity_objc.yml +2 -0
- data/lib/assets/patches/continue_user_activity_swift.yml +2 -0
- data/lib/assets/patches/did_finish_launching_new_objc.yml +2 -0
- data/lib/assets/patches/did_finish_launching_new_swift.yml +2 -0
- data/lib/assets/patches/did_finish_launching_new_test_objc.yml +2 -0
- data/lib/assets/patches/did_finish_launching_new_test_swift.yml +2 -0
- data/lib/assets/patches/did_finish_launching_objc.yml +2 -0
- data/lib/assets/patches/did_finish_launching_swift.yml +2 -0
- data/lib/assets/patches/did_finish_launching_test_objc.yml +2 -0
- data/lib/assets/patches/did_finish_launching_test_swift.yml +2 -0
- data/lib/assets/patches/objc_import.yml +3 -0
- data/lib/assets/patches/open_url_new_objc.yml +2 -0
- data/lib/assets/patches/open_url_new_swift.yml +2 -0
- data/lib/assets/patches/open_url_objc.yml +2 -0
- data/lib/assets/patches/open_url_source_application_objc.yml +2 -0
- data/lib/assets/patches/open_url_source_application_swift.yml +2 -0
- data/lib/assets/patches/open_url_swift.yml +2 -0
- data/lib/assets/patches/swift_import.yml +3 -0
- data/lib/branch_io_cli.rb +2 -1
- data/lib/branch_io_cli/cli.rb +3 -3
- data/lib/branch_io_cli/command.rb +4 -0
- data/lib/branch_io_cli/{commands → command}/command.rb +4 -3
- data/lib/branch_io_cli/{commands → command}/report_command.rb +57 -54
- data/lib/branch_io_cli/{commands → command}/setup_command.rb +29 -26
- data/lib/branch_io_cli/{commands → command}/validate_command.rb +4 -2
- data/lib/branch_io_cli/configuration.rb +4 -0
- data/lib/branch_io_cli/configuration/configuration.rb +211 -0
- data/lib/branch_io_cli/configuration/report_configuration.rb +164 -0
- data/lib/branch_io_cli/configuration/setup_configuration.rb +215 -0
- data/lib/branch_io_cli/configuration/validate_configuration.rb +26 -0
- data/lib/branch_io_cli/core_ext/io.rb +2 -2
- data/lib/branch_io_cli/helper.rb +1 -1
- data/lib/branch_io_cli/helper/branch_helper.rb +0 -16
- data/lib/branch_io_cli/helper/ios_helper.rb +87 -468
- data/lib/branch_io_cli/helper/methods.rb +1 -1
- data/lib/branch_io_cli/helper/patch_helper.rb +267 -0
- data/lib/branch_io_cli/version.rb +1 -1
- metadata +55 -11
- data/lib/branch_io_cli/commands.rb +0 -4
- data/lib/branch_io_cli/helper/configuration_helper.rb +0 -529
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4599199e006b06d1b616d660c85fa73f04b5c75f687d7bea90511df2cc73b5e0
|
4
|
+
data.tar.gz: 8b0b81d38d5bec8d6d733c18ff0bfbffa5658ccd6a5d84618403cae1bca5f7d8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be893c6067fa95597a296c8e7dacc66a847365ab1e5cb124d2000acf64716fd7dc40853839c3abbdc114c6ff0bb7d141e19e13f2694ecfe5b8d5168361f0203a
|
7
|
+
data.tar.gz: 1549178e5eb7f6e13f4f3e8d4de74171502bec799bb29e1d9ab2da2e4ea45f9c6957edd4818eafe005419d4abec9497f40c51104a7f630bac76043bdd79437a0
|
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
4
|
+
[[Branch getInstance] initSessionWithLaunchOptions:launchOptions
|
5
|
+
andRegisterDeepLinkHandlerUsingBranchUniversalObject:^(BranchUniversalObject *universalObject, BranchLinkProperties *linkProperties, NSError *error){
|
6
|
+
// TODO: Route Branch links
|
7
|
+
}];
|
8
|
+
return YES;
|
9
|
+
}
|
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
3
|
+
Branch.getInstance().initSession(launchOptions: launchOptions) {
|
4
|
+
universalObject, linkProperties, error in
|
5
|
+
|
6
|
+
// TODO: Route Branch links
|
7
|
+
}
|
8
|
+
return true
|
9
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
|
3
|
+
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
|
4
|
+
#ifdef DEBUG
|
5
|
+
[Branch setUseTestBranchKey:YES];
|
6
|
+
#endif // DEBUG
|
7
|
+
|
8
|
+
[[Branch getInstance] initSessionWithLaunchOptions:launchOptions
|
9
|
+
andRegisterDeepLinkHandlerUsingBranchUniversalObject:^(BranchUniversalObject *universalObject, BranchLinkProperties *linkProperties, NSError *error){
|
10
|
+
// TODO: Route Branch links
|
11
|
+
}];
|
12
|
+
return YES;
|
13
|
+
}
|
@@ -0,0 +1,13 @@
|
|
1
|
+
|
2
|
+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
|
3
|
+
#if DEBUG
|
4
|
+
Branch.setUseTestBranchKey(true)
|
5
|
+
#endif
|
6
|
+
|
7
|
+
Branch.getInstance().initSession(launchOptions: launchOptions) {
|
8
|
+
universalObject, linkProperties, error in
|
9
|
+
|
10
|
+
// TODO: Route Branch links
|
11
|
+
}
|
12
|
+
return true
|
13
|
+
}
|
@@ -0,0 +1,8 @@
|
|
1
|
+
#ifdef DEBUG
|
2
|
+
[Branch setUseTestBranchKey:YES];
|
3
|
+
#endif // DEBUG
|
4
|
+
|
5
|
+
[[Branch getInstance] initSessionWithLaunchOptions:launchOptions
|
6
|
+
andRegisterDeepLinkHandlerUsingBranchUniversalObject:^(BranchUniversalObject *universalObject, BranchLinkProperties *linkProperties, NSError *error){
|
7
|
+
// TODO: Route Branch links
|
8
|
+
}];
|
data/lib/branch_io_cli.rb
CHANGED
data/lib/branch_io_cli/cli.rb
CHANGED
@@ -109,7 +109,7 @@ EOF
|
|
109
109
|
commit: false,
|
110
110
|
carthage_command: "update --platform ios"
|
111
111
|
)
|
112
|
-
|
112
|
+
Command::SetupCommand.new(options).run!
|
113
113
|
end
|
114
114
|
end
|
115
115
|
|
@@ -142,7 +142,7 @@ EOF
|
|
142
142
|
c.option "--target MyAppTarget", String, "Name of a target to modify in the Xcode project"
|
143
143
|
|
144
144
|
c.action do |args, options|
|
145
|
-
valid =
|
145
|
+
valid = Command::ValidateCommand.new(options).run!
|
146
146
|
exit_code = valid ? 0 : 1
|
147
147
|
exit exit_code
|
148
148
|
end
|
@@ -180,7 +180,7 @@ EOF
|
|
180
180
|
out: "./report.txt",
|
181
181
|
pod_repo_update: true
|
182
182
|
)
|
183
|
-
|
183
|
+
Command::ReportCommand.new(options).run!
|
184
184
|
end
|
185
185
|
end
|
186
186
|
|
@@ -1,7 +1,8 @@
|
|
1
1
|
module BranchIOCLI
|
2
|
-
module
|
2
|
+
module Command
|
3
3
|
class Command
|
4
4
|
attr_reader :options
|
5
|
+
attr_reader :config # command-specific configuration object
|
5
6
|
|
6
7
|
def initialize(options)
|
7
8
|
@options = options
|
@@ -15,8 +16,8 @@ module BranchIOCLI
|
|
15
16
|
Helper::BranchHelper
|
16
17
|
end
|
17
18
|
|
18
|
-
def
|
19
|
-
Helper::
|
19
|
+
def patch_helper
|
20
|
+
Helper::PatchHelper
|
20
21
|
end
|
21
22
|
end
|
22
23
|
end
|
@@ -2,17 +2,17 @@ require "cocoapods-core"
|
|
2
2
|
require "branch_io_cli/helper/methods"
|
3
3
|
|
4
4
|
module BranchIOCLI
|
5
|
-
module
|
5
|
+
module Command
|
6
6
|
class ReportCommand < Command
|
7
7
|
def initialize(options)
|
8
8
|
super
|
9
|
-
|
9
|
+
@config = Configuration::ReportConfiguration.new options
|
10
10
|
end
|
11
11
|
|
12
12
|
def run!
|
13
13
|
say "\n"
|
14
14
|
|
15
|
-
if
|
15
|
+
if config.header_only
|
16
16
|
say report_header
|
17
17
|
exit 0
|
18
18
|
end
|
@@ -30,7 +30,7 @@ module BranchIOCLI
|
|
30
30
|
|
31
31
|
install_command = "pod install"
|
32
32
|
|
33
|
-
if
|
33
|
+
if config.pod_repo_update
|
34
34
|
install_command += " --repo-update"
|
35
35
|
else
|
36
36
|
say <<EOF
|
@@ -43,53 +43,53 @@ EOF
|
|
43
43
|
sh install_command
|
44
44
|
end
|
45
45
|
|
46
|
-
File.open
|
46
|
+
File.open config.report_path, "w" do |report|
|
47
47
|
report.write "Branch.io Xcode build report v #{VERSION} #{DateTime.now}\n\n"
|
48
48
|
report.write "#{report_configuration}\n"
|
49
49
|
report.write "#{report_header}\n"
|
50
50
|
|
51
51
|
# run xcodebuild -list
|
52
|
-
report.
|
52
|
+
report.log_command "#{base_xcodebuild_cmd} -list"
|
53
53
|
|
54
54
|
# If using a workspace, -list all the projects as well
|
55
|
-
if
|
56
|
-
|
57
|
-
path = File.join File.dirname(
|
58
|
-
report.
|
55
|
+
if config.workspace_path
|
56
|
+
config.workspace.file_references.map(&:path).each do |project_path|
|
57
|
+
path = File.join File.dirname(config.workspace_path), project_path
|
58
|
+
report.log_command "xcodebuild -list -project #{path}"
|
59
59
|
end
|
60
60
|
end
|
61
61
|
|
62
62
|
base_cmd = base_xcodebuild_cmd
|
63
63
|
# Add -scheme option for the rest of the commands if using a workspace
|
64
|
-
base_cmd = "#{base_cmd} -scheme #{
|
64
|
+
base_cmd = "#{base_cmd} -scheme #{config.scheme}" if config.workspace_path
|
65
65
|
|
66
66
|
# xcodebuild -showBuildSettings
|
67
|
-
report.
|
67
|
+
report.log_command "#{base_cmd} -showBuildSettings"
|
68
68
|
|
69
69
|
# Add more options for the rest of the commands
|
70
|
-
base_cmd = "#{base_cmd} -configuration #{
|
71
|
-
base_cmd = "#{base_cmd} -target #{
|
70
|
+
base_cmd = "#{base_cmd} -configuration #{config.configuration} -sdk #{config.sdk}"
|
71
|
+
base_cmd = "#{base_cmd} -target #{config.target}" unless config.workspace_path
|
72
72
|
|
73
|
-
if
|
73
|
+
if config.clean
|
74
74
|
say "Cleaning"
|
75
|
-
report.
|
75
|
+
report.log_command "#{base_cmd} clean"
|
76
76
|
end
|
77
77
|
|
78
78
|
say "Building"
|
79
|
-
report.
|
79
|
+
report.log_command "#{base_cmd} -verbose"
|
80
80
|
|
81
81
|
say "Done ✅"
|
82
82
|
end
|
83
83
|
|
84
|
-
say "Report generated in #{
|
84
|
+
say "Report generated in #{config.report_path}"
|
85
85
|
end
|
86
86
|
|
87
87
|
def base_xcodebuild_cmd
|
88
88
|
cmd = "xcodebuild"
|
89
|
-
if
|
90
|
-
cmd = "#{cmd} -workspace #{
|
89
|
+
if config.workspace_path
|
90
|
+
cmd = "#{cmd} -workspace #{config.workspace_path}"
|
91
91
|
else
|
92
|
-
cmd = "#{cmd} -project #{
|
92
|
+
cmd = "#{cmd} -project #{config.xcodeproj_path}"
|
93
93
|
end
|
94
94
|
cmd
|
95
95
|
end
|
@@ -102,30 +102,30 @@ EOF
|
|
102
102
|
end
|
103
103
|
|
104
104
|
def requirement_from_podfile
|
105
|
-
return nil unless
|
106
|
-
podfile = File.read
|
105
|
+
return nil unless config.podfile_path
|
106
|
+
podfile = File.read config.podfile_path
|
107
107
|
matches = /\n?\s*pod\s+("Branch"|'Branch').*?\n/m.match podfile
|
108
108
|
matches ? matches[0].strip : nil
|
109
109
|
end
|
110
110
|
|
111
111
|
def requirement_from_cartfile
|
112
|
-
return nil unless
|
113
|
-
cartfile = File.read
|
112
|
+
return nil unless config.cartfile_path
|
113
|
+
cartfile = File.read config.cartfile_path
|
114
114
|
matches = %r{^git(hub\s+"|\s+"https://github.com/)BranchMetrics/(ios-branch-deep-linking|iOS-Deferred-Deep-Linking-SDK.*?).*?\n}m.match cartfile
|
115
115
|
matches ? matches[0].strip : nil
|
116
116
|
end
|
117
117
|
|
118
118
|
def version_from_podfile_lock
|
119
|
-
return nil unless
|
120
|
-
podfile_lock = Pod::Lockfile.from_file Pathname.new "#{
|
119
|
+
return nil unless config.podfile_path && File.exist?("#{config.podfile_path}.lock")
|
120
|
+
podfile_lock = Pod::Lockfile.from_file Pathname.new "#{config.podfile_path}.lock"
|
121
121
|
version = podfile_lock.version "Branch"
|
122
122
|
|
123
123
|
version ? "#{version} [Podfile.lock]" : nil
|
124
124
|
end
|
125
125
|
|
126
126
|
def version_from_cartfile_resolved
|
127
|
-
return nil unless
|
128
|
-
cartfile_resolved = File.read "#{
|
127
|
+
return nil unless config.cartfile_path && File.exist?("#{config.cartfile_path}.resolved")
|
128
|
+
cartfile_resolved = File.read "#{config.cartfile_path}.resolved"
|
129
129
|
|
130
130
|
# Matches:
|
131
131
|
# git "https://github.com/BranchMetrics/ios-branch-deep-linking"
|
@@ -143,7 +143,7 @@ EOF
|
|
143
143
|
end
|
144
144
|
|
145
145
|
def version_from_branch_framework
|
146
|
-
framework =
|
146
|
+
framework = config.target.frameworks_build_phase.files.find { |f| f.file_ref.path =~ /Branch.framework$/ }
|
147
147
|
return nil unless framework
|
148
148
|
framework_path = framework.file_ref.real_path
|
149
149
|
info_plist_path = File.join framework_path.to_s, "Info.plist"
|
@@ -159,7 +159,7 @@ EOF
|
|
159
159
|
|
160
160
|
def version_from_bnc_config_m
|
161
161
|
# Look for BNCConfig.m in embedded source
|
162
|
-
bnc_config_m_ref =
|
162
|
+
bnc_config_m_ref = config.xcodeproj.files.find { |f| f.path =~ /BNCConfig\.m$/ }
|
163
163
|
return nil unless bnc_config_m_ref
|
164
164
|
bnc_config_m = File.read bnc_config_m_ref.real_path
|
165
165
|
matches = /BNC_SDK_VERSION\s+=\s+@"(\d+\.\d+\.\d+)"/m.match bnc_config_m
|
@@ -172,29 +172,28 @@ EOF
|
|
172
172
|
<<EOF
|
173
173
|
Configuration:
|
174
174
|
|
175
|
-
Xcode workspace: #{
|
176
|
-
Xcode project: #{
|
177
|
-
Scheme: #{
|
178
|
-
Target: #{
|
179
|
-
Configuration: #{
|
180
|
-
SDK: #{
|
181
|
-
Podfile: #{
|
182
|
-
Cartfile: #{
|
183
|
-
Pod repo update: #{
|
184
|
-
Clean: #{
|
175
|
+
Xcode workspace: #{config.workspace_path || '(none)'}
|
176
|
+
Xcode project: #{config.xcodeproj_path || '(none)'}
|
177
|
+
Scheme: #{config.scheme || '(none)'}
|
178
|
+
Target: #{config.target || '(none)'}
|
179
|
+
Configuration: #{config.configuration || '(none)'}
|
180
|
+
SDK: #{config.sdk}
|
181
|
+
Podfile: #{config.podfile_path || '(none)'}
|
182
|
+
Cartfile: #{config.cartfile_path || '(none)'}
|
183
|
+
Pod repo update: #{config.pod_repo_update.inspect}
|
184
|
+
Clean: #{config.clean.inspect}
|
185
185
|
EOF
|
186
186
|
end
|
187
187
|
|
188
188
|
def pod_install_required?
|
189
189
|
# If this is set, its existence has been verified.
|
190
|
-
return false unless
|
190
|
+
return false unless config.podfile_path
|
191
191
|
|
192
|
-
lockfile_path = "#{
|
193
|
-
manifest_path = File.expand_path "../Pods/Manifest.lock",
|
192
|
+
lockfile_path = "#{config.podfile_path}.lock"
|
193
|
+
manifest_path = File.expand_path "../Pods/Manifest.lock", config.podfile_path
|
194
194
|
|
195
195
|
return true unless File.exist?(lockfile_path) && File.exist?(manifest_path)
|
196
196
|
|
197
|
-
podfile = Pod::Podfile.from_file Pathname.new config_helper.podfile_path
|
198
197
|
lockfile = Pod::Lockfile.from_file Pathname.new lockfile_path
|
199
198
|
manifest = Pod::Lockfile.from_file Pathname.new manifest_path
|
200
199
|
|
@@ -206,7 +205,7 @@ EOF
|
|
206
205
|
# compare checksum of Podfile with checksum in Podfile.lock
|
207
206
|
# This is a good sanity check, but perhaps unnecessary. It means pod install
|
208
207
|
# has not been run since the Podfile was modified, which is probably an oversight.
|
209
|
-
return true unless lockfile.to_hash["PODFILE CHECKSUM"] == podfile.checksum
|
208
|
+
return true unless lockfile.to_hash["PODFILE CHECKSUM"] == config.podfile.checksum
|
210
209
|
|
211
210
|
false
|
212
211
|
end
|
@@ -217,17 +216,21 @@ EOF
|
|
217
216
|
|
218
217
|
header += `xcodebuild -version`
|
219
218
|
|
220
|
-
header += "\nTarget #{
|
219
|
+
header += "\nTarget #{config.target.name}:\n"
|
220
|
+
header += " Deployment target: #{config.target.deployment_target}\n"
|
221
|
+
header += " Modules #{config.modules_enabled? ? '' : 'not '}enabled\n"
|
222
|
+
header += " Swift #{config.swift_version}\n" if config.swift_version
|
223
|
+
header += " Bridging header: #{config.bridging_header_path}\n" if config.bridging_header_path
|
221
224
|
|
222
|
-
if
|
225
|
+
if config.podfile_path
|
223
226
|
begin
|
224
227
|
cocoapods_version = `pod --version`.chomp
|
225
228
|
rescue Errno::ENOENT
|
226
229
|
header += "\n(pod command not found)\n"
|
227
230
|
end
|
228
231
|
|
229
|
-
if File.exist?("#{
|
230
|
-
podfile_lock = Pod::Lockfile.from_file Pathname.new "#{
|
232
|
+
if File.exist?("#{config.podfile_path}.lock")
|
233
|
+
podfile_lock = Pod::Lockfile.from_file Pathname.new "#{config.podfile_path}.lock"
|
231
234
|
end
|
232
235
|
|
233
236
|
if cocoapods_version || podfile_lock
|
@@ -242,8 +245,8 @@ EOF
|
|
242
245
|
end
|
243
246
|
|
244
247
|
# Already verified existence.
|
245
|
-
podfile = Pod::Podfile.from_file Pathname.new
|
246
|
-
target_definition = podfile.target_definition_list.find { |t| t.name ==
|
248
|
+
podfile = Pod::Podfile.from_file Pathname.new config.podfile_path
|
249
|
+
target_definition = podfile.target_definition_list.find { |t| t.name == config.target.name }
|
247
250
|
if target_definition
|
248
251
|
branch_dep = target_definition.dependencies.find { |p| p.name == "Branch" }
|
249
252
|
header += "Podfile target #{target_definition.name}:"
|
@@ -255,13 +258,13 @@ EOF
|
|
255
258
|
header += ", #{branch_dep.external_source}" if branch_dep && branch_dep.external_source
|
256
259
|
header += "\n"
|
257
260
|
else
|
258
|
-
header += "Target #{
|
261
|
+
header += "Target #{config.target.name.inspect} not found in Podfile.\n"
|
259
262
|
end
|
260
263
|
|
261
264
|
header += "\npod install #{pod_install_required? ? '' : 'not '}required.\n"
|
262
265
|
end
|
263
266
|
|
264
|
-
if
|
267
|
+
if config.cartfile_path
|
265
268
|
begin
|
266
269
|
carthage_version = `carthage version`.chomp
|
267
270
|
header += "\nUsing Carthage v. #{carthage_version}\n"
|