#18 ✓resolved
Matt Todd

Running Halcyon With No Server

Reported by Matt Todd | March 26th, 2008 @ 10:15 PM | in Release 0.5.0

Essentially, make it work so that Halcyon applications can be run without Rack and not in an explicit Halcyon app-space.

This may be connected to the issue with making a Flat Halcyon app file.

Example of running Halcyon without Rack:

require 'halcyon'
require 'rack/mock'
class Application < Halcyon::Controller
  def time
    ok(Time.now.to_s)
  end
end
class Halcyon::Application
  route do |r|
    r.match('/time').to(:controller => 'application', :action => 'time')
  end
end
@log = ''
Halcyon.config = {'log_level' => 'debug', 'logger' => Logger.new(StringIO.new(@log)), 'allow_from' => 'all'}.to_mash
@app = Halcyon::Runner.new

Then you can use the Rack request mocking class to request actions:

@app.call(Rack::MockRequest.env_for('/time'))

or even

Rack::MockRequest.new(@app).get("/time")

Note: this was my way of documenting various ways to debug and test (especially for the specs I'm working on) Halcyon apps without requiring servers and for allowing step-through capability. This may be wrapped up into a command like init and start to allow for interactive mode or something.

Comments and changes to this ticket

  • Matt Todd

    Matt Todd March 26th, 2008 @ 10:03 PM

    • Milestone changed from Release 0.4.0 to Release 0.5.0
    • State changed from “new” to “open”

    Filed under Release 0.5.0. Most of this is already functional, just requires a little packaging, especially for the interactive mode. Modelling this after Merb would be very cool.

  • Matt Todd

    Matt Todd March 31st, 2008 @ 03:56 AM

    • State changed from “open” to “resolved”

    Added. May change in the future.

    Code pulled from Merb's console adapter. (Hooray.)

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

People watching this ticket

Pages