class Theine::ConfigReader

Attributes

base_port[RW]
max_port[RW]
min_free_workers[RW]
rails_root[R]
spawn_parallel[RW]

Public Class Methods

new(rails_root) click to toggle source
# File lib/theine/config.rb, line 7
def initialize(rails_root)
  @rails_root = rails_root
  @base_port = 11000
  @max_port = 11100
  @min_free_workers = 2
  @spawn_parallel = true
  load_config(File.expand_path("~/.theine"))
  load_config("#{rails_root}/.theine")
end

Public Instance Methods

load_config(path) click to toggle source
# File lib/theine/config.rb, line 17
def load_config(path)
  if File.exist?(path)
    config = YAML.load(File.read(path))
    config.each_pair do |k, v|
      setter = :"#{k}="
      send(setter, v) if respond_to?(setter)
    end
  end
end