Sha256: 079cf833001f86169e048d1eae62ff87297c9488daed0a035bc112df3e0d9440

Contents?: true

Size: 869 Bytes

Versions: 10

Compression:

Stored size: 869 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

    # @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

10 entries across 10 versions & 1 rubygems

Version Path
paraduct-0.0.1.beta15 lib/paraduct/configuration.rb
paraduct-0.0.1.beta14 lib/paraduct/configuration.rb
paraduct-0.0.1.beta13 lib/paraduct/configuration.rb
paraduct-0.0.1.beta12 lib/paraduct/configuration.rb
paraduct-0.0.1.beta11 lib/paraduct/configuration.rb
paraduct-0.0.1.beta10 lib/paraduct/configuration.rb
paraduct-0.0.1.beta9 lib/paraduct/configuration.rb
paraduct-0.0.1.beta8 lib/paraduct/configuration.rb
paraduct-0.0.1.beta7 lib/paraduct/configuration.rb
paraduct-0.0.1.beta6 lib/paraduct/configuration.rb