Re: [MacRuby-devel] Implementing Undo In RaiseMan / MacRuby

2009-10-27 Thread John Shea
Steve,

I am not sure what stage you are at with your example, I originally did this
without using an array controller, and the undoing worked fine.

I just threw together a version with an array controller - and the
insertObject(person,
inEmployeesAtIndex:index) and remove methods are being called by the array
controller - however they seem to be passing the index as a nil. Perhaps
this is what Ernest was talking about - an unboxing issue??
Undoing initially works.

Selecting the second row, and then pressing insert causes a crash into the
debugger - so perhaps again some issue with what method the array controller
is calling or trying to call  (and the vars it is trying to pass)  - as
Ernest implied (?).

Note that this experiment was still with 0.4.
Perhaps it works ok in later versions?

I personally have not come across this issue before because I never use the
arraycontroller method insert and remove - I always have my own controller
methods - usually I want to check other things before adding or removing (I
believe later in the book the array controller methods are replaced with own
methods).

Not a solution but perhaps you can work around it, by using your own
controller actions, and then exploring the undo aspects?

Cheers,
John

On Mon, Oct 26, 2009 at 4:06 PM, s.ross  wrote:

> John--
>
> I've started a github repo at http://github.com/sxross/raiseman-rb, but it
> doesn't yet reflect that I can now do initial editing of an inserted row,
> but undo is not there yet.
>
> Thanks,
>
> Steve
>
>
> On Oct 26, 2009, at 1:22 AM, John Shea wrote:
>
> Hi Steve,
> did you solve this one?
> if not perhaps you could post somewhere the MyDocument.rb code for us to
> look at?
> Cheers,
> J
>
> On Sun, Oct 25, 2009 at 7:17 PM, s.ross  wrote:
>
>> I'm trying to implement the RaiseMan example from Aaron Hillegass's book
>> in MacRuby. All has gone pretty well until I reached undo. The idea is to
>> handle the insertObject message each time a Person is inserted and
>> manipulate the undo stack.
>>
>>   def insertObject(p, inEmployeesAtIndex:index)
>> NSLog("adding #{p} to #{employees}") # <= Not called, huh?
>> undo = @undoManager
>> undo.prepareWithInvocationTarget(self,
>> removeObjectFromEmployeesAtIndex:index)
>> if !undo.isUndoing
>>   undo.setActionName("Insert Person")
>> end
>> employees.insertObject(p, atIndex:index)
>>   end
>>
>> The Objective-C signature for this is:
>>
>> - (void)insertObject:(Person *)p inEmployeesAtIndex:(int)index
>>
>> Works in Objective-C but in my Ruby, the method is not recognized as a
>> handler to be invoked when a Person object is to be inserted in the
>> employees array. I should note that I created the employees array using Ruby
>> syntax:
>>
>> @employees ||= []
>>
>> Changing this to:
>>
>> @employees ||= NSMutableArray.alloc.init
>>
>> makes no difference in this scenario.
>>
>> Any hints with respect to what I'm missing here?
>>
>> Thanks,
>>
>> Steve
>>
>>
>> ___
>> MacRuby-devel mailing list
>> [email protected]
>> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>>
>>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
>
> ___
> MacRuby-devel mailing list
> [email protected]
> http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel
>
>
___
MacRuby-devel mailing list
[email protected]
http://lists.macosforge.org/mailman/listinfo.cgi/macruby-devel


Re: [MacRuby-devel] Implementing Undo In RaiseMan / MacRuby

2009-10-27 Thread Benjamin Stiglitz

  def insertObject(p, inEmployeesAtIndex:index)
NSLog("adding #{p} to #{employees}") # <= Not called, huh?
undo = @undoManager
undo.prepareWithInvocationTarget(self,  
removeObjectFromEmployeesAtIndex:index)

if !undo.isUndoing
  undo.setActionName("Insert Person")
end
employees.insertObject(p, atIndex:index)
  end


FWIW, the third line of the body should read
undo.prepareWithInvocationTarget(self).removeObjectFromEmployeesAtIndex 
(index)


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


