0

When I run a ruby program from the command line, I have to add "ruby" at the beginning of the command (ex. 'ruby hangman.rb'). My question is, how do I make a command line program without having to use 'ruby' in front to run the program. I know this has to be possible because RoR is written in ruby and you don't have to run "ruby rails [command]", you just run "rails". Any Ideas?

1 Answers1

1

Best option would be to bundle it as a Gem - this allows to define an executable.

Another a bit "hacky" option would be to create a hangman.bat file that would just call ruby hangman.rb

Note that both cases would still require ruby to be installed on any target computer.

Martin
  • 7,634
  • 1
  • 20
  • 23