Sha256: ffb4524fe42b090b5910918e685d9a8b230e84d905964883af69c1d176ef98eb

Contents?: true

Size: 561 Bytes

Versions: 1

Compression:

Stored size: 561 Bytes

Contents

class Servel::ConfigParser
  attr_reader :config

  def initialize
    @config = TTY::Config.new
    @config.filename = "servel"
    @config.append_path(Dir.pwd)
    @config.append_path((Pathname.new(Dir.home) + ".servel").to_s)
    @config.append_path(Dir.home)
    @config.env_prefix = "servel"
    @config.autoload_env
    @config.read if @config.exist?

    @config.append(*parse_argv, to: :listings)
  end

  def parse_argv
    ARGV.map do |arg|
      root, url_root = arg.split(":" , 2)
      { root => url_root }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
servel-0.31.0 lib/servel/config_parser.rb