branch_io_cli 0.12.5 → 0.12.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 48e336c69b9c5ad8f7ab8de92720aa3b1c9cb7d5d207d21d5555dd91c3ca3e32
4
- data.tar.gz: 180282031893b9e7b7277ceb3e2bc11143f803879ad094e3d5290e4bfca6df66
3
+ metadata.gz: 6d66c36f8ea879767e9928b94821ca85203a04db1beda4e23c387194b955e60f
4
+ data.tar.gz: 0a3d8be8d0787754615ac1c98cb7b07e86261bd46e13e1006a5e6ff5e284bb48
5
5
  SHA512:
6
- metadata.gz: 3187f68f3c2ed85eb3b57ae2cd21cb58d4f9d57b04062fa157ac8f9fce77724c7b0d37d82733f9d520ba72e34172311825fd2dcc7d24676d23b799c4aa21a214
7
- data.tar.gz: db654aa13ac717e8294cbe0a66b6f199490642ec8a47180a8e6bfbf0bc8f9acc2ef113a791b2cf8986c63c602ac16861c2ec0da8df997a1d971fdb578fd2c373
6
+ metadata.gz: e9720d76203af10eeb5ce6abab6760c8e73235309dea04f66fa276e07f33b8d957b14827f3f3470e579aad8efa934e0ce65b82ef783e49619b07b394d4d48631
7
+ data.tar.gz: cbbc107c96b63ee5ffe3ee7256dca279c53ed8aca4ac60cdb8b932f62ce8d82bb7cc6797e8d450fac91d878c1589820c69485a073442a255eb232fab358d4fd5
@@ -21,7 +21,7 @@ module BranchIOCLI
21
21
  return 1 unless valid || config.force
22
22
  end
23
23
 
24
- # Make sure we can resolve all build settings in a project using
24
+ # Make sure we can resolve all build settings in a project that uses
25
25
  # CocoaPods.
26
26
  if config.podfile_path && File.exist?(config.podfile_path) && config.pod_install_required?
27
27
  tool_helper.verify_cocoapods
@@ -50,37 +50,28 @@ module BranchIOCLI
50
50
  end
51
51
 
52
52
  def validate_universal_links
53
- say "Validating new Universal Link configuration before making any changes.\n\n"
54
- valid = helper.validate_team_and_bundle_ids_from_aasa_files @domains
55
- if valid
56
- say "Universal Link configuration passed validation. ✅\n\n"
57
- else
58
- say "Universal Link configuration failed validation.\n\n"
59
- helper.errors.each { |error| say " #{error}" }
60
- end
61
- valid
62
- end
53
+ say "Validating new Universal Link configuration before making any changes."
54
+ valid = true
55
+ config.xcodeproj.build_configurations.each do |c|
56
+ message = "Validating #{c.name} configuration"
57
+ say "\n<%= color('#{message}', [BOLD, CYAN]) %>\n\n"
63
58
 
64
- def update_project_settings
65
- say "Updating project settings.\n\n"
66
- helper.add_custom_build_setting if config.setting
67
- helper.add_keys_to_info_plist @keys
68
- config.target.add_system_frameworks config.frameworks unless config.frameworks.blank?
59
+ configuration_valid = helper.validate_team_and_bundle_ids_from_aasa_files @domains, false, c.name
69
60
 
70
- return unless config.target.symbol_type == :application
61
+ if configuration_valid
62
+ say "Universal Link configuration passed validation for #{c.name} configuration. ✅\n\n"
63
+ else
64
+ say "Universal Link configuration failed validation for #{c.name} configuration.\n\n"
65
+ helper.errors.each { |error| say " #{error}" }
66
+ end
71
67
 
72
- helper.add_branch_universal_link_domains_to_info_plist @domains
73
- helper.ensure_uri_scheme_in_info_plist
74
- config.xcodeproj.build_configurations.each do |c|
75
- new_path = helper.add_universal_links_to_project @domains, false, c.name
76
- sh "git", "add", new_path if config.commit && new_path
68
+ valid &&= configuration_valid
77
69
  end
78
- ensure
79
- config.xcodeproj.save
70
+ valid
80
71
  end
81
72
 
82
73
  def add_sdk
83
- say "Making sure Branch dependency is available."
74
+ say "\nMaking sure Branch dependency is available.\n\n"
84
75
  case config.sdk_integration_mode
85
76
  when :cocoapods
86
77
  if File.exist? config.podfile_path
@@ -97,7 +88,24 @@ module BranchIOCLI
97
88
  when :direct
98
89
  tool_helper.add_direct config
99
90
  end
100
- say "\n"
91
+ end
92
+
93
+ def update_project_settings
94
+ say "Updating project settings.\n\n"
95
+ helper.add_custom_build_setting if config.setting
96
+ helper.add_keys_to_info_plist @keys
97
+ config.target.add_system_frameworks config.frameworks unless config.frameworks.blank?
98
+
99
+ return unless config.target.symbol_type == :application
100
+
101
+ helper.add_branch_universal_link_domains_to_info_plist @domains
102
+ helper.ensure_uri_scheme_in_info_plist
103
+ config.xcodeproj.build_configurations.each do |c|
104
+ new_path = helper.add_universal_links_to_project @domains, false, c.name
105
+ sh "git", "add", new_path if config.commit && new_path
106
+ end
107
+ ensure
108
+ config.xcodeproj.save
101
109
  end
102
110
 
103
111
  def commit_changes
