发现直接利用gym命令行打包过于麻烦,直接编写了脚本执行:
default_platform :ios
platform :ios do
before_all do
git_pull
end
#打包配置
#版本号
version = get_version_number(xcodeproj: "Project.xcodeproj")
#build number自动加1
build_number = increment_build_number
plist_path = "./Info.plist"
set_info_plist_value(path: "#{plist_path}", key: "CFBundleVersion", value: "#{build_number}")
#打包时间记录
time = Time.new
timeString = time.strftime("%Y-%m-%d_%H:%M:%S")
project_path = "Project根目录"
workspace = "#{project_path}/your workspace.xcworkspace"
output_directory = "#{project_path}/APP"
output_name = "#{version}_#{build_number}_#{timeString}.ipa"
lane :release do
gym(
workspace: "#{workspace}",
configuration: "Release",
scheme: "Scheme Name",
export_method: "ad-hoc",
clean: true,
# Destination directory. Defaults to current directory.
output_directory: "#{output_directory}",
# specify the name of the .ipa file to generate (including file extension)
output_name: "day_inke_release_#{output_name}",
silent: false,
include_symbols: true,
use_legacy_build_api: true
)
#上传到fir.im
system "fir publish #{output_directory}/day_inke_release_#{output_name} -T Your TokenId "
end
end
备注:注意脚本中斜体部分,修改为自己的配置。
cd到工程根目录下,运行命令为:fastlane release
静待出包(注意,打包前,工程的证书设置一定要正确)
网友评论
/Users/aone/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/rubygems_integration.rb:393:in `block in replace_bin_path': can't find executable fir (Gem::Exception)
from /Users/aone/.rvm/gems/ruby-2.3.0/gems/bundler-1.13.6/lib/bundler/rubygems_integration.rb:410:in `block in replace_bin_path'
from /Users/aone/.rvm/gems/ruby-2.3.0/bin/fir:22:in `<main>'
from /Users/aone/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `eval'
from /Users/aone/.rvm/gems/ruby-2.3.0/bin/ruby_executable_hooks:15:in `<main>'
#上传到fir.im 出错,fir命令无法执行
system "fir me"
end
就这一条,我以为是gym的环境变量没有配置什么的,我简简单单的运行这一条都会出错,现在搞的只能用shell 执行fastlane再执行fir。你在ruby下配置了fir环境变量了没有?我的系统版本是:10.12.1