pindo 4.9.2 → 4.9.4

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.
@@ -1,156 +0,0 @@
1
- require 'fileutils'
2
- require 'pindo/client/giteeclient'
3
-
4
- module Pindo
5
- class Command
6
- class Dev < Command
7
- class Createbuild < Dev
8
-
9
- include Appselect
10
-
11
- self.summary = '创建工程编译选项'
12
-
13
- self.description = <<-DESC
14
-
15
- 创建工程编译选项, 用法:pindo dev createbuild,按照提示填写。创建完成之后, 使用pindo dev autobuild编译时可以选择创建好的编译选项
16
-
17
- DESC
18
-
19
- self.arguments = [
20
-
21
- ]
22
-
23
- def self.options
24
- [
25
- ['--deploy', '默认用开发的bundle id,使用--deploy设置使用发布bundle id来重签名, 用法: --deploy'],
26
- ].concat(super)
27
- end
28
-
29
- def initialize(argv)
30
- @args_deploy_flag = argv.flag?('deploy', false)
31
- super
32
- end
33
-
34
- def validate!
35
- super
36
-
37
- @app_type = ask('App的代号(必填): ')
38
- help! '需要一个唯一的代号' if @app_type.nil? || @app_type.empty?
39
-
40
- @platform_name = ask('使用的Boss平台名称(必填): ')
41
- help! '需要指定Boss平台' if @platform_name.nil? || @platform_name.empty?
42
- @git_repo_name = @platform_name
43
-
44
- @app_desc = ask('请填写App代号的描述(可不填): ')
45
-
46
-
47
-
48
- @selected_bundleid= nil
49
- if @args_deploy_flag
50
- @selected_bundleid = get_selected_deploy_bundleid()
51
- else
52
- @selected_bundleid = get_selected_dev_bundleid()
53
- end
54
-
55
- puts "选择使用的bundle id: #{@selected_bundleid}"
56
-
57
- end
58
-
59
- def run
60
-
61
- @gitee_client = GiteeClient.new(access_token:pindo_single_config.gitee_api_key)
62
- pindo_setting_dir = pindo_single_config.pindo_env_configdir
63
-
64
- setting_file = 'dev_build_setting.json'
65
- if @args_deploy_flag
66
- setting_file = 'deploy_build_setting.json'
67
- end
68
-
69
- setting_file_fullname = File.join(pindo_setting_dir, setting_file)
70
- setting_file_json = JSON.parse(File.read(setting_file_fullname))
71
- if setting_file_json[@app_type]
72
- answer = agree("输入的App代号已存,重新创建?(Y/n):")
73
- unless answer
74
- raise Informative, "输入的App代号已存在!!!"
75
- end
76
- end
77
-
78
- puts "========================="
79
- puts "========================="
80
- puts
81
- puts
82
- puts "App的代号: #{@app_type}"
83
- puts "Boss平台名称: #{@platform_name}"
84
- puts "App选择的bundle id: #{@selected_bundleid}"
85
- puts "仓库名称: #{@git_repo_name}"
86
- puts "App的描述: #{@app_desc}"
87
- puts
88
-
89
- answer = agree("请确认上面信息是否正确(Y/n):")
90
- unless answer
91
- raise Informative, "重新输入 !!!"
92
- end
93
-
94
- args_temp = [@git_repo_name]
95
- args_temp << "--test"
96
- Pindo::Command::Deploy::Initconfig::run(args_temp)
97
-
98
- modify_build_setting
99
-
100
- modify_build_config_json
101
-
102
- end
103
-
104
-
105
-
106
- def modify_build_setting
107
-
108
- pindo_setting_dir = clone_pindo_env_config_repo(force_delete:false)
109
- setting_file = 'dev_build_setting.json'
110
- if @args_deploy_flag
111
- setting_file = 'deploy_build_setting.json'
112
- end
113
- setting_file_fullname = File.join(pindo_setting_dir, setting_file)
114
- setting_file_json = JSON.parse(File.read(setting_file_fullname))
115
- setting_file_json[@app_type] = {}
116
- setting_file_json[@app_type]['git_repo_name'] = @git_repo_name
117
- setting_file_json[@app_type]['build_desc'] = @app_desc
118
- setting_file_json = Hash[setting_file_json.sort]
119
- File.open(setting_file_fullname, "w") do |f|
120
- f.write(JSON.pretty_generate(setting_file_json))
121
- end
122
-
123
- git_addpush_repo(path:pindo_setting_dir, message:"add app_type: #{@app_type}", commit_file_params:[setting_file])
124
- end
125
-
126
- def modify_build_config_json
127
-
128
- pindo_dir = pindo_single_config.pindo_dir
129
- app_config_dir = File.join(pindo_dir, @git_repo_name)
130
-
131
- selected_config_dir = clong_buildconfig_repo(repo_name: @selected_bundleid)
132
- if File.exist?(File.join(selected_config_dir, "config.json"))
133
- FileUtils.cp_r(File.join(selected_config_dir, "config.json"), app_config_dir)
134
- end
135
-
136
- app_config_file = File.join(app_config_dir, "config.json")
137
- app_config_json = JSON.parse(File.read(app_config_file))
138
-
139
- app_config_json = app_config_json || {}
140
- app_config_json["project_info"]["app_type"] = @app_type
141
- app_config_json["project_info"]["app_desc"] = @app_desc
142
- app_config_json["app_setting"]["kGUKeyAppPlatform"] = @platform_name
143
-
144
- File.open(app_config_file, "w") do |f|
145
- f.write(JSON.pretty_generate(app_config_json))
146
- end
147
- git_addpush_repo(path:app_config_dir, message:"更新配置")
148
- end
149
-
150
-
151
-
152
- end
153
- end
154
- end
155
- end
156
-
@@ -1,75 +0,0 @@
1
- require 'fileutils'
2
-
3
- module Pindo
4
- class Command
5
- class Dev < Command
6
- class Pgyercert < Dev
7
-
8
- include Appselect
9
-
10
- include XcodeCertHelper
11
-
12
- self.summary = '生成pgyer需要的证书,上传个pgyer重签名用'
13
-
14
- self.description = <<-DESC
15
-
16
- 生成pgyer需要的证书,上传个pgyer重签名用。
17
-
18
- DESC
19
-
20
- self.arguments = [
21
-
22
- ]
23
-
24
- def self.options
25
- [
26
- ['--deploy', '默认用开发的bundle id,使用--deploy设置使用发布bundle id'],
27
- ['--adhoc', '默认用dev证书,使用--adhoc设置使用adhoc证书'],
28
- ].concat(super)
29
- end
30
-
31
- def initialize(argv)
32
- @args_adhoc_flag = argv.flag?('adhoc', false)
33
- @args_deploy_flag = argv.flag?('deploy', false)
34
- super
35
- end
36
-
37
-
38
- def run
39
-
40
- mainapp_bundleid= nil
41
- if @args_deploy_flag
42
- mainapp_bundleid = get_selected_deploy_bundleid()
43
- else
44
- mainapp_bundleid = get_selected_dev_bundleid()
45
- end
46
- puts "选择使用的bundle id: #{mainapp_bundleid}"
47
-
48
- args_temp = []
49
- args_temp << mainapp_bundleid
50
- Pindo::Command::Deploy::Pullconfig::run(args_temp)
51
-
52
-
53
- # project_dir = Dir.pwd
54
- # Dir.chdir(project_dir)
55
- # config_json_file = File.join(project_dir,"config.json")
56
- # Debug::modify_cert_with_project(project_dir:project_dir, config_file:config_json_file)
57
-
58
- args_temp = []
59
- if @args_adhoc_flag
60
- args_temp << "--adhoc"
61
- else
62
- args_temp << "--dev"
63
- end
64
-
65
- Pindo::Command::Deploy::Cert::run(args_temp)
66
-
67
- end
68
-
69
-
70
-
71
- end
72
- end
73
- end
74
- end
75
-
@@ -1,164 +0,0 @@
1
- require 'fileutils'
2
-
3
- module Pindo
4
- class Command
5
- class Ios < Command
6
- class Cert < Ios
7
-
8
- include Appselect
9
-
10
- include XcodeCertHelper
11
- self.summary = '更新iOS证书并使用新证书设置Xcode工程'
12
- self.description = <<-DESC
13
- 更新iOS证书并使用新证书设置Xcode工程。
14
-
15
- 支持功能:
16
-
17
- * 更新iOS证书
18
-
19
- * 设置Xcode工程证书
20
-
21
- * 支持开发和发布证书
22
-
23
- 使用示例:
24
-
25
- $ pindo ios cert # 更新开发证书
26
-
27
- $ pindo ios cert --deploy # 更新发布bundle id
28
-
29
- $ pindo ios cert --adhoc # 更新adhoc证书
30
-
31
- $ pindo ios cert --macos # 更新macos平台证书
32
-
33
- DESC
34
-
35
- self.arguments = [
36
-
37
- ]
38
-
39
- # 命令选项
40
- def self.options
41
- [
42
- ['--deploy', '默认使用开发环境的bundle id,使用此选项切换为发布环境的bundle id'],
43
- ['--adhoc', '默认使用开发证书,使用此选项切换为adhoc证书'],
44
- ['--macos', '指定为macOS平台的证书'],
45
- ['--upload', '生成用于上传到蒲公英平台的证书'],
46
- ].concat(super)
47
- end
48
-
49
- def initialize(argv)
50
- @args_adhoc_flag = argv.flag?('adhoc', false)
51
- @args_deploy_flag = argv.flag?('deploy', false)
52
- @args_macos_flag = argv.flag?('macos', false)
53
- @upload_flag = argv.flag?('upload', false)
54
- super
55
- end
56
-
57
-
58
- def run
59
-
60
- mainapp_bundleid= nil
61
- if @args_deploy_flag
62
- mainapp_bundleid = get_selected_deploy_bundleid()
63
- else
64
- mainapp_bundleid = get_selected_dev_bundleid()
65
- end
66
-
67
- args_temp = []
68
- args_temp << mainapp_bundleid
69
- Pindo::Command::Deploy::Pullconfig::run(args_temp)
70
-
71
-
72
- project_dir = Dir.pwd
73
- Dir.chdir(project_dir)
74
- config_json_file = File.join(project_dir,"config.json")
75
- Cert::modify_cert_with_project(project_dir:project_dir, config_file:config_json_file)
76
-
77
- args_temp = []
78
- if @args_adhoc_flag
79
- args_temp << "--adhoc"
80
- else
81
- args_temp << "--dev"
82
- end
83
-
84
-
85
-
86
- project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
87
- if !project_fullname.nil?
88
- project_obj = Xcodeproj::Project.open(project_fullname)
89
- project_build_platform = project_obj.root_object.build_configuration_list.get_setting("SDKROOT")["Release"]
90
- if !project_build_platform.nil? && project_build_platform.eql?("macosx")
91
- @args_macos_flag = true
92
- end
93
- end
94
-
95
- if @args_macos_flag
96
- args_temp << "--macos"
97
- end
98
-
99
- if @upload_flag
100
- args_temp << "--upload"
101
- end
102
-
103
- Pindo::Command::Deploy::Cert::run(args_temp)
104
-
105
- end
106
-
107
- def self.modify_cert_with_project(project_dir:nil, config_file:nil)
108
-
109
- project_fullname = Dir.glob(File.join(project_dir, "/*.xcodeproj")).max_by {|f| File.mtime(f)}
110
- if !project_fullname.nil?
111
-
112
- entitlements_plist_path = nil
113
- project_obj = Xcodeproj::Project.open(project_fullname)
114
- project_obj.targets.each do |target|
115
- if target.product_type.to_s.eql?("com.apple.product-type.application") then
116
- temp_entitlements_file = target.build_configurations.first.build_settings['CODE_SIGN_ENTITLEMENTS']
117
- if !temp_entitlements_file.nil? && !temp_entitlements_file.empty?
118
- entitlements_plist_path = File.join(project_dir, temp_entitlements_file)
119
- end
120
- end
121
- end
122
-
123
- # puts entitlements_plist_path
124
- if !entitlements_plist_path.nil? && File.exist?(entitlements_plist_path)
125
- config_json = nil
126
- if File.exist?(config_file)
127
- config_json = JSON.parse(File.read(config_file))
128
- end
129
-
130
- entitlements_plist_dict = Xcodeproj::Plist.read_from_path(entitlements_plist_path)
131
-
132
- if entitlements_plist_dict["com.apple.developer.icloud-container-identifiers"].nil?
133
- if !config_json.nil? && !config_json["app_info"]['app_icloud_id'].nil?
134
- config_json["app_info"].delete('app_icloud_id')
135
- end
136
- end
137
-
138
- if entitlements_plist_dict["com.apple.security.application-groups"].nil?
139
- if !config_json.nil? && !config_json["app_info"]['app_group_id'].nil?
140
- config_json["app_info"].delete('app_group_id')
141
- end
142
- end
143
-
144
- # puts JSON.pretty_generate(config_json)
145
- if !config_json.nil?
146
- File.open(config_file, "w") do |f|
147
- f.write(JSON.pretty_generate(config_json))
148
- end
149
-
150
- end
151
-
152
- end
153
-
154
- end
155
-
156
-
157
- end
158
-
159
-
160
- end
161
- end
162
- end
163
- end
164
-
@@ -1,56 +0,0 @@
1
-
2
- require 'fileutils'
3
-
4
- module Pindo
5
- class Command
6
- class Upgrade < Command
7
-
8
- self.summary = '更新pindo'
9
-
10
- self.description = <<-DESC
11
- 更新pindo版本,用法: pindo upgrade
12
- DESC
13
-
14
- self.arguments = [
15
-
16
- ]
17
-
18
- def self.options
19
- [
20
-
21
- ].concat(super)
22
- end
23
-
24
- def initialize(argv)
25
- super(argv)
26
- @additional_args = argv.remainder!
27
- end
28
-
29
- def validate!
30
- super
31
- end
32
-
33
- def run
34
-
35
- puts "正在更新pindo..."
36
- command = '/bin/bash -c "$(curl -fsSL https://gitee.com/goodbuildtest/env/raw/master/pindo_upgrade.sh)"'
37
- puts "正在运行脚本: #{command}"
38
- system command
39
- # clone_pindo_common_config_repo(force_delete: false)
40
- # clone_pindo_env_config_repo(force_delete: false)
41
-
42
- # commands = [
43
- # "sudo gem update pindo",
44
- # "sudo gem cleanup"
45
- # ]
46
-
47
- # commands.each do |command|
48
- # puts "正在执行 #{command} ..."
49
- # system command
50
- # end
51
- # puts "pindo 已更新到最新版本!"
52
- end
53
-
54
- end
55
- end
56
- end