Tagged Questions
274
votes
7answers
62k views
How do I pass command line arguments to a rake task?
I've got a rake task that I am making that needs to insert a value into multiple databases.
I'd like to be able to pass this value into the rake task from the command line, or from another rake ...
11
votes
2answers
3k views
How to I launch a ruby script from the command line by just its name?
On windows, I can run my ruby script like this:
> ruby myscript.rb
but I want to set things up so that I can just do this instead?..
> myscript.rb
How do I do this? I know it's possible ...
7
votes
5answers
22k views
Detect if running with administrator privileges under Windows XP
I am trying to work out how to detect whether a user is running with admin rights under Windows XP. This is fairly easy to do in Vista/Win7 thanks to the whoami command. Here's a snippet in Ruby for ...
13
votes
3answers
11k views
Running command line commands within Ruby script
Is there a way to run command line commands through Ruby? I'm trying to create a small little Ruby program that would dial out and receive/send through command line programs like 'screen', 'rcsz', ...
10
votes
13answers
21k views
How can I change the text color in the windows command prompt
I have a command line program, which outputs logging to the screen.
I want error lines to show up in red. Is there some special character codes I can output to switch the text color to red, then ...
3
votes
3answers
7k views
Pass variables to ruby script via command line
I've installed RubyInstaller on windows and I'm running this IMAP Sync script but I need to use it to sync hundreds of accounts. If I could pass these vars to it via command line I could automate the ...
4
votes
2answers
2k views
Printing an ASCII spinning “cursor” in the console
I have a Ruby script that does some long taking jobs. It is command-line only and I would like to show that the script is still running and not halted. I used to like the so called "spinning cursor" ...
20
votes
8answers
8k views
How to output my ruby commandline text in different colours
How can I make the puts commands I output from a commandline based ruby program colour?
I would appreciated any references to how I call each different colour also.
Lets say we start with this..
...
10
votes
5answers
2k views
serve current directory from command line
could someone give me a hint, howto serve the current directory from command line with ruby? it would be great, if i can have some system wide configuration (e.g. mime-types) and simply launch it from ...
8
votes
7answers
7k views
IO.popen - how to wait for process to finish?
I'm using IO.popen in Ruby to run a series of command line commands in a loop. I then need to run another command outside of the loop. The command outside of the loop cannot run until all of the ...
3
votes
1answer
3k views
Running phantomjs from a Ruby on Rails application
I'm interested in using Phantomjs and I'd like to run it from my Ruby on Rails application. However, this is a command line tool (i.e. I'd need to run something like phantomjs rasterize.js ...
8
votes
3answers
1k views
Run a Ruby library from the command-line
I've just learned the basics of Ruby after being very happy with Python for several years (I'm still using Python for some things), but I'd like to know if there's an idiom or hack to solve this ...
7
votes
4answers
365 views
How to get long filename from ARGV
I want to make a tool that takes some filenames as parameters, but when I use this code:
ARGV.each do|a|
puts "Argument: #{a}"
end
and I use drag and drop or "send to" in Windows, I get the short ...
2
votes
2answers
2k views
How to execute Windows CLI commands in Ruby?
I have a file located in the directory "C:\Documents and Settings\test.exe" but when I write the command `C:\Documents and Settings\test.exe in single qoutes(which I am not able to display in this ...
1
vote
1answer
195 views
Ruby Command line application to update Facebook Status
i am intrested in developing a command line application using ruby to update Facebook status. To do this i need to be authenticated. Does Facebook Api provides authentication using comman line ...
5
votes
3answers
2k views
Possible to call executable Thor-powered script without calling thor?
I have a thor-based Ruby script, but I want to deploy it as a gem in people's bin directories that people can hit without having to do thor mytool.
So instead they'd just use mytool
Is this ...
2
votes
2answers
303 views
How to create a shell command supporting Ruby?
I'm creating a gem in which I would like to be able to make a shell command performing a function in the gem. In a more simple context, I need to create a shell script that performs a Ruby function ...
1
vote
1answer
158 views
Hello world on ruby and rails (ror)
I've saved 'hello world' as a .rb file on my computer running Mac OS X Lion. I'm trying to create a new directory called ruby_tutorials in the root of my file system, but I'm having some trouble.
I ...
0
votes
1answer
2k views
Execute script with Ruby on Rails?
I want to start my daemon with my application.
In the command line, I can write something like lib/daemons/mydaemon_ctl start to start up my daemon, but I have to do this manually. I want the daemon ...