ykcitool 0.4.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE.txt +21 -0
- data/README.md +253 -0
- data/bin/ykcitool +20 -0
- data/lib/GitTools/git_analysis.rb +109 -0
- data/lib/HttpService/HttpServiceHelper.rb +28 -0
- data/lib/HttpService/git_tag_analysis_handler.rb +20 -0
- data/lib/actions/YKFastlaneExecute.rb +89 -0
- data/lib/actions/archive.rb +151 -0
- data/lib/actions/archiveHelper.rb +41 -0
- data/lib/actions/certificate.rb +95 -0
- data/lib/actions/git.rb +21 -0
- data/lib/actions/init.rb +145 -0
- data/lib/actions/pod.rb +29 -0
- data/lib/actions/ykgit.rb +28 -0
- data/lib/actions/ykservice_http.rb +31 -0
- data/lib/interface.rb +58 -0
- data/lib/ykfastlane/helper.rb +84 -0
- data/lib/ykfastlane/tools.rb +172 -0
- data/lib/ykfastlane/version.rb +6 -0
- metadata +189 -0
@@ -0,0 +1,151 @@
|
|
1
|
+
require "actions/YKFastlaneExecute"
|
2
|
+
require 'ykfastlane/version'
|
3
|
+
require 'ykfastlane/tools'
|
4
|
+
require 'ykfastlane/helper'
|
5
|
+
require 'actions/archiveHelper'
|
6
|
+
module YKFastlane
|
7
|
+
|
8
|
+
class Archive < YKFastlane::SubCommandBase
|
9
|
+
include YKFastlane::ArchiveHelper
|
10
|
+
|
11
|
+
desc "display_product_path", "display archive output path"
|
12
|
+
|
13
|
+
def display_product_path()
|
14
|
+
YKFastlane::Tools.UI(YKARCHIVE_PRODUCT_PATH)
|
15
|
+
end
|
16
|
+
|
17
|
+
no_commands {
|
18
|
+
def platform_edit_user_execute(options)
|
19
|
+
puts("#{method(:platform_edit_user_execute)}:#{options}")
|
20
|
+
if options[:pgyer_user].blank? == false && options[:pgyer_api].blank? == false # pgyer
|
21
|
+
pgyerinfo = {
|
22
|
+
K_archiveEnv_pgyer_api => options[:pgyer_api],
|
23
|
+
K_archiveEnv_pgyer_user => options[:pgyer_user]
|
24
|
+
}
|
25
|
+
self.update_archive_map(YKFastlane::ArchiveHelper::K_archiveEnv_config_pgyer, pgyerinfo)
|
26
|
+
puts "archive update pgyer info success"
|
27
|
+
end
|
28
|
+
|
29
|
+
if options[:fir_api_token].blank? == false #fir
|
30
|
+
fir_info = {
|
31
|
+
K_archiveEnv_firApiToken => options[:fir_api_token]
|
32
|
+
}
|
33
|
+
self.update_archive_map(YKFastlane::ArchiveHelper::K_archiveEnv_config_fir, fir_info)
|
34
|
+
puts "archive update fir info success"
|
35
|
+
end
|
36
|
+
|
37
|
+
if options[:apple_password].blank? == false && options[:apple_password].blank? == false # tf
|
38
|
+
tf_info = {
|
39
|
+
K_archiveEnv_tf_account => options[:apple_account],
|
40
|
+
K_archiveEnv_tf_password => options[:apple_password]
|
41
|
+
}
|
42
|
+
self.update_archive_map(YKFastlane::ArchiveHelper::K_archiveEnv_config_tf, tf_info)
|
43
|
+
puts "archive update tf info success"
|
44
|
+
end
|
45
|
+
end
|
46
|
+
}
|
47
|
+
|
48
|
+
desc "upload_tf", "upload ipa to test flight, will send failed message to enterprise robot \'#{Helper::YKWECHAT_ROBOT_TOKEN}\'"
|
49
|
+
option :ipa, :required => true, :type => :string, :aliases => :i, :desc => 'scheme name'
|
50
|
+
option :user_name, :type => :string, :aliases => :u, :desc => 'apple id, 如果不传递,则使用env配置的'
|
51
|
+
option :pass_word, :type => :string, :aliases => :p, :desc => 'apple id 专属app密钥, 如果不传递,则使用env配置的 配置链接: https://appleid.apple.com/account/manage'
|
52
|
+
option :wxwork_access_token, :type => :string, :aliases => :t, :desc => '微信机器人token, 用以通知到相关业务群,如果没有, 则会使用配置中的机器人, 如果依旧没有, 则不通知企业微信,但是业务依旧成功'
|
53
|
+
option :note, :type => :string, :aliases => :n, :desc => '通知信息,用以通知相关业务群,如果没有,业务依旧成功'
|
54
|
+
|
55
|
+
def upload_tf()
|
56
|
+
puts "upload_tf"
|
57
|
+
if options[:user_name].blank? || options[:pass_word].blank?
|
58
|
+
apple_info = self.load_archive_config_dict(YKFastlane::ArchiveHelper::K_archiveEnv_config_tf)
|
59
|
+
options.update(apple_dict)
|
60
|
+
end
|
61
|
+
|
62
|
+
code = YKFastlaneExecute.executeFastlaneLane("upload_ipa_to_tf", options)
|
63
|
+
exit(code) unless code == 0
|
64
|
+
end
|
65
|
+
|
66
|
+
desc "tf", "archive ios project and upload to TF, will send failed message to enterprise robot \'#{Helper::YKWECHAT_ROBOT_TOKEN}\'"
|
67
|
+
option :scheme, :required => true, :type => :string, :aliases => :s, :desc => 'scheme name'
|
68
|
+
option :user_name, :type => :string, :aliases => :u, :desc => 'apple id, 如果不传递,则使用env配置的'
|
69
|
+
option :pass_word, :type => :string, :aliases => :p, :desc => 'apple id 专属app密钥, 如果不传递,则使用env配置的 配置链接: https://appleid.apple.com/account/manage'
|
70
|
+
|
71
|
+
option :wxwork_access_token, :type => :string, :aliases => :w, :desc => '企业微信机器人 webhook中的key字段, 如果没有,则使用env中配置的机器人'
|
72
|
+
option :note, :type => :string, :aliases => :n, :desc => '测试包发包信息'
|
73
|
+
option :xcworkspace, :type => :string, :aliases => :x, :desc => '.xcworkspace 文件相对于指令工作目录的相对路径, 如果.xcworkspace文件在工程根目录,则可以不传递此参数'
|
74
|
+
option :cocoapods, :type => :numeric, :aliases => :c, :desc => '是否需要执行pod install, 默认不执行pod install 指令, 1:执行, 非1:不执行'
|
75
|
+
option :flutter_directory, :type => :string, :aliases => :d, :desc => '如果有flutter混编, 此参数是 flutter项目的相对路径.'
|
76
|
+
|
77
|
+
def tf()
|
78
|
+
puts "archive_tf"
|
79
|
+
if options[:user_name].blank? || options[:pass_word].blank?
|
80
|
+
apple_dict = self.load_archive_config_dict(YKFastlane::ArchiveHelper::K_archiveEnv_config_tf)
|
81
|
+
if apple_dict != nil && apple_dict.blank?() == false
|
82
|
+
options.update(apple_dict)
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
code = YKFastlaneExecute.executeFastlaneLane("archive_tf", options)
|
87
|
+
exit(code) unless code == 0
|
88
|
+
end
|
89
|
+
|
90
|
+
desc "pgyer", "archive ios project and upload to pgyer, will send failed message to enterprise robot \'#{Helper::YKWECHAT_ROBOT_TOKEN}\'"
|
91
|
+
option :scheme, :required => true, :type => :string, :aliases => :s, :desc => 'scheme name'
|
92
|
+
option :pgyer_api, :type => :string, :aliases => :a, :desc => '蒲公英平台的api key; 如果不传,会使用全局配置的 api key'
|
93
|
+
option :pgyer_user, :type => :string, :aliases => :u, :desc => '蒲公英平台的user key; 如果不传,会使用全局配置的 user key'
|
94
|
+
option :wxwork_access_token, :type => :string, :aliases => :w, :desc => '企业微信机器人 webhook中的key字段, 如果没有,则使用env中配置的机器人'
|
95
|
+
option :note, :type => :string, :aliases => :n, :desc => '测试包发包信息'
|
96
|
+
option :xcworkspace, :type => :string, :aliases => :x, :desc => '.xcworkspace 文件相对于指令工作目录的相对路径, 如果.xcworkspace文件在工程根目录,则可以不传递此参数'
|
97
|
+
option :cocoapods, :type => :numeric, :aliases => :c, :desc => '是否需要执行pod install, 默认不执行pod install 指令, 1:执行, 非1:不执行'
|
98
|
+
option :flutter_directory, :type => :string, :aliases => :d, :desc => '如果有flutter混编, 此参数是 flutter项目的相对路径.'
|
99
|
+
option :export, :type => :string, :aliases => :e, :desc => '包的类型, app-store, ad-hoc, enterprise 默认为enterprise'
|
100
|
+
|
101
|
+
def pgyer()
|
102
|
+
puts "archive_pgyer"
|
103
|
+
|
104
|
+
if options[:pgyer_user].blank? || options[:pgyer_api].blank?
|
105
|
+
dict = self.load_archive_config_dict(YKFastlane::ArchiveHelper::K_archiveEnv_config_pgyer)
|
106
|
+
options.update(dict)
|
107
|
+
end
|
108
|
+
|
109
|
+
code = YKFastlaneExecute.executeFastlaneLane("archive_pgyer", options)
|
110
|
+
exit(code) unless code == 0
|
111
|
+
end
|
112
|
+
|
113
|
+
desc "fir", "archive ios project and upload to fir, will send failed message to enterprise robot \'#{Helper::YKWECHAT_ROBOT_TOKEN}\'"
|
114
|
+
option :scheme, :required => true, :type => :string, :aliases => :s, :desc => 'scheme name'
|
115
|
+
option :fir_api_token, :type => :string, :aliases => :f, :desc => 'Fir平台api token'
|
116
|
+
option :wxwork_access_token, :type => :string, :aliases => :w, :desc => '企业微信机器人 webhook中的key字段, 如果没有,则使用env中配置的机器人'
|
117
|
+
option :note, :type => :string, :aliases => :n, :desc => '测试包发包信息'
|
118
|
+
option :xcworkspace, :type => :string, :aliases => :x, :desc => '.xcworkspace 文件相对于指令工作目录的相对路径, 如果.xcworkspace文件在工程根目录,则可以不传递此参数'
|
119
|
+
option :cocoapods, :type => :numeric, :aliases => :c, :desc => '是否需要执行pod install, 默认不执行pod install 指令, 1:执行, 非1:不执行'
|
120
|
+
option :flutter_directory, :type => :string, :aliases => :d, :desc => '如果有flutter混编, 此参数是 flutter项目的相对路径.'
|
121
|
+
option :export, :type => :string, :aliases => :e, :desc => '包的类型, app-store, ad-hoc, enterprise 默认为enterprise'
|
122
|
+
|
123
|
+
def fir()
|
124
|
+
puts "archive_fir"
|
125
|
+
if options[:fir_api_token].blank?
|
126
|
+
dict = self.load_archive_config_dict(YKFastlane::ArchiveHelper::K_archiveEnv_config_fir)
|
127
|
+
options.update(dict)
|
128
|
+
end
|
129
|
+
|
130
|
+
code = YKFastlaneExecute.executeFastlaneLane("archive_fir", options)
|
131
|
+
exit(code) unless code == 0
|
132
|
+
end
|
133
|
+
|
134
|
+
desc "clean_product_dir", "clean product path"
|
135
|
+
def clean_product_dir()
|
136
|
+
YKFastlaneExecute.executeFastlaneLane("clean_product_directory", options)
|
137
|
+
end
|
138
|
+
|
139
|
+
no_commands do
|
140
|
+
def list_platform_user_execute()
|
141
|
+
self.list_user_map()
|
142
|
+
end
|
143
|
+
|
144
|
+
def list_profiles_execute()
|
145
|
+
code = YKFastlaneExecute.executeFastlaneLane("list_profile_configs", options)
|
146
|
+
exit(code) unless code == 0
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
end
|
151
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'ykfastlane/version'
|
2
|
+
require 'ykfastlane/tools'
|
3
|
+
require 'ykfastlane/helper'
|
4
|
+
module YKFastlane
|
5
|
+
|
6
|
+
module ArchiveHelper
|
7
|
+
YKARCHIVE_PRODUCT_PATH = File.expand_path(File.join(Dir.home, "iosYeahArchive"))
|
8
|
+
|
9
|
+
YKARCHIVE_ENV_PATH = File.join(YKFastlane::YKFASTLANE_ENV_PATH, 'archive_config', 'archive_config.yml')
|
10
|
+
|
11
|
+
K_archiveEnv_config_tf = :test_flight
|
12
|
+
K_archiveEnv_tf_account = :user_name
|
13
|
+
K_archiveEnv_tf_password = :pass_word
|
14
|
+
|
15
|
+
K_archiveEnv_config_fir = :fir
|
16
|
+
K_archiveEnv_firApiToken = :fir_api_token
|
17
|
+
|
18
|
+
K_archiveEnv_config_pgyer = :pgyer
|
19
|
+
K_archiveEnv_pgyer_user = :pgyer_user
|
20
|
+
K_archiveEnv_pgyer_api = :pgyer_api
|
21
|
+
|
22
|
+
def self.update_archive_map(key, value)
|
23
|
+
YKFastlane::Tools.update_yml("", YKARCHIVE_ENV_PATH, key, value)
|
24
|
+
end
|
25
|
+
|
26
|
+
def update_archive_map(key, value)
|
27
|
+
YKFastlane::Tools.update_yml("", YKARCHIVE_ENV_PATH, key, value)
|
28
|
+
end
|
29
|
+
|
30
|
+
def load_archive_config_dict(platform_name)
|
31
|
+
dict = YKFastlane::Tools.load_yml_value(YKARCHIVE_ENV_PATH, platform_name)
|
32
|
+
return dict == nil ? {} : dict
|
33
|
+
end
|
34
|
+
|
35
|
+
def list_user_map()
|
36
|
+
YKFastlane::Tools.display_yml(YKARCHIVE_ENV_PATH)
|
37
|
+
end
|
38
|
+
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
@@ -0,0 +1,95 @@
|
|
1
|
+
require 'actions/YKFastlaneExecute'
|
2
|
+
require 'ykfastlane/helper'
|
3
|
+
require 'thor'
|
4
|
+
require 'openssl'
|
5
|
+
|
6
|
+
module YKFastlane
|
7
|
+
class Certificate < YKFastlane::SubCommandBase
|
8
|
+
|
9
|
+
desc "sync_apple_profile", "sync and install mobile provision file from apple developer service"
|
10
|
+
option :user_name, :require => true, :type => :string, :aliases => :u, :desc => 'apple account'
|
11
|
+
option :password, :require => true, :type => :string, :aliases => :p, :desc => 'apple account password'
|
12
|
+
option :workspace, :require => false, :type => :string, :aliases => :w, :desc => 'p12 password'
|
13
|
+
option :bundle_ids, :require => false, :type => :array, :aliases => :b, :desc => "bundle identifier arr, separate by \" \" once more than one, exaple: 123 456 234"
|
14
|
+
|
15
|
+
def sync_apple_profile()
|
16
|
+
puts "options:#{options}"
|
17
|
+
arr = options[:bundle_ids]
|
18
|
+
if arr != nil && arr.count > 0
|
19
|
+
str = arr.join(",")
|
20
|
+
options[:bundle_ids] = str
|
21
|
+
end
|
22
|
+
|
23
|
+
if options[:workspace].blank? == false
|
24
|
+
Dir.chdir(Dir.pwd) do
|
25
|
+
options[:workspace] = File.expand_path(options[:workspace])
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
puts "options_formatter:#{options}"
|
30
|
+
code = YKFastlaneExecute.executeFastlaneLane("sync_apple_profile", options)
|
31
|
+
exit! code unless code == 0
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "update_profile", "Update one profile"
|
35
|
+
option :profile_path, :require => true, :type => :array, :aliases => :p, :desc => 'profile path'
|
36
|
+
|
37
|
+
def update_profile()
|
38
|
+
result_arr = []
|
39
|
+
arr = options[:profile_path]
|
40
|
+
if arr != nil && arr.count > 0
|
41
|
+
Dir.chdir(Dir.pwd) do
|
42
|
+
arr.each do |one|
|
43
|
+
path = File.expand_path(one)
|
44
|
+
result_arr << path
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
str = result_arr.join(",")
|
50
|
+
options[:profile_path] = str unless str.blank?
|
51
|
+
puts "options:#{options}"
|
52
|
+
code = YKFastlaneExecute.executeFastlaneLane("update_profiles", options)
|
53
|
+
exit! code unless code == 0
|
54
|
+
end
|
55
|
+
|
56
|
+
desc "update_cer", "edit certificate & profile for project schem or target"
|
57
|
+
option :cer_password, :require => true, :type => :string, :aliases => :p, :desc => 'p12 password'
|
58
|
+
option :cer_path, :require => true, :type => :string, :aliases => :c, :desc => 'p12 path'
|
59
|
+
|
60
|
+
def update_cer()
|
61
|
+
puts "options:#{options}"
|
62
|
+
|
63
|
+
para = {}
|
64
|
+
Dir.chdir(Dir.pwd) do
|
65
|
+
para[:cer_path] = File.expand_path(options[:cer_path]) unless options[:cer_path].blank?
|
66
|
+
end
|
67
|
+
|
68
|
+
para[:password] = options[:cer_password]
|
69
|
+
|
70
|
+
code = YKFastlaneExecute.executeFastlaneLane("update_certificate_p12", para)
|
71
|
+
exit! code unless code == 0
|
72
|
+
end
|
73
|
+
|
74
|
+
desc "sync_git", "sync certificate & profile git"
|
75
|
+
def sync_git()
|
76
|
+
puts "#{method(:sync_git)}--options:#{options}"
|
77
|
+
self.sync_git_execute({})
|
78
|
+
end
|
79
|
+
|
80
|
+
no_commands {
|
81
|
+
def sync_git_execute(options)
|
82
|
+
puts "#{method(:sync_git_execute)}--options:#{options}"
|
83
|
+
code = YKFastlaneExecute.executeFastlaneLane("sync_certificate_profile", options)
|
84
|
+
exit! code unless code == 0
|
85
|
+
end
|
86
|
+
|
87
|
+
def list_details_execute()
|
88
|
+
puts("certificate list_details")
|
89
|
+
code = YKFastlaneExecute.executeFastlaneLane("list_profile_certificate_config", options)
|
90
|
+
exit! code unless code == 0
|
91
|
+
end
|
92
|
+
}
|
93
|
+
|
94
|
+
end
|
95
|
+
end
|
data/lib/actions/git.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require 'actions/YKFastlaneExecute'
|
2
|
+
|
3
|
+
module YKFastlane
|
4
|
+
class Git < YKFastlane::SubCommandBase
|
5
|
+
desc "analysis_commit", "analysis git commit"
|
6
|
+
option :path, :require => false, :type => :string, :aliases => :p, :desc => 'the path should be analysised'
|
7
|
+
|
8
|
+
def analysis_commit()
|
9
|
+
self.analysis_git_commit_execute(options)
|
10
|
+
end
|
11
|
+
|
12
|
+
no_commands do
|
13
|
+
def analysis_git_commit_execute(options)
|
14
|
+
puts("analysis git commit info execute:#{options}")
|
15
|
+
path = options[:path].blank? ? Dir.pwd : File.expand_path(options[:path])
|
16
|
+
puts("path:#{path}")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
data/lib/actions/init.rb
ADDED
@@ -0,0 +1,145 @@
|
|
1
|
+
require 'git'
|
2
|
+
require 'yaml'
|
3
|
+
require 'json'
|
4
|
+
|
5
|
+
require 'actions/YKFastlaneExecute'
|
6
|
+
require 'actions/archiveHelper'
|
7
|
+
|
8
|
+
module YKFastlane
|
9
|
+
class Init < YKFastlane::SubCommandBase
|
10
|
+
include Helper
|
11
|
+
|
12
|
+
desc "execute_configs", "execute configs that user defines"
|
13
|
+
|
14
|
+
option :all, :aliases => :a, :type => :boolean, :require => false, :desc => "execute all configs"
|
15
|
+
option :script, :aliases => :s, :type => :boolean, :require => false, :desc => "execute script config"
|
16
|
+
option :profile, :aliases => :p, :type => :boolean, :require => false, :desc => "execute profile config"
|
17
|
+
|
18
|
+
def execute_configs()
|
19
|
+
puts("options:#{options}")
|
20
|
+
self.execute_config_execute(options)
|
21
|
+
end
|
22
|
+
|
23
|
+
desc "edit_configs", "update all configurations"
|
24
|
+
long_desc <<-LONGDESC
|
25
|
+
本指令集只是一个门户指令,核心打包功能是通过调用fastlane脚本实现的。\n
|
26
|
+
需要配置:\n
|
27
|
+
1. 配置fastlane脚本的远程仓库;\n
|
28
|
+
2. 配置任务失败时候的反馈企业微信机器人 企业微信机器人配置: \033[0;32m https://developer.work.weixin.qq.com/document/path/91770 \e[0m\n
|
29
|
+
3. p12 与 profile 的托管仓库\n
|
30
|
+
4. fir, pgyer, tf 的账号口令\n
|
31
|
+
LONGDESC
|
32
|
+
|
33
|
+
option :fastfile_remote, :aliases => :l, :type => :string, :desc => "fastlane 文件的 git remote, 可用参数:#{Helper.default_fast_file_remote()}"
|
34
|
+
|
35
|
+
option :wx_access_token, :aliases => :t, :type => :string, :desc => "enterprise wechat robot token"
|
36
|
+
|
37
|
+
option :profile_remote_url, :aliases => :r, :require => false, :type => :string, :desc => "profile & certificate git remote url, example:#{YKFastlane::Helper.default_certificate_git_remote}"
|
38
|
+
|
39
|
+
option :pgyer_user, :aliases => :u, :type => :string, :required => false, :desc => 'pgyer 平台 user'
|
40
|
+
option :pgyer_api, :aliases => :a, :type => :string, :required => false, :desc => 'pgyer 平台 api, 配置链接: \033[0;32m https://appleid.apple.com/account/manage \e[0m'
|
41
|
+
|
42
|
+
option :apple_account, :aliases => :c, :type => :string, :required => false, :desc => 'apple id'
|
43
|
+
option :apple_password, :aliases => :p, :type => :string, :required => false, :desc => 'apple id 专属app密钥, 配置链接: \033[0;32m https://appleid.apple.com/account/manage \e[0m'
|
44
|
+
|
45
|
+
option :fir_api_token, :aliases => :f, :type => :string, :required => false, :desc => 'fir 平台 api token'
|
46
|
+
|
47
|
+
def edit_configs()
|
48
|
+
require 'actions/certificate'
|
49
|
+
require 'actions/archive'
|
50
|
+
puts("all_config:#{options}")
|
51
|
+
|
52
|
+
YKFastlane::Init.new().config_execute(options)
|
53
|
+
YKFastlane::Archive.new().platform_edit_user_execute(options)
|
54
|
+
YKFastlane::Certificate.new().sync_git_execute(options) unless options[:profile_remote_url].blank?
|
55
|
+
end
|
56
|
+
|
57
|
+
desc 'define_fast_execute_path', "指定fastlane文件的路径,此处是为了调试fastlane脚本"
|
58
|
+
option :debug_flag, :aliases => :d, :type => :string, :require => true, :desc => "运行调试脚本的开关, 1:运行调试脚本, 其他:运行默认脚本"
|
59
|
+
option :fastfile_path, :aliases => :e, :type => :string, :desc => "运行的fastlane 文件的路径,此处是为了调试"
|
60
|
+
|
61
|
+
def define_fast_execute_path()
|
62
|
+
Helper.update_config("debug flag", Helper::K_YK_CONFIG_FASTLANE_DEBUG, options[:debug_flag] ? options[:debug_flag] : 0)
|
63
|
+
Helper.update_config("execute path", Helper::K_YK_CONFIG_FASTLANE_SCRIPT, options[:fastfile_path].blank? ? "" : options[:fastfile_path])
|
64
|
+
end
|
65
|
+
|
66
|
+
desc "list_all_configs", "print the env config file: #{Helper::YKCONFIG_PATH}"
|
67
|
+
|
68
|
+
def list_all_configs()
|
69
|
+
require 'actions/certificate'
|
70
|
+
require 'actions/archive'
|
71
|
+
|
72
|
+
YKFastlane::Certificate.new().list_details_execute()
|
73
|
+
|
74
|
+
YKFastlane::Archive.new().list_platform_user_execute()
|
75
|
+
Helper.display_config_yml
|
76
|
+
YKFastlane::Archive.new().list_profiles_execute()
|
77
|
+
end
|
78
|
+
|
79
|
+
no_commands {
|
80
|
+
def execute_config_execute(options)
|
81
|
+
require 'actions/certificate'
|
82
|
+
|
83
|
+
if options[:all] == true
|
84
|
+
self.sync_script_execute({})
|
85
|
+
YKFastlane::Certificate.new().sync_git_execute({})
|
86
|
+
else
|
87
|
+
if options[:script] == true
|
88
|
+
self.sync_script_execute({})
|
89
|
+
end
|
90
|
+
if options[:profile] == true
|
91
|
+
YKFastlane::Certificate.new().sync_git_execute({})
|
92
|
+
end
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def sync_script_execute(options)
|
97
|
+
fastfile_remote = options[:fastfile_remote].blank? ? Helper::load_config_value(Helper::K_fastfile_remote) : options[:fastfile_remote]
|
98
|
+
|
99
|
+
if fastfile_remote.blank?
|
100
|
+
puts "no remote, work failed"
|
101
|
+
exit false
|
102
|
+
end
|
103
|
+
|
104
|
+
p = Helper::YKFastlne_SCRIPT_PATH
|
105
|
+
p_temp = p + "_temp"
|
106
|
+
FileUtils.remove_dir(p_temp, force: true)
|
107
|
+
|
108
|
+
cloneResult = YKFastlane::Tools.clone_git_repository(fastfile_remote, p_temp)
|
109
|
+
if cloneResult != 0
|
110
|
+
exit cloneResult
|
111
|
+
end
|
112
|
+
|
113
|
+
if Dir.exist?(p)
|
114
|
+
puts "directory exist, so we delete it:#{p}"
|
115
|
+
FileUtils.remove_dir(p, true)
|
116
|
+
end
|
117
|
+
|
118
|
+
if File.exist?(File.dirname(p)) == false
|
119
|
+
FileUtils.mkdir_p(File.dirname(p))
|
120
|
+
end
|
121
|
+
FileUtils.mv(p_temp, p, force: true, verbose: true)
|
122
|
+
|
123
|
+
Dir.chdir(p) do
|
124
|
+
system("bundle install --verbose")
|
125
|
+
end
|
126
|
+
return 0
|
127
|
+
end
|
128
|
+
|
129
|
+
def config_execute(options)
|
130
|
+
puts("#{method(:config_execute)}:#{options}")
|
131
|
+
|
132
|
+
if options[:fastfile_remote].blank? == false
|
133
|
+
Helper.update_config('', Helper::K_fastfile_remote, options[:fastfile_remote]) unless options[:fastfile_remote].blank?
|
134
|
+
self.sync_script_execute({})
|
135
|
+
end
|
136
|
+
|
137
|
+
Helper.update_config('', Helper::K_wx_access_token, options[:wx_access_token]) unless options[:wx_access_token].blank?
|
138
|
+
YKFastlane::ArchiveHelper.update_archive_map(Helper::K_wx_access_token, options[:wx_access_token]) unless options[:wx_access_token].blank?
|
139
|
+
Helper.display_config_yml
|
140
|
+
end
|
141
|
+
}
|
142
|
+
|
143
|
+
end
|
144
|
+
|
145
|
+
end
|
data/lib/actions/pod.rb
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'actions/YKFastlaneExecute'
|
2
|
+
require 'ykfastlane/helper'
|
3
|
+
require 'rails'
|
4
|
+
|
5
|
+
module YKFastlane
|
6
|
+
class Pod < YKFastlane::SubCommandBase
|
7
|
+
desc 'github_transfer', '迁移github三方库到移开gitlab.'
|
8
|
+
long_desc <<-LONGDESC
|
9
|
+
1. 需要在移开gitlab创建一个同名的git仓库.
|
10
|
+
2. 尝试迁移所有tag, 当碰到迁移失败的tag的时候,并不会导致整个迁移的失败;
|
11
|
+
3. 最终会输出迁移成功的数组和失败的数组
|
12
|
+
LONGDESC
|
13
|
+
option :orignal_url, :aliases => :o, :required => true, :type => :string, :desc => '原始源码仓库'
|
14
|
+
option :ykgitlab_url, :aliases => :d, :required => true, :type => :string, :desc => '迁移的目标仓库'
|
15
|
+
option :versions, :aliases => :s, :type => :string, :desc => '迁移的目标版本,多个的时候用空格\' \'隔开, 默认遍历尝试迁移所有的版本,比较耗时'
|
16
|
+
option :wxwork_access_token, :aliases => :w, :type => :string, :desc => '用于将任务结果传给企业微信'
|
17
|
+
|
18
|
+
def github_transfer()
|
19
|
+
puts "github_pod_transfer"
|
20
|
+
if options[:wxwork_access_token].blank?
|
21
|
+
wxtoken = YKFastlane::Helper.load_config_value(YKFastlane::Helper::K_wx_access_token)
|
22
|
+
options[:wxwork_access_token] = wxtoken unless wxtoken.blank?
|
23
|
+
end
|
24
|
+
|
25
|
+
code = Ykfastlane::YKFastlaneExecute.executeFastlaneLane("github_pod_transfer", options)
|
26
|
+
exit(code)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
require 'actions/YKFastlaneExecute'
|
2
|
+
|
3
|
+
module YKFastlane
|
4
|
+
class YKGit < YKFastlane::SubCommandBase
|
5
|
+
require "GitTools/git_analysis"
|
6
|
+
include YKFastlane::GitAnalysis
|
7
|
+
|
8
|
+
desc "diff_to_tag", "analysis git commit"
|
9
|
+
option :path, :require => false, :type => :string, :aliases => :p, :desc => 'the path should be analysised'
|
10
|
+
|
11
|
+
def diff_to_tag()
|
12
|
+
self.analysis_git_commit_execute(options)
|
13
|
+
end
|
14
|
+
|
15
|
+
no_commands do
|
16
|
+
def analysis_git_commit_execute(options)
|
17
|
+
puts("analysis git commit info execute:#{options}")
|
18
|
+
path = options[:path].blank? ? Dir.pwd : File.expand_path(options[:path])
|
19
|
+
puts("path:#{path}")
|
20
|
+
diff_hash = self.commit_tag_diff(path)
|
21
|
+
|
22
|
+
YKFastlane::Tools.UI(diff_hash.to_json)
|
23
|
+
diff_hash
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'actions/YKFastlaneExecute'
|
2
|
+
|
3
|
+
module YKFastlane
|
4
|
+
|
5
|
+
class YKServiceHttp < YKFastlane::SubCommandBase
|
6
|
+
require 'HttpService/HttpServiceHelper'
|
7
|
+
include YKHttpModule::YKHttpHelper
|
8
|
+
|
9
|
+
desc "start", "start ykfastlane service"
|
10
|
+
def start()
|
11
|
+
self.start_execute(options)
|
12
|
+
end
|
13
|
+
|
14
|
+
desc "stop", "stop ykfastlane service"
|
15
|
+
def stop()
|
16
|
+
self.stop_execute(options)
|
17
|
+
end
|
18
|
+
|
19
|
+
no_commands do
|
20
|
+
def start_execute(options)
|
21
|
+
puts("start service execute")
|
22
|
+
YKHttpModule::YKHttpHelper.startService(8080)
|
23
|
+
end
|
24
|
+
|
25
|
+
def stop_execute(options)
|
26
|
+
puts("stop service execute")
|
27
|
+
YKHttpModule::YKHttpHelper.stopService
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/interface.rb
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ykfastlane/version'
|
4
|
+
|
5
|
+
require 'actions/YKFastlaneExecute'
|
6
|
+
require 'actions/archive'
|
7
|
+
require 'actions/pod'
|
8
|
+
require 'actions/init'
|
9
|
+
require 'actions/certificate'
|
10
|
+
require 'thor'
|
11
|
+
|
12
|
+
module YKFastlane
|
13
|
+
class Interface < Thor
|
14
|
+
include Thor::Actions
|
15
|
+
require_relative 'actions/YKFastlaneExecute'
|
16
|
+
include YKFastlane::Helper
|
17
|
+
|
18
|
+
class_option :verbose, :type => :boolean
|
19
|
+
def self.exit_on_failure?
|
20
|
+
true
|
21
|
+
end
|
22
|
+
|
23
|
+
# desc "lanes", 'list all lanes'
|
24
|
+
#
|
25
|
+
# def lanes()
|
26
|
+
# puts "lanes"
|
27
|
+
# code = YKFastlane::YKFastlaneExecute.executeFastlaneLane("lanes", options)
|
28
|
+
# exit(code)
|
29
|
+
# end
|
30
|
+
|
31
|
+
desc "archive", "archive functions"
|
32
|
+
subcommand "archive", YKFastlane::Archive
|
33
|
+
|
34
|
+
# desc "pod", "cocoapods functions"
|
35
|
+
# subcommand "pod", YKFastlane::Pod
|
36
|
+
|
37
|
+
desc "init", "init ykcitool"
|
38
|
+
subcommand "init", YKFastlane::Init
|
39
|
+
|
40
|
+
desc "certificate", "manager ios certificate & profile files"
|
41
|
+
subcommand "certificate", YKFastlane::Certificate
|
42
|
+
|
43
|
+
desc "update", "update ykcitool"
|
44
|
+
def update()
|
45
|
+
require 'actions/YKFastlaneExecute'
|
46
|
+
code = YKFastlane::YKFastlaneExecute.executeCommand("gem uninstall ykcitool -a -x", "gem install ykcitool", "")
|
47
|
+
exit! code unless code == 0
|
48
|
+
end
|
49
|
+
|
50
|
+
desc "uninstall", "uninstall self"
|
51
|
+
def uninstall()
|
52
|
+
require 'actions/YKFastlaneExecute'
|
53
|
+
code = YKFastlane::YKFastlaneExecute.executeCommand("gem uninstall ykcitool -a -x", "", "")
|
54
|
+
exit! code unless code == 0
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
end
|