easyci 1.1.0 → 1.1.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 113eafe943159d19560edb28ccc1d34194386b6a58072f9105128ed8015ad0cf
4
- data.tar.gz: 161f61e90ffd504c193b04a13c5abc4654e7b8d1d2761257cf5789f93440915a
3
+ metadata.gz: 480eba74298dfe03c29f4122eb8eff6d8689463477fcdaa299df3a9732b02f21
4
+ data.tar.gz: 63a3252686696c5622a40e9a884a5f18b34f7654d5f7b23b5b7415d91320289b
5
5
  SHA512:
6
- metadata.gz: 81dc6c108ba624d7d3ae75f2ac65b96a1ed00456b614cf8a78dbe796018c8452c80db6c7c8030feff960295a9848a4ed3451aacf5bc5e48373be293d7e62dff1
7
- data.tar.gz: 1742a9e8803c8610a29b0c8696627380f1d13684c29c2281316c907eae6c29d5742af467c883d19df9dbff71daf4cd59071ba3a49e3fb8532485482551d35a9c
6
+ metadata.gz: dea00daaf62abc9c57f60931e96cd4f3cdd4302e1bc4ffc518173ed2e04113f857e764abae8a883476519e10e640b455e2ee0a79a34833b0419098e64c69ba7d
7
+ data.tar.gz: 917e420dceb7d09075fb576f4de2e8bb349ca7259bb326bae4ba1b2bcb489fc575c619ebadde47562cbee8f02df6d077319d6443ae8c2a2c6d5d3218770945a0
@@ -28,8 +28,6 @@ module EasyCI
28
28
 
29
29
  gitee_draw_dir = File.expand_path('~/Documents/gitee_draw')
30
30
  FileUtils.mkdir_p(gitee_draw_dir)
31
-
32
- ssh_host_gitee_dreamstudio = ENV['SSH_HOST_GITEE_DREAMSTUDIO'] || 'gitee.com'
33
31
 
34
32
  gitee_repo = ENV['GITEE_REPO'] || 'fundesignexport/MagicSortDemoDesignExport'
35
33
  gitee_repo_name = gitee_repo.split('/').last
@@ -38,6 +36,15 @@ module EasyCI
38
36
  puts "GITEE_REPO 和 GITEE_BRANCH 不能为空"
39
37
  exit 1
40
38
  end
39
+
40
+ ssh_host_gitee = 'gitee.com'
41
+ if !gitee_repo.empty? && gitee_repo.start_with?('fundesignexport')
42
+ ssh_host_gitee = 'gitee-fununitydraw'
43
+ elsif !gitee_repo.empty? && gitee_repo.start_with?('gooddesignexport')
44
+ ssh_host_gitee = 'gitee-joyunitydraw'
45
+ else
46
+ ssh_host_gitee = 'gitee.com'
47
+ end
41
48
 
42
49
  work_dir = File.join(gitee_draw_dir, gitee_repo_name)
43
50
  if File.exist?(work_dir)
@@ -67,7 +74,7 @@ module EasyCI
67
74
 
68
75
  runner_dir = File.join(work_dir, runner_repo_name)
69
76
  FileUtils.rm_rf(runner_dir) if File.exist?(runner_dir)
70
- git_url = @use_https ? "https://gitee.com/#{@runner_repo}.git" : "git@#{ssh_host_gitee_dreamstudio}:#{@runner_repo}.git"
77
+ git_url = @use_https ? "https://gitee.com/#{@runner_repo}.git" : "git@#{ssh_host_gitee}:#{@runner_repo}.git"
71
78
  puts "git_url: #{git_url}"
72
79
  clone_runner_result = system("cd #{work_dir} && git clone --depth 1 -b #{runner_branch} #{git_url} #{runner_repo_name}")
73
80
  unless clone_runner_result
@@ -86,7 +93,7 @@ module EasyCI
86
93
  end
87
94
  FileUtils.mkdir_p(File.join(runner_dir, 'Assets'))
88
95
  puts "下载截图仓库..."
89
- git_url = @use_https ? "https://gitee.com/#{gitee_repo}.git" : "git@gitee.com:#{gitee_repo}.git"
96
+ git_url = @use_https ? "https://gitee.com/#{gitee_repo}.git" : "git@#{ssh_host_gitee}:#{gitee_repo}.git"
90
97
  puts "git_url: #{git_url}"
91
98
  gitee_repo_local_path = File.join(work_dir, gitee_repo_name)
92
99
  FileUtils.rm_rf(gitee_repo_local_path) if File.exist?(gitee_repo_local_path)
