Sha256: b5cc5c3a644cdc50c206e683d97ee6d29eabe995d160a4637e197c65e8d22f66

Contents?: true

Size: 1.21 KB

Versions: 21

Compression:

Stored size: 1.21 KB

Contents

require_relative "loads_yaml_config"
require_relative "merges_settings"
require_relative "creates_config_store"

module Standard
  Config = Struct.new(:runner, :paths, :rubocop_options, :rubocop_config_store)

  class BuildsConfig
    def initialize
      @resolves_yaml_option = ResolvesYamlOption.new
      @loads_yaml_config = LoadsYamlConfig.new
      @merges_settings = MergesSettings.new
      @creates_config_store = CreatesConfigStore.new
    end

    def call(argv, search_path = Dir.pwd)
      standard_yaml_path = @resolves_yaml_option.call(argv, search_path, "--config", ".standard.yml")

      # Don't load the existing todo file when generating a new todo file.  Otherwise the
      # new todo file won't have the ignore rules in the existing file.
      todo_yaml_path = unless argv.include?("--generate-todo")
        @resolves_yaml_option.call(argv, search_path, "--todo", ".standard_todo.yml")
      end

      standard_config = @loads_yaml_config.call(standard_yaml_path, todo_yaml_path)

      settings = @merges_settings.call(argv, standard_config)
      Config.new(
        settings.runner,
        settings.paths,
        settings.options,
        @creates_config_store.call(standard_config)
      )
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
standard-1.44.0 lib/standard/builds_config.rb
standard-1.43.0 lib/standard/builds_config.rb
standard-1.42.1 lib/standard/builds_config.rb
standard-1.42.0 lib/standard/builds_config.rb
standard-1.41.1 lib/standard/builds_config.rb
standard-1.41.0 lib/standard/builds_config.rb
standard-1.40.1 lib/standard/builds_config.rb
standard-1.40.0 lib/standard/builds_config.rb
standard-1.39.2 lib/standard/builds_config.rb
standard-1.39.1 lib/standard/builds_config.rb
standard-1.39.0 lib/standard/builds_config.rb
standard-1.38.0 lib/standard/builds_config.rb
standard-1.37.0 lib/standard/builds_config.rb
standard-1.35.0.1 lib/standard/builds_config.rb
standard-1.34.0.1 lib/standard/builds_config.rb
standard-1.35.1 lib/standard/builds_config.rb
standard-1.35.0 lib/standard/builds_config.rb
standard-1.34.0 lib/standard/builds_config.rb
getargv-0.3.3-universal-darwin vendor/bundle/ruby/3.3.0/gems/standard-1.33.0/lib/standard/builds_config.rb
standard-1.33.0 lib/standard/builds_config.rb