lib/ronin/config.rb in ronin-0.1.1 vs lib/ronin/config.rb in ronin-0.1.2
- old
+ new
@@ -25,7 +25,40 @@
module Ronin
module Config
# Ronin home directory
PATH = FileUtils.mkdir_p(File.join(ENV['HOME'],'.ronin'))
+
+ # Path to static directory
+ STATIC_DIR = File.expand_path(File.join(File.dirname(__FILE__),'..','..','static'))
+
+ # Main configuration file
+ CONFIG_PATH = File.expand_path(File.join(PATH,'config.rb'))
+
+ # Configuration files directory
+ CONFIG_DIR = File.expand_path(File.join(PATH,'config'))
+
+ # Temporary file directory
+ TMP_DIR = FileUtils.mkdir_p(File.join(PATH,'tmp'))
+
+ #
+ # Require the Ronin configuration file with the given _name_ in the
+ # Ronin configuration files directory. If _name_ is not given, than the
+ # main Ronin configuration file will be loaded.
+ #
+ # # Load the main config file at <tt>~/.ronin/config.rb</tt>
+ # Config.load # => true
+ #
+ # # Load a specific config file in <tt>~/.ronin/config/</tt>
+ # Config.load 'sql' # => true
+ #
+ def Config.load(name=nil)
+ if name
+ path = File.expand_path(File.join(CONFIG_DIR,name))
+ else
+ path = CONFIG_PATH
+ end
+
+ require path if File.file?(path)
+ end
end
end