Module: Ronin::Repos

Defined in:
lib/ronin/repos.rb,
lib/ronin/repos/cli.rb,
lib/ronin/repos/root.rb,
lib/ronin/repos/version.rb,
lib/ronin/repos/cache_dir.rb,
lib/ronin/repos/class_dir.rb,
lib/ronin/repos/exceptions.rb,
lib/ronin/repos/repository.rb,
lib/ronin/repos/cli/command.rb,
lib/ronin/repos/cli/commands/new.rb,
lib/ronin/repos/cli/commands/list.rb,
lib/ronin/repos/cli/commands/show.rb,
lib/ronin/repos/cli/commands/purge.rb,
lib/ronin/repos/cli/commands/remove.rb,
lib/ronin/repos/cli/commands/update.rb,
lib/ronin/repos/cli/commands/install.rb,
lib/ronin/repos/cli/commands/completion.rb

Overview

Top-level methods for accessing repositories.

Defined Under Namespace

Modules: ClassDir Classes: CLI, CacheDir, CommandFailed, CommandNotInstalled, Exception, Repository, RepositoryNotFound

Constant Summary collapse

ROOT =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

Path to ronin-repos root directory.

File.expand_path(File.join(__dir__,'..','..','..'))
VERSION =

ronin-repos version

'0.2.0'

Class Method Summary collapse

Class Method Details

.cache_dirCacheDir

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Note:

This method lazy initializes CacheDir when first called.

The global repositories cache directory.

Returns:

  • (CacheDir)

    The global repositories cache directory (~/.cache/ronin-repos).

Since:

  • 0.2.0



40
41
42
# File 'lib/ronin/repos.rb', line 40

def self.cache_dir
  @cache_dir ||= CacheDir.new
end

.find_file(path) ⇒ String?

Finds the first matching file.

Examples:

repos.find_file("wordlists/wordlist.txt")
# => "/home/user/.cache/ronin-repos/foo-repo/wordlists/wordlist.txt"

Parameters:

  • path (String)

    The relative path of the file.

Returns:

  • (String, nil)

    The absolute path of the matching file or nil if no matching file could be found.



58
59
60
# File 'lib/ronin/repos.rb', line 58

def self.find_file(path)
  cache_dir.find_file(path)
end

.glob(pattern, &block) ⇒ Array<String>

Finds all files in all repos that matches the glob pattern

Examples:

repos.glob("wordlists/*.txt")
# => ["/home/user/.cache/ronin-repos/foo-repo/wordlists/cities.txt",
#     "/home/user/.cache/ronin-repos/foo-repo/wordlists/states.txt",
#     "/home/user/.cache/ronin-repos/bar-repo/wordlists/bands.txt",
#     "/home/user/.cache/ronin-repos/bar-repo/wordlists/beers.txt"]

Parameters:

  • pattern (String)

    The file glob pattern to search for.

Returns:

  • (Array<String>)

    The absolute paths to the files that match the glob pattern.



78
79
80
# File 'lib/ronin/repos.rb', line 78

def self.glob(pattern,&block)
  cache_dir.glob(pattern,&block)
end

.list_files(pattern = '{**/}*.*') ⇒ Set<String>

Lists all files across all installed repos.

Parameters:

  • pattern (String) (defaults to: '{**/}*.*')

    The glob pattern to use to list specific files.

Returns:

  • (Set<String>)

    The matching files within all repositories.



91
92
93
# File 'lib/ronin/repos.rb', line 91

def self.list_files(pattern='{**/}*.*')
  cache_dir.list_files(pattern)
end