Re: [MacRuby-devel] [MacRuby] #216: fork subprocess exiting (normally) segfaults

2009-10-27 Thread MacRuby
#216: fork subprocess exiting (normally) segfaults
---+
 Reporter:  cel...@…   |   Owner:  lsansone...@…
 Type:  defect |  Status:  new  
 Priority:  major  |   Milestone:   
Component:  MacRuby|Keywords:  fork process 
---+

Comment(by ernest.prabha...@…):

 Any update on this? I notice that the MacRuby 0.5 beta (nightly) simply
 reports "fork" as unsupported, perhaps due to this.

 irb(main):001:0> fork
 RuntimeError: fork is not supported yet
 from core:in `fork'
 from (irb):1:in `'
 from core:in `eval:'
 from core:in `evaluate:'

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #385: Cannot distribute macruby apps

2009-10-27 Thread MacRuby
#385: Cannot distribute macruby apps
---+
 Reporter:  hungerandthi...@…  |Owner:  lsansone...@…   
 
 Type:  defect |   Status:  closed  
 
 Priority:  blocker|Milestone:  MacRuby 0.5 
 
Component:  MacRuby|   Resolution:  fixed   
 
 Keywords:  macruby, distribute, rubygems  |  
---+
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed


Comment:

 This should be fixed in r2905, make sure to remove the old "Embed MacRuby"
 target of your project and add the new one.

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #361: Embed MacRuby Target Adds 60+ MB to .app

2009-10-27 Thread MacRuby
#361: Embed MacRuby Target Adds 60+ MB to .app
-+--
 Reporter:  dy...@…  |Owner:  lsansone...@…
 Type:  defect   |   Status:  closed   
 Priority:  blocker  |Milestone:  MacRuby 0.5  
Component:  MacRuby  |   Resolution:  fixed
 Keywords:   |  
-+--
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  => MacRuby 0.5


Comment:

 As of r2905, the new Embed MacRuby target makes a fresh new MacRuby .app
 49MB, and when passing --no-stdlib to macruby_deploy inside the target
 script the .app becomes 28MB.

 We will make further improvements in the near future to reduce the size of
 embedded macruby apps, but I think this bug can be closed.

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #360: Embed MacRuby Target Fails If $TARGET_BUILD_DIR contains spaces

2009-10-27 Thread MacRuby
#360: Embed MacRuby Target Fails If $TARGET_BUILD_DIR contains spaces
-+--
 Reporter:  dy...@…  |Owner:  lsansone...@…
 Type:  defect   |   Status:  closed   
 Priority:  blocker  |Milestone:  MacRuby 0.5  
Component:  MacRuby  |   Resolution:  fixed
 Keywords:   |  
-+--
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  => MacRuby 0.5


Comment:

 Thank you, merged as r2906.

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #216: fork subprocess exiting (normally) segfaults

2009-10-27 Thread MacRuby
#216: fork subprocess exiting (normally) segfaults
---+
 Reporter:  cel...@…   |   Owner:  lsansone...@…
 Type:  defect |  Status:  new  
 Priority:  major  |   Milestone:   
Component:  MacRuby|Keywords:  fork process 
---+

Comment(by lsansone...@…):

 #fork will be hard to support in MacRuby because the underlying system
 (CoreFoundation, libauto) do not support it. I highly recommend using
 threads OR GCD instead.

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #216: fork subprocess exiting (normally) segfaults

2009-10-27 Thread MacRuby
#216: fork subprocess exiting (normally) segfaults
---+
 Reporter:  cel...@…   |   Owner:  lsansone...@…
 Type:  defect |  Status:  new  
 Priority:  major  |   Milestone:   
Component:  MacRuby|Keywords:  fork process 
---+

Comment(by ernest.prabha...@…):

 I can appreciate that, but I really want to run something in a separate
 *process* to take advantage of memory isolation.  Is there another way to
 asynchronously spawn another process from Ruby?

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #216: fork subprocess exiting (normally) segfaults

