Sha256: c5af2895470cedbbfe87f0970dec7aa57e8305472d4bc9732c11f0841bb3a0e1

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

#!/usr/bin/env ruby

require 'zmq'

#
# A Mongrel2 connector and configuration library for Ruby.
# 
# == Author/s
# 
# * Michael Granger <ged@FaerieMUD.org>
# 
module Mongrel2

	abort "\n\n>>> Mongrel2 requires Ruby 1.9.2 or later. <<<\n\n" if RUBY_VERSION < '1.9.2'

	# Library version constant
	VERSION = '0.3.0'

	# Version-control revision constant
	REVISION = %q$Revision: 745c431bcc1b $


	require 'mongrel2/logging'
	extend Mongrel2::Logging

	require 'mongrel2/constants'
	include Mongrel2::Constants


	### Get the library version. If +include_buildnum+ is true, the version string will
	### include the VCS rev ID.
	def self::version_string( include_buildnum=false )
		vstring = "Ruby-Mongrel2 %s" % [ VERSION ]
		vstring << " (build %s)" % [ REVISION[/: ([[:xdigit:]]+)/, 1] || '0' ] if include_buildnum
		return vstring
	end


	# ZMQ::Context (lazy-loaded)
	@zmq_ctx = nil

	### Fetch the ZMQ::Context for sockets, creating it if necessary.
	def self::zmq_context
		if @zmq_ctx.nil?
			Mongrel2.log.info "Using 0MQ %d.%d.%d" % ZMQ.version
			@zmq_ctx = ZMQ::Context.new
		end

		return @zmq_ctx
	end


	require 'mongrel2/exceptions'
	require 'mongrel2/connection'
	require 'mongrel2/handler'
	require 'mongrel2/request'
	require 'mongrel2/httprequest'
	require 'mongrel2/jsonrequest'
	require 'mongrel2/xmlrequest'
	require 'mongrel2/response'
	require 'mongrel2/control'

end # module Mongrel2


# Workaround for rbzmq <= 2.3.0
unless defined?( ZMQ::Error )
	module ZMQ
		Error = ::RuntimeError
	end
end


Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mongrel2-0.3.0 lib/mongrel2.rb