1 cd 項目根目錄python
fastlane init
複製代碼
2 選擇自定義 3 配置文件ios
# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:ios)
#targets = ['ElbC', 'ElbT', 'ElbF']
targets = ['ElbALL', 'ElbC', 'ElbC online', 'ElbF', 'ElbF online', 'ElbT', 'ElbT online']
ALL_DIR = Time.now.strftime("%Y-%m-%d %H:%M:%S")
platform :ios do
desc "ElbT 測試版本"
lane :ElbT do
gym(scheme:"ElbT",
export_method:"enterprise",
output_directory:"~/Desktop/App/ElbT/",#文件路徑
output_name:"ElbT--#{ALL_DIR}.ipa"
)
end
lane :all do
targets.each do |t|
gym(scheme:t,
export_method:"enterprise",
output_directory:"~/Desktop/App/All/#{ALL_DIR}/",#文件路徑
output_name:"#{t}--#{ALL_DIR}.ipa"
)
end
end
end
複製代碼
4 執行 終端切換至項目下的fastlane bash
4.1 文件介紹 Appfile內部是我的開發者帳號的配置 Fastfile 定義的是一個個的lane,執行不一樣的打包操做操做實例 單個打包 ElbT
fastlane ElbT
測試
一鍵打包全部 fastlane all
ui
5 打包過程 spa
6 結束# This file contains the fastlane.tools configuration
# You can find the documentation at https://docs.fastlane.tools
#
# For a list of all available actions, check out
#
# https://docs.fastlane.tools/actions
#
# For a list of all available plugins, check out
#
# https://docs.fastlane.tools/plugins/available-plugins
#
# Uncomment the line if you want fastlane to automatically update itself
# update_fastlane
default_platform(:ios)
#targets = ['ElbC', 'ElbT', 'ElbF']
targets = ['ElbALL', 'ElbC', 'ElbC online', 'ElbF', 'ElbF online', 'ElbT', 'ElbT online']
ALL_DIR = Time.now.strftime("%Y-%m-%d-%H-%M-%S")
platform :ios do
desc "App打包功能"
lane :App do
#刪除以前
# exec "rm -rf rm -rf App"
puts "請按照順序選擇(從0開始):"
for index in 0 .. targets.length - 1 do
item = targets[index]
puts "#{index} #{item}\n"
end
$name = STDIN.gets
$name = $name.chomp
puts $name
$name = $name.to_i #轉換爲數字
while $name <0 || $name > targets.length do
puts "請按照順序選擇(從0開始):#{targets}"
$name = STDIN.gets
$name = $name.chomp
puts $name
$name = $name.to_i
end
scheme = targets[$name] #選擇的scheme
dest = "#{scheme}--#{ALL_DIR}.ipa"
current_dir = "./fastlane/"
local_dir = "App/ElbT/"
dest_dir = "#{current_dir}#{local_dir}"
#用戶上傳的文件
file_path = "'./#{local_dir}#{dest}'"
# puts file_path
gym(scheme:scheme,
export_method:"enterprise",
output_directory: dest_dir,#文件路徑
output_name:dest)
puts "輸入您的郵箱:\n"
$email_name = STDIN.gets
$email_name = $email_name.chomp
puts "您輸入的郵箱是:#{$email_name}\n"
puts "輸入您的郵箱密碼:\n"
$email_password = STDIN.gets
$email_password = $email_password.chomp
puts "您輸入的密碼是:#{$email_password}\n"
$command = "python semail.py #{$email_name} #{$email_password} #{file_path}"
puts " 即將發送郵件 ~> #{$command}"
puts "發送請輸入:1\n"
$commit = STDIN.gets
$commit = $commit.chomp
if $commit.to_i == 1 then
#發送郵件
exec "#{$command}"
# 執行本地清理刪除
exec "rm -rf rm -rf App"
end
end
end
複製代碼
對應發送郵件Python腳本3d
![](https://user-gold-cdn.xitu.io/2019/1/29/168975b8f6fc132a?w=874&h=350&f=png&s=67647)
複製代碼