Class: BranchIOCLI::Commands::ValidateCommand

Inherits:
Command
  • Object
show all
Defined in:
lib/branch_io_cli/commands/validate_command.rb

Instance Attribute Summary

Attributes inherited from Command

#options

Instance Method Summary collapse

Methods inherited from Command

#config_helper, #helper

Constructor Details

#initialize(options) ⇒ ValidateCommand

Returns a new instance of ValidateCommand.



4
5
6
7
# File 'lib/branch_io_cli/commands/validate_command.rb', line 4

def initialize(options)
  super
  config_helper.validate_validation_options options
end

Instance Method Details

#run!Object



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
# File 'lib/branch_io_cli/commands/validate_command.rb', line 9

def run!
  # raises
  xcodeproj = config_helper.xcodeproj

  valid = true

  unless options.domains.nil? || options.domains.empty?
    domains_valid = helper.validate_project_domains(
      options.domains,
      xcodeproj,
      options.target
    )

    if domains_valid
      say "Project domains match :domains parameter: ✅"
    else
      say "Project domains do not match specified :domains"
      helper.errors.each { |error| say " #{error}" }
    end

    valid &&= domains_valid
  end

  configuration_valid = helper.validate_team_and_bundle_ids_from_aasa_files xcodeproj, options.target
  unless configuration_valid
    say "Universal Link configuration failed validation."
    helper.errors.each { |error| say " #{error}" }
  end

  valid &&= configuration_valid

  say "Universal Link configuration passed validation. ✅" if valid

  valid
end