2009-10-27 Thread MacRuby
#216: fork subprocess exiting (normally) segfaults
---+
 Reporter:  cel...@…   |   Owner:  lsansone...@…
 Type:  defect |  Status:  new  
 Priority:  major  |   Milestone:   
Component:  MacRuby|Keywords:  fork process 
---+

Comment(by lsansone...@…):

 You can still spawn a new process (using #system, #`, #popen, etc.). If
 you want to run Ruby code in that process, you can spawn a new
 `/usr/bin/env macruby' process that way.

-- 
Ticket URL: 
MacRuby 

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


[MacRuby-devel] spotlight - MDItemRef

2009-10-27 Thread Alan Skipp
Would anyone be able to give me a hint on how to get the following
objective-c code working with macruby. The code uses spotlight to
extract metadata from a file.

MDItemRef inspectedRef =
MDItemCreate(kCFAllocatorDefault,(CFStringRef)path);
CFArrayRef attributeNames = MDItemCopyAttributeNames(inspectedRef);

NSLog(@"%@", (NSArray*)attributeNames);


I was hoping that including the 'CoreServices' framework would work, but
no joy.

>> framework 'CoreServices'
=> true
>> item = MDItemCreate(KCFAllocatorDefault, '/Users/alan/Desktop/test.jpg')
NameError: uninitialized constant KCFAllocatorDefault
from core:in `const_missing:'
from (irb):2:in `'
from core:in `eval:'
from core:in `evaluate:'
-- 
  Alan Skipp
  [email protected]

-- 
http://www.fastmail.fm - IMAP accessible web-mail

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


Re: [MacRuby-devel] spotlight - MDItemRef

2009-10-27 Thread Laurent Sansonetti

Hi Alan,

I'm afraid the MD* APIs haven't been covered by BridgeSupport yet, so  
it may not be possible to call it directly from MacRuby at this point.  
I would recommend to file a bug at http://bugreporter.apple.com so  
that we can consider this for a future Mac OS X release, and to wrap  
this C API into an Objective-C class that you can call from MacRuby in  
the meantime.


Laurent

On Oct 27, 2009, at 5:13 PM, Alan Skipp wrote:


Would anyone be able to give me a hint on how to get the following
objective-c code working with macruby. The code uses spotlight to
extract metadata from a file.

MDItemRef inspectedRef =
MDItemCreate(kCFAllocatorDefault,(CFStringRef)path);
CFArrayRef attributeNames = MDItemCopyAttributeNames(inspectedRef);

NSLog(@"%@", (NSArray*)attributeNames);


I was hoping that including the 'CoreServices' framework would work,  
but

no joy.


framework 'CoreServices'

=> true
item = MDItemCreate(KCFAllocatorDefault, '/Users/alan/Desktop/ 
test.jpg')

NameError: uninitialized constant KCFAllocatorDefault
from core:in `const_missing:'
from (irb):2:in `'
from core:in `eval:'
from core:in `evaluate:'
--
 Alan Skipp
 [email protected]

--
http://www.fastmail.fm - IMAP accessible web-mail

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


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


Re: [MacRuby-devel] [MacRuby] #90: macruby fails to install (problem with File.join)

2009-10-27 Thread MacRuby
#90: macruby fails to install (problem with File.join)
---+
 Reporter:  jakub.su...@…  |Owner:  lsansone...@…
 Type:  defect |   Status:  closed   
 Priority:  blocker|Milestone:  MacRuby 0.5  
Component:  MacRuby|   Resolution:  fixed
 Keywords: |  
---+
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed
  * milestone:  => MacRuby 0.5


Comment:

 This should probably be fixed now.

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #334: MacIrb hangs after require on Snow Leopard

2009-10-27 Thread MacRuby
#334: MacIrb hangs after require on Snow Leopard
-+--
 Reporter:  rwa...@… |Owner:  lsansone...@…
 Type:  defect   |   Status:  closed   
 Priority:  blocker  |Milestone:  MacRuby 0.5  
Component:  MacRuby  |   Resolution:  fixed
 Keywords:   |  
-+--
Changes (by lsansone...@…):

  * status:  new => closed
  * resolution:  => fixed


Comment:

 This should be fixed since a long time and at least in 0.5 beta1.

-- 
Ticket URL: 
MacRuby 

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


[MacRuby-devel] [MacRuby] #405: Uncaught exception building RubyGems

2009-10-27 Thread MacRuby
#405: Uncaught exception building RubyGems
---+
 Reporter:  hungerandthi...@…  |   Owner:  lsansone...@…
   
 Type:  defect |  Status:  new  
   
 Priority:  blocker|   Milestone:  MacRuby 0.5  
   
Component:  MacRuby|Keywords:  macruby, rubygems, 
exception
---+
 Trying to build RubyGems with macruby throws:

 {{{
 uncaught Objective-C/C++ exception...
 terminate called after throwing an instance of
 'RoxorReturnFromBlockException*'
 }}}

-- 
Ticket URL: 
MacRuby 

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


Re: [MacRuby-devel] [MacRuby] #405: Uncaught exception building RubyGems

2009-10-27 Thread MacRuby
#405: Uncaught exception building RubyGems
---+
 Reporter:  hungerandthi...@…  |   Owner:  lsansone...@…
   
 Type:  defect |  Status:  new  
   
 Priority:  blocker|   Milestone:  MacRuby 0.5  
   
Component:  MacRuby|Keywords:  macruby, rubygems, 
exception
---+

Comment(by lsansone...@…):

 Could you provide more information about what you are trying to do? It's
 impossible to determine from what you gave us.

-- 
Ticket URL: 
MacRuby 

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


[MacRuby-devel] [MacRuby] #406: Can't load gem grit.

2009-10-27 Thread MacRuby
#406: Can't load gem grit.
---+
 Reporter:  hungerandthi...@…  |   Owner:  lsansone...@…
 Type:  defect |  Status:  new  
 Priority:  blocker|   Milestone:  MacRuby 0.5  
Component:  MacRuby|Keywords:  rubygems, grit, gems 
---+
 Sorry to be so specific about not being able to load a specific gem.
 I do this:

 {{{
 require 'rubygems'
 require 'grit'
 include Grit
 }}}

 and get

 {{{
 in `require:': undefined method `[]' for nil:NilClass (NoMethodError).
 }}}

 It seems to be coming from the

 {{{
 require 'rubygems'
 }}}

 inside of grit.rb. If I disable this line, it includes it with the
 following warnings:

 {{{
 unknown: warning: already initialized constant VERSION
 unknown: warning: already initialized constant MEDIA_TYPE_RE
 unknown: warning: already initialized constant UNREG_RE
 unknown: warning: already initialized constant ENCODING_RE
 unknown: warning: already initialized constant PLATFORM_RE
 unknown: warning: already initialized constant SIGNATURES
 unknown: warning: already initialized constant IANA_URL
 unknown: warning: already initialized constant RFC_URL
 unknown: warning: already initialized constant DRAFT_URL
 unknown: warning: already initialized constant LTSW_URL
 unknown: warning: already initialized constant CONTACT_URL
 unknown: warning: can't register `extensions' as an KVO setter on class
 `MIME::Type' (method `setExtensions:')
 unknown: warning: can't register `encoding' as an KVO setter on class
 `MIME::Type' (method `setEncoding:')
 unknown: warning: can't register `system' as an KVO setter on class
 `MIME::Type' (method `setSystem:')
 unknown: warning: can't register `obsolete' as an KVO setter on class
 `MIME::Type' (method `setObsolete:')
 unknown: warning: can't register `docs' as an KVO setter on class
 `MIME::Type' (method `setDocs:')
 unknown: warning: can't register `url' as an KVO setter on class
 `MIME::Type' (method `setUrl:')
 unknown: warning: can't register `registered' as an KVO setter on class
 `MIME::Type' (method `setRegistered:')
 unknown: warning: already initialized constant VERSION
 }}}

-- 
Ticket URL: 
MacRuby 

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