A checklist to follow when starting a new project if you are using rbenv or rvm:
Make sure this is in your .bashrc or .zshrc
1
| |
Then any time you would need bundle exec you can just use be. Or alternatively, Hal Fulton pointed out you can do bundle exec bash to get a bash shell that would be the same as using be each time :)
- Create a directory for your project and change into it.
- Create a Ruby version file:
echo "2.4.0" > .ruby_version. - Change out of directory and back in, and ensure your version of ruby is correct with
ruby -v. - Make sure Bundler is installed:
gem install bundler. - Create a Gemfile
bundle init. - Setup git repo with
git init. - Create a README file and put the name of your project and what it is used for.
- Add all files
git add .. - Commit
git commit -m "inital commit".
Then if you are making a ruby gem:
- Use
bundle gem myawesomegemor do it by hand (helps you to remember.. hehe) - Create a gemspec
touch myawesomelibrary.gemspec. - Make directory:
mkdir lib. - Make library file:
touch lib/myawesomelibrary.rb. - Make test directory:
mkdir test. - Make test file:
touch test/myawesomelibrary_test.rb.
Gem spec template:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
If you are making a rails app:
Add the version of Rails you want to use to the Gemfile ie: rails "5.0.1" and bundle install.
Then do rails new . to create a rails app with the same name as current directory.