passbe/beef-migration-test-2 — Issue #333: Add Command Module Function: Map file to a url
Author: passbe
Created: 2011-12-05 10:29:55+00:00
State: open

Create a function which maps a file to a url in the Command base class (/lib/modules/command.rb). This will enable a derived command module make available arbitrary files over HTTP.

# If no path is specified the function will map the file to a random path.
# If no extension is specified the function will not add an extension.
# The request_count will specify how many times the file can be requested before it is unmapped.
# The default functionality is the map the file to a random path.
# The url path is returned.

def map_file_to_url(file, path=nil, extension=nil, request_count=1)

....

return url_path
end

Original link: http://code.google.com/p/beef/issues/detail?id=153