5 Replies Latest reply on Dec 4, 2013 10:00 AM by Jon Tara

    Ruby IRB vs Rhodes Ruby IRB

    Glenn Sayer

      It looks like some commands that work IRB Ruby don’t work in Rhodes Ruby.  Have some Ruby commands been removed in Rhodes?

       

      Is there a document that explains what has been removed or is there a IRB for Rhodes Ruby?

        • Re: Ruby IRB vs Rhodes Ruby IRB

          Hi Glenn,

           

          We did not remove anything from Ruby VM, so Rhodes Ruby is the same general Ruby.

           

          Regarding the command line interface to Ruby, it is not part of the Rhodes at all.

           

          Maybe I can answer in more details if you describe your app/development scenario and what are you trying to achieve.

           

          Regards,

          Albert

            • Re: Ruby IRB vs Rhodes Ruby IRB
              Glenn Sayer

              After further investigation, it is appearing that this is
              not a Rhodes Ruby vs regular Ruby thing, but rather some objects are included
              in rhosimulator that are not included in the build/run win32.  The specific example of URI.encode is shown
              below.  I believe we have had the same
              issues with CGI and Sockets.

               

               

               

               

               

              code:
              WebView.navigate("/app/Loading/index?msg=#{URI.encode('Syncing,

               

               

              please wait.
              ')}&destination=/app/Settings/wait_for_sync")

               

               

              Result using run:win32:rhosimulator

               

               

              (Embedded image moved to file: pic06511.gif)

               

               

               

               

               

              Result using run:win32 (The error in the logs is URI is
              an undefined constant, and if I do manual URL encoding it works) (Embedded
              image moved to file: pic22741.gif)

            • Re: Ruby IRB vs Rhodes Ruby IRB
              Jon Tara

              Just to make sure you understand Albert's previous response: there is no IRB in Rhodes. You cannot do any testing of Rhodes apps or Rhodes Ruby using IRB.

               

              When you run IRB, you are running your desktop Ruby IRB. You will have the Ruby library and Gems installed on your desktop system. The Ruby used in Rhodes is different, and is embedded within the Rhodes Gem. It has a truncated Ruby library, and no support at all for Gems. (It supports Rhodes extensions instead.)

               

              When you build your project, all of your Ruby code is compiled to Ruby byte code. At run-time, the byte code is interpreted.

               

              I think that RhoSimulator does use your desktop Ruby, though, and so you will have library functions available that are not present in Rhodes. Obviously, you should not use them.

               

              I do not use RhoSimulator, because I feel it is too far from reality to be useful.

                • Re: Ruby IRB vs Rhodes Ruby IRB
                  Glenn Sayer

                  Jon,

                   

                  Thanks for the explanation.  Your response about the Rhodes Gem has a truncated Ruby Lib is the question.  What Ruby functionality is truncated out of the Rhodes Gem?

                   

                  If IRB is not a valid Ruby test tool then what is for the Rhodes Ruby?

                    • Re: Ruby IRB vs Rhodes Ruby IRB
                      Jon Tara

                      You will have to check the docs for exactly what library functionality is missing. Quite a bit of the missing stuff is actually available in Rhodes as optional extensions - you need only enable the extension(s). See the docs on extensions. Net::HTTP is a good example of omitted library code that is available as a Rhodes extension.

                       

                      I do use IRB and/or simple command-line applications for testing of non-UI code. I make sure to match the same version of Ruby used in Rhodes. You just need to be aware that you are not testing using the actual Ruby/library that will be used when you build your application.

                       

                      I do most testing by writing to the log. Yes, it's crude. There's a debugger in RhoSimulator, some other members of our team have used it, but I avoid the RhoSimulator because it's not a realistic environment.