@@ -101,8 +108,8 @@ module EasyCI
101
108
  FileUtils.mkdir_p(resources_dir)
102
109
  FileUtils.cp_r(File.join(gitee_repo_local_path, '2D', '.'), resources_dir)
103
110
  FileUtils.cp_r(File.join(gitee_repo_local_path, 'Common/Font'), File.join(resources_dir, 'Fonts'))
104
- # 安全复制 Languages 文件夹(如果存在)
105
- languages_path = File.join(gitee_repo_local_path, 'Common/Languages')
111
+ # 安全复制 Language 文件夹(如果存在)
112
+ languages_path = File.join(gitee_repo_local_path, 'Common/Language')
106
113
  if Dir.exist?(languages_path)
107
114
  FileUtils.cp_r(languages_path, resources_dir)
108
115
  else
@@ -112,18 +119,52 @@ module EasyCI
112
119
  FileUtils.mv(File.join(gitee_repo_local_path, 'Resources'), resources_dir)
113
120
  end
114
121
 
122
+ # 如果 resources_dir 的FGUI目录下有Code文件夹,则删除
123
+ fgui_dir = File.join(resources_dir, 'FGUI')
124
+ if File.exist?(File.join(fgui_dir, 'Code'))
125
+ FileUtils.rm_rf(File.join(fgui_dir, 'Code'))
126
+ end
127
+
115
128
  # 运行Unity截图任务
116
129
  unity_path = find_unity_path(runner_dir)
117
130
  puts "运行Unity截图任务..."
118
131
  FileUtils.chdir(runner_dir)
119
- system("#{unity_path} -projectPath #{runner_dir} -executeMethod SpineAutoImporter.CIRunner -logFile screenshot-log.txt")
132
+ system("mkdir -p ~/UnityTemp && TMPDIR=~/UnityTemp #{unity_path} -projectPath #{runner_dir} -executeMethod SpineAutoImporter.CIRunner -logFile screenshot-log.txt")
120
133
 
121
134
  # 压缩截图
122
135
  puts "开始压缩截图..."
123
136
  system("cd #{runner_dir} && find . -path \"*/Screenshots/*.png\" -exec pngquant --quality=70-95 --ext .png --force {} \\;")
124
137
  # 运行Node脚本(如果需要)
125
138
  puts "运行后处理脚本..."
126
- system("cd #{runner_dir} && docker run --rm -v \"$(pwd):/app\" -w /app node:22.0.0 bash -c \"cd Scripts && export BUILD_FROM_PRO=#{gitee_repo_name} && yarn install && npx ts-node index.ts\"")
139
+ # 你想传入的变量前缀,比如 GITEE_
140
+ env_prefixes = ["GITEE_"]
141
+
142
+ # 构建 docker run 的 -e 参数
143
+ env_flags = ENV
144
+ .select { |k, _| env_prefixes.any? { |prefix| k.start_with?(prefix) } }
145
+ .map { |k, _| "-e #{k}" }
146
+ .join(" ")
147
+
148
+ # 可选:你也可以在这里补充额外变量
149
+ extra_env = {
150
+ "BUILD_FROM_PRO" => gitee_repo_name,
151
+ "BUILD_FROM_REPO" => gitee_repo
152
+ }
153
+ extra_env.each { |k, v| ENV[k] = v }
154
+
155
+ # 构建并执行命令
156
+ cmd = <<~CMD
157
+ cd #{runner_dir} && \
158
+ docker run --rm #{env_flags} \
159
+ -v "$(pwd):/app" \
160
+ -w /app \
161
+ node:22.0.0 bash -c "cd Scripts && yarn install && npx ts-node index.ts"
162
+ CMD
163
+
164
+ system(cmd)
165
+ puts "执行命令:\n#{cmd}"
166
+ # export gitee_repo 和 gitee_repo_name
167
+ # system("cd #{runner_dir} && docker run --rm -v \"$(pwd):/app\" -w /app node:22.0.0 bash -c \"cd Scripts && export BUILD_FROM_PRO=#{gitee_repo_name} && export BUILD_FROM_REPO=#{gitee_repo} && yarn install && npx ts-node index.ts\"")
127
168
 
128
169
  end
129
170
 
@@ -1,5 +1,5 @@
1
1
  module EasyCI
2
2
 
3
- VERSION = '1.1.0'
3
+ VERSION = '1.1.7'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: easyci
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Wade
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-06-17 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: claide
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.6.3
103
+ rubygems_version: 3.6.9
104
104
  specification_version: 4
105
105
  summary: EasyCI - 简单的CI工具集
106
106
  test_files: []