Class: Pfm::Command::ValidatorCommands::Base

Inherits:
Base
  • Object
show all
Defined in:
lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb

Direct Known Subclasses

Infrastructure, ServerBuild

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#build_base_dir, #build_dir, #build_exists?, #build_setup, #deploy_setup, #deploy_setupv2, #inf_base_dir, #needs_help?, #needs_version?, #run_with_default_options, #templates_dir, #verbose?

Methods included from Helpers

debug, err, msg, system_command

Constructor Details

#initialize(params) ⇒ Base

Returns a new instance of Base.



14
15
16
17
18
19
20
21
22
23
# File 'lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb', line 14

def initialize(params)
  super()
  @params_valid = true
  @errors = []
  @params = params
  @failure = false

  @reports_dir = "#{Pfm::Settings.new.config_directory}/tests/reports"
  @artifacts_dir = "#{Pfm::Settings.new.config_directory}/tests/artifacts"
end

Instance Attribute Details

#errorsObject (readonly)

Returns the value of attribute errors.



10
11
12
# File 'lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb', line 10

def errors
  @errors
end

#paramsObject (readonly)

Returns the value of attribute params.



9
10
11
# File 'lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb', line 9

def params
  @params
end

Instance Method Details

#params_valid?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb', line 44

def params_valid?
  @params_valid
end

#read_and_validate_paramsObject



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb', line 27

def read_and_validate_params
  arguments = parse_options(@params)

  case arguments.size
  when 0
    @params_valid = (@config[:validator_name] == 'infrastructure')

  when 1
    @params_valid = build_exists?

  when 2

  else
    @params_valid = false
  end
end

#setup_artifacts_dirsObject



52
53
54
55
56
57
58
59
60
61
# File 'lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb', line 52

def setup_artifacts_dirs
  if use_circle_ci?
    @reports_dir = ENV['CIRCLE_TEST_REPORTS']
    @artifacts_dir = ENV['CIRCLE_ARTIFACTS']
    return
  end

  FileUtils.mkdir_p(@reports_dir)
  FileUtils.mkdir_p(@artifacts_dir)
end

#setup_contextObject



25
# File 'lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb', line 25

def setup_context; end

#use_circle_ci?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb', line 48

def use_circle_ci?
  @params.include?('-c') || @params.include?('--circle-ci')
end