Sha256: 713f6b2286d9d771ecc82e7f5c68ac2d5158c1cde84f9f110b202b813fe1b6a1

Contents?: true

Size: 1.49 KB

Versions: 68

Compression:

Stored size: 1.49 KB

Contents

require "idlc-sdk-pfm/command/validator_commands"

module Pfm
  module Command
    module ValidatorCommands
      class ValidationError < StandardError; end

      class Base < Command::Base
        attr_reader :params
        attr_reader :errors

        options.merge!(SharedValidatorOptions.options)

        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

        def setup_context; end

        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

        def params_valid?
          @params_valid
        end

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

        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
      end
    end
  end
end

Version data entries

68 entries across 68 versions & 2 rubygems

Version Path
iapi-idlc-sdk-pfm-1.0.24 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.23 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.22 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.21 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.20 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.19 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.18 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.17 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.16 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.15 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.14 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.13 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.12 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.11 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.10 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.9 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.8 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.7 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.6 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb
iapi-idlc-sdk-pfm-1.0.5 lib/iapi-idlc-sdk-pfm/command/validator_commands/base.rb