Class: BranchIOCLI::Command::ValidateCommand

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

Instance Attribute Summary

Attributes inherited from Command

#config, #options

Instance Method Summary collapse

Methods inherited from Command

available_options, command_name, configuration_class, examples, #helper, #initialize, #patch_helper, return_value

Constructor Details

This class inherits a constructor from BranchIOCLI::Command::Command

Instance Method Details

#run!Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/branch_io_cli/command/validate_command.rb', line 4

def run!
  valid = true

  unless config.domains.nil? || config.domains.empty?
    domains_valid = helper.validate_project_domains(config.domains)

    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
  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 ? 0 : 1
end