I started learning Ruby on Rails (hereinafter, rails) from the middle of May, and experienced everything from creating a super-standard chat application to deploying it, so I would like to organize the procedure as my own memorandum.
The flow of chat application creation with Rails that I did is as follows. Create the tutorial in 7 parts.
1 Build a development environment on Mac (Mac OS Catalina) 2 Create an app template with Rails 3 Front screen implementation (haml and sass) 4 Login function implementation 5 Group function implementation 6 Message function implementation 7 Implementation of Ajax asynchronous communication
First, we will organize the environment construction procedure on Mac (Mac OS Catalina).
Command Line Tools = Tools for running software on the command line (terminal). To make the login shell zsh, execute the following command in the turnal.
#Set zsh as default
% chsh -s /bin/zsh
#Show login shell
% echo $SHELL
#If the following is displayed, it is successful.
/bin/zsh
Install Command Line Tools.
% xcode-select --install
Homebrew = Software management tool. Homebrew installation procedure.
#Move to home directory
% cd
#Check if you are in your home directory
% pwd
#Introduction of Homebrew(Processing takes time)
% ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
#Version confirmation
% brew -v
Homebrew "version"
#Keep up to date
% brew update
#Change permissions
% sudo chown -R `whoami`:admin /usr/local/bin
#rbenv and ruby-install build
% brew install rbenv ruby-build
#Make it available from anywhere
% echo 'eval "$(rbenv init -)"' >> ~/.zshrc
#Reflect the modification of the configuration file
% source ~/.zshrc
#Introducing readline(For Japanese input)
% brew install readline
#Make it available from anywhere
% brew link readline --force
Install Ruby. (This will take some time)
% RUBY_CONFIGURE_OPTS="--with-readline-dir=$(brew --prefix readline)"
% rbenv install "version"
This is the procedure after installation.
#Change from default ruby by specifying version
% rbenv global 2.6.5
#Reflect the change of settings
% rbenv rehash
#Check version
% ruby -v
MySQL = database management tool
#MySQL installation
% brew install [email protected]
#Auto start setting
% mkdir ~/Library/LaunchAgents
% ln -sfv /usr/local/opt/mysql\@5.6/*.plist ~/Library/LaunchAgents
% launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql\@5.6.plist
#MySQL command introduction
% echo 'export PATH="/usr/local/opt/[email protected]/bin:$PATH"' >> ~/.zshrc
% source ~/.zshrc
#Try the MySQL command
% which mysql
#Success if the following is displayed
/usr/local/opt/[email protected]/bin/mysql
Confirmation of MySQL startup.
#Check the status of MySQL
% mysql.server status
#Success if the following is displayed
SUCCESS! MySQL running
Rails (application framework) is a Ruby gem, so install it with bundler.
#Install bundler
% gem install bundler
#Rails installation(take time)
% gem install rails --version='6.0.0'
#Reload rbenv
% rbenv rehash
#Rails version check
% rails -v
Rails "version"
(You will specify it later with the rails new command)
It is a program that enables server-side processing with JavaScript. JavaScript is used when performing asynchronous communication with Rails. Install with Homebrew. (Ignore the already installed error)
# node.install js
% brew install nodejs
#Version confirmation
% node -v
JavaScript package manager. It runs on Node.js and manages the JavaScript library.
I have npm in the same JavaScript package manager, but yarn seems to be positioned as an improvement of npm.
#install yarn
% brew install yarn
#Check yarn version
% yarn -v
This completes the development environment construction for Ruby on Rails.
Recommended Posts