module Ronin::Gen
Constants
Public Class Methods
generator(name)
click to toggle source
Loads the generator with the given name.
@param [String] name
The colon separated name of the generator.
@return [Generator, nil]
The loaded generator. If `nil` is returned, then the generator could not be found.
@raise [UnknownGenerator]
The generator could not be found or loaded.
@example
Gen.generator 'library' # => Ronin::Gen::Generators::Library
@example Load a generator within a namespace
Gen.generator 'exploits:remote_tcp' # => Ronin::Gen::Generators::Exploits::RemoteTcp
@since 1.0.0
# File lib/ronin/gen/gen.rb, line 54 def Gen.generator(name) name = name.to_s path = name.tr(':','/') unless (generator = Generators.require_const(path)) raise(UnknownGenerator,"unknown generator #{name.dump}") end return generator end
generators()
click to toggle source
The names of all available generators.
@return [Hash]
The names and paths of all installed generators.
@since 0.3.0
# File lib/ronin/gen/gen.rb, line 73 def Gen.generators if @generators.empty? directory = File.join('lib',Generators.namespace_root) Installation.each_file_in(directory,'rb') do |path| # strip the tailing '.rb' file extension name = path.chomp('.rb') # replace any file separators with a ':', to mimic the # Rake task naming convention name.tr!(File::SEPARATOR,':') @generators << name end end return @generators end