Guys, I have InstantRails in my PC. i have written a ruby programm which will copy a file from my document to rails private directory varifying some characteristic of files.Suppose ruby directory is c:/instantsRails/ruby/bin/ruby.exe and my file is in c:/myfile.rb . so how can i create a bat file which can run ruby and run my file? so that each time when i copy file to upload directory and just click the .bat file and do the job. waiting for ur responce. Amin -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
save a text file as blah.bat in the file type ruby myfile.rb save, run and smile :) regards On 3/1/07, Ruhul Amin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Guys, > I have InstantRails in my PC. i have written a ruby programm which will > copy a file from my document to rails private directory varifying some > characteristic of files.Suppose ruby directory is > c:/instantsRails/ruby/bin/ruby.exe and my file is in c:/myfile.rb . so > how can i create a bat file which can run ruby and run my file? so that > each time when i copy file to upload directory and just click the .bat > file and do the job. > > waiting for ur responce. > > > Amin > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ivor Paul wrote:> save a text file as blah.bat > > in the file type > > ruby myfile.rb > > save, run and smile :) > > regardsthanks for ur reply . but I tried it but error was "ruby" command not found. so i guess, i have to first run the ruby.exe and then then run the file by ruby. am I right? if yes then how can I do this? Amin -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
I would guess that ruby isn''t properly installed...or not installed at all, apart from instantRails. if you type "ruby -v" in a cmd you should get a line telling you which version of ruby you have installed... instantrails contains ruby so that rails applications can run in the instantrails sandbox, but it does not install as a os wide application/service...I''m out of my depth with the vocab. Basically, if you download and install ruby http://rubyforge.org/frs/?group_id=167 it will install and you will be able to run ruby anywhere in a command line. On 3/1/07, Ruhul Amin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Ivor Paul wrote: > > save a text file as blah.bat > > > > in the file type > > > > ruby myfile.rb > > > > save, run and smile :) > > > > regards > > thanks for ur reply . but I tried it but error was > > "ruby" command not found. > so i guess, i have to first run the ruby.exe and then then run the file > by ruby. > > am I right? if yes then how can I do this? > > > Amin > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On 3/1/07, Ruhul Amin <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > Ivor Paul wrote: > > save a text file as blah.bat > > > > in the file type > > > > ruby myfile.rb > > > > save, run and smile :) > > > > regards > > thanks for ur reply . but I tried it but error was > > "ruby" command not found. > so i guess, i have to first run the ruby.exe and then then run the file > by ruby. > > am I right? if yes then how can I do this?The problem your are having is because of one of the features of Instant Rails: the fact that it does not modify your system environment. IR''s ruby\bin directory is not on your system path (as it would be with a normal Ruby installation). If you don''t plan to move IR at all (for example, you don''t have it on a flash drive), then the simplest thing would be to put IR''s ruby\bin on the path. Another alternative would be to put your bat file in IR''s ruby\bin directory and then at runtime use the path to the bat file to construct a path to ruby\bin\ruby.exe. For examples of doing this, look at the bat files already in the ruby\bin directory. Curt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ruhul Amin wrote:> Ivor Paul wrote: >> save a text file as blah.bat >> >> in the file type >> >> ruby myfile.rb >> >> save, run and smile :) >> >> regards > > thanks for ur reply . but I tried it but error was > > "ruby" command not found. > so i guess, i have to first run the ruby.exe and then then run the file > by ruby. > > am I right? if yes then how can I do this? > > > AminPerhaps the path to your ruby.exe is not included in your PATH environment variable in Windows. If so, either edit your PATH to include it, or else add the full path to the ruby.exe to your batch file: c:\InstantRails\bin\ruby.exe myfile.rb [Your actual path may vary from that shown above] -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
David wrote:> Ruhul Amin wrote: > >> Ivor Paul wrote: >> >>> save a text file as blah.bat >>> >>> in the file type >>> >>> ruby myfile.rb >>> >>> save, run and smile :) >>> >>> regards >>> >> thanks for ur reply . but I tried it but error was >> >> "ruby" command not found. >> so i guess, i have to first run the ruby.exe and then then run the file >> by ruby. >> >> am I right? if yes then how can I do this? >> >> >> Amin >> > > Perhaps the path to your ruby.exe is not included in your PATH > environment variable in Windows. If so, either edit your PATH to include > it, or else add the full path to the ruby.exe to your batch file: > > c:\InstantRails\bin\ruby.exe myfile.rb > > [Your actual path may vary from that shown above] > >This should help you, it''s from my .bat files that run ruby scripts. Of course, fix the paths to match yours. <code> echo off cls REM Set up the environment variables for the script set PATH_TO_RUBY=D:\InstantRails\ruby\bin set RUBY=%PATH_TO_RUBY%\ruby.exe set PATH_TO_SCRIPTS=F:\Projects\autoscripts %RUBY% %PATH_TO_SCRIPTS%\MyRubyScript1.rb %RUBY% %PATH_TO_SCRIPTS%\MyRubyScript2.rb %RUBY% %PATH_TO_SCRIPTS%\MyRubyScript3.rb </code> If you want it to be something that starts asynchronously (in the sense that it starts in a separate Command window and does not hold up the original .bat file which is starting your script, you could also use: <code> start %RUBY% %PATH_TO_SCRIPTS%\AnotherScript.rb </code> Hope this helps! Cheers Mohit. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
thanks for clarifying that for me as well! On 3/1/07, David <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> > > Ruhul Amin wrote: > > Ivor Paul wrote: > >> save a text file as blah.bat > >> > >> in the file type > >> > >> ruby myfile.rb > >> > >> save, run and smile :) > >> > >> regards > > > > thanks for ur reply . but I tried it but error was > > > > "ruby" command not found. > > so i guess, i have to first run the ruby.exe and then then run the file > > by ruby. > > > > am I right? if yes then how can I do this? > > > > > > Amin > > Perhaps the path to your ruby.exe is not included in your PATH > environment variable in Windows. If so, either edit your PATH to include > it, or else add the full path to the ruby.exe to your batch file: > > c:\InstantRails\bin\ruby.exe myfile.rb > > [Your actual path may vary from that shown above] > > -- > Posted via http://www.ruby-forum.com/. > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---