Sha256: d268c94cdf06d887b37d309b76bbee49bad7454d285c03d137c62c165cb1308d

Contents?: true

Size: 928 Bytes

Versions: 6

Compression:

Stored size: 928 Bytes

Contents

module Paraduct
  require "singleton"
  require "yaml"

  class Configuration
    include Singleton

    # @return [Pathname]
    def variables
      config_data[:variables]
    end

    # @return [String, Array<String>]
    def script
      config_data[:script]
    end

    # @return [Integer]
    def max_threads
      config_data[:max_threads] || 4
    end

    def rsync_option
      config_data[:rsync_option] || {}
    end

    def exclude
      config_data[:exclude] || []
    end

    # @return [Pathname]
    def work_dir
      _work_dir = config_data[:work_dir] || "tmp/paraduct_workspace"
      root_dir.join(_work_dir)
    end

    # @return [Pathname]
    def config_file
      root_dir.join(".paraduct.yml")
    end

    # @return [Pathname]
    def root_dir
      Pathname.pwd
    end

    private

    def config_data
      @config_data ||= YAML.load_file(config_file).with_indifferent_access
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
paraduct-0.0.3 lib/paraduct/configuration.rb
paraduct-0.0.3.beta2 lib/paraduct/configuration.rb
paraduct-0.0.2 lib/paraduct/configuration.rb
paraduct-0.0.1 lib/paraduct/configuration.rb
paraduct-0.0.1.beta17 lib/paraduct/configuration.rb
paraduct-0.0.1.beta16 lib/paraduct/configuration.rb