@@ -53,6 +53,18 @@ module BranchIOCLI
53
53
  return nil unless current
54
54
  current.root
55
55
  end
56
+
57
+ # Removes any trailing :/* from the argument and returns a copy.
58
+ # Matches:
59
+ # myscheme
60
+ # myscheme:
61
+ # myscheme://
62
+ # myscheme:///
63
+ # etc.
64
+ def uri_scheme_without_suffix(scheme)
65
+ return nil if scheme.blank?
66
+ scheme.sub %r{:/*$}, ""
67
+ end
56
68
  end
57
69
 
58
70
  attr_reader :options
@@ -175,7 +175,13 @@ module BranchIOCLI
175
175
 
176
176
  def validate_uri_scheme(options)
177
177
  # No validation at the moment. Just strips off any trailing ://
178
- @uri_scheme = uri_scheme_without_suffix options.uri_scheme
178
+ uri_scheme = options.uri_scheme
179
+
180
+ if confirm
181
+ uri_scheme ||= ask "Please enter any URI scheme you entered in the Branch Dashboard (optional). "
182
+ end
183
+
184
+ @uri_scheme = self.class.uri_scheme_without_suffix uri_scheme
179
185
  end
180
186
 
181
187
  def app_link_roots_from_domains(domains)
@@ -225,12 +231,6 @@ module BranchIOCLI
225
231
  custom_domains + app_link_subdomains
226
232
  end
227
233
 
228
- # Removes any trailing :// from the argument and returns a copy
229
- def uri_scheme_without_suffix(scheme)
230
- return nil if scheme.nil?
231
- scheme.sub %r{://$}, ""
232
- end
233
-
234
234
  def prompt_for_podfile_or_cartfile
235
235
  loop do
236
236
  path = ask("Please enter the location of your Podfile or Cartfile: ").trim
@@ -40,7 +40,8 @@ module BranchIOCLI
40
40
  example: "myurischeme[://]",
41
41
  type: String,
42
42
  aliases: "-U",
43
- label: "URI scheme"
43
+ label: "URI scheme",
44
+ convert_proc: ->(value) { Configuration.uri_scheme_without_suffix(value) }
44
45
  ),
45
46
  Option.new(
46
47
  name: :setting,
@@ -57,7 +58,7 @@ module BranchIOCLI
57
58
  example: "config1,config2",
58
59
  type: Array,
59
60
  negatable: true,
60
- valid_values_proc: -> { Configuration.current.xcodeproj.build_configurations.map(&:name) }
61
+ valid_values_proc: -> { Configuration.current && Configuration.current.xcodeproj.build_configurations.map(&:name) }
61
62
  ),
62
63
  Option.new(
63
64
  name: :xcodeproj,
@@ -73,7 +74,7 @@ module BranchIOCLI
73
74
  example: "MyAppTarget",
74
75
  type: String,
75
76
  confirm_symbol: :target_name,
76
- valid_values_proc: -> { Configuration.current.xcodeproj.targets.map(&:name) }
77
+ valid_values_proc: -> { Configuration.current && Configuration.current.xcodeproj.targets.map(&:name) }
77
78
  ),
78
79
  Option.new(
79
80
  name: :podfile,
@@ -177,9 +177,13 @@ module BranchIOCLI
177
177
  end
178
178
 
179
179
  def team_and_bundle_from_app_id(identifier)
180
- team = identifier.sub(/\..+$/, "")
181
- bundle = identifier.sub(/^[^.]+\./, "")
182
- [team, bundle]
180
+ matches = /^(.*?)\.(.*)$/.match identifier
181
+ matches[1, 2]
182
+ end
183
+
184
+ def reportable_app_id(identifier)
185
+ team, bundle = team_and_bundle_from_app_id identifier
186
+ "Signing team: #{team.inspect}, Bundle identifier: #{bundle.inspect}"
183
187
  end
184
188
 
185
189
  def update_team_and_bundle_ids_from_aasa_file(domain)
@@ -317,12 +321,27 @@ module BranchIOCLI
317
321
  match_found = identifiers.include? app_id
318
322
 
319
323
  unless match_found
320
- @errors << "[#{domain}] appID mismatch. Project: #{app_id}. AASA: #{identifiers}"
324
+ report_app_id_mismatch domain, app_id, identifiers
321
325
  end
322
326
 
323
327
  match_found
324
328
  end
325
329
 
330
+ def report_app_id_mismatch(domain, app_id, identifiers)
331
+ error_string = "[#{domain}] appID mismatch. Project #{reportable_app_id app_id}\n"
332
+ if identifiers.count <= 20
333
+ error_string << " Apps from AASA:\n"
334
+ identifiers.each do |identifier|
335
+ reportable = reportable_app_id identifier
336
+ error_string << " #{reportable}\n"
337
+ end
338
+ else
339
+ error_string << " Please check your settings in the Branch Dashboard (https://dashboard.branch.io)"
340
+ end
341
+
342
+ @errors << error_string
343
+ end
344
+
326
345
  def validate_project_domains(expected, configuration = RELEASE_CONFIGURATION)
327
346
  @errors = []
328
347
  project_domains = domains_from_project configuration
@@ -1,3 +1,3 @@
1
1
  module BranchIOCLI
2
- VERSION = "0.12.5"
2
+ VERSION = "0.12.6"
3
3
  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.12.5
4
+ version: 0.12.6
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-12-13 00:00:00.000000000 Z
12
+ date: 2017-12-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: CFPropertyList