iOS開發(fā)統(tǒng)一項目環(huán)境搭建

一.用什么管理ruby 版本
·使用Homebrew 和 rbenv 來管理ruby版本(這個過程可能會有點慢,請耐心等待)

# 1.安裝Homebrew 
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# 2.安裝rbenv軟件
brew install rbenv ruby-build rbenv-vars
# 3.使用rbenv 查看當前可用的ruby 版本
rbenv install -l
# 4. 使用rbenv安裝ruby 
rbenv install 3.0.0
# 5. 鎖定ruby 版本 (鎖定版本的時候會生產(chǎn)一個.ruby-version的文件,里面的內(nèi)容就只有一個ruby版本)
rbenv local 3.0.0

二.用什么管理cocoapods 版本,和 fastlane版本
·使用bundler 管理cocoapods 和fastlane 版本
1.安裝bundle

gem install bundler

2.bundle 初始化 (會生成一個Gemfile文件)

bundle init

3.修改Gemfile 文件也就是在Gemfile 文件中設置我們的cocoapods 和 fastlane 的版本
Gemfile 文件內(nèi)容如下:

# frozen_string_literal: true

source "https://rubygems.org"

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

# gem "rails"


# cocoapods 最新版本可以在  https://rubygems.org 網(wǎng)站中搜索查詢
gem "cocoapods", "1.10.1"
# fastlane 最新版本可以在  https://rubygems.org 網(wǎng)站中搜索查詢
gem "fastlane", "2.180.0"

4.安裝cocoapods 和 fastlane 管理軟件

bundle install

5.生成profile 文件

bundle exec pod init

6.編輯profile 文件

# Uncomment the next line to define a global platform for your project
platform :ios, '11.0'

target 'RbenvAndBundlerTestProject' do
  # Comment the next line if you don't want to use dynamic frameworks
  use_frameworks!

  # Pods for RbenvAndBundlerTestProject

  pod "Alamofire"

end

7.安裝安裝pod

bundle exec pod install

三.gitignore 的下載和使用
·gitignore 文件下載地址

# gitignore 文件下載
https://github.com/github/gitignore

#Swift.gitignore 文件下載地址(我項目使用的是Swift 所以我下載的是Swift.gitignore 文件)
https://github.com/github/gitignore/blob/master/Swift.gitignore

修改Swift.gitignore 文件名為.gitignore 文件
把.gitignore 文件放入項目文件夾中去
修改后的.gitignore 文件內(nèi)容如下:

# Xcode
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

## User settings
xcuserdata/

## compatibility with Xcode 8 and earlier (ignoring not required starting Xcode 9)
*.xcscmblueprint
*.xccheckout

## compatibility with Xcode 3 and earlier (ignoring not required starting Xcode 4)
build/
DerivedData/
*.moved-aside
*.pbxuser
!default.pbxuser
*.mode1v3
!default.mode1v3
*.mode2v3
!default.mode2v3
*.perspectivev3
!default.perspectivev3

## Obj-C/Swift specific
*.hmap

## App packaging
*.ipa
*.dSYM.zip
*.dSYM

## Playgrounds
timeline.xctimeline
playground.xcworkspace

# Swift Package Manager
#
# Add this line if you want to avoid checking in source code from Swift Package Manager dependencies.
# Packages/
# Package.pins
# Package.resolved
# *.xcodeproj
#
# Xcode automatically generates this directory with a .xcworkspacedata file and xcuserdata
# hence it is not needed unless you have added a package configuration file to your project
# .swiftpm

.build/

# CocoaPods
#
# We recommend against adding the Pods directory to your .gitignore. However
# you should judge for yourself, the pros and cons are mentioned at:
# https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control
#
Pods/
#
# Add this line if you want to avoid checking in source code from the Xcode workspace
# *.xcworkspace

# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts

Carthage/Build/

# Accio dependency management
Dependencies/
.accio/

# fastlane
#
# It is recommended to not store the screenshots in the git repo.
# Instead, use fastlane to re-generate the screenshots whenever they are needed.
# For more information about the recommended setup visit:
# https://docs.fastlane.tools/best-practices/source-control/#source-control

fastlane/report.xml
fastlane/Preview.html
fastlane/screenshots/**/*.png
fastlane/test_output

# Code Injection
#
# After new code Injection tools there's a generated folder /iOSInjectionProject
# https://github.com/johnno1962/injectionforxcode

iOSInjectionProject/

四.項目組成員,整么統(tǒng)一項目環(huán)境呢?
項目組成員只需要下拉git 項目
在項目目錄中找到ios_project_path.sh 文件
在控制臺 項目目錄中 執(zhí)行 ./ios_project_path.sh 就可以配置完成統(tǒng)一的環(huán)境了

?著作權歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容