Zoltan Toth
2009-Oct-02 07:45 UTC
[Ironruby-core] Newbie questions regarding IronRuby in Silverlight...
Hi Guys, How do we, for example, use BigDecimal in IronRuby within a Silverlight application? When we just require ''bigdecimal'', we get an error saying that file can''t be found. Do we have to add that and other ruby standard library files to our application and if so, where do we put them? Note that we are actually developing a standard (non-dynamic) C# Silverlight application (and hence are not using Chiron) and wish merely to execute ruby scripts client-side at various times. We would like these scripts to be split into different files, for obvious reasons. We envisage that certain files (i.e. standard library and other non changing code) may well be bound into the xap file somehow and other files may well be dynamically obtained from the back-end. So far, we''ve been able to execute ruby files deployed as "Build Action: Resource" in VS2008 but, we have not, as yet, been able to get one file to require another in a similar manner to the Chiron demos in IronRuby 0.9.1. (i.e. app.rb requires Silverlight.rb). Any help would be greatly appreciated, Thanks, Zoltan. -- Posted via http://www.ruby-forum.com/.
Ivan Porto Carrero
2009-Oct-02 08:20 UTC
[Ironruby-core] Newbie questions regarding IronRuby in Silverlight...
But that will include all the files and gems you have installed on your machine for ironruby. It might be a better idea to copy the ruby files you need into a folder in your project. You can use them as an embedded resource and then execute their code in order to require them ExecuteScript does that for you. If you want to use the plain ruby require syntax then you can include them in the root folder of what gets included in the xap. If your Silverlight application is a DynamicApplication then you have the necessary PAL loaded and you can use plain require statements --- Met vriendelijke groeten - Best regards - Salutations Ivan Porto Carrero Blog: http://flanders.co.nz Twitter: http://twitter.com/casualjim Author of IronRuby in Action (http://manning.com/carrero) On Fri, Oct 2, 2009 at 10:05 AM, Shay Friedman <shay.friedman at gmail.com>wrote:> I guess you will need to add the path to the libs directory when creating > the XAP file. > When you create a XAP file with Chiron, there is a /path switch where you > can pass semi-colon separated values with paths to include in the XAP file. > Something like: > chr /z:myfile.xap /path:c:\IronRuby\libs > > Have you tried that? > > All the best, > Shay. > > ------------------------------------------ > Shay Friedman > Author of IronRuby Unleashed > http://www.IronShay.com > Follow me: http://twitter.com/ironshay > > > On Fri, Oct 2, 2009 at 9:45 AM, Zoltan Toth <lists at ruby-forum.com> wrote: > >> Hi Guys, >> >> How do we, for example, use BigDecimal in IronRuby within a Silverlight >> application? When we just require ''bigdecimal'', we get an error saying >> that file can''t be found. Do we have to add that and other ruby >> standard library files to our application and if so, where do we put >> them? >> >> Note that we are actually developing a standard (non-dynamic) C# >> Silverlight application (and hence are not using Chiron) and wish merely >> to execute ruby scripts client-side at various times. We would like >> these scripts to be split into different files, for obvious reasons. We >> envisage that certain files (i.e. standard library and other non >> changing code) may well be bound into the xap file somehow and other >> files may well be dynamically obtained from the back-end. >> >> So far, we''ve been able to execute ruby files deployed as "Build Action: >> Resource" in VS2008 but, we have not, as yet, been able to get one file >> to require another in a similar manner to the Chiron demos in IronRuby >> 0.9.1. (i.e. app.rb requires Silverlight.rb). >> >> Any help would be greatly appreciated, >> >> Thanks, >> >> Zoltan. >> -- >> Posted via http://www.ruby-forum.com/. >> _______________________________________________ >> Ironruby-core mailing list >> Ironruby-core at rubyforge.org >> http://rubyforge.org/mailman/listinfo/ironruby-core >> > > > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core > >-------------- next part -------------- An HTML attachment was scrubbed... URL: <http://rubyforge.org/pipermail/ironruby-core/attachments/20091002/7325d3c3/attachment.html>
Zoltan Toth
2009-Oct-04 23:35 UTC
[Ironruby-core] Newbie questions regarding IronRuby in Silverlight...
Many thanks to all of your input. Much appreciated! I''ll try your suggestions over the next few days and let you know the results. Thanks again, Zoltan. -- Posted via http://www.ruby-forum.com/.
Zoltan Toth
2009-Oct-12 22:26 UTC
[Ironruby-core] Newbie questions regarding IronRuby in Silverlight...
Once again thanks, we were able to get things working. Please note that we have offline requirements that require us to deploy the portions of the ruby standard library that we require, within our Silverlight application. My only other question is why does IronRuby ship with what appears to be two versions of the Ruby standard library? There appears to be a standard implementation (i.e. \lib\ruby\1.8 for IronRuby 0.9.1) that uses ruby scripts and there also appears to be an implementation that calls into the CLR (i.e. \lib\IronRuby) in order to do its stuf. Do we have a choice of which to use or do we need to deploy both? Many thanks for your help. Zoltan. -- Posted via http://www.ruby-forum.com/.
Nathan Stults
2009-Oct-12 22:28 UTC
[Ironruby-core] Newbie questions regarding IronRuby in Silverlight...
I''ve been pondering the exact same thing - it is a touch confusing. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Zoltan Toth Sent: Monday, October 12, 2009 3:26 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core]Newbie questions regarding IronRuby in Silverlight... Once again thanks, we were able to get things working. Please note that we have offline requirements that require us to deploy the portions of the ruby standard library that we require, within our Silverlight application. My only other question is why does IronRuby ship with what appears to be two versions of the Ruby standard library? There appears to be a standard implementation (i.e. \lib\ruby\1.8 for IronRuby 0.9.1) that uses ruby scripts and there also appears to be an implementation that calls into the CLR (i.e. \lib\IronRuby) in order to do its stuf. Do we have a choice of which to use or do we need to deploy both? Many thanks for your help. Zoltan. -- Posted via http://www.ruby-forum.com/. _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Jimmy Schementi
2009-Oct-12 22:49 UTC
[Ironruby-core] Newbie questions regarding IronRuby in Silverlight...
There are not two copies, one is ruby stdlib, and one is IronRuby''s own lib. The ruby stdlib contains pieces implemented in ruby, as well as C. In IronRuby we ported all the C stuff to C# (that''s what IronRuby.Libraries.dll is), and redistribute the ruby code. So both directories are all part of the standard library. For Silverlight, I would suggest you only deploy the files that you use; the entire stdlib is fairly large. ~Jimmy Sent from my phone On Oct 12, 2009, at 3:26 PM, "Zoltan Toth" <lists at ruby-forum.com> wrote:> Once again thanks, we were able to get things working. Please note > that > we have offline requirements that require us to deploy the portions of > the ruby standard library that we require, within our Silverlight > application. > > My only other question is why does IronRuby ship with what appears > to be > two versions of the Ruby standard library? There appears to be a > standard implementation (i.e. \lib\ruby\1.8 for IronRuby 0.9.1) that > uses ruby scripts and there also appears to be an implementation that > calls into the CLR (i.e. \lib\IronRuby) in order to do its stuf. Do > we > have a choice of which to use or do we need to deploy both? > > Many thanks for your help. > > Zoltan. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >
Nathan Stults
2009-Oct-12 22:58 UTC
[Ironruby-core] Newbie questions regardingIronRuby in Silverlight...
Is anyone aware of a tool that can recursively detect (and possibly extract) ruby dependencies given a top level .rb, or set of .rb files? I could see it being a tedious process to discover manually what components of the standard library were used by any given application. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jimmy Schementi Sent: Monday, October 12, 2009 3:49 PM To: <ironruby-core at rubyforge.org> Cc: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Newbie questions regardingIronRuby in Silverlight... There are not two copies, one is ruby stdlib, and one is IronRuby''s own lib. The ruby stdlib contains pieces implemented in ruby, as well as C. In IronRuby we ported all the C stuff to C# (that''s what IronRuby.Libraries.dll is), and redistribute the ruby code. So both directories are all part of the standard library. For Silverlight, I would suggest you only deploy the files that you use; the entire stdlib is fairly large. ~Jimmy Sent from my phone On Oct 12, 2009, at 3:26 PM, "Zoltan Toth" <lists at ruby-forum.com> wrote:> Once again thanks, we were able to get things working. Please note > that > we have offline requirements that require us to deploy the portions of > the ruby standard library that we require, within our Silverlight > application. > > My only other question is why does IronRuby ship with what appears > to be > two versions of the Ruby standard library? There appears to be a > standard implementation (i.e. \lib\ruby\1.8 for IronRuby 0.9.1) that > uses ruby scripts and there also appears to be an implementation that > calls into the CLR (i.e. \lib\IronRuby) in order to do its stuf. Do > we > have a choice of which to use or do we need to deploy both? > > Many thanks for your help. > > Zoltan. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >_______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Tomas Matousek
2009-Oct-12 23:11 UTC
[Ironruby-core] Newbie questions regardingIronRuby in Silverlight...
It is not possible to completely and reliably automate such task in general. You could run your application and see what files are being required. You can monkey-patch Kernel#require and load so that they log the files being required. However you would need to exercise all code paths that might possibly load a file to get the full list. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Nathan Stults Sent: Monday, October 12, 2009 3:58 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Newbie questions regardingIronRuby in Silverlight... Is anyone aware of a tool that can recursively detect (and possibly extract) ruby dependencies given a top level .rb, or set of .rb files? I could see it being a tedious process to discover manually what components of the standard library were used by any given application. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jimmy Schementi Sent: Monday, October 12, 2009 3:49 PM To: <ironruby-core at rubyforge.org> Cc: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Newbie questions regardingIronRuby in Silverlight... There are not two copies, one is ruby stdlib, and one is IronRuby''s own lib. The ruby stdlib contains pieces implemented in ruby, as well as C. In IronRuby we ported all the C stuff to C# (that''s what IronRuby.Libraries.dll is), and redistribute the ruby code. So both directories are all part of the standard library. For Silverlight, I would suggest you only deploy the files that you use; the entire stdlib is fairly large. ~Jimmy Sent from my phone On Oct 12, 2009, at 3:26 PM, "Zoltan Toth" <lists at ruby-forum.com> wrote:> Once again thanks, we were able to get things working. Please note > that we have offline requirements that require us to deploy the > portions of the ruby standard library that we require, within our > Silverlight application. > > My only other question is why does IronRuby ship with what appears to > be two versions of the Ruby standard library? There appears to be a > standard implementation (i.e. \lib\ruby\1.8 for IronRuby 0.9.1) that > uses ruby scripts and there also appears to be an implementation that > calls into the CLR (i.e. \lib\IronRuby) in order to do its stuf. Do > we have a choice of which to use or do we need to deploy both? > > Many thanks for your help. > > Zoltan. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >_______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Tomas Matousek
2009-Oct-12 23:16 UTC
[Ironruby-core] Newbie questions regardingIronRuby in Silverlight...
If you want to give it a try anyways you can also pass -ET LOAD_COMPILED command line options to ir.exe to see what files are being loaded. For example: D:\M3\Merlin\Main\Languages\Ruby>rbx -ET LOAD_COMPILED D:\M3\Merlin\Main\Languages\Ruby\Scripts\bin\iirb LOAD_COMPILED: 1: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/irb.rb LOAD_COMPILED: 2: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/e2mmap.rb LOAD_COMPILED: 3: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/irb/init.rb LOAD_COMPILED: 4: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/irb/context.rb LOAD_COMPILED: 5: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/irb/workspace.rb LOAD_COMPILED: 6: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/irb/extend-command.rb LOAD_COMPILED: 7: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/irb/ruby-lex.rb LOAD_COMPILED: 8: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/irb/slex.rb LOAD_COMPILED: 9: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/irb/notifier.rb LOAD_COMPILED: 10: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/irb/output-method.rb LOAD_COMPILED: 11: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/irb/ruby-token.rb LOAD_COMPILED: 12: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/irb/input-method.rb LOAD_COMPILED: 13: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/site_ruby/1.8/readline.rb LOAD_COMPILED: 14: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/site_ruby/1.8/rbreadline.rb LOAD_COMPILED: 15: D:/M3/Merlin/Main/Languages/Ruby/libs/etc.rb LOAD_COMPILED: 16: D:/M3/Merlin/Main/Languages/Ruby/libs/Win32API.rb LOAD_COMPILED: 17: D:/M3/Merlin/External.LCA_RESTRICTED/Languages/Ruby/redist-libs/ruby/1.8/irb/locale.rb irb(main):001:0> Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: Monday, October 12, 2009 4:11 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Newbie questions regardingIronRuby in Silverlight... It is not possible to completely and reliably automate such task in general. You could run your application and see what files are being required. You can monkey-patch Kernel#require and load so that they log the files being required. However you would need to exercise all code paths that might possibly load a file to get the full list. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Nathan Stults Sent: Monday, October 12, 2009 3:58 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Newbie questions regardingIronRuby in Silverlight... Is anyone aware of a tool that can recursively detect (and possibly extract) ruby dependencies given a top level .rb, or set of .rb files? I could see it being a tedious process to discover manually what components of the standard library were used by any given application. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jimmy Schementi Sent: Monday, October 12, 2009 3:49 PM To: <ironruby-core at rubyforge.org> Cc: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Newbie questions regardingIronRuby in Silverlight... There are not two copies, one is ruby stdlib, and one is IronRuby''s own lib. The ruby stdlib contains pieces implemented in ruby, as well as C. In IronRuby we ported all the C stuff to C# (that''s what IronRuby.Libraries.dll is), and redistribute the ruby code. So both directories are all part of the standard library. For Silverlight, I would suggest you only deploy the files that you use; the entire stdlib is fairly large. ~Jimmy Sent from my phone On Oct 12, 2009, at 3:26 PM, "Zoltan Toth" <lists at ruby-forum.com> wrote:> Once again thanks, we were able to get things working. Please note > that we have offline requirements that require us to deploy the > portions of the ruby standard library that we require, within our > Silverlight application. > > My only other question is why does IronRuby ship with what appears to > be two versions of the Ruby standard library? There appears to be a > standard implementation (i.e. \lib\ruby\1.8 for IronRuby 0.9.1) that > uses ruby scripts and there also appears to be an implementation that > calls into the CLR (i.e. \lib\IronRuby) in order to do its stuf. Do > we have a choice of which to use or do we need to deploy both? > > Many thanks for your help. > > Zoltan. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >_______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core
Nathan Stults
2009-Oct-12 23:19 UTC
[Ironruby-core] Newbiequestions regardingIronRuby in Silverlight...
Well, if you have good test coverage for your ruby code, that should be doable :) Probably monkey patching and good tests is the way to go then. In your journeys through the Ruby standard libraries, have you noticed that they tend to require/load dependencies dynamically (i.e. based on magic strings a static automation tool could not follow) fairly frequently? Or is it rather rare? Also, would it be feasible to host the standard libraries on the web and rig up the hosting environment to fall back to a web server if the libraries being dynamically loaded weren''t properly deployed with the app? -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Tomas Matousek Sent: Monday, October 12, 2009 4:11 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Newbiequestions regardingIronRuby in Silverlight... It is not possible to completely and reliably automate such task in general. You could run your application and see what files are being required. You can monkey-patch Kernel#require and load so that they log the files being required. However you would need to exercise all code paths that might possibly load a file to get the full list. Tomas -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Nathan Stults Sent: Monday, October 12, 2009 3:58 PM To: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Newbie questions regardingIronRuby in Silverlight... Is anyone aware of a tool that can recursively detect (and possibly extract) ruby dependencies given a top level .rb, or set of .rb files? I could see it being a tedious process to discover manually what components of the standard library were used by any given application. -----Original Message----- From: ironruby-core-bounces at rubyforge.org [mailto:ironruby-core-bounces at rubyforge.org] On Behalf Of Jimmy Schementi Sent: Monday, October 12, 2009 3:49 PM To: <ironruby-core at rubyforge.org> Cc: ironruby-core at rubyforge.org Subject: Re: [Ironruby-core] Newbie questions regardingIronRuby in Silverlight... There are not two copies, one is ruby stdlib, and one is IronRuby''s own lib. The ruby stdlib contains pieces implemented in ruby, as well as C. In IronRuby we ported all the C stuff to C# (that''s what IronRuby.Libraries.dll is), and redistribute the ruby code. So both directories are all part of the standard library. For Silverlight, I would suggest you only deploy the files that you use; the entire stdlib is fairly large. ~Jimmy Sent from my phone On Oct 12, 2009, at 3:26 PM, "Zoltan Toth" <lists at ruby-forum.com> wrote:> Once again thanks, we were able to get things working. Please note > that we have offline requirements that require us to deploy the > portions of the ruby standard library that we require, within our > Silverlight application. > > My only other question is why does IronRuby ship with what appears to > be two versions of the Ruby standard library? There appears to be a > standard implementation (i.e. \lib\ruby\1.8 for IronRuby 0.9.1) that > uses ruby scripts and there also appears to be an implementation that > calls into the CLR (i.e. \lib\IronRuby) in order to do its stuf. Do > we have a choice of which to use or do we need to deploy both? > > Many thanks for your help. > > Zoltan. > -- > Posted via http://www.ruby-forum.com/. > _______________________________________________ > Ironruby-core mailing list > Ironruby-core at rubyforge.org > http://rubyforge.org/mailman/listinfo/ironruby-core >_______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core _______________________________________________ Ironruby-core mailing list Ironruby-core at rubyforge.org http://rubyforge.org/mailman/listinfo/ironruby-core