Class: Pfm::Command::ValidatorCommands::Base
- Defined in:
- lib/idlc-sdk-pfm/command/validator_commands/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(params) ⇒ Base
constructor
A new instance of Base.
- #params_valid? ⇒ Boolean
- #read_and_validate_params ⇒ Object
- #setup_artifacts_dirs ⇒ Object
- #setup_context ⇒ Object
- #use_circle_ci? ⇒ Boolean
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/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
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
10 11 12 |
# File 'lib/idlc-sdk-pfm/command/validator_commands/base.rb', line 10 def errors @errors end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
9 10 11 |
# File 'lib/idlc-sdk-pfm/command/validator_commands/base.rb', line 9 def params @params end |
Instance Method Details
#params_valid? ⇒ Boolean
44 45 46 |
# File 'lib/idlc-sdk-pfm/command/validator_commands/base.rb', line 44 def params_valid? @params_valid end |
#read_and_validate_params ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/idlc-sdk-pfm/command/validator_commands/base.rb', line 27 def read_and_validate_params arguments = (@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_dirs ⇒ Object
52 53 54 55 56 57 58 59 60 61 |
# File 'lib/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_context ⇒ Object
25 |
# File 'lib/idlc-sdk-pfm/command/validator_commands/base.rb', line 25 def setup_context; end |
#use_circle_ci? ⇒ Boolean
48 49 50 |
# File 'lib/idlc-sdk-pfm/command/validator_commands/base.rb', line 48 def use_circle_ci? @params.include?('-c') || @params.include?('--circle-ci') end |