Before we get started building our voice memo app, we will need to setup Ruby - the language we will be writing our app in.
In this section we will need to:
- Install a newer version on Ruby (your mac already has Ruby, but an older version)
- Install rbenv a version manager for Ruby.
The Ruby Language
Ruby is the language for writing Rails applications. It has been around since 1985 and has developed an enormous community of developers and enthusiasts. Ruby focuses on developer productivity making the language easy and pleasant to write.
A dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write.
You can checkout the Ruby homepage here:
Installing the latest version of Ruby
macOS comes with ruby 2.7 installed, but it does not allow us to upgrade the version of Ruby. Because of this, it is very common to have different versions of Ruby installed. The system or global Ruby and local Ruby versions. To enable us to have different versions of Ruby installed, we will need to use a language manager. rbenv is a solid choice for managing our Ruby versions.
Install rbenv via homebrew:
brew install rbenv
Initialize rbenv with:
Copy the output from your terminal and paste it in your terminal profile eg (.bash_profile, .zshrc)
Verify that rbenv is installed correctly by running:
curl -fsSL https://github.com/rbenv/rbenv-installer/raw/master/bin/rbenv-doctor | bash
Install the latest version of ruby: 2.5.0
rbenv install 2.5.0
Set the global ruby version to 2.5.0
rbenv global 2.5.0
Running rbenv local 2.5.0 will set your local ruby version to 2.5.0 instead of using the global version and will create a .ruby-version file in your current directory. We will run that command later in the tutorial.
Ruby applications are called Gems. If you have ever used cocoapods or fastlane, they both are written in Ruby and are Gems.
We will be installing a few Gems in this tutorial. One of them being the Rails framework.
You can search for all Gems on the RubyGems homepage:
The Rails Framework
Rails is a web application development framework written in the Ruby. Rails follows convention over configuration as it makes certain assumptions about what a developer needs to build a web application. This translates to faster development time and a fun development experience.
Because the Rails framework has such an active community, we can find a Gem for just about any functionality we want to add to our web app.
Want to add photo attachments? Setup an API? there is a Gem for that.
Install the Rails framework with:
sudo gem install rails
Lets go over what we have learnt so far:
- Ruby is the language for writing rails applications
- Packaged Ruby applications are called Gems
- The Rails framework is a Ruby Gem
- Rbenv lets us install and manage different versions of Ruby
If you have feedback on this tutorial or find any mistakes, please open issues on the
GitHub Repository or comment below.