Member-only story
Ruby for iOS Developers — Part 3
In Part 1, we did a light introduction to Ruby and in Part 2, we learned about asdf and installing a certain Ruby version. Now that we have Ruby setup, we can focus on getting our desired Ruby libraries (a.k.a. gems) using the one gem that rules them all: Bundler.
Usually, as an iOS developer, you’ll often be dealing with these two gems: fastlane and cocoapods. So let’s experiment a little with getting these installed on our system.
First things first, let’s create a folder in which we can experiment: mkdir tmp_ruby
and move to that folder: cd tmp_ruby
.
Now, using asdf we can specify the version of Ruby we would like to work with: asdf local ruby 2.7.0
which will create the .tool-versions
file with the following content: ruby 2.7.0
. As previously discussed, this is how asdf knows what to do.
Installing gems are extremely easy. All you have to do is to run: gem install fastlane
or gem install cocoapods
. That is indeed easy when we only need two gems but what would we do if we have 20 of them? What would we do if wee had a development team that changes often and every new developer is supposed to install all 20 of those gems? What do we do when we have to update those gems? And how do we tell the whole development team to update as well?
As you can see, just as it is with our Swift libraries, Ruby libraries are also no joke. There are a lot of things to consider, a lot of things that can go wrong and a lot of manual steps to deal with those problems…