-
-
Save amaxwellblair/81fa491bdf2d2c81af85 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
coverage/ |
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
language: ruby | |
script: bundle exec mrspec --color | |
rvm: | |
- 2.2.2 |
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
source "https://www.rubygems.org" | |
gem "mrspec" | |
gem "pry" | |
gem "pry-nav" | |
gem "simplecov" | |
gem "codeclimate-test-reporter", group: :test, require: nil |
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; | |
touch test/"$1"_test.rb | |
#Optional inclusion of TravisCI and SimpleCov on every project creation | |
# - Requires a template folder that new projects will pull from (required files are included in the gist) | |
# - The script below assumes template folders are saved in "/turing/template/" | |
#cp "/Users/your_profile_name/turing/template/Gemfile" "$1"; | |
#cp "/Users/your_profile_name/turing/template/.travis.yml" "$1"; | |
#cp "/Users/your_profile_name/turing/template/.gitignore" "$1"; | |
# /Users/your_profile_name" Ex: "/Users/allan/turing/template/Gemfile" | |
} | |
# You use the bash script as follows | |
$ new_ruby_project cat | |
# This creates the following directory structure (without inclusion of TravisCI and SimpleCov) | |
. | |
├── lib | |
│ └── cat.rb | |
└── test | |
├── cat_test.rb | |
└── test_helper.rb | |
# This creates the following directory structure (with inclusion of TravisCI and SimpleCov) | |
. | |
├── Gemfile | |
├── .gitignore | |
├── .travis.yml | |
├── 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