Top Level Namespace

Defined Under Namespace

Modules: Enumerable Classes: Maveric, Module, StandardError, Symbol

Instance Method Summary collapse

Instance Method Details

#uriObject

Maveric: A simple, non-magical, framework

Resources

Maveric releases can normally be found on rubyforge. Documentation sits at rubyforge as well. Maveric’s code base resides at rubyforge as well, but will eventually be located at devjavu.

Maveric is also listed at the RAA as maveric. This page lags a bit behind rubyforge in terms of updates.

Version

We are at version 0.4.0 and approaching a solid, stable, and full release. It’s not often I complete a project to a public release, often relegating the the half completed code to my code vault and it never seeing the light of day again. So this is definately a yey!

Version 0.4.0 refines the Route class and interactions by utilizing a Struct. Maveric no longer depends on any lib outside of core or stdlibs allowing you to only install Maveric for functionality. We are now using -w and -d switches during development and striving for concise and correct code.

Maveric addons have been revised, giving the current functionality of Maveric to FastCGI and Mongrel. A plugin to WEBrick has been provided, but is untested and not supported.

Check other documentation for a full list of changes.

Authors

Maveric is designed and coded by blink of #ruby-lang on irc.freenode.net

Licence

This software is licensed under the CC-GNU LGPL

Disclaimer

This software is provided “as is” and without any express or implied warranties, including, without limitation, the implied warranties of merchantability and fitness for a particular purpose. Authors are not responsible for any damages, direct or indirect.

Maveric: History

Maveric was initially designed as a replacement for Camping in the style of a Model-View-Controller framework. Early implementations aimed to reduce the amount of “magic” to 0. Outstanding magic of Camping is that nothing is related due to the reading, gsub-ing, and eval-ing of the Camping source file Also, even the unobfuscated/unabridged version of Camping is a bit hard to follow at times.

However, the result of this initial attempt was a spaghetti of winding code, empty template modules, and rediculous inheritance paths between the template modules and a plethora of dynamically generated classes and modules. I got more complaints with that particular jumble of code than any other, evar.

The next iteration of Maveric was a seeking of simplification and departure from the concept of cloning Camping and its functionality and settling for Camping-esqe. At this point, I started talking to ezmobius on #ruby-lang and their Merb project. We talked a bit about merging and brainstorming but my lone wolf tendencies stirred me away from such an endeavour, but I came away a compatriot and inspiration for a new routing methodology inspired by Merb’s. The result is the Route that’s been stable since, only varying in method placement and data management.

After building to a version that stood on it’s owned and was able to run a variance of my website as functional as the Camping version. I noticed a few tendncies of my coding and refactored. I also redesigned the concept from a modules that included the Maveric module to that of subclassing Maveric, which is a Mongrel::HttpHandlerPlugin. This allowed the running of Maveric apps without using Mongrel::CampingHandler as well as not worrying about namespace clobbering.

Because ehird from #ruby-lang was whining about it so much I removed its dependancy on Mongrel sooner than later. Maveric should now be very maveric.

Because Maveric 0.1.0 worked, but still didn’t do things the way I wanted I revised and refactored codes and algorithms into future versions which will hopefully be all that I want. Everything beyond 1.0.0 will be improvements and extensions.

Not so Maveric

Maveric has additional libs to allow you to run Maveric behind different http server implementations. CGI, FastCGI, and Mongrel are supported. If another service exists that you’d like to have supported please submit a patch of a good reason why.

For these examples we will utilize the simplest functional Maveric possible

require 'maveric'
class Maveric::Index < Maveric::Controller
  def get
    'Hello, world!'
  end
end

To use CGI: (not cgi.rb)

puts Maveric.new.dispatch.to_s

To use FastCGI:

require 'maveric/fastcgi'
::Maveric::FCGI(MyMaveric.new)

To use Mongrel:

require 'maveric/mongrel'
h = ::Mongrel::HttpHandler ip, port
h.register mountpoint, MyMaveric.new
h.join.run

However, if your script is mounted at a point other than /, use the :path_prefix option to adjust your routes. This affects all routes generated from MyMaveric.

mav = MyMaveric.new :path_prefix => mountpoint
::Maveric::FCGI(mav)
h.register mountpoint, mav



126
# File 'lib/maveric.rb', line 126

require 'uri'