Skip to content

Instantly share code, notes, and snippets.

@amaxwellblair
Forked from julsfelic/new_ruby_project.bash
Last active January 2, 2016 05:07
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amaxwellblair/81fa491bdf2d2c81af85 to your computer and use it in GitHub Desktop.
Save amaxwellblair/81fa491bdf2d2c81af85 to your computer and use it in GitHub Desktop.
Bash Function to Quickly Create Ruby Project Structure
language: ruby
script: bundle exec mrspec --color
rvm:
- 2.2.2
source "https://www.rubygems.org"
gem "mrspec"
gem "pry"
gem "pry-nav"
gem "simplecov"
gem "codeclimate-test-reporter", group: :test, require: nil
# 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