Quote Rails Tutorial
$ echo "gem: --no-document" >> ~/.gemrc
To install Rails, use the gem command. I've added settings to the command to avoid wasting time installing Ruby documentation.
$ gem install rails -v 6.0.3
Installed with version 6.0.3
$ rails -v
# Rails 6.0.3
Check the version (check if it matches if specified and installed)
$ source <(curl -sL https://cdn.learnenough.com/yarn_install)
========================================
Your Yarn packages are out of date!
Please run `yarn install --check-files` to update.
========================================
$ yarn install --check-files
Do the above and it's OK
$ cd #Move to project home directory
$ mkdir environment #Create environment directory
$ cd environment/ #Move to the created environment directory
$ rails _6.0.3_ new <app name>
Quote Rails Tutorial Table 1.2: Overview of Default Rails Directory Configuration (https://railstutorial.jp/)
directory | Use |
---|---|
app/ | Key application code including models, views, controllers, helpers, etc. |
app/assets | Assets such as CSS (Cascading Style Sheet), JavaScript files, images used in the application |
bin/ | Binary executable |
config/ | Application settings |
db/ | Database related files |
doc/ | Application documentation, such as manuals |
lib/ | Library and module storage |
log/ | Application log file |
public/ | Data to be published directly to the general public (Web browser, etc.) such as error pages |
bin/rails | Rails scripts used for code generation, console launch, local web server launch, etc. |
test/ | Application testing |
tmp/ | temporary file |
README.md | A brief description of the application |
Gemfile | Gem definition file required for this application |
Gemfile.lock | List to check the version of gem used by the application |
config.ru | Configuration file for Rack middleware |
.gitignore | A pattern for specifying files that you don't want to include in Git |
A bundler is a gem that manages gem versions and gem dependencies. By using bundler, you can develop with multiple people or even if the gem version goes up without causing an error.
Since the gem used differs depending on each development environment, enter the required gem. (Example bootsnap, byebug, etc.)
$ cd hello_app/
$ bundle install
If you get an error saying [bundle update], run bundle update first
This is the environment construction.