Last active
January 2, 2016 04:41
-
-
Save julsfelic/abdd92f98610b25d937b to your computer and use it in GitHub Desktop.
Bash Function to Quickly Create Ruby Project Structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Copy this function into your .bash_profile found at ~/.bash_profile | |
# You can rename the function to your preference | |
function new_ruby_project { | |
mkdir $1; | |
cd $1; | |
mkdir lib/; | |
touch lib/"$1".rb; | |
mkdir test/; | |
touch test/test_helper.rb; | |
echo "require 'minitest'" >> test/test_helper.rb; | |
touch test/"$1"_test.rb | |
echo "require 'test_helper'" >> test/"$1"_test.rb; | |
} | |
# You use the bash script as follows | |
$ new_ruby_project cat | |
# This creates the following directory structure | |
. | |
├── lib | |
│ └── cat.rb | |
└── test | |
├── cat_test.rb | |
└── test_helper.rb | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment