Search code examples
ruby-on-railscmdcommandjruby

New to Command Prompt - Do I need to prefix every command with "Jruby -S ..."


I'm new to using Window's Command Prompt, and also to developing with Ruby on Rails. Possibly a silly question but one that I'm sure everyone who learns with CodeCademy will end up asking; right now I'm prefixing every command for my project with 'Jruby -S ...", for example:

C:\users\MyName\MyProject> Jruby -S rails new MyApp
...    
C:\users\MyName\MyProject> Jruby -S bundle install
...
C:\users\MyName\MyProject> Jruby -S rake db:migrate

Can I use some kind of alternative shell to save me typing Jruby -S every time? I'm aware of bash and powershell but have basically zero knowledge of whether I should be using them...

Thanks folks!


EDIT Lots of helpful suggestions below, but I was really looking for a shell to mimic the functionality of the console on codecademy.com (which I believe is supposed to work like a Mac's 'bash' program?). Thanks anyway.


Solution

  • I'm new to using Window's Command Prompt

    The CMD works very similarly to the GUI/Shell -- you have to call applications and then run commands with them.

    The difference between CMD and windows is that CMD is "naked" - you have to ensure all the paths are correct, and that you're calling the correct application each time.

    For example, calling rails server literally translates as:

    • Program = ruby.exe / rails
    • Command = server

    CMD uses the PATH environment variable to make this process smoother.

    The PATH var basically allows you to reference applications on your computer from the CLI (command line interface). This means that if you have an application (EG ruby.exe), you can add the ruby.exe directory to your PATH variable, allowing you to call ruby ... straight from cmd.

    --

    In your case, I don't have much experience with JRuby; I do know, however, that if you want to invoke the functionality of that application, you have to call it from the cli.

    Hopefully my answer gives some context.