1. IOS项目开发环境搭建--项目环境

2021-04-08  本文已影响0人  ProfessorFan

问题

  1. 操作系统统一
  2. 开发软件版本统一
  3. 用什么管理ruby 版本
  4. 用什么管理cocoapods 版本,和 fastlane版本
  5. gitignore 的下载和使用
  6. 项目组成员,整么统一项目环境呢?

项目地址

Github

重要提示

以下所有的命令操作,最好都在项目的根目录下面操作

答案

  1. 操作系统统一
  1. 开发软件版本统一
  1. 用什么管理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 版本 (锁定版本的时候会生产一个.ruby-version的文件,里面的内容就只有一个ruby版本)
rbenv local 3.0.0

  1. 用什么管理cocoapods 版本,和 fastlane版本
  1. 安装bundle
gem install bundler
  1. bundle 初始化 (会生成一个Gemfile文件)
bundle init
  1. 修改Gemfile 文件也就是在Gemfile 文件中设置我们的cocoapods 和 fastlane 的版本
    Gemfile 文件内容如下:
# frozen_string_literal: true

source "https://rubygems.org"

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

# gem "rails"


# cocoapods 最新版本可以在  https://rubygems.org 网站中搜索查询
gem "cocoapods", "1.10.1"
# fastlane 最新版本可以在  https://rubygems.org 网站中搜索查询
gem "fastlane", "2.180.0"
  1. 安装cocoapods 和 fastlane 管理软件
bundle install
  1. 生成profile 文件
bundle exec pod init
  1. 编辑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
  1. 安装安装pod
bundle exec pod install
  1. gitignore 的下载和使用
# gitignore 文件下载
https://github.com/github/gitignore

#Swift.gitignore 文件下载地址(我项目使用的是Swift 所以我下载的是Swift.gitignore 文件)
https://github.com/github/gitignore/blob/master/Swift.gitignore
# 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/

  1. 项目组成员,整么统一项目环境呢?

结束语

到此一个基本的统一项目环境搭建,基本就OK搞定了

上一篇 下一篇

猜你喜欢

热点阅读