branch_io_cli 0.9.2 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/assets/completions/completion.bash +1 -1
- data/lib/assets/patches/ContinueUserActivity.swift +1 -1
- data/lib/assets/patches/continue_user_activity_new_objc.yml +1 -0
- data/lib/assets/patches/continue_user_activity_new_swift.yml +1 -0
- data/lib/assets/patches/continue_user_activity_objc.yml +1 -0
- data/lib/assets/patches/continue_user_activity_swift.yml +1 -0
- data/lib/assets/patches/did_finish_launching_new_objc.yml +3 -0
- data/lib/assets/patches/did_finish_launching_new_swift.yml +3 -0
- data/lib/assets/patches/did_finish_launching_objc.yml +1 -0
- data/lib/assets/patches/did_finish_launching_swift.yml +1 -0
- data/lib/assets/patches/open_url_new_objc.yml +1 -0
- data/lib/assets/patches/open_url_new_swift.yml +1 -0
- data/lib/assets/patches/open_url_objc.yml +1 -0
- data/lib/assets/patches/open_url_source_application_objc.yml +1 -0
- data/lib/assets/patches/open_url_source_application_swift.yml +1 -0
- data/lib/assets/patches/open_url_swift.yml +1 -0
- data/lib/branch_io_cli/command/report_command.rb +8 -6
- data/lib/branch_io_cli/configuration/configuration.rb +1 -1
- data/lib/branch_io_cli/configuration/setup_configuration.rb +0 -1
- data/lib/branch_io_cli/helper/ios_helper.rb +4 -0
- data/lib/branch_io_cli/helper/patch_helper.rb +36 -57
- data/lib/branch_io_cli/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2908cdd4340d1d0d43da1875c4e08c2e4f6e46b56836395aaf47f6d401834218
|
4
|
+
data.tar.gz: bcbfe15c402201a6a6594712b688ca5288a7c54d20a99a9aa0517c6264bbf220
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9edff995284b5a31a39cf22bb02a198b775c35a072046d5c2527730e41055d1e1c3f8dc1d800e0d8768809b8f4b35524453cf2c7d4ce8da7a29491d97c340d4
|
7
|
+
data.tar.gz: 2ea56d6e150521ea6e956584fb0fc8f4c7774702746724eb6d94418840387a2ee0fa42ce2945a34e5d05daddcdb13d81a182e9775be8b99c2f5ad04110c4ec9a
|
@@ -19,7 +19,7 @@ _branch_io_complete()
|
|
19
19
|
validate_opts="$global_opts -D --domains --xcodeproj --target"
|
20
20
|
|
21
21
|
report_opts="$global_opts --xcodeproj --workspace --header-only --no-clean --scheme --target --configuration --sdk --out"
|
22
|
-
report_opts="$
|
22
|
+
report_opts="$report_opts --podfile --cartfile --no-pod-repo-update"
|
23
23
|
|
24
24
|
if [[ ${cur} == -* ]] ; then
|
25
25
|
case "${cmd}" in
|
@@ -118,7 +118,7 @@ EOF
|
|
118
118
|
def version_from_podfile_lock
|
119
119
|
return nil unless config.podfile_path && File.exist?("#{config.podfile_path}.lock")
|
120
120
|
podfile_lock = Pod::Lockfile.from_file Pathname.new "#{config.podfile_path}.lock"
|
121
|
-
version = podfile_lock.version "Branch"
|
121
|
+
version = podfile_lock.version("Branch") || podfile_lock.version("Branch-SDK")
|
122
122
|
|
123
123
|
version ? "#{version} [Podfile.lock]" : nil
|
124
124
|
end
|
@@ -246,17 +246,19 @@ EOF
|
|
246
246
|
|
247
247
|
# Already verified existence.
|
248
248
|
podfile = Pod::Podfile.from_file Pathname.new config.podfile_path
|
249
|
-
target_definition = podfile.
|
249
|
+
target_definition = podfile.target_definitions[config.target.name]
|
250
250
|
if target_definition
|
251
|
-
|
251
|
+
branch_deps = target_definition.dependencies.select { |p| p.name =~ %r{^(Branch|Branch-SDK)(/.*)?$} }
|
252
252
|
header += "Podfile target #{target_definition.name}:"
|
253
253
|
header += "\n use_frameworks!" if target_definition.uses_frameworks?
|
254
254
|
header += "\n platform: #{target_definition.platform}"
|
255
255
|
header += "\n build configurations: #{target_definition.build_configurations}"
|
256
256
|
header += "\n inheritance: #{target_definition.inheritance}"
|
257
|
-
|
258
|
-
|
259
|
-
|
257
|
+
branch_deps.each do |dep|
|
258
|
+
header += "\n pod '#{dep.name}', '#{dep.requirement}'"
|
259
|
+
header += ", #{dep.external_source}" if dep.external_source
|
260
|
+
header += "\n"
|
261
|
+
end
|
260
262
|
else
|
261
263
|
header += "Target #{config.target.name.inspect} not found in Podfile.\n"
|
262
264
|
end
|
@@ -187,7 +187,6 @@ module BranchIOCLI
|
|
187
187
|
return if !options.add_sdk || sdk_integration_mode
|
188
188
|
|
189
189
|
# If no CocoaPods or Carthage, check to see if the framework is linked.
|
190
|
-
target = helper.target_from_project xcodeproj, options.target
|
191
190
|
return if target.frameworks_build_phase.files.map(&:file_ref).map(&:path).any? { |p| p =~ /Branch.framework$/ }
|
192
191
|
|
193
192
|
# --podfile, --cartfile not specified. No Podfile found. No Cartfile found. No Branch.framework in project.
|
@@ -1,3 +1,4 @@
|
|
1
|
+
require "cocoapods-core"
|
1
2
|
require "json"
|
2
3
|
require "net/http"
|
3
4
|
require "openssl"
|
@@ -402,6 +403,9 @@ module BranchIOCLI
|
|
402
403
|
mode: :append,
|
403
404
|
text: "\n\\1pod \"Branch\""
|
404
405
|
).apply podfile_path
|
406
|
+
# Store a Pod::Podfile representation of this file.
|
407
|
+
# TODO: Might want to move this to Configuration.
|
408
|
+
config.podfile = Pod::Podfile.from_file Pathname.new "Podfile"
|
405
409
|
sh install_command
|
406
410
|
end
|
407
411
|
|
@@ -58,8 +58,10 @@ module BranchIOCLI
|
|
58
58
|
|
59
59
|
app_delegate = File.read app_delegate_swift_path
|
60
60
|
|
61
|
-
# Can't check for the import here, since there may be a bridging header.
|
62
|
-
|
61
|
+
# Can't just check for the import here, since there may be a bridging header.
|
62
|
+
# This may match branch.initSession (if the Branch instance is stored) or
|
63
|
+
# Branch.getInstance().initSession, etc.
|
64
|
+
return false if app_delegate =~ /(import\s+branch|branch\.*initsession)/i
|
63
65
|
|
64
66
|
unless config.bridging_header_required?
|
65
67
|
load_patch(:swift_import).apply app_delegate_swift_path
|
@@ -99,14 +101,11 @@ module BranchIOCLI
|
|
99
101
|
def patch_did_finish_launching_method_swift(app_delegate_swift_path)
|
100
102
|
app_delegate_swift = File.read app_delegate_swift_path
|
101
103
|
|
102
|
-
patch = load_patch(:did_finish_launching_swift)
|
103
104
|
is_new_method = app_delegate_swift !~ /didFinishLaunching[^\n]+?\{/m
|
104
105
|
if is_new_method
|
105
|
-
|
106
|
-
patch.regexp = /var\s+window\s?:\s?UIWindow\?.*?\n/m
|
106
|
+
patch = load_patch :did_finish_launching_new_swift
|
107
107
|
else
|
108
|
-
|
109
|
-
patch.regexp = /didFinishLaunchingWithOptions.*?\{[^\n]*\n/m
|
108
|
+
patch = load_patch :did_finish_launching_swift
|
110
109
|
end
|
111
110
|
patch.apply app_delegate_swift_path, binding: binding
|
112
111
|
end
|
@@ -114,105 +113,85 @@ module BranchIOCLI
|
|
114
113
|
def patch_did_finish_launching_method_objc(app_delegate_objc_path)
|
115
114
|
app_delegate_objc = File.read app_delegate_objc_path
|
116
115
|
|
117
|
-
patch = load_patch(:did_finish_launching_objc)
|
118
116
|
is_new_method = app_delegate_objc !~ /didFinishLaunchingWithOptions/m
|
119
117
|
if is_new_method
|
120
|
-
|
121
|
-
patch.regexp = /^@implementation.*?\n/m
|
118
|
+
patch = load_patch :did_finish_launching_new_objc
|
122
119
|
else
|
123
|
-
|
124
|
-
patch.regexp = /didFinishLaunchingWithOptions.*?\{[^\n]*\n/m
|
120
|
+
patch = load_patch :did_finish_launching_objc
|
125
121
|
end
|
126
122
|
patch.apply app_delegate_objc_path, binding: binding
|
127
123
|
end
|
128
124
|
|
129
125
|
def patch_open_url_method_swift(app_delegate_swift_path)
|
130
126
|
app_delegate_swift = File.read app_delegate_swift_path
|
131
|
-
|
127
|
+
|
132
128
|
if app_delegate_swift =~ /application.*open\s+url.*options/
|
133
129
|
# Has application:openURL:options:
|
134
|
-
|
135
|
-
patch = load_patch patch_name
|
136
|
-
patch.regexp = /application.*open\s+url.*options:.*?\{.*?\n/m
|
130
|
+
patch = load_patch :open_url_swift
|
137
131
|
elsif app_delegate_swift =~ /application.*open\s+url.*sourceApplication/
|
138
132
|
# Has application:openURL:sourceApplication:annotation:
|
139
133
|
# TODO: This method is deprecated.
|
140
|
-
|
141
|
-
patch = load_patch patch_name
|
142
|
-
patch.regexp = /application.*open\s+url.*sourceApplication:.*?\{.*?\n/m
|
134
|
+
patch = load_patch :open_url_source_application_swift
|
143
135
|
else
|
144
136
|
# Has neither
|
145
|
-
|
146
|
-
patch = load_patch patch_name
|
147
|
-
patch.regexp = /\n\s*\}[^{}]*\Z/m
|
137
|
+
patch = load_patch :open_url_new_swift
|
148
138
|
end
|
149
139
|
patch.apply app_delegate_swift_path
|
150
140
|
end
|
151
141
|
|
152
142
|
def patch_continue_user_activity_method_swift(app_delegate_swift_path)
|
153
|
-
|
154
|
-
|
155
|
-
if
|
156
|
-
|
157
|
-
patch_name += "swift"
|
158
|
-
patch = load_patch patch_name
|
159
|
-
patch.regexp = /application:.*continue userActivity:.*restorationHandler:.*?\{.*?\n/m
|
143
|
+
app_delegate_swift = File.read app_delegate_swift_path
|
144
|
+
|
145
|
+
if app_delegate_swift =~ /application:.*continue userActivity:.*restorationHandler:/
|
146
|
+
patch = load_patch :continue_user_activity_swift
|
160
147
|
else
|
161
|
-
|
162
|
-
patch_name += "new_swift"
|
163
|
-
patch = load_patch patch_name
|
164
|
-
patch.regexp = /\n\s*\}[^{}]*\Z/m
|
148
|
+
patch = load_patch :continue_user_activity_new_swift
|
165
149
|
end
|
166
150
|
patch.apply app_delegate_swift_path
|
167
151
|
end
|
168
152
|
|
169
153
|
def patch_open_url_method_objc(app_delegate_objc_path)
|
170
154
|
app_delegate_objc = File.read app_delegate_objc_path
|
171
|
-
|
155
|
+
|
172
156
|
if app_delegate_objc =~ /application:.*openURL:.*options/
|
173
157
|
# Has application:openURL:options:
|
174
|
-
|
175
|
-
patch = load_patch patch_name
|
176
|
-
patch.regexp = /application:.*openURL:.*options:.*?\{.*?\n/m
|
158
|
+
patch = load_patch :open_url_objc
|
177
159
|
elsif app_delegate_objc =~ /application:.*openURL:.*sourceApplication/
|
178
160
|
# Has application:openURL:sourceApplication:annotation:
|
179
|
-
|
180
|
-
|
181
|
-
patch.regexp = /application:.*openURL:.*sourceApplication:.*?\{.*?\n/m
|
161
|
+
patch = load_patch :open_url_source_annotation_objc
|
162
|
+
# TODO: This method is deprecated.
|
182
163
|
else
|
183
164
|
# Has neither
|
184
|
-
|
185
|
-
patch = load_patch patch_name
|
186
|
-
patch.regexp = /\n\s*@end[^@]*\Z/m
|
165
|
+
patch = load_patch :open_url_new_objc
|
187
166
|
end
|
188
167
|
patch.apply app_delegate_objc_path
|
189
168
|
end
|
190
169
|
|
191
170
|
def patch_continue_user_activity_method_objc(app_delegate_objc_path)
|
192
|
-
|
193
|
-
|
194
|
-
if
|
195
|
-
|
196
|
-
patch = load_patch patch_name
|
197
|
-
patch.regexp = /application:.*continueUserActivity:.*restorationHandler:.*?\{.*?\n/m
|
171
|
+
app_delegate_swift = File.read app_delegate_objc_path
|
172
|
+
|
173
|
+
if app_delegate_swift =~ /application:.*continueUserActivity:.*restorationHandler:/
|
174
|
+
patch = load_patch :continue_user_activity_objc
|
198
175
|
else
|
199
|
-
|
200
|
-
patch_name += "new_objc"
|
201
|
-
patch = load_patch patch_name
|
202
|
-
patch.regexp = /\n\s*@end[^@]*\Z/m
|
176
|
+
patch = load_patch :continue_user_activity_new_objc
|
203
177
|
end
|
204
178
|
patch.apply app_delegate_objc_path
|
205
179
|
end
|
206
180
|
|
207
181
|
def patch_podfile(podfile_path)
|
208
|
-
|
182
|
+
target_definition = config.podfile.target_definitions[config.target.name]
|
183
|
+
raise "Target #{config.target.name} not found in Podfile" unless target_definition
|
209
184
|
|
210
|
-
# Podfile already contains the Branch pod
|
211
|
-
|
212
|
-
return false if podfile =~ /pod\s+('Branch'|"Branch")/
|
185
|
+
# Podfile already contains the Branch pod, possibly just a subspec
|
186
|
+
return false if target_definition.dependencies.any? { |d| d.name =~ %r{^(Branch|Branch-SDK)(/.*)?$} }
|
213
187
|
|
214
188
|
say "Adding pod \"Branch\" to #{podfile_path}"
|
215
189
|
|
190
|
+
# It may not be clear from the Pod::Podfile whether the target has a do block.
|
191
|
+
# It doesn't seem to be possible to update the Podfile object and write it out.
|
192
|
+
# So we patch.
|
193
|
+
podfile = File.read config.podfile_path
|
194
|
+
|
216
195
|
if podfile =~ /target\s+(["'])#{config.target.name}\1\s+do.*?\n/m
|
217
196
|
# if there is a target block for this target:
|
218
197
|
patch = PatternPatch::Patch.new(
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: branch_io_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Branch
|
@@ -59,14 +59,14 @@ dependencies:
|
|
59
59
|
requirements:
|
60
60
|
- - ">="
|
61
61
|
- !ruby/object:Gem::Version
|
62
|
-
version: 0.
|
62
|
+
version: 0.5.1
|
63
63
|
type: :runtime
|
64
64
|
prerelease: false
|
65
65
|
version_requirements: !ruby/object:Gem::Requirement
|
66
66
|
requirements:
|
67
67
|
- - ">="
|
68
68
|
- !ruby/object:Gem::Version
|
69
|
-
version: 0.
|
69
|
+
version: 0.5.1
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: plist
|
72
72
|
requirement: !ruby/object:Gem::Requirement
|
@@ -267,6 +267,8 @@ files:
|
|
267
267
|
- lib/assets/patches/continue_user_activity_new_swift.yml
|
268
268
|
- lib/assets/patches/continue_user_activity_objc.yml
|
269
269
|
- lib/assets/patches/continue_user_activity_swift.yml
|
270
|
+
- lib/assets/patches/did_finish_launching_new_objc.yml
|
271
|
+
- lib/assets/patches/did_finish_launching_new_swift.yml
|
270
272
|
- lib/assets/patches/did_finish_launching_objc.yml
|
271
273
|
- lib/assets/patches/did_finish_launching_swift.yml
|
272
274
|
- lib/assets/patches/objc_import.yml
|