Sha256: 00cf8e2342ae31853e0e6023f9f28035ce35c94bfa4c34abd533104b937f4809
Contents?: true
Size: 1020 Bytes
Versions: 1
Compression:
Stored size: 1020 Bytes
Contents
module Slappy module Commands class Run class InvalidPathError < StandardError; end def call load_config load_scripts Slappy.start rescue InvalidPathError => e puts TermColor.parse "<red>Error:</red> #{e.message}" end private def load_config file = File.expand_path Slappy.configuration.config_file_path, Dir.pwd begin require file rescue LoadError raise InvalidPathError.new, "file #{file} not found" end end def load_scripts script_dir = Slappy.configuration.scripts_dir_path unless FileTest.directory? script_dir message = "directory #{script_dir} not found" fail InvalidPathError.new, message end script_dir = "./#{script_dir}" unless script_dir.match(%r{"./"}) Dir.glob("#{script_dir}/**/*.rb").each do |file| block = proc { require file } block.call end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
slappy-0.3.0 | lib/slappy/commands/run.rb |