Module: Ronin::Config

Extended by:
DataPaths::Finders
Includes:
DataPaths
Defined in:
lib/ronin/config.rb

Overview

Configuration information for Ronin.

Constant Summary collapse

HOME =

The users home directory

Env.home
PATH =

Ronin home directory

HOME.join('.ronin')
CONFIG_DIR =

Configuration files directory

PATH.join('config')
REPOS_DIR =

Directory which repositories are installed into

PATH.join('repos')
TMP_DIR =

Temporary file directory

PATH.join('tmp')

Class Method Summary collapse

Class Method Details

.load(name = nil) ⇒ Object

Loads the Ronin configuration file.

Examples:

Load the config file at ~/.ronin/config.rb

Config.load
# => true

Load the config file at ~/.ronin/config/sql.rb

Config.load :sql
# => true

Parameters:

  • name (Symbol, String, nil) (defaults to: nil)

    The optional name of the file to load within CONFIG_DIR.



67
68
69
70
71
72
73
74
75
# File 'lib/ronin/config.rb', line 67

def Config.load(name=nil)
  path = if name
           CONFIG_DIR.join("#{name}.rb").expand_path
         else
           PATH.join('config.rb')
         end

  require path if path.file?
end

.tmp_dir(sub_path = nil) ⇒ Pathname

Auto-creates a directory within TMP_DIR.

Parameters:

  • sub_path (String) (defaults to: nil)

    The sub-path within TMP_DIR.

Returns:

  • (Pathname)

    The full path within TMP_DIR.



88
89
90
91
92
93
94
95
96
97
98
# File 'lib/ronin/config.rb', line 88

def Config.tmp_dir(sub_path=nil)
  if sub_path
    sub_path = File.expand_path(File.join('',sub_path))
    path = TMP_DIR.join(sub_path)

    path.mkpath unless path.exist?
    return path
  end

  return TMP_DIR
end