cocoapods-aomi-bin 0.0.5 → 0.1.1
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 +4 -4
- data/lib/cocoapods-lhj-bin/command/bin.rb +6 -1
- data/lib/cocoapods-lhj-bin/command/bin/config/push.rb +48 -0
- data/lib/cocoapods-lhj-bin/command/bin/fetch.rb +68 -0
- data/lib/cocoapods-lhj-bin/command/bin/local.rb +178 -0
- data/lib/cocoapods-lhj-bin/command/bin/oss/del.rb +38 -0
- data/lib/cocoapods-lhj-bin/command/bin/oss/list.rb +26 -0
- data/lib/cocoapods-lhj-bin/command/bin/trans.rb +63 -0
- data/lib/cocoapods-lhj-bin/gem_version.rb +1 -1
- data/lib/cocoapods-lhj-bin/helpers/oss_helper.rb +35 -0
- data/lib/cocoapods-lhj-bin/helpers/trans_helper.rb +50 -0
- data/lib/cocoapods-lhj-bin/helpers/upload_helper.rb +2 -4
- metadata +14 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 573cfa8ea8dbb183b001012e62bab0fe0d043b7494abfa403c56ca097a2623b4
|
4
|
+
data.tar.gz: cc36ab1f0f6bf554105484779d5cc8fcc727cd48d3fabc77561efddb840e2660
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c8a581391a943116753f427b42e3fcef34b93cf67ab6a59d517c1baf6c585e7d9734b76a6ba6a419724a7334bc31ecaaa1934324f8e87885aeacf2021015e7ec
|
7
|
+
data.tar.gz: bd35aeb5f7d75da16f309c1df4b38e73a03c9aee332009c2b542716b3d0bab1169d7a5e15f48ae3d033a9df5d7f09b6608d594244c8f95102c001676f6952ca8
|
@@ -6,7 +6,13 @@ require 'cocoapods-lhj-bin/command/bin/code'
|
|
6
6
|
require 'cocoapods-lhj-bin/command/bin/update'
|
7
7
|
require 'cocoapods-lhj-bin/command/bin/install'
|
8
8
|
require 'cocoapods-lhj-bin/command/bin/import'
|
9
|
+
require 'cocoapods-lhj-bin/command/bin/local'
|
10
|
+
require 'cocoapods-lhj-bin/command/bin/trans'
|
11
|
+
require 'cocoapods-lhj-bin/command/bin/fetch'
|
9
12
|
require 'cocoapods-lhj-bin/command/bin/lhj'
|
13
|
+
require 'cocoapods-lhj-bin/command/bin/config/push'
|
14
|
+
require 'cocoapods-lhj-bin/command/bin/oss/list'
|
15
|
+
require 'cocoapods-lhj-bin/command/bin/oss/del'
|
10
16
|
require 'cocoapods-lhj-bin/helpers'
|
11
17
|
require 'cocoapods-lhj-bin/native'
|
12
18
|
|
@@ -35,7 +41,6 @@ module Pod
|
|
35
41
|
|
36
42
|
self.abstract_command = true
|
37
43
|
|
38
|
-
self.default_subcommand = 'open'
|
39
44
|
self.summary = '组件二进制化插件.'
|
40
45
|
self.description = <<-DESC
|
41
46
|
组件二进制化插件。利用源码私有源与二进制私有源实现对组件依赖类型的切换。
|
@@ -0,0 +1,48 @@
|
|
1
|
+
#coding:utf-8
|
2
|
+
require 'cocoapods-lhj-bin/helpers/oss_helper'
|
3
|
+
require 'yaml'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Bin < Command
|
8
|
+
class Init < Bin
|
9
|
+
class Push < Init
|
10
|
+
self.summary = '推送配置文档到OSS.'
|
11
|
+
|
12
|
+
def initialize(argv)
|
13
|
+
super
|
14
|
+
end
|
15
|
+
|
16
|
+
def run
|
17
|
+
push
|
18
|
+
end
|
19
|
+
|
20
|
+
def push_cn_hk
|
21
|
+
file = File.expand_path("#{Pod::Config.instance.home_dir}/zh2hant.yml")
|
22
|
+
CBin::OSS::Helper.instance.upload('zh2hant.yml', file)
|
23
|
+
end
|
24
|
+
|
25
|
+
def push
|
26
|
+
file = File.expand_path("#{Pod::Config.instance.home_dir}/bin_dev.yml")
|
27
|
+
CBin::OSS::Helper.instance.upload('bin_dev.yml', file)
|
28
|
+
end
|
29
|
+
|
30
|
+
def trans
|
31
|
+
key_map = {}
|
32
|
+
path = '/Users/lihaijian/workspace/cocoa/cocoapods-lhj-bin-build-temp/zh2Hant.properties'
|
33
|
+
File.open(path, 'r+') do |f|
|
34
|
+
f.each_line do |line|
|
35
|
+
arr = line.split('=')
|
36
|
+
key = [arr[0][2, 4].hex].pack("U")
|
37
|
+
val = arr[1].strip!
|
38
|
+
key_map[key] = [val[2, 4].hex].pack("U")
|
39
|
+
end
|
40
|
+
end
|
41
|
+
File.open('/Users/lihaijian/workspace/cocoa/cocoapods-lhj-bin-build-temp/zh2hant.yml', 'w') { |f| f.write key_map.to_yaml }
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Bin < Command
|
8
|
+
class Fetch < Bin
|
9
|
+
self.summary = '提取源码的中文字符串,并生成中英文对照csv文件'
|
10
|
+
|
11
|
+
def self.options
|
12
|
+
[
|
13
|
+
%w[--file-type 从文件扩展名中查找中文字符串,默认为m,h],
|
14
|
+
%w[--file-name 生成csv文件名,默认为gen_cn_key.csv]
|
15
|
+
]
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(argv)
|
19
|
+
@current_path = argv.shift_argument || Dir.pwd
|
20
|
+
@file_type = argv.option('file-type', 'm,h')
|
21
|
+
@file_name = argv.option('file-name', 'gen_cn_key.csv')
|
22
|
+
@cn_keys = []
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def run
|
27
|
+
handle_files
|
28
|
+
gen_csv
|
29
|
+
end
|
30
|
+
|
31
|
+
def gen_csv
|
32
|
+
file = File.join(@current_path, @file_name)
|
33
|
+
FileUtils.rm_rf(file) if File.exist?(file)
|
34
|
+
CSV.open(file, 'wb:utf-8') do |csv|
|
35
|
+
csv << %w[国际化key 中文 英文 原字符 所在文件 文件路径]
|
36
|
+
@cn_keys.each do |k|
|
37
|
+
csv << [k[:key], k[:cn], k[:en], k[:str], k[:fname], k[:dirname]]
|
38
|
+
end
|
39
|
+
end
|
40
|
+
UI.puts "生成csv文件完成.\n文件路径:#{File.absolute_path(file)}".green
|
41
|
+
end
|
42
|
+
|
43
|
+
def handle_files
|
44
|
+
Dir.glob("#{@current_path}/**/*.{#{@file_type}}").each do |f|
|
45
|
+
handle_file f
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def handle_file(file)
|
50
|
+
File.open(file, 'r') do |f|
|
51
|
+
f.each_line do |line|
|
52
|
+
handle_line(file, line) if line =~ /@"[^"]*[\u4e00-\u9fa5]+[^"]*"/
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
def handle_line(file, line)
|
58
|
+
reg = /@"[^"]*[\u4e00-\u9fa5]+[^"]*"/
|
59
|
+
ma = reg.match(line)
|
60
|
+
str = ma[0]
|
61
|
+
key = "#{File.basename(file, '.*')}.#{rand(36**8).to_s(36)}"
|
62
|
+
@cn_keys << { key: key, cn: str[2, str.length - 3], en: '', str: str, dirname: File.dirname(file),
|
63
|
+
fname: File.basename(file) }
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,178 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
require 'cocoapods-lhj-bin/helpers/trans_helper'
|
5
|
+
|
6
|
+
module Pod
|
7
|
+
class Command
|
8
|
+
class Bin < Command
|
9
|
+
class Local < Bin
|
10
|
+
self.summary = '根据中英文对照csv文件,生成国际化配置, 及批量更新源码(使用国际化写法)'
|
11
|
+
|
12
|
+
def self.options
|
13
|
+
[
|
14
|
+
%w[--key-col 国际化key在csv中第几列,默认为0],
|
15
|
+
%w[--cn-col 中文在csv中第几列,默认为1],
|
16
|
+
%w[--en-col 英文在csv中第几列,默认为2],
|
17
|
+
%w[--csv-file csv文件名,默认为当前目录下所有csv文件],
|
18
|
+
%w[--gen-file 生成配置文件名,默认名为: Localizable.strings],
|
19
|
+
%w[--modify-source 修改源码,使用国际化key代替中文字符串],
|
20
|
+
%w[--modify-file-type 需要修改源码的文件类型,默认为m,h],
|
21
|
+
%w[--modify-format-string 修改为国际化后的字符格式,默认为NSLocalizedString(%s, @"")]
|
22
|
+
]
|
23
|
+
end
|
24
|
+
|
25
|
+
def initialize(argv)
|
26
|
+
@current_path = argv.shift_argument || Dir.pwd
|
27
|
+
@key_col = argv.option('key-col', 0).to_i
|
28
|
+
@cn_col = argv.option('cn-col', 1).to_i
|
29
|
+
@en_col = argv.option('en-col', 2).to_i
|
30
|
+
@csv_file = argv.option('csv-file', '*')
|
31
|
+
@gen_file_name = argv.option('gen-file', 'Localizable.strings')
|
32
|
+
@modify_source_flag = argv.flag?('modify-source', false)
|
33
|
+
@modify_file_type = argv.option('modify-file-type', 'm,h')
|
34
|
+
@modify_format_string = argv.option('modify-format-string', 'NSLocalizedString(%s, @"")')
|
35
|
+
@key_map = {}
|
36
|
+
@cn_key_map = {}
|
37
|
+
super
|
38
|
+
end
|
39
|
+
|
40
|
+
def run
|
41
|
+
read_csv_file
|
42
|
+
if @key_map.keys.length.positive?
|
43
|
+
write_en_strings
|
44
|
+
write_zh_cn_strings
|
45
|
+
write_zh_hk_strings
|
46
|
+
handle_modify_source if @modify_source_flag
|
47
|
+
else
|
48
|
+
UI.puts "获取中英文映射文件失败, 检查参数--csv-file=xx是否正常\n".red
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def en_dir_name
|
53
|
+
'en.lproj'
|
54
|
+
end
|
55
|
+
|
56
|
+
def zh_hk_dir_name
|
57
|
+
'zh-hk.lproj'
|
58
|
+
end
|
59
|
+
|
60
|
+
def zh_cn_dir_name
|
61
|
+
'zh-cn.lproj'
|
62
|
+
end
|
63
|
+
|
64
|
+
def generate_file_name
|
65
|
+
@gen_file_name
|
66
|
+
end
|
67
|
+
|
68
|
+
def handle_modify_source
|
69
|
+
UI.puts '开始修改源码开始'
|
70
|
+
Dir.glob("#{@current_path}/**/*.{#{@modify_file_type}}").each do |f|
|
71
|
+
handle_modify_file f if File.stat(f).writable?
|
72
|
+
end
|
73
|
+
UI.puts '开始修改源码结束'
|
74
|
+
end
|
75
|
+
|
76
|
+
def handle_modify_file(file)
|
77
|
+
str = modify_file_string(file)
|
78
|
+
File.open(file, 'w+') do |f|
|
79
|
+
f.write(str)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def modify_file_string(file)
|
84
|
+
str = ''
|
85
|
+
File.open(file, 'r') do |f|
|
86
|
+
f.each_line do |line|
|
87
|
+
str += modify_format_string(f, line)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
str
|
91
|
+
end
|
92
|
+
|
93
|
+
def modify_format_string(file, line)
|
94
|
+
result = line
|
95
|
+
result = handle_modify_line line if line =~ /@"[^"]*[\u4e00-\u9fa5]+[^"]*"/
|
96
|
+
result
|
97
|
+
end
|
98
|
+
|
99
|
+
def handle_modify_line(line)
|
100
|
+
result = line
|
101
|
+
reg = /@"[^"]*[\u4e00-\u9fa5]+[^"]*"/
|
102
|
+
ma = reg.match(line)
|
103
|
+
key = find_key_by_cn_val(ma[0])
|
104
|
+
if key
|
105
|
+
val = format(@modify_format_string, "@\"#{key}\"")
|
106
|
+
result = line.gsub(ma[0], val)
|
107
|
+
end
|
108
|
+
result
|
109
|
+
end
|
110
|
+
|
111
|
+
def find_key_by_cn_val(val)
|
112
|
+
cn_key = val[2, val.length - 3]
|
113
|
+
@cn_key_map[cn_key]
|
114
|
+
end
|
115
|
+
|
116
|
+
def read_csv_file
|
117
|
+
path = "#{@current_path}/#{@csv_file}.csv"
|
118
|
+
Dir.glob(path).each do |p|
|
119
|
+
CSV.foreach(p) do |row|
|
120
|
+
key = row[@key_col]
|
121
|
+
unless key =~ /[\u4e00-\u9fa5]/
|
122
|
+
@key_map[key] = { zh: row[@cn_col], en: row[@en_col] }
|
123
|
+
@cn_key_map[row[@cn_col]] = key
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
end
|
128
|
+
|
129
|
+
def format_str(type, area = :cn)
|
130
|
+
str = ''
|
131
|
+
@key_map.each do |k, v|
|
132
|
+
val = v[type]
|
133
|
+
case area
|
134
|
+
when :hk
|
135
|
+
val = CBin::Trans::Helper.instance.trans_zh_hk_str val
|
136
|
+
when :cn
|
137
|
+
val = CBin::Trans::Helper.instance.trans_zh_cn_str val
|
138
|
+
end
|
139
|
+
str += "\"#{k}\" = \"#{val}\";\n"
|
140
|
+
end
|
141
|
+
str
|
142
|
+
end
|
143
|
+
|
144
|
+
def write_to_file(file, contents)
|
145
|
+
FileUtils.rm_rf(file) if File.exist?(file)
|
146
|
+
FileUtils.mkdir_p(File.dirname(file)) unless File.exist?(File.dirname(file))
|
147
|
+
File.open(file, 'w+') do |f|
|
148
|
+
f.write(contents)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
def generate_file(file, type)
|
153
|
+
content = format_str(type)
|
154
|
+
write_to_file(file, content)
|
155
|
+
end
|
156
|
+
|
157
|
+
def write_en_strings
|
158
|
+
file = File.join(@current_path, en_dir_name, generate_file_name)
|
159
|
+
generate_file(file, :en)
|
160
|
+
UI.puts "生成英文配置完成.文件路径:#{File.absolute_path(file)}\n".green
|
161
|
+
end
|
162
|
+
|
163
|
+
def write_zh_cn_strings
|
164
|
+
file = File.join(@current_path, zh_cn_dir_name, generate_file_name)
|
165
|
+
generate_file(file, :zh)
|
166
|
+
UI.puts "生成简体中文配置完成.文件路径:#{File.absolute_path(file)}\n".green
|
167
|
+
end
|
168
|
+
|
169
|
+
def write_zh_hk_strings
|
170
|
+
file = File.join(@current_path, zh_hk_dir_name, generate_file_name)
|
171
|
+
content = format_str(:zh, :hk)
|
172
|
+
write_to_file(file, content)
|
173
|
+
UI.puts "生成繁体中文配置完成.文件路径:#{File.absolute_path(file)}\n".green
|
174
|
+
end
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'cocoapods-lhj-bin/helpers/oss_helper'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class Bin < Command
|
7
|
+
class OSS < Bin
|
8
|
+
class Del < OSS
|
9
|
+
self.summary = '删除OSS的key'
|
10
|
+
|
11
|
+
self.arguments = [
|
12
|
+
CLAide::Argument.new('--key=XX', true)
|
13
|
+
]
|
14
|
+
|
15
|
+
def self.options
|
16
|
+
[
|
17
|
+
['--key', 'OSS对应的key']
|
18
|
+
]
|
19
|
+
end
|
20
|
+
|
21
|
+
def initialize(argv)
|
22
|
+
@key = argv.option('key')
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def validate!
|
27
|
+
help! "请输入key" unless @key
|
28
|
+
super
|
29
|
+
end
|
30
|
+
|
31
|
+
def run
|
32
|
+
CBin::OSS::Helper.instance.delete(@key)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'cocoapods-lhj-bin/helpers/oss_helper'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class Bin < Command
|
7
|
+
class OSS < Bin
|
8
|
+
class List < OSS
|
9
|
+
self.summary = '查看OSS列表'
|
10
|
+
|
11
|
+
def initialize(argv)
|
12
|
+
super
|
13
|
+
end
|
14
|
+
|
15
|
+
def run
|
16
|
+
objects = CBin::OSS::Helper.instance.list
|
17
|
+
objects.each do |o|
|
18
|
+
path = "#{CBin::OSS::Helper.instance.url_path}/#{o.key}"
|
19
|
+
UI.puts path.green
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
require 'cocoapods-lhj-bin/helpers/trans_helper'
|
3
|
+
|
4
|
+
module Pod
|
5
|
+
class Command
|
6
|
+
class Bin < Command
|
7
|
+
class Trans < Bin
|
8
|
+
self.summary = '源码中的简繁体转换'
|
9
|
+
|
10
|
+
def self.options
|
11
|
+
[
|
12
|
+
%w[--file-type 文件扩展名,默认为m,h,pch,xib],
|
13
|
+
%w[--zh-cn 转成简体中文,默认转成繁体]
|
14
|
+
]
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(argv)
|
18
|
+
@current_path = argv.shift_argument || Dir.pwd
|
19
|
+
@file_type = argv.option('file-type', 'm,h,pch,xib')
|
20
|
+
@zh_cn = argv.flag?('zh-cn', false)
|
21
|
+
super
|
22
|
+
end
|
23
|
+
|
24
|
+
def run
|
25
|
+
handler_files
|
26
|
+
end
|
27
|
+
|
28
|
+
def handler_files
|
29
|
+
Dir.glob("#{@current_path}/**/*.{#{@file_type}}").each do |f|
|
30
|
+
handler_file f
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def handler_file(file)
|
35
|
+
str = format_file_string(file)
|
36
|
+
File.open(file, 'w+') do |f|
|
37
|
+
f.write(str)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
def format_file_string(file)
|
42
|
+
str = ''
|
43
|
+
File.open(file, 'r+') do |f|
|
44
|
+
f.each_line do |line|
|
45
|
+
str += format_line_string(line)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
str
|
49
|
+
end
|
50
|
+
|
51
|
+
def format_line_string(line)
|
52
|
+
result = line
|
53
|
+
if line =~ /[\u4e00-\u9fa5]/
|
54
|
+
result = CBin::Trans::Helper.instance.trans_zh_cn_str(line) if @zh_cn
|
55
|
+
result = CBin::Trans::Helper.instance.trans_zh_hk_str(line) unless @zh_cn
|
56
|
+
end
|
57
|
+
result
|
58
|
+
end
|
59
|
+
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'aliyun/oss'
|
2
|
+
require 'cocoapods-lhj-bin/config/config'
|
3
|
+
|
4
|
+
module CBin
|
5
|
+
class OSS
|
6
|
+
class Helper
|
7
|
+
def initialize
|
8
|
+
@client = Aliyun::OSS::Client.new(endpoint: CBin.config.oss_endpoint,
|
9
|
+
access_key_id: CBin.config.oss_access_key_id,
|
10
|
+
access_key_secret: CBin.config.oss_access_key_secret)
|
11
|
+
@bucket = @client.get_bucket(CBin.config.oss_bucket)
|
12
|
+
end
|
13
|
+
|
14
|
+
def url_path
|
15
|
+
"http://#{CBin.config.oss_bucket}.#{CBin.config.oss_endpoint}"
|
16
|
+
end
|
17
|
+
|
18
|
+
def upload(key, file)
|
19
|
+
@bucket.put_object(key, :file => file)
|
20
|
+
end
|
21
|
+
|
22
|
+
def list
|
23
|
+
@bucket.list_objects
|
24
|
+
end
|
25
|
+
|
26
|
+
def delete(key)
|
27
|
+
@bucket.delete_object(key)
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.instance
|
31
|
+
@instance ||= new
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
|
2
|
+
module CBin
|
3
|
+
class Trans
|
4
|
+
class Helper
|
5
|
+
|
6
|
+
def self.instance
|
7
|
+
@instance ||= new
|
8
|
+
end
|
9
|
+
|
10
|
+
def yaml_file
|
11
|
+
File.join(Pod::Config.instance.home_dir, 'zh2hant.yml')
|
12
|
+
end
|
13
|
+
|
14
|
+
def load_trans_map
|
15
|
+
require 'yaml'
|
16
|
+
down_load_yaml unless File.exist?(yaml_file)
|
17
|
+
contents = YAML.safe_load(File.open(yaml_file))
|
18
|
+
contents.to_hash
|
19
|
+
end
|
20
|
+
|
21
|
+
def down_load_yaml
|
22
|
+
require 'open-uri'
|
23
|
+
UI.puts "开始下载简繁配置文件...\n"
|
24
|
+
URI.open('http://aomi-ios-repo.oss-cn-shenzhen.aliyuncs.com/zh2hant.yml') do |i|
|
25
|
+
File.open(yaml_file, 'w+') do |f|
|
26
|
+
f.write(i.read)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
def trans_zh_cn_str(input)
|
32
|
+
@trans_map_invert ||= load_trans_map.invert
|
33
|
+
out = []
|
34
|
+
input.each_char do |c|
|
35
|
+
out << (@trans_map_invert[c] || c)
|
36
|
+
end
|
37
|
+
out.join('')
|
38
|
+
end
|
39
|
+
|
40
|
+
def trans_zh_hk_str(input)
|
41
|
+
@trans_map ||= load_trans_map
|
42
|
+
out = []
|
43
|
+
input.each_char do |c|
|
44
|
+
out << (@trans_map[c] || c)
|
45
|
+
end
|
46
|
+
out.join('')
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'cocoapods-lhj-bin/helpers/oss_helper'
|
2
2
|
require 'cocoapods-lhj-bin/native/podfile'
|
3
3
|
require 'cocoapods/command/gen'
|
4
4
|
require 'cocoapods/generate'
|
@@ -17,8 +17,6 @@ module CBin
|
|
17
17
|
@spec = spec
|
18
18
|
@code_dependencies = code_dependencies
|
19
19
|
@sources = sources
|
20
|
-
@client = Aliyun::OSS::Client.new(endpoint: CBin.config.oss_endpoint, access_key_id: CBin.config.oss_access_key_id, access_key_secret: CBin.config.oss_access_key_secret )
|
21
|
-
@bucket = @client.get_bucket(CBin.config.oss_bucket)
|
22
20
|
end
|
23
21
|
|
24
22
|
def upload
|
@@ -73,7 +71,7 @@ EOF
|
|
73
71
|
res = File.exist?(zip_file)
|
74
72
|
end
|
75
73
|
if res
|
76
|
-
|
74
|
+
CBin::OSS::Helper.instance.upload("#{@spec.name}/#{@spec.version}/#{@spec.name}.zip", zip_file)
|
77
75
|
end
|
78
76
|
res
|
79
77
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-aomi-bin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lihaijian
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-05-
|
11
|
+
date: 2021-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: parallel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: '0'
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: aliyun-sdk
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -109,16 +109,22 @@ files:
|
|
109
109
|
- lib/cocoapods-lhj-bin/command/bin/archive.rb
|
110
110
|
- lib/cocoapods-lhj-bin/command/bin/auto.rb
|
111
111
|
- lib/cocoapods-lhj-bin/command/bin/code.rb
|
112
|
+
- lib/cocoapods-lhj-bin/command/bin/config/push.rb
|
112
113
|
- lib/cocoapods-lhj-bin/command/bin/dup.rb
|
114
|
+
- lib/cocoapods-lhj-bin/command/bin/fetch.rb
|
113
115
|
- lib/cocoapods-lhj-bin/command/bin/import.rb
|
114
116
|
- lib/cocoapods-lhj-bin/command/bin/init.rb
|
115
117
|
- lib/cocoapods-lhj-bin/command/bin/initHotKey.rb
|
116
118
|
- lib/cocoapods-lhj-bin/command/bin/install.rb
|
117
119
|
- lib/cocoapods-lhj-bin/command/bin/lhj.rb
|
118
120
|
- lib/cocoapods-lhj-bin/command/bin/lib/lint.rb
|
121
|
+
- lib/cocoapods-lhj-bin/command/bin/local.rb
|
122
|
+
- lib/cocoapods-lhj-bin/command/bin/oss/del.rb
|
123
|
+
- lib/cocoapods-lhj-bin/command/bin/oss/list.rb
|
119
124
|
- lib/cocoapods-lhj-bin/command/bin/repo/update.rb
|
120
125
|
- lib/cocoapods-lhj-bin/command/bin/spec/create.rb
|
121
126
|
- lib/cocoapods-lhj-bin/command/bin/spec/push.rb
|
127
|
+
- lib/cocoapods-lhj-bin/command/bin/trans.rb
|
122
128
|
- lib/cocoapods-lhj-bin/command/bin/update.rb
|
123
129
|
- lib/cocoapods-lhj-bin/config/config.rb
|
124
130
|
- lib/cocoapods-lhj-bin/config/config_asker.rb
|
@@ -134,10 +140,12 @@ files:
|
|
134
140
|
- lib/cocoapods-lhj-bin/helpers/framework_builder.rb
|
135
141
|
- lib/cocoapods-lhj-bin/helpers/library.rb
|
136
142
|
- lib/cocoapods-lhj-bin/helpers/library_builder.rb
|
143
|
+
- lib/cocoapods-lhj-bin/helpers/oss_helper.rb
|
137
144
|
- lib/cocoapods-lhj-bin/helpers/sources_helper.rb
|
138
145
|
- lib/cocoapods-lhj-bin/helpers/spec_creator.rb
|
139
146
|
- lib/cocoapods-lhj-bin/helpers/spec_files_helper.rb
|
140
147
|
- lib/cocoapods-lhj-bin/helpers/spec_source_creator.rb
|
148
|
+
- lib/cocoapods-lhj-bin/helpers/trans_helper.rb
|
141
149
|
- lib/cocoapods-lhj-bin/helpers/upload_helper.rb
|
142
150
|
- lib/cocoapods-lhj-bin/native.rb
|
143
151
|
- lib/cocoapods-lhj-bin/native/acknowledgements.rb
|