[MacRuby] #935: Control Tower won't run Objective-C Rack App

MacRuby ruby-noreply at macosforge.org
Wed Oct 6 14:58:35 PDT 2010


#935: Control Tower won't run Objective-C Rack App
-----------------------------+----------------------------------------------
 Reporter:  lp@…             |       Owner:  joshua.ballanco@…        
     Type:  defect           |      Status:  new                      
 Priority:  major            |   Milestone:  MacRuby 0.8              
Component:  ControlTower     |    Keywords:  control_tower framework  
-----------------------------+----------------------------------------------
Description changed by lsansonetti@…:

Old description:

> Loading a Objective-C Rack app inside a framework won't work:
>
> my Objective-C class:
>
> __________________________________________
> @implementation ObjcRackApp
>
> - (NSArray*)call:(NSDictionary *)env {
>
> return [NSArray arrayWithObjects:
>
> [NSNumber numberWithInteger:200],
>
> [NSDictionary dictionaryWithObject:@"text/plain" forKey:@"Content-Type"],
>
> @"Hello Objc!",
>
> nil];
>
> }
>
> @end
>
> ________________________________________________
>

> I can confirm it load and behaves properly with this script:
>
> ________________________________________________
>
> framework "ObjcRackApp.framework"
>
> class Hello
>   def call(env)
>     [200, { 'Content-Type' => 'text/plain' }, "Hello Control Tower!"]
>   end
> end
>
> env = {"a"=>"hash"}
>
> arr = ObjcRackApp.alloc.init.call(env)
>
> puts arr.class
> puts arr[0].class
> puts arr[1].class
> puts arr[2].class
>
> arr = Hello.new.call(env)
>
> puts arr.class
> puts arr[0].class
> puts arr[1].class
> puts arr[2].class
>
> __________________________________________
>
> which print:
> __________________________________________
>
> Array
> Fixnum
> Hash
> String
> Array
> Fixnum
> Hash
> String
>
> __________________________________________
>
> but when I run:
>
> __________________________________________
>
> framework "ObjcRackApp.framework"
>
> app = ObjcRackApp.alloc.init
> run app
>
> __________________________________________
>
> with control_tower -R hello_objc.ru, the server starts without error but
> I get served a blank page in my browser
> attached to this ticket are the used Objective-C framework and my Xcode
> project which built it.

New description:

 Loading a Objective-C Rack app inside a framework won't work:

 my Objective-C class:

 {{{
 @implementation ObjcRackApp

 - (NSArray*)call:(NSDictionary *)env {

 return [NSArray arrayWithObjects:

 [NSNumber numberWithInteger:200],

 [NSDictionary dictionaryWithObject:@"text/plain" forKey:@"Content-Type"],

 @"Hello Objc!",

 nil];

 }

 @end
 }}}

 I can confirm it load and behaves properly with this script:

 {{{
 framework "ObjcRackApp.framework"

 class Hello
   def call(env)
     [200, { 'Content-Type' => 'text/plain' }, "Hello Control Tower!"]
   end
 end

 env = {"a"=>"hash"}

 arr = ObjcRackApp.alloc.init.call(env)

 puts arr.class
 puts arr[0].class
 puts arr[1].class
 puts arr[2].class

 arr = Hello.new.call(env)

 puts arr.class
 puts arr[0].class
 puts arr[1].class
 puts arr[2].class
 }}}

 which print:

 {{{
 Array
 Fixnum
 Hash
 String
 Array
 Fixnum
 Hash
 String
 }}}

 but when I run:

 {{{
 framework "ObjcRackApp.framework"

 app = ObjcRackApp.alloc.init
 run app
 }}}

 with control_tower -R hello_objc.ru, the server starts without error but I
 get served a blank page in my browser
 attached to this ticket are the used Objective-C framework and my Xcode
 project which built it.

--

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/935#comment:1>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list