LoginSignup
0
0

More than 5 years have passed since last update.

fastlaneやcocoapodsのバージョンをプロジェクトごとにチームで同じものを使う方法

Last updated at Posted at 2018-11-21

背景

チームで複数のプロジェクトを開発しているとプロジェクトごとにfastlaneなどのバージョンが違ったりすることがよくある。
pod installをするとPodifle.lockが更新されてしまったり
人によって挙動が変わったり色々不便。

対策

bundlerを使う。

rbenvのインストール

$ brew install rbenv 
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bash_profile
$ echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
$ source ~/.bash_profile

rbenvインストール - 公式ドキュメント

rbenv-binstubsインストール

bundlerでインストールしたライブラリをbundle exec経由しなくても使えるプラグイン

$ brew install rbenv-binstubs 

bundlerインストール

※bundlerだけはグローバルにインストールします。

$ gem install bundler

bundler初期設定

$ cd /プロジェクトのルートディレクトリ
$ bundle init

cocoapodsとfastlaneを追加

Gemfile
# frozen_string_literal: true

source "https://rubygems.org"

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

# 以下を追加
gem "fastlane"
gem "cocoapods"

実際にインストール

$ bundle install --path=vendor/bundle --binstubs=vendor/bin

.bundle/config に設定が保存されるので、2回目以降は bundle install で大丈夫。

おまけ

gitignore

ぼくのいるチームでは以下の.gitignoreを書いてライブラリのアップデートで大量のfilechangeがでないようにしてます。

.gitignore
vendor/bundle
vendor/bin

参考

Homebrewのインストールとrbenvのインストールまで Mac編

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