I don't suppose you'd care to contribute an example? This is clearly helpful!
- Jordan On Jul 21, 2010, at 11:44 AM, Nick Ludlam wrote: > On 21 Jul 2010, at 15:31, Alexander von Below wrote: > >> Hello, >> >> I apologize for the repost, but I have not found help anywhere else... >> >> My goal is to run a ControlTower instance (1) in MacRuby within a Cocoa app, >> i.e. using -[MacRuby evaluateFileAtPath:] >> >> First question: Is this possible at all? >> >> Second question: >> >> I understand that my control script is the body to: >> >> app = Rack::Builder.new { ... config ... }.to_app >> >> but I have not figured out how to make an .rb file that will run a control >> tower instance. >> >> Any help is appreciated! > > Hi Alexander, > I've got a MacRuby app happily running very happily with Control Tower. First > I cloned the code from github, and built and installed the macgem package. > Then I also installed rack with > > sudo macgem install rack > > in order to get some of Rack's built in server functionality. Then a short > script would look like: > > > require 'rubygems' > require 'control_tower' > require 'rack/utils' > > server_options = { :port => 3001, :host => '0.0.0.0', :concurrent => false } > > app = Rack::Builder.new do > map "/" do run Rack::File.new("/Users/nick/Sites/") end > end.to_app > > @s = ControlTower::Server.new(app, server_options) > if @s > puts 'Starting control tower webserver' > @s.start > else > puts "ERROR: Couldnt build server" > end > > This would run a server on port 3001, and expose the files found in your > ~/Sites/ directory as top level files > > eg. ~/Sites/index.html becomes http://localhost:3001/index.html > > Of course you'd need to replace 'nick' with your user homedir name. > > > Nick > > _______________________________________________ > MacRuby-devel mailing list > MacRuby-devel@lists.macosforge.org > http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel _______________________________________________ MacRuby-devel mailing list MacRuby-devel@lists.macosforge.org http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel