cocoapods-aomi-bin 0.1.10 → 0.1.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-lhj-bin/command/bin.rb +2 -0
- data/lib/cocoapods-lhj-bin/command/bin/local/fetch.rb +12 -5
- data/lib/cocoapods-lhj-bin/command/bin/local/filter.rb +85 -0
- data/lib/cocoapods-lhj-bin/command/bin/local/local.rb +1 -1
- data/lib/cocoapods-lhj-bin/command/bin/local/micro_service.rb +90 -0
- data/lib/cocoapods-lhj-bin/gem_version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8581691289d5161199dd5f1169a37499e00d3dbe2f1197599f77ebd1724ad80d
|
4
|
+
data.tar.gz: cd27e27a2df116550292744b2f4797d4fe5218f3059373c173653f6aab771163
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: aca5282ce3545156241bc926bae0f4da242ea36140f19fbc01494c55d39d8c69a7c56928f3f4b26132b693208fcf945aac62827830e0020761a3bf03f08c1c2f
|
7
|
+
data.tar.gz: 6efcbd3de94086bc98d9bf98466ccfd5c92cdfe510db59c025a84b4c4d0db7f2608d08b0f527fa8b4d1e55ffd448c6af0c0f499e0389e76ecfff088c479cc2e1
|
@@ -8,6 +8,8 @@ require 'cocoapods-lhj-bin/command/bin/install'
|
|
8
8
|
require 'cocoapods-lhj-bin/command/bin/import'
|
9
9
|
require 'cocoapods-lhj-bin/command/bin/local/local'
|
10
10
|
require 'cocoapods-lhj-bin/command/bin/local/fetch'
|
11
|
+
require 'cocoapods-lhj-bin/command/bin/local/filter'
|
12
|
+
require 'cocoapods-lhj-bin/command/bin/local/micro_service'
|
11
13
|
require 'cocoapods-lhj-bin/command/bin/local/upload'
|
12
14
|
require 'cocoapods-lhj-bin/command/bin/trans'
|
13
15
|
require 'cocoapods-lhj-bin/command/bin/lhj'
|
@@ -50,7 +50,13 @@ module Pod
|
|
50
50
|
|
51
51
|
def handle_files
|
52
52
|
Dir.glob("#{@current_path}/**/*.{#{@file_type}}").each do |f|
|
53
|
-
|
53
|
+
dir_name = File.dirname(f)
|
54
|
+
if /Pods/ =~ f
|
55
|
+
mod_name = framework_name(dir_name)
|
56
|
+
handle_file f if /^ML/ =~ mod_name
|
57
|
+
else
|
58
|
+
handle_file f
|
59
|
+
end
|
54
60
|
end
|
55
61
|
end
|
56
62
|
|
@@ -61,7 +67,7 @@ module Pod
|
|
61
67
|
def handle_file(file)
|
62
68
|
File.open(file, 'r') do |f|
|
63
69
|
f.each_line do |line|
|
64
|
-
handle_line(file, line) if zh_ch_reg =~ line
|
70
|
+
handle_line(file, line) if zh_ch_reg =~ line && !((/DDLog/ =~ line) || (/NSLog/ =~ line))
|
65
71
|
end
|
66
72
|
end
|
67
73
|
end
|
@@ -102,9 +108,11 @@ module Pod
|
|
102
108
|
def update_source_header
|
103
109
|
Dir.glob("#{@current_path}/**/*.{m,h}").each do |f|
|
104
110
|
if f =~ /Pods/
|
105
|
-
|
111
|
+
dir_name = File.dirname(f)
|
112
|
+
mod_name = framework_name(dir_name)
|
113
|
+
handle_file f if /^ML/ =~ mod_name
|
106
114
|
else
|
107
|
-
handler_file
|
115
|
+
handler_file f
|
108
116
|
end
|
109
117
|
end
|
110
118
|
end
|
@@ -140,7 +148,6 @@ module Pod
|
|
140
148
|
end
|
141
149
|
result
|
142
150
|
end
|
143
|
-
|
144
151
|
end
|
145
152
|
end
|
146
153
|
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Bin < Command
|
8
|
+
class Filter < Bin
|
9
|
+
self.summary = '过滤重复对象'
|
10
|
+
|
11
|
+
def initialize(argv)
|
12
|
+
@current_path = argv.shift_argument || Dir.pwd
|
13
|
+
@file_type = argv.option('file-type', 'm,h')
|
14
|
+
@file_name = argv.option('file-name', 'MaucaoLife_zh_en.csv')
|
15
|
+
@cn_keys = []
|
16
|
+
@key_map = {}
|
17
|
+
@used_keys = []
|
18
|
+
super
|
19
|
+
end
|
20
|
+
|
21
|
+
def run
|
22
|
+
fetch_keys
|
23
|
+
read_csv
|
24
|
+
gen_csv
|
25
|
+
end
|
26
|
+
|
27
|
+
def csv_file_name
|
28
|
+
file_name = @file_name
|
29
|
+
file_name = "#{@file_name}.csv" unless /.csv$/ =~ @file_name
|
30
|
+
file_name
|
31
|
+
end
|
32
|
+
|
33
|
+
def read_csv
|
34
|
+
path = File.join(@current_path, csv_file_name)
|
35
|
+
Dir.glob(path).each do |p|
|
36
|
+
CSV.foreach(p) do |row|
|
37
|
+
key = row[0]
|
38
|
+
if @used_keys.any? { |k| k.eql?(key) }
|
39
|
+
@cn_keys << { key: key, cn: row[1], en: row[2], fname: row[3], dirname: row[4] }
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def gen_csv
|
46
|
+
file = File.join(@current_path, csv_file_name)
|
47
|
+
FileUtils.rm_rf(file) if File.exist?(file)
|
48
|
+
CSV.open(file, 'wb:utf-8') do |csv|
|
49
|
+
csv << %w[国际化key 中文 英文 所在文件 文件路径]
|
50
|
+
@cn_keys.each do |k|
|
51
|
+
csv << [k[:key], k[:cn], k[:en], k[:fname], k[:dirname]]
|
52
|
+
end
|
53
|
+
end
|
54
|
+
UI.puts "生成csv文件完成.\n文件路径:#{File.absolute_path(file)}".green
|
55
|
+
end
|
56
|
+
|
57
|
+
def fetch_keys
|
58
|
+
Dir.glob("#{@current_path}/**/*.{#{@file_type}}").each do |f|
|
59
|
+
handle_file f
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def zh_ch_reg
|
64
|
+
/MLLocalizedString\([^)]+\)/
|
65
|
+
end
|
66
|
+
|
67
|
+
def handle_file(file)
|
68
|
+
File.open(file, 'r') do |f|
|
69
|
+
f.each_line do |line|
|
70
|
+
handle_line(file, line) if zh_ch_reg =~ line
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
def handle_line(file, line)
|
76
|
+
line.scan(zh_ch_reg) do |str|
|
77
|
+
str[20, str.length - 22]
|
78
|
+
@used_keys << str[20, str.length - 22]
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -170,7 +170,7 @@ module Pod
|
|
170
170
|
|
171
171
|
def modify_format_string(file, line)
|
172
172
|
result = line
|
173
|
-
result = handle_modify_line(file, line) if zh_ch_reg =~ line
|
173
|
+
result = handle_modify_line(file, line) if zh_ch_reg =~ line && !((/DDLog/ =~ line) || (/NSLog/ =~ line))
|
174
174
|
result
|
175
175
|
end
|
176
176
|
|
@@ -0,0 +1,90 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'csv'
|
4
|
+
|
5
|
+
module Pod
|
6
|
+
class Command
|
7
|
+
class Bin < Command
|
8
|
+
class Service < Bin
|
9
|
+
self.summary = '微服务名变更'
|
10
|
+
|
11
|
+
def initialize(argv)
|
12
|
+
@current_path = argv.shift_argument || Dir.pwd
|
13
|
+
@file_type = argv.option('file-type', 'm,h')
|
14
|
+
@file_name = argv.option('file-name', 'service_map.csv')
|
15
|
+
@service_map = {}
|
16
|
+
super
|
17
|
+
end
|
18
|
+
|
19
|
+
def run
|
20
|
+
read_csv
|
21
|
+
update_source
|
22
|
+
end
|
23
|
+
|
24
|
+
def read_csv
|
25
|
+
path = File.join(@current_path, csv_file_name)
|
26
|
+
Dir.glob(path).each do |p|
|
27
|
+
CSV.foreach(p) do |row|
|
28
|
+
@service_map[row[0]] = row[1] if row[0]
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def csv_file_name
|
34
|
+
file_name = @file_name
|
35
|
+
file_name = "#{@file_name}.csv" unless /.csv$/ =~ @file_name
|
36
|
+
file_name
|
37
|
+
end
|
38
|
+
|
39
|
+
def update_source
|
40
|
+
Dir.glob("#{@current_path}/**/*.{m,h}").each do |f|
|
41
|
+
if f =~ /Pods/
|
42
|
+
update_file(f) if f =~ %r{Pods/ML}
|
43
|
+
else
|
44
|
+
update_file(f)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def update_file(file)
|
50
|
+
File.chmod(0o644, file)
|
51
|
+
str = file_string(file)
|
52
|
+
File.open(file, 'w+') do |f|
|
53
|
+
f.write(str)
|
54
|
+
end
|
55
|
+
File.chmod(0o444, file) if file =~ /Pods/
|
56
|
+
end
|
57
|
+
|
58
|
+
def file_string(file)
|
59
|
+
str = ''
|
60
|
+
File.open(file, 'r+') do |f|
|
61
|
+
f.each_line do |line|
|
62
|
+
str += format_string(f, line)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
str
|
66
|
+
end
|
67
|
+
|
68
|
+
def format_string(file, line)
|
69
|
+
result = line
|
70
|
+
line.scan(url_reg) do |key|
|
71
|
+
result = result.gsub(key, @service_map[key])
|
72
|
+
end
|
73
|
+
result
|
74
|
+
end
|
75
|
+
|
76
|
+
def find_head_key(line)
|
77
|
+
line.match(url_reg)
|
78
|
+
end
|
79
|
+
|
80
|
+
def url_reg
|
81
|
+
@url_key_reg ||= begin
|
82
|
+
keys = @service_map.keys.join('|')
|
83
|
+
/@".*#{keys}.*"/
|
84
|
+
end
|
85
|
+
@url_key_reg
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
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.1.
|
4
|
+
version: 0.1.11
|
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-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -118,7 +118,9 @@ files:
|
|
118
118
|
- lib/cocoapods-lhj-bin/command/bin/lhj.rb
|
119
119
|
- lib/cocoapods-lhj-bin/command/bin/lib/lint.rb
|
120
120
|
- lib/cocoapods-lhj-bin/command/bin/local/fetch.rb
|
121
|
+
- lib/cocoapods-lhj-bin/command/bin/local/filter.rb
|
121
122
|
- lib/cocoapods-lhj-bin/command/bin/local/local.rb
|
123
|
+
- lib/cocoapods-lhj-bin/command/bin/local/micro_service.rb
|
122
124
|
- lib/cocoapods-lhj-bin/command/bin/local/upload.rb
|
123
125
|
- lib/cocoapods-lhj-bin/command/bin/oss/del.rb
|
124
126
|
- lib/cocoapods-lhj-bin/command/bin/oss/list.rb
|