branch_io_cli 0.9.6 → 0.9.7
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/branch_io_cli/command/report_command.rb +6 -0
- data/lib/branch_io_cli/configuration/configuration.rb +35 -0
- data/lib/branch_io_cli/configuration/setup_configuration.rb +23 -8
- data/lib/branch_io_cli/helper.rb +1 -0
- data/lib/branch_io_cli/helper/ios_helper.rb +1 -1
- data/lib/branch_io_cli/helper/patch_helper.rb +6 -8
- data/lib/branch_io_cli/helper/report_helper.rb +23 -0
- data/lib/branch_io_cli/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f34a0beb6001798fa4ca54e4b69ead8baaa811b313ef7166e6a03ff6d00fb51
|
4
|
+
data.tar.gz: de7f72a71a6f61a893a1b89025d21caf2efa475c100590fda5a48cb3bd9dc838
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b3cb56a99bdafeb2dbb47f012a692da84ad37c3e8a836d908d6a0a3286dd91ea1a7669a3d21d42798ab859c8e3f16938a1599c69745834240d07ab29cb33cfa
|
7
|
+
data.tar.gz: 3a3bc8dec22dd6ee83d84fc136b24eadf5a99448cddf73ecf02127ca4f6f44928ac6a04fca6ca1b6c5c06ab2e9e37e806f8da0d806cc9eeca2745d29191e7d1e
|
@@ -94,6 +94,10 @@ EOF
|
|
94
94
|
say "Report generated in #{config.report_path}"
|
95
95
|
end
|
96
96
|
|
97
|
+
def report_helper
|
98
|
+
Helper::ReportHelper
|
99
|
+
end
|
100
|
+
|
97
101
|
def base_xcodebuild_cmd
|
98
102
|
cmd = "xcodebuild"
|
99
103
|
if config.workspace_path
|
@@ -376,6 +380,8 @@ EOF
|
|
376
380
|
end
|
377
381
|
end
|
378
382
|
|
383
|
+
report += report_helper.report_imports
|
384
|
+
|
379
385
|
report
|
380
386
|
end
|
381
387
|
|
@@ -198,6 +198,22 @@ EOF
|
|
198
198
|
podfile && !uses_frameworks?
|
199
199
|
end
|
200
200
|
|
201
|
+
def app_delegate_swift_path
|
202
|
+
return nil unless swift_version && swift_version.to_f >= 3.0
|
203
|
+
|
204
|
+
app_delegate = target.source_build_phase.files.find { |f| f.file_ref.path =~ /AppDelegate\.swift$/ }
|
205
|
+
return nil if app_delegate.nil?
|
206
|
+
|
207
|
+
app_delegate.file_ref.real_path.to_s
|
208
|
+
end
|
209
|
+
|
210
|
+
def app_delegate_objc_path
|
211
|
+
app_delegate = target.source_build_phase.files.find { |f| f.file_ref.path =~ /AppDelegate\.m$/ }
|
212
|
+
return nil if app_delegate.nil?
|
213
|
+
|
214
|
+
app_delegate.file_ref.real_path.to_s
|
215
|
+
end
|
216
|
+
|
201
217
|
# TODO: How many of these can vary by configuration?
|
202
218
|
|
203
219
|
def modules_enabled?
|
@@ -225,6 +241,25 @@ EOF
|
|
225
241
|
@swift_version = target.resolved_build_setting("SWIFT_VERSION")["Release"]
|
226
242
|
@swift_version
|
227
243
|
end
|
244
|
+
|
245
|
+
def branch_imports
|
246
|
+
return @branch_imports if @branch_imports
|
247
|
+
|
248
|
+
source_files = [app_delegate_swift_path, app_delegate_objc_path, bridging_header_path]
|
249
|
+
@branch_imports = source_files.compact.map { |f| { f => branch_imports_from_file(f) } }.inject({}, :merge)
|
250
|
+
@branch_imports
|
251
|
+
end
|
252
|
+
|
253
|
+
# Detect anything that appears to be an attempt to import the Branch SDK,
|
254
|
+
# even if it might be wrong.
|
255
|
+
def branch_imports_from_file(path)
|
256
|
+
imports = []
|
257
|
+
File.readlines(path).each_with_index do |line, line_no|
|
258
|
+
next unless line =~ /(include|import).*branch/i
|
259
|
+
imports << "#{line_no}: #{line.chomp}"
|
260
|
+
end
|
261
|
+
imports
|
262
|
+
end
|
228
263
|
end
|
229
264
|
end
|
230
265
|
end
|
@@ -87,20 +87,35 @@ module BranchIOCLI
|
|
87
87
|
end
|
88
88
|
|
89
89
|
def validate_keys_from_setup_options(options)
|
90
|
-
live_key = options.live_key
|
91
|
-
test_key = options.test_key
|
92
90
|
@keys = {}
|
93
|
-
keys[:live] = live_key unless live_key.nil?
|
94
|
-
keys[:test] = test_key unless test_key.nil?
|
95
91
|
|
92
|
+
# 1. Check the options passed in. If nothing (nil) passed, continue.
|
93
|
+
validate_key options.live_key, :live, accept_nil: true
|
94
|
+
validate_key options.test_key, :test, accept_nil: true
|
95
|
+
|
96
|
+
# 2. Did we find a valid key above?
|
96
97
|
while @keys.empty?
|
98
|
+
# 3. If not, prompt.
|
97
99
|
say "A live key, a test key or both is required."
|
98
|
-
|
99
|
-
|
100
|
+
validate_key nil, :live
|
101
|
+
validate_key nil, :test
|
102
|
+
end
|
103
|
+
|
104
|
+
# 4. We have at least one valid key now.
|
105
|
+
end
|
106
|
+
|
107
|
+
def key_valid?(key, type)
|
108
|
+
return false if key.nil?
|
109
|
+
key.empty? || key =~ /^key_#{type}_/
|
110
|
+
end
|
100
111
|
|
101
|
-
|
102
|
-
|
112
|
+
def validate_key(key, type, options = {})
|
113
|
+
return if options[:accept_nil] && key.nil?
|
114
|
+
until key_valid? key, type
|
115
|
+
say "#{key.inspect} is not a valid #{type} Branch key. It must begin with key_#{type}_." if key
|
116
|
+
key = ask "Please enter your #{type} Branch key or use --#{type}-key [enter for none]: "
|
103
117
|
end
|
118
|
+
@keys[type] = key unless key.empty?
|
104
119
|
end
|
105
120
|
|
106
121
|
def validate_all_domains(options, required = true)
|
data/lib/branch_io_cli/helper.rb
CHANGED
@@ -645,7 +645,7 @@ EOF
|
|
645
645
|
|
646
646
|
# 2. carthage update
|
647
647
|
Dir.chdir(File.dirname(cartfile_path)) do
|
648
|
-
sh "carthage #{config.carthage_command}"
|
648
|
+
sh "carthage #{config.carthage_command} ios-branch-deep-linking"
|
649
649
|
end
|
650
650
|
|
651
651
|
# 3. Add Cartfile and Cartfile.resolved to commit (in case :commit param specified)
|
@@ -58,12 +58,10 @@ module BranchIOCLI
|
|
58
58
|
end
|
59
59
|
|
60
60
|
def patch_app_delegate_swift(project)
|
61
|
-
return false unless config.
|
61
|
+
return false unless config.patch_source
|
62
|
+
app_delegate_swift_path = config.app_delegate_swift_path
|
62
63
|
|
63
|
-
|
64
|
-
return false if app_delegate_swift.nil?
|
65
|
-
|
66
|
-
app_delegate_swift_path = app_delegate_swift.real_path.to_s
|
64
|
+
return false unless app_delegate_swift_path
|
67
65
|
|
68
66
|
app_delegate = File.read app_delegate_swift_path
|
69
67
|
|
@@ -87,10 +85,10 @@ module BranchIOCLI
|
|
87
85
|
end
|
88
86
|
|
89
87
|
def patch_app_delegate_objc(project)
|
90
|
-
|
91
|
-
|
88
|
+
return false unless config.patch_source
|
89
|
+
app_delegate_objc_path = config.app_delegate_objc_path
|
92
90
|
|
93
|
-
|
91
|
+
return false unless app_delegate_objc_path
|
94
92
|
|
95
93
|
app_delegate = File.read app_delegate_objc_path
|
96
94
|
return false if app_delegate =~ %r{^\s+#import\s+<Branch/Branch.h>|^\s+@import\s+Branch\s*;}
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require "branch_io_cli/configuration/configuration"
|
2
|
+
|
3
|
+
module BranchIOCLI
|
4
|
+
module Helper
|
5
|
+
class ReportHelper
|
6
|
+
class << self
|
7
|
+
def report_imports
|
8
|
+
report = "Branch imports:\n"
|
9
|
+
config.branch_imports.each_key do |path|
|
10
|
+
report += " #{config.relative_path path}:\n"
|
11
|
+
report += " #{config.branch_imports[path].join("\n ")}"
|
12
|
+
report += "\n"
|
13
|
+
end
|
14
|
+
report
|
15
|
+
end
|
16
|
+
|
17
|
+
def config
|
18
|
+
Configuration::Configuration.current
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Branch
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-11-
|
12
|
+
date: 2017-11-13 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: CFPropertyList
|
@@ -302,6 +302,7 @@ files:
|
|
302
302
|
- lib/branch_io_cli/helper/ios_helper.rb
|
303
303
|
- lib/branch_io_cli/helper/methods.rb
|
304
304
|
- lib/branch_io_cli/helper/patch_helper.rb
|
305
|
+
- lib/branch_io_cli/helper/report_helper.rb
|
305
306
|
- lib/branch_io_cli/version.rb
|
306
307
|
homepage: http://github.com/BranchMetrics/branch_io_cli
|
307
308
|
licenses:
|