Class: BranchIOCLI::Command::ValidateCommand

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

Instance Attribute Summary collapse

Attributes inherited from Command

#options

Instance Method Summary collapse

Methods inherited from Command

#helper, #patch_helper

Constructor Details

#initialize(options) ⇒ ValidateCommand

Returns a new instance of ValidateCommand.



6
7
8
9
# File 'lib/branch_io_cli/command/validate_command.rb', line 6

def initialize(options)
  super
  @config = Configuration::ValidateConfiguration.new options
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

Instance Method Details

#run!Object



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

def run!
  valid = true

  unless options.domains.nil? || options.domains.empty?
    domains_valid = helper.validate_project_domains(options.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
end