public
Description: The Ruby Implementation of SWX RPC
Homepage: http://swxruby.org
Clone URL: git://github.com/meekish/swxruby.git
swxruby / examples / standalone / standalone.rb
a8798ed0 » Jed Hurt 2008-03-11 Wrote RDOC formatted commen... 1 # = Merb Standalone SWX Ruby Server
2 #
3 # An example of how simple it is to build a standalone SWX Ruby server using Merb.
4 #
5 # == Prerequisites
6 #
7 # * SWX Ruby Gem (gem install swxruby)
8 # * merb-core 0.9.1 or later (gem install merb-core)
9 #
10 # == Take it for a spin
11 #
12 # * Open a terminal in the examples/standalone directory and execute 'merb -I standalone.rb' to fire up the Merb server.
13 # * Open standalone.fla in Flash 8 or later.
14 # * Publish Preview (ctrl+enter on Windows; cmd+enter on OS X).
15 # * Watch as the output panel begins tracing "Hello from Merb!".
16 require 'rubygems'
60f5761d » Jed Hurt 2008-03-11 Added merb standalone server 17 require 'swxruby'
18
19 # =================
20 # = Service Class =
21 # =================
22 class SwxServiceClasses::HelloMerb
23 def just_say_the_words
24 'Hello from Merb!'
25 end
26 end
27
28 # ====================
29 # = Merb Application =
30 # ====================
f5e151f4 » Jed Hurt 2008-03-11 Make Merb controller more s... 31 Merb::Router.prepare { |r| r.match('/').to(:controller => 'swx_ruby_controller', :action =>'gateway') }
60f5761d » Jed Hurt 2008-03-11 Added merb standalone server 32
f5e151f4 » Jed Hurt 2008-03-11 Make Merb controller more s... 33 class SwxRubyController < Merb::Controller
60f5761d » Jed Hurt 2008-03-11 Added merb standalone server 34 def gateway
10851c37 » Bronson McKinley 2009-01-17 Flash Player 10 didn't like... 35 send_data(SwxGateway.process(params), :filename => 'data.swf', :type => 'application/swf', :disposition => 'inline')
60f5761d » Jed Hurt 2008-03-11 Added merb standalone server 36 end
37 end