LoginSignup
0
0

More than 1 year has passed since last update.

How to Start New Rails App

Last updated at Posted at 2017-06-23

#What this
This document is for setting up new Rails app with specific ruby and rails version, too complexed process, by using rbenv, ruby version organizing system.

#Understanding
Directory_you_want_to_build_your_app
├── Gemfile
├── vendor
│  └── bundle
│    ├── ...
│    └── ...
└── YourApp
  ├── app
  ├── assets
  │   ├── ...

Once You Have to Make 'Gemfile' and 'vendor/bundle' Directory.
After Generate 'YourApp' by Those, You can Delete if You Want.
Then, Dig Into 'YourApp' and do 'bundle install' for 'YourApp'.
This process could be complicated for you.

#How to

###Install rbenv

brew install rbenv

###Install some packages for enable rbenv

brew install openssl
brew install readline
brew install libiconv

###Check Versions Available

rbenv versions -l

###Get ruby version want to use ("2.x.x" is version you want to have)

rbenv install 2.x.x

###Change Ruby version to installed version

rbenv global 2.x.x

###Get proper bundler for specific ruby version

rbenv exec gem install bundler

###Also Rails for specific ruby version

rbenv exec gem install rails

###Make Gemfile in the directory you want to put your new rails app in ("4.x.x" is version of rails you need)

cat << EOS > Gemfile
source "http://rubygems.org"
gem "rails", "4.x.x"
EOS

###Install rails to make rails app

bundle install --path vendor/bundle

###Make rails app

bundle exec rails new MyApp --skip-bundle

###Move into rails directory

cd MyApp

###Bundle install in the new app directory

bundle install --path vendor/bundle

#FINISHED!!!

###Now you can do whatever you want

bundle exec rails server

or

bundle exec rails console

and so...

###Have fun!!!

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0