class RunConfig

run config

run config

c = RunConfig.new("test")
c.run_user_config
c.run_local_config

Public Class Methods

new(name) click to toggle source
# File lib/el4r/el4r-sub.rb, line 229
def initialize(name)
  @name = name
end

Public Instance Methods

run_local_config() click to toggle source
# File lib/el4r/el4r-sub.rb, line 237
def run_local_config
  rcs = []
  rcs.push ".#{@name}rc"
  rcs.push "#{@name}.rc"
  rcs.push "_#{@name}rc"
  rcs.push "$#{@name}rc"
  rcs.push "#{@name}rc"
  run_config rcs
end
run_user_config() click to toggle source
# File lib/el4r/el4r-sub.rb, line 233
def run_user_config
  run_config [File.expand_path("~/.#{@name}rc")] if ENV.key?("HOME")
end

Private Instance Methods

run_config(rcs) click to toggle source
# File lib/el4r/el4r-sub.rb, line 248
def run_config(rcs)
  catch(:EXIT) do
    for rc in rcs
      begin
        load rc
        throw :EXIT
      rescue LoadError, Errno::ENOENT
      rescue
        print "load error: #{rc}\n"
        print $!.class, ": ", $!, "\n"
        for err in $@[0, $@.size - 2]
          print "\t", err, "\n"
        end
        throw :EXIT
      end
    end
  end
end