This package is designed to allow developers to easily add files as dependecies in their projects. Optimized for ruby.
requirouter package
requirouter is designed to allow ease of use when requiring files as dependecies in your projects.
You can find and install this package by opening your Atom text editor, and pressing ctrl+shift+p.
From there, search 'requirouter' and you can install the package.
This functionality works by selecting the file to be required, and putting it into the currently-active text editor window.
So, given the following tree structure:
Let's say we want to require Fun.rb
in Hello.rb
. Navigate into Hello.rb so that it is your Active Text Editor (you can type in there).
The fastest way is to select just one file is to right-click on the desired file in the Tree View and select Get Relative Path
.
That's it! The file is now correctly required at the top of the file, with no need to modify the $LOAD_PATH.
There are alternative methods as well. To accomplish the same goal, highlight Fun.rb in the Atom Tree View. This can conveniently be done by holding ctrl
and making sure only the desired file(s) is/are highlighted by clicking in the Tree View.
Now that we have the desired file(s) selected, we can go back into Hello.rb and use the keyboard shortcut ctrl+alt+p
to paste in the proper path for requirement. The package automatically inserts this line of text at the top of the file. This is the best method to require multiple files in one go.
Alternatively, you can right-click in the text editor and select Get Path String
from the menu.