[MacRuby-devel] [MacRuby] #619: Constant scope in a block is determined at run-time?

2010-02-18 Thread MacRuby
#619: Constant scope in a block is determined at run-time?
+---
 Reporter:  cheke...@…  |   Owner:  lsansone...@…
 Type:  defect  |  Status:  new  
 Priority:  major   |   Milestone:   
Component:  MacRuby |Keywords:   
+---
 r3572

 Following code can't run by macruby. Both ruby 1.8.7 and 1.9.1 work.

 {{{
 module A
   B = "Not defined in top-level."

   def self.extended(base)
 base.class_eval do
   puts B
 end
   end
 end

 class C
   # Not include A
   extend A
 end
 }}}

 NameError: uninitialized constant C::B
 from /Users/dche/(irb):6:in `block'
 from /Users/dche/(irb):5:in `extended:'

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] macruby/hotcocoa questions

2010-02-18 Thread Gary Weaver

Hello,

I wrote a small application in HotCocoa/MacRuby just to get familiar 
with it ( http://github.com/garysweaver/hourz ). MacRuby and HotCocoa 
are awesome! I did have a few issues during development that I thought 
I'd share in case anyone can assist.


I'm using MacRuby 0.5 and HotCocoa 0.5.1 on OS X 10.6.2, was using 
TextMate vs. XCode to develop it. I have some experience with Ruby, but 
consider me a newbie to MacRuby, HotCocoa, and Cocoa (and Obj-C for that 
matter).


Here is what I ran into:

* If I take a stringValue from a text field, Marshal.dump it to a file, 
and then Marshal.load it, and put it back into the text field, it puts 
wierd characters in the end of the value like 'Òÿýÿÿÿ'. I think this 
might be a result of the class that I'm Marshalling that contains 
"include HotCocoa::Behaviors"? Not sure. I wasn't able to reproduce the 
issue via macirb using simple array or array of simple custom class 
Marshalling to file and back, but I'm able to reproduce the issue 
everytime in my app, but the class is more complicated.


* I wasn't able to get File.copy to work so I wrote my own method to 
copy a file. Could you provide an example that can copy a file in 
MacRuby using File.copy or using FileUtils?


* I wasn't able to set the (HotCocoa) layout_view frame or hidden 
properties successfully via calls by a button on_action. I could set 
them fine as long as they were called during startup of the application. 
For example, I wanted to do the following to hide a layout_view and 
replace it with another layout_view and vice versa in the same area of 
the window, but these methods only worked if being called during the 
initial load. I'm thinking maybe there is some sort of refresh method I 
need to call?


 def in_add_mode
   @edit_view.frame = [0, 0, 0, 0]
   @edit_view.hidden = true
   @add_view.frame = [0, 0, 0, 40]
   @add_view.hidden = false
 end

 def in_edit_mode
   @add_view.frame = [0, 0, 0, 0]
   @add_view.hidden = true
   @edit_view.frame = [0, 0, 0, 40]
   @edit_view.hidden = false
   # ...
 end

* (window).will_miniaturize { exit } works great to keep the app active 
(in the dock) after closing the window, but I don't know what to call 
such that I could close the window and then click on the icon in the 
dock it then show the window. Also when I close it, it doesn't appear to 
be in the hidden state, because the dock menu indicates that I can hide 
the window (but it is hidden).


* I couldn't figure out how to access the dock_menu in HotCocoa/MacRuby 
(I'm not using XCode or 
http://www.echographia.com/blog/2009/02/08/dynamic-dock-menus-in-macruby/ 
would have helped). I'd like to be able to manage it dynamically in 
HotCocoa if possible to be able to choose which Task I'm working on at 
the moment without showing the window. It would also be cool to 
dynamically change the dock icon when this happens to somehow indicate 
which task is being worked on (similar to Thunderbird showing the number 
of new messages, maybe I could show a number or some brief text?).


* I couldn't figure out how to alter the "About" part of the application 
to provide the authorship, license, and link to the project, although I 
know the version number is specified in config/build.yml. It would also 
be cool to have full control over that area and define the window, etc.


* I wasn't sure what the best practice would be to ensure that the 
window could be resized if someone somehow is using larger/smaller 
fonts, but to keep it from being resized so much that it is unusable. 
Maybe the right thing to do is to just specify a defined size/frame for 
the window that cannot be changed?


* Note that I might also look into storing the task data as xml or json. 
I'd rather it be hand-editable if needed. (I assume I could just put the 
array into a hash and use to_xml/from_xml or to_json/from_json.)


Again, thanks so much for all of your work on this. It is really cool to 
develop apps for OS X this quickly! (<16 hours total dev time, not 
including time to post to GitHub, and a lot of that was research, 
documentation, making an icon, etc.)


Thanks in advance for any assistance!

Gary
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #555: Redefinition of method gives unexpected behavior

2010-02-18 Thread MacRuby
#555: Redefinition of method gives unexpected behavior
+---
 Reporter:  macch...@…  |Owner:  lsansone...@…
 Type:  defect  |   Status:  closed   
 Priority:  major   |Milestone:  MacRuby 0.6  
Component:  MacRuby |   Resolution:  fixed
 Keywords:  |  
+---

Comment(by macch...@…):

 I can confirm the fix with the latest nightly build.

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] [MacRuby] #613: Dispatch classes should be wrapped in an Data struct to allow subclassing

2010-02-18 Thread MacRuby
#613: Dispatch classes should be wrapped in an Data struct to allow subclassing
+---
 Reporter:  ernest.prabha...@…  |   Owner:  pthom...@…
 Type:  defect  |  Status:  new   
 Priority:  minor   |   Milestone:
Component:  MacRuby |Keywords:
+---

Comment(by pthom...@…):

 I had considered making a Dispatch::Base object, but it seemed like
 overkill.

 I'm actually not sure that any of the Dispatch objects can be subclassed
 safely, since they are all of type T_DATA.
 Calling DATA_PTR() on a subclass of a T_DATA object causes a segmentation
 fault.
 I need to look into whether it's possible for subclasses of T_DATA to
 behave properly when they have to interact with C code.
 I guess this patch doesn't do much, then. *wry grin*

-- 
Ticket URL: 
MacRuby 

___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


[MacRuby-devel] is active_support supported in MacRuby 0.5?

2010-02-18 Thread Gary Weaver

Is active_support supported in MacRuby 0.5?

$ macirb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'active_support'
NoMethodError: undefined method `alias_method_chain' for Range:Class

Thanks in advance,
Gary
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] is active_support supported in MacRuby 0.5?

2010-02-18 Thread Laurent Sansonetti
Hi Gary,

On Feb 18, 2010, at 2:06 PM, Gary Weaver wrote:

> Is active_support supported in MacRuby 0.5?
> 
> $ macirb
> irb(main):001:0> require 'rubygems'
> => true
> irb(main):002:0> require 'active_support'
> NoMethodError: undefined method `alias_method_chain' for Range:Class

Not in 0.5, but 0.6 will support it. trunk has preliminary (and experimental) 
support.

Laurent
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel