Hi All,
I would like to do this -> my_script arg1, arg2
This doesn't seem to work when the script has arguments.
But if I type -> ruby my_script arg1,arg2
It works fine.
Is there a way I can run the my_script without typing ruby each time?
Thanks
Hi All,
I would like to do this -> my_script arg1, arg2
This doesn't seem to work when the script has arguments.
But if I type -> ruby my_script arg1,arg2
It works fine.
Is there a way I can run the my_script without typing ruby each time?
Thanks
chmod a+x my_script (restrict permissions if you want)
./my_script args
or put my_script in your PATH, and just type `my_script args'
On Mon, Nov 24, 2008 at 4:47 PM, Jayson Williams <williams.jayson@gmail.com> wrote:
Hi All,
I would like to do this -> my_script arg1, arg2
This doesn't seem to work when the script has arguments.But if I type -> ruby my_script arg1,arg2
It works fine.Is there a way I can run the my_script without typing ruby each time?
Thanks
--
Diogo
on any *nix platform, make the script executable and put a hash-bang line at the top
chmod 755 my_script
vim my_script
i#!/usr/bin/env ruby<Return><Esc>:wq
my_script arg1 arg2
Blessings,
TwP
On Nov 24, 2008, at 11:47 AM, Jayson Williams wrote:
Hi All,
I would like to do this -> my_script arg1, arg2
This doesn't seem to work when the script has arguments.But if I type -> ruby my_script arg1,arg2
It works fine.Is there a way I can run the my_script without typing ruby each time?
#!/usr/bin/env ruby
Yes, I forgot the shebang.
Diogo
I am using win os, so the shabang thing isn't an option for me. I put
the script in my ruby bin path, and I can access the script from
anywhere now, but I still have the same problem with the script not
running properly unless i type ruby first. It is as if ruby does not
attempt to read in arguments unless you explicitly pass the script
through ruby. If I call the script with the arguments without putting
'ruby' first, the args don't seem to get read.
On Mon, Nov 24, 2008 at 2:05 PM, Diogo Lisboa <diogoslisboa@gmail.com> wrote:
chmod a+x my_script (restrict permissions if you want)
./my_script argsor put my_script in your PATH, and just type `my_script args'
On Mon, Nov 24, 2008 at 4:47 PM, Jayson Williams > <williams.jayson@gmail.com> wrote:
Hi All,
I would like to do this -> my_script arg1, arg2
This doesn't seem to work when the script has arguments.But if I type -> ruby my_script arg1,arg2
It works fine.Is there a way I can run the my_script without typing ruby each time?
Thanks--
Diogo
Yep, in Windows you have to invoke ruby first on the command line. The
shebang in the Unix world is kind of a short hand for doing this.
On Mon, Nov 24, 2008 at 2:12 PM, Jayson Williams <williams.jayson@gmail.com>wrote:
I am using win os, so the shabang thing isn't an option for me. I put
the script in my ruby bin path, and I can access the script from
anywhere now, but I still have the same problem with the script not
running properly unless i type ruby first. It is as if ruby does not
attempt to read in arguments unless you explicitly pass the script
through ruby. If I call the script with the arguments without putting
'ruby' first, the args don't seem to get read.On Mon, Nov 24, 2008 at 2:05 PM, Diogo Lisboa <diogoslisboa@gmail.com> > wrote:
> chmod a+x my_script (restrict permissions if you want)
> ./my_script args
>
> or put my_script in your PATH, and just type `my_script args'
>
> On Mon, Nov 24, 2008 at 4:47 PM, Jayson Williams > > <williams.jayson@gmail.com> wrote:
>> Hi All,
>>
>> I would like to do this -> my_script arg1, arg2
>> This doesn't seem to work when the script has arguments.
>>
>> But if I type -> ruby my_script arg1,arg2
>> It works fine.
>>
>> Is there a way I can run the my_script without typing ruby each time?
>> Thanks
>>
>>
>
>
>
> --
> Diogo
>
>
--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."
-Greg Graffin (Bad Religion)
Jayson, if your not on a real OS, you need to associate the extension
.rb with the interpreter. It's been a little while since I've done
this in windows, but it's actually pretty straightforward. You may
have to google for how to associate the script with the interpreter
though, as I don't recall the _exact_ steps.
--Kyle
On Mon, Nov 24, 2008 at 3:12 PM, Jayson Williams <williams.jayson@gmail.com> wrote:
I am using win os, so the shabang thing isn't an option for me. I put
the script in my ruby bin path, and I can access the script from
anywhere now, but I still have the same problem with the script not
running properly unless i type ruby first. It is as if ruby does not
attempt to read in arguments unless you explicitly pass the script
through ruby. If I call the script with the arguments without putting
'ruby' first, the args don't seem to get read.
Jayson Williams wrote:
I am using win os, so the shabang thing isn't an option for me. I put
the script in my ruby bin path, and I can access the script from
anywhere now, but I still have the same problem with the script not
running properly unless i type ruby first. It is as if ruby does not
attempt to read in arguments unless you explicitly pass the script
through ruby. If I call the script with the arguments without putting
'ruby' first, the args don't seem to get read.
With my one-click-install it works just fine. This is my test1.rb:
puts ARGV
#when called like this:
#test1.rb first second
#it produces
#first
#second
hth,
Siep
--
Posted via http://www.ruby-forum.com/\.
If you absolutely must get rid of the need to type ruby first you could use
rubyscript2exe to build a windows exe file out of your script.
On Mon, Nov 24, 2008 at 2:21 PM, Glen Holcomb <damnbigman@gmail.com> wrote:
On Mon, Nov 24, 2008 at 2:12 PM, Jayson Williams < > williams.jayson@gmail.com> wrote:
I am using win os, so the shabang thing isn't an option for me. I put
the script in my ruby bin path, and I can access the script from
anywhere now, but I still have the same problem with the script not
running properly unless i type ruby first. It is as if ruby does not
attempt to read in arguments unless you explicitly pass the script
through ruby. If I call the script with the arguments without putting
'ruby' first, the args don't seem to get read.On Mon, Nov 24, 2008 at 2:05 PM, Diogo Lisboa <diogoslisboa@gmail.com> >> wrote:
> chmod a+x my_script (restrict permissions if you want)
> ./my_script args
>
> or put my_script in your PATH, and just type `my_script args'
>
> On Mon, Nov 24, 2008 at 4:47 PM, Jayson Williams >> > <williams.jayson@gmail.com> wrote:
>> Hi All,
>>
>> I would like to do this -> my_script arg1, arg2
>> This doesn't seem to work when the script has arguments.
>>
>> But if I type -> ruby my_script arg1,arg2
>> It works fine.
>>
>> Is there a way I can run the my_script without typing ruby each time?
>> Thanks
>>
>>
>
>
>
> --
> Diogo
>
>Yep, in Windows you have to invoke ruby first on the command line. The
shebang in the Unix world is kind of a short hand for doing this.--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."-Greg Graffin (Bad Religion)
--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."
-Greg Graffin (Bad Religion)
And here I am forgetting the simple steps, doh!
On Mon, Nov 24, 2008 at 2:26 PM, Kyle Schmitt <kyleaschmitt@gmail.com>wrote:
On Mon, Nov 24, 2008 at 3:12 PM, Jayson Williams > <williams.jayson@gmail.com> wrote:
> I am using win os, so the shabang thing isn't an option for me. I put
> the script in my ruby bin path, and I can access the script from
> anywhere now, but I still have the same problem with the script not
> running properly unless i type ruby first. It is as if ruby does not
> attempt to read in arguments unless you explicitly pass the script
> through ruby. If I call the script with the arguments without putting
> 'ruby' first, the args don't seem to get read.Jayson, if your not on a real OS, you need to associate the extension
.rb with the interpreter. It's been a little while since I've done
this in windows, but it's actually pretty straightforward. You may
have to google for how to associate the script with the interpreter
though, as I don't recall the _exact_ steps.--Kyle
--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."
-Greg Graffin (Bad Religion)
Doesn't seem to work that way for me. I created a file called args.rb
that looks like this
puts ARGV[0]
#end
This is what I get
args.rb hello
nil
ruby args.rb hello
hello
I think in the first example ruby is using my arguments for the
interpreter. Any ideas how I can tell ruby to use the arguments for
the script and not the interpreter?
Jayson
On Mon, Nov 24, 2008 at 4:53 PM, Siep Korteling <s.korteling@gmail.com> wrote:
Jayson Williams wrote:
I am using win os, so the shabang thing isn't an option for me. I put
the script in my ruby bin path, and I can access the script from
anywhere now, but I still have the same problem with the script not
running properly unless i type ruby first. It is as if ruby does not
attempt to read in arguments unless you explicitly pass the script
through ruby. If I call the script with the arguments without putting
'ruby' first, the args don't seem to get read.With my one-click-install it works just fine. This is my test1.rb:
puts ARGV
#when called like this:
#test1.rb first second
#it produces
#first
#secondhth,
Siep
--
Posted via http://www.ruby-forum.com/\.
Kyle Schmitt wrote:
Jayson, if your not on a real OS, you need to associate the extension
.rb with the interpreter. It's been a little while since I've done
this in windows, but it's actually pretty straightforward. You may
have to google for how to associate the script with the interpreter
though, as I don't recall the _exact_ steps.
That *used* to happen when installing the 1-click[sic] version.
(It's in the PATHEXT system environment variable. I think there has to be something n the registry as well, but you could get that by right-clicking a .rb file and selecting the app to always open files of that type.)
Anyways, on my Vista box, it all works fine. I type the name of a script, no file extension, passing args, and all is super cool awesome.
I've never had to explicitly invoke ruby, even on XP. It's one case where Windows did the right thing reliably. ![]()
--
James Britt
www.happycamperstudios.com - Wicked Cool Coding
www.jamesbritt.com - Playing with Better Toys
www.ruby-doc.org - Ruby Help & Documentation
www.rubystuff.com - The Ruby Store for Ruby Stuff
The associations are correct. I reset them just to be sure though. I
can execute the script without ruby, and it runs, but without ruby
first, the args are not getting read.
The rubyscript2exe suggestion worked. Thanks Glen
Thanks everyone for the feedback
On Mon, Nov 24, 2008 at 4:18 PM, Glen Holcomb <damnbigman@gmail.com> wrote:
On Mon, Nov 24, 2008 at 2:21 PM, Glen Holcomb <damnbigman@gmail.com> wrote:
On Mon, Nov 24, 2008 at 2:12 PM, Jayson Williams < >> williams.jayson@gmail.com> wrote:
I am using win os, so the shabang thing isn't an option for me. I put
the script in my ruby bin path, and I can access the script from
anywhere now, but I still have the same problem with the script not
running properly unless i type ruby first. It is as if ruby does not
attempt to read in arguments unless you explicitly pass the script
through ruby. If I call the script with the arguments without putting
'ruby' first, the args don't seem to get read.On Mon, Nov 24, 2008 at 2:05 PM, Diogo Lisboa <diogoslisboa@gmail.com> >>> wrote:
> chmod a+x my_script (restrict permissions if you want)
> ./my_script args
>
> or put my_script in your PATH, and just type `my_script args'
>
> On Mon, Nov 24, 2008 at 4:47 PM, Jayson Williams >>> > <williams.jayson@gmail.com> wrote:
>> Hi All,
>>
>> I would like to do this -> my_script arg1, arg2
>> This doesn't seem to work when the script has arguments.
>>
>> But if I type -> ruby my_script arg1,arg2
>> It works fine.
>>
>> Is there a way I can run the my_script without typing ruby each time?
>> Thanks
>>
>>
>
>
>
> --
> Diogo
>
>Yep, in Windows you have to invoke ruby first on the command line. The
shebang in the Unix world is kind of a short hand for doing this.--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."-Greg Graffin (Bad Religion)
If you absolutely must get rid of the need to type ruby first you could use
rubyscript2exe to build a windows exe file out of your script.--
"Hey brother Christian with your high and mighty errand, Your actions speak
so loud, I can't hear a word you're saying."-Greg Graffin (Bad Religion)
Glen Holcomb wrote:
If you absolutely must get rid of the need to type ruby first you could use
rubyscript2exe to build a windows exe file out of your script.
You can associate .rb files with the Ruby Interpreter - that should do it. That's how One Click Install sets it up so that if you double click on it, it will just run the script rather than open it in an editor.
Cheers,
Mohit.
11/25/2008 | 1:10 PM.
Jayson, hum. I guess that makes sense. Now that I'm thinking back I
never used command line options on my windows-ruby stuff, and I do
recall having to go through extra (extra ugly too) hoops to get some
of my vbscripts to read options from the command line properly. The
rubyscript2exe is probably the best way to go anyway ![]()
On Mon, Nov 24, 2008 at 3:39 PM, Jayson Williams <williams.jayson@gmail.com> wrote:
The associations are correct. I reset them just to be sure though. I
can execute the script without ruby, and it runs, but without ruby
first, the args are not getting read.The rubyscript2exe suggestion worked. Thanks Glen
Thanks everyone for the feedback
Jayson Williams wrote:
The associations are correct. I reset them just to be sure though. I
can execute the script without ruby, and it runs, but without ruby
first, the args are not getting read.
Are command-line arguments included in the file association?
There should be something like "...\ruby.exe" "$*" or
"...\ruby.exe" "%1" "%2" "%3" "%4" "%5" (up to %9, this form is
restricted to 9 arguments).
Daniel
FWIW, I never had problems calling Ruby scripts with command line
args, and I just enter the script name without "ruby". Currently I'm
using the OCI on Windows 2000...
Regards,
Pit
2008/11/24 Kyle Schmitt <kyleaschmitt@gmail.com>:
Jayson, hum. I guess that makes sense. Now that I'm thinking back I
never used command line options on my windows-ruby stuff, (...)
How about creating a .bat file with:
ruby my_script %*
At least, I think it's %*.
On Tue, Nov 25, 2008 at 5:55 AM, Kyle Schmitt <kyleaschmitt@gmail.com> wrote:
On Mon, Nov 24, 2008 at 3:39 PM, Jayson Williams > <williams.jayson@gmail.com> wrote:
The associations are correct. I reset them just to be sure though. I
can execute the script without ruby, and it runs, but without ruby
first, the args are not getting read.The rubyscript2exe suggestion worked. Thanks Glen
Thanks everyone for the feedback
Jayson, hum. I guess that makes sense. Now that I'm thinking back I
never used command line options on my windows-ruby stuff, and I do
recall having to go through extra (extra ugly too) hoops to get some
of my vbscripts to read options from the command line properly. The
rubyscript2exe is probably the best way to go anyway
--
jorrel
Daniel,
I don't believe these arguments are included in the association. I am
not sure how to add them.
On Tue, Nov 25, 2008 at 12:00 PM, Daniel Schömer <daniel.schoemer@gmx.net> wrote:
Jayson Williams wrote:
The associations are correct. I reset them just to be sure though. I
can execute the script without ruby, and it runs, but without ruby
first, the args are not getting read.Are command-line arguments included in the file association?
There should be something like "...\ruby.exe" "$*" or
"...\ruby.exe" "%1" "%2" "%3" "%4" "%5" (up to %9, this form is
restricted to 9 arguments).Daniel
Daniel Schömer wrote:
Jayson Williams wrote:
The associations are correct. I reset them just to be sure though. I
can execute the script without ruby, and it runs, but without ruby
first, the args are not getting read.
Are command-line arguments included in the file association?
There should be something like "...\ruby.exe" "$*" or
"...\ruby.exe" "%1" "%2" "%3" "%4" "%5" (up to %9, this form is
restricted to 9 arguments).Daniel
OK! I have it here... I just checked through the Windows XP stuff on my PC...
I think this is what you need to do.
1. Open a folder.
2. Select Tools > Folder Options
3. Tab: File Types
4. Scroll down till you find RB in the list
5. In the box that says 'Details for ...' click on [Advanced]
6. There is a box called 'Actions'
7. Select the open action - create a new one called open if it isn't there
8. In the pop-up window, these are my settings:
Action: open
Application used to perform this action: "c:\ruby\bin\ruby.exe" "%1" %*
use DDE
Application: ruby
Topic: System
(other fields blank)
[OK]
Try?
Cheers,
Mohit.
11/26/2008 | 1:50 AM.