Sha256: 4595e4d88b81742c8f61c9df1b39c6671a40e51a5139acc3d201729e95200598

Contents?: true

Size: 1.5 KB

Versions: 2

Compression:

Stored size: 1.5 KB

Contents

# encoding: UTF-8

module Central
  module Devtools
    class Project
      include Concord.new(:root)

      CONFIGS = {
        container: Config::Container,
        devtools: Config::Devtools,
        flay: Config::Flay,
        flog: Config::Flog,
        reek: Config::Reek,
        mutant: Config::Mutant,
        rubocop: Config::Rubocop,
        yardstick: Config::Yardstick
      }.freeze

      private_constant(*constants(false))

      attr_reader(*CONFIGS.keys)

      # The spec root
      #
      # @return [Pathname]
      #
      # @api private
      attr_reader :spec_root

      # Initialize object
      #
      # @param [Pathname] root
      #
      # @return [undefined]
      #
      # @api private
      #
      def initialize(root)
        super(root)

        initialize_environment
        initialize_configs
      end

      # Init rspec
      #
      # @return [self]
      #
      # @api private
      def init_rspec
        Initializer::Rspec.call(self)
        self
      end

      private

      # Initialize environment
      #
      # @return [undefined]
      #
      # @api private
      def initialize_environment
        @spec_root = root.join(SPEC_DIRECTORY_NAME)
      end

      # Initialize configs
      #
      # @return [undefined]
      #
      # @api private
      def initialize_configs
        config_dir = root.join(DEFAULT_CONFIG_DIR_NAME)

        CONFIGS.each do |name, klass|
          instance_variable_set(:"@#{name}", klass.new(config_dir))
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
central-devtools-0.8.4 lib/central/devtools/project.rb
central-devtools-0.8.3 lib/central/devtools/project.rb