Skip to content
This repository has been archived by the owner on Aug 26, 2019. It is now read-only.

Handbook: Shell

Sergey Smagin edited this page Nov 22, 2015 · 5 revisions

To change schell, use chsh command (please read man: http://linux.die.net/man/1/chsh ). Rush executable is in project_folder/bin/rush.

To use the shell, add rush/bin to your path, and then run "rush" at the regular unix shell. You can also specify the complete path if you'd rather not add it to your path.

Once in the shell, there is no concept of current working directory. Instead, dirs are assigned to variables. There are two variables defined automatically: root, and home. From here you can use square backets to describe a file path. For example, accessing the myproj dir from your home directory would be:

myproj = home['myproj/']

(Note that directories must be specified with a trailing slash.)

A dir object can be operated upon by commands such as ls:

myproj.ls

Any dir can access child objects with the same square bracket notation:

myproj['app/models/my_model.rb']

Operate on files as single objects:

myproj['app/models/my_model.rb'].vi

...or in groups:

myproj['app/models/*.rb'].mate

There are four commands for the operations typically referred to as move and copy, as follows:

file = myproj['app/models/my_model.rb']
file.rename 'renamed_model.rb' 
file.duplicate 'renamed_model_copy.rb' 
file.copy_to myproj['app/controllers/']
file.move_to home['Desktop/']

Of course this is Ruby, so go nuts:

file.rename file.name.gsub(/(.+)_(model|obj)/, '\\2_\\1')

Next: Globbing

source: https://web.archive.org/web/http://rush.heroku.com/handbook/shell

Clone this wiki locally