lib/hss.rb in hss-0.2.8 vs lib/hss.rb in hss-0.2.9

- old
+ new

@@ -2,11 +2,10 @@ require 'pathname' require 'version' ## # HSS module provides a helper for SSH shortcuts - module HSS DEFAULT_CONFIG = '~/.hss.yml' DEFAULT_LIBRARY = Pathname.new(__FILE__).realpath.split[0].to_s + '/helpers' class << self @@ -18,18 +17,17 @@ end end ## # Handlers load configurations and control their use - class Handler attr_reader :patterns, :config, :helpers ## Make a new handler with a config and parser def initialize(params = {}) - params = { config: params } if params.is_a? String + params = { :config => params } if params.is_a? String load_config(params[:config]) @helpers = [] load_helpers(params[:helpers]) @parser = HSS::Parser.new(@config) end @@ -61,11 +59,11 @@ ## # Load helper modules def load_helpers(helper_path = nil) helper_path ||= HSS::DEFAULT_LIBRARY - helper_path = File.absolute_path(helper_path) + helper_path = File.expand_path(helper_path) Dir.glob(helper_path + '/*').each do |helper| begin require helper @helpers << helper rescue LoadError, SyntaxError @@ -75,10 +73,9 @@ end end ## # Parser objects exist as containers for helper methods - class Parser ## # The config is scoped here so it is available to helpers def initialize(config)