An error that indicates we weren’t able to fetch some data from a source
Run an instance of the gem program.
Gem::GemRunner
is only intended for internal use by RubyGems itself. It does not form any public API and may change at any time for any reason.
If you would like to duplicate functionality of ‘gem` commands, use the classes they call directly.
Gem::Server
and allows users to serve gems for consumption by ‘gem –remote-install`.
gem_server starts an HTTP server on the given port and serves the following:
“/” - Browsing of gem spec files for installed gems
“/specs.#{Gem.marshal_version}.gz” - specs name/version/platform index
“/latest_specs.#{Gem.marshal_version}.gz” - latest specs name/version/platform index
“/quick/” - Individual gemspecs
“/gems” - Direct access to download the installable gems
“/rdoc?q=” - Search for installed rdoc documentation
gem_server = Gem::Server.new Gem.dir, 8089, false gem_server.run
RefError
is raised when a referenced object has been recycled by the garbage collector
An HTTP Proxy server which proxies GET, HEAD and POST requests.
To create a simple proxy server:
require 'webrick' require 'webrick/httpproxy' proxy = WEBrick::HTTPProxyServer.new Port: 8000 trap 'INT' do proxy.shutdown end trap 'TERM' do proxy.shutdown end proxy.start
See ::new
for proxy-specific configuration items.
To modify content the proxy server returns use the :ProxyContentHandler
option:
handler = proc do |req, res| if res['content-type'] == 'text/plain' then res.body << "\nThis content was proxied!\n" end end proxy = WEBrick::HTTPProxyServer.new Port: 8000, ProxyContentHandler: handler
An HTTP Server
Base server class
Base TCP server class. You must subclass GenericServer
and provide a run
method.
Creates XML-RPC call/response documents
This is the base class for all XML-RPC server-types (CGI
, standalone). You can add handler and set a default handler. Do not use this server, as this is/should be an abstract class.
The arity (number of accepted arguments) of a handler (method or Proc
object) is compared to the given arguments submitted by the client for a RPC, or Remote Procedure Call.
A handler is only called if it accepts the number of arguments, otherwise the search for another handler will go on. When at the end no handler was found, the default_handler, XMLRPC::BasicServer#set_default_handler
will be called.
With this technique it is possible to do overloading by number of parameters, but only for Proc
handler, because you cannot define two methods of the same name in the same class.
Implements a CGI-based XML-RPC server.
require "xmlrpc/server" s = XMLRPC::CGIServer.new s.add_handler("michael.add") do |a,b| a + b end s.add_handler("michael.div") do |a,b| if b == 0 raise XMLRPC::FaultException.new(1, "division by zero") else a / b end end s.set_default_handler do |name, *args| raise XMLRPC::FaultException.new(-99, "Method #{name} missing" + " or wrong number of parameters!") end s.serve
Note: Make sure that you don’t write to standard-output in a handler, or in any other part of your program, this would cause a CGI-based server to fail!
Implements a standalone XML-RPC server. The method XMLRPC::Server#serve
is left if a SIGHUP is sent to the program.
require "xmlrpc/server" s = XMLRPC::Server.new(8080) s.add_handler("michael.add") do |a,b| a + b end s.add_handler("michael.div") do |a,b| if b == 0 raise XMLRPC::FaultException.new(1, "division by zero") else a / b end end s.set_default_handler do |name, *args| raise XMLRPC::FaultException.new(-99, "Method #{name} missing" + " or wrong number of parameters!") end s.serve
This module has all methods of FileUtils
module, but it outputs messages before acting. This equates to passing the :verbose
flag to methods in FileUtils
.
Logging severity.
Mixin for HTTP and FTP URIs.