Forum: Ruby Launch ruby script from Quicksilver

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E7f7666b77605917fd4cdf801c26355a?d=identicon&s=25 Adam Walters (ajwalters)
on 2008-10-18 23:29
Hello,

I was wondering if anybody knew how to launch a ruby script from
quicksilver?  Ideally, i would like to enter text mode of quicksilver,
enter some text to be passed as an argument and run the ruby script w/
that argument.  However, it seems like the scripts are not running,
passing arguments aside

I created a script test.rb in ~/Library/Application
Support/Quicksilver/Actions and have tried calling it from Quicksilver
but it does not seem to run.  If i run:

ruby test.rb

everything works fine.  If i bring up quicksilver, and launch test.rb,
nothing happens

Anybody have any suggestions?

Thanks
60c6b87c4cc2716c83a737e0ba2d3bc0?d=identicon&s=25 David Rio (Guest)
on 2008-10-18 23:55
(Received via mailing list)
On Sat, Oct 18, 2008 at 4:29 PM, Adam Walters <ajwalters@gmail.com>
wrote:

> but it does not seem to run.  If i run:
>
> ruby test.rb
>
> everything works fine.  If i bring up quicksilver, and launch test.rb,
> nothing happens
>
> Anybody have any suggestions?
>


Have you checked if you get any error in the console? Also, does it work
with regular shell scripts?
D71ee781fc01856cc187c3ce14374c80?d=identicon&s=25 Mikael Høilund (Guest)
on 2008-10-19 00:00
(Received via mailing list)
On Oct 18, 2008, at 23:29, Adam Walters wrote:
> I created a script test.rb in ~/Library/Application
> Support/Quicksilver/Actions and have tried calling it from Quicksilver
> but it does not seem to run.

Put the text `#!/usr/bin/env ruby` in the file as the first line, give
it execute permissions (`chmod +x test.rb` from the terminal), and
restart Quicksilver. Works for me.

I haven't tested this thoroughly, so some steps might be superfluous,
but it definitely works.

--
instance_variable_set(%@\@%sample@%%@ew@.succ, Class.new(&proc{def
self.net;$;,
$/='','/';%;.fqn-
cmtkhng;end}));Kernel.send(:"define_method",:method_missing){|
n,$_|$_<<"?kd!jhl";n=split.map{|q|q.succ}*'';puts n.reverse.chomp.tr(*
%w{" a})}
me@example.net
E7f7666b77605917fd4cdf801c26355a?d=identicon&s=25 Adam Walters (ajwalters)
on 2008-10-19 00:32
If i try executing the command from the terminal i get the following:

-bash: require: command not found

This happens with or without  '#! /usr/bin/env ruby' as the first line

The firs tline of my script, asside from #! /usr/bin/env ruby, is
"require 'rubygems'".

Any thoughts why this is failing.

Thanks for the help,
Adam
D71ee781fc01856cc187c3ce14374c80?d=identicon&s=25 Mikael Høilund (Guest)
on 2008-10-19 00:47
(Received via mailing list)
On Oct 19, 2008, at 0:31, Adam Walters wrote:

> If i try executing the command from the terminal i get the following:
>
> -bash: require: command not found


Sorry, my silly mistake. It wasn't actually working.

I've definitely gotten it to work now by putting the direct path to
Ruby in the shebang line, instead of env. It works without setting any
execute permissions. My file looks like this:

--8<----
#!/usr/bin/ruby

system "touch ~/Desktop/works_#{rand(65535)}"
--8<----

Modify /usr/bin/ruby if that's not your Ruby's path. Make sure there
are no spaces in the first line at all.

Now I've gotta delete a bunch of empty files from my desktop :<
E7f7666b77605917fd4cdf801c26355a?d=identicon&s=25 Adam Walters (ajwalters)
on 2008-10-19 01:13
Nice, that worked.  I think i just needed to specifically set my ruby
path.  thanks!
This topic is locked and can not be replied to.