itools 1.1.1 → 1.1.5

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: 62210651cf76afa15688f068dc392d58630ddd539b79695b7fe05d8064425083
4
- data.tar.gz: de194c6c1816aabc9a968442afa0160d7cdc1655ac9323f28868a1a172070da5
3
+ metadata.gz: 231409dd71fbd6f84598d2270edc928ad0288089b0bdb9536632cc832ed20bae
4
+ data.tar.gz: a64240894bfa6a17fcf0d4d63050378cf5c8e9cc4f6239ff0329d0cce0eff302
5
5
  SHA512:
6
- metadata.gz: e0e3411284537b74403a0569907e786bbea7c00210f02b8941c3dcfabb32a1c5ae3c527277618080d16770cb4a3365d8346bb88413c5474993419dc360823c8d
7
- data.tar.gz: be869cf345ad952e4b2edbb6001f33b717bb07f80a8708d03d0241b25cc0338a7f66b9b2f8e954d36b795be56dd5cc9eeb73573697f43ea4b6beea6106ae810f
6
+ metadata.gz: '049cbfd7152daa2944833d1d3f7cae6ef40a00725c2811f02779105919b34a09cf3fe94cf33c034aa1801646e169437eed0808e818282de8d1333b64a1565719'
7
+ data.tar.gz: d9e790bc02448e7d0c9e0516527333f02ed1a834138a5d35dbfd186e0f83be6ada8e29c83aa1dc0f4733040299f437b2ed0848de8bf0ba69f4e1cd1794c25e44
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- ruby-2.3.7
1
+ ruby-2.4.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- itools (1.1.1)
4
+ itools (1.1.5)
5
5
  bundler (~> 1.17)
6
6
  git (~> 1.5)
7
7
  gli (~> 2.17)
@@ -11,11 +11,13 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- git (1.5.0)
15
- gli (2.18.0)
14
+ git (1.7.0)
15
+ rchardet (~> 1.8)
16
+ gli (2.20.0)
16
17
  rake (10.5.0)
17
- ruby-ole (1.2.12.1)
18
- spreadsheet (1.1.9)
18
+ rchardet (1.8.0)
19
+ ruby-ole (1.2.12.2)
20
+ spreadsheet (1.2.6)
19
21
  ruby-ole (>= 1.0)
20
22
 
21
23
  PLATFORMS
@@ -25,4 +27,4 @@ DEPENDENCIES
25
27
  itools!
26
28
 
27
29
  BUNDLED WITH
28
- 1.17.1
30
+ 1.17.3
data/bin/itools CHANGED
@@ -79,4 +79,12 @@ command :pre_commit do |c|
79
79
  Itools::GitSets.commit_msg_init(args)
80
80
  end
81
81
  end
82
+ #本地commit规范化
83
+ desc "通过执行该命令,可以将podfile.lock中所有的依赖平铺至Podifle中"
84
+ arg 'podfile.lock'
85
+ command :podfile_tiled do |c|
86
+ c.action do |global_options,options, args|
87
+ Itools::PodfileTiled.podfile_tiled(args)
88
+ end
89
+ end
82
90
  exit run(ARGV)
@@ -64,6 +64,7 @@ module Itools
64
64
  sheet1.row(0)[0] = "序号"
65
65
  sheet1.row(0)[1] = "文件名"
66
66
  sheet1.row(0)[2] = "文件路径"
67
+ sheet1.row(0)[3] = "文件占用内存大小"
67
68
  total_size = 0
68
69
  @classes.each_with_index{|r_item,f_index|
69
70
  # if !r_item.fr_name.include?("+")
@@ -81,11 +81,13 @@ module Itools
81
81
  sheet1 = book.create_worksheet
82
82
  sheet1.row(0)[0] = "文件名"
83
83
  sheet1.row(0)[1] = "文件路径"
84
+ sheet1.row(0)[2] = "文件大小(B)"
84
85
  imags.each_with_index {|item,idx|
85
86
  sheet1.row(idx+1)[0] = item
86
87
  path = imgFinder.get_image_path(item)
87
88
  sheet1.row(idx+1)[1] = path
88
89
  unuse_total_size = unuse_total_size + File.size(path)
90
+ sheet1.row(idx+1)[2] = File.size(path)
89
91
  puts item
90
92
  }
91
93
  book.write "#{imgFinder.find_path}/search_result.xls"
@@ -42,6 +42,7 @@ module Itools
42
42
  file_count = 0
43
43
  total_count = 0
44
44
  total_size = 0
45
+ file_size = 0
45
46
  Find.find(folder) do |filename|
46
47
  if File.file?(filename)
47
48
  total_count = total_count + 1
@@ -52,6 +53,7 @@ module Itools
52
53
  elsif file_exts.include?(File.extname(filename).delete(".")) #查找指定后缀的文件
53
54
  sum = sum + File.size(filename)
54
55
  file_count = file_count + 1
56
+ file_size = file_size + File.size(filename)
55
57
  else
56
58
  #不做任何处理
57
59
  end
@@ -60,7 +62,7 @@ module Itools
60
62
  if file_exts.size == 0
61
63
  puts "\033[32m文件夹中共#{total_count}个文件,共#{get_show_size(total_size)}(#{total_size})\033[0m"
62
64
  else
63
- puts "\033[32m文件夹中共#{total_count}个文件,共#{get_show_size(total_size)}(#{total_size});找到后缀为(#{file_exts_string})的文件#{file_count}个,共#{get_show_size(sum)}(#{total_size}).\033[0m"
65
+ puts "\033[32m文件夹中共#{total_count}个文件,共#{get_show_size(total_size)}(#{total_size});找到后缀为(#{file_exts_string})的文件#{file_count}个,共#{get_show_size(file_size)}(#{file_size}).\033[0m"
64
66
  end
65
67
 
66
68
  # puts `du -b #{folder} | awk '{print $1}'`.to_i
@@ -0,0 +1,95 @@
1
+ module Itools
2
+ class PodInfo
3
+ attr_accessor :pod_name, :pod_version
4
+ def initialize(name, version)
5
+ @pod_name = name
6
+ @pod_version = version
7
+ end
8
+ end
9
+ class PodfileTiled
10
+ def self.podfile_tiled(args)
11
+ all_pods = [] #所有依赖的pod
12
+ exist_pods = [] #当前podfile已经存在的pod
13
+ need_add_pods = [] #当前需要添加到podfile中的pod
14
+ pod_tag = 1
15
+
16
+ fileInfo = File.open(args[0])
17
+
18
+ total_index = 0
19
+ fileInfo.each_line do |line|
20
+ line_string = line.delete("\n")
21
+ if line_string == 'PODS:'
22
+ # 配置成功,后续请直接使用git commit ,不要加 -m\033[0m
23
+ puts "\033[32m开始分析依赖\033[0m"
24
+ pod_tag = 1
25
+ next
26
+ elsif line_string == 'DEPENDENCIES:'
27
+ puts "\033[32m开始分析当前Podfile中已添加的依赖项\033[0m"
28
+ pod_tag = 2
29
+ next
30
+ elsif line_string == 'SPEC REPOS:'
31
+ pod_tag = 0
32
+ puts "\033[32mpodfile.lock分析结束\033[0m"
33
+ end
34
+
35
+ if pod_tag == 1 #分析所有pod
36
+ if line_string[0, 3] == ' -' && !line_string.include?('/')
37
+ # puts line_string
38
+ pod_version = line_string[/\((.*?)\)/, 1]
39
+ pod_name =
40
+ line_string.gsub(pod_version, '').delete('(').delete(')').delete(
41
+ ':'
42
+ ).delete('-').strip
43
+ temp_pod = PodInfo.new(pod_name, pod_version)
44
+ all_pods << temp_pod
45
+ puts "查找到pod库:#{pod_name}, 版本号为:'#{pod_version}' #{all_pods.length}"
46
+ end
47
+ end
48
+
49
+ if pod_tag == 2 #分析当前podfile已经有的pod
50
+ pod_name
51
+ pod_version = line_string[/\((.*?)\)/, 1]
52
+ if pod_version
53
+ pod_name =
54
+ line_string.gsub(pod_version, '').delete('(').delete(')').delete(
55
+ ':'
56
+ ).delete('-').strip
57
+ else
58
+ pod_name = line_string.delete('-').lstrip.rstrip
59
+ end
60
+
61
+ if pod_name.length == 0 || pod_name.include?('/')
62
+ next
63
+ end
64
+ temp_pod = PodInfo.new(pod_name, pod_version)
65
+ if pod_version
66
+ temp_pod.pod_version = pod_version.delete('=').strip
67
+ end
68
+
69
+ exist_pods << temp_pod
70
+ puts "Podfile中已包含 #{pod_name}, 版本号为:'#{pod_version}'"
71
+ end
72
+ end
73
+ temp_exist_pods = []
74
+ all_pods.each do |all_pod|
75
+ exist_pods.each do |exist_pod|
76
+ if all_pod.pod_name == exist_pod.pod_name
77
+ temp_exist_pods << all_pod
78
+ end
79
+ end
80
+ end
81
+
82
+ need_add_pods = all_pods - temp_exist_pods
83
+ if need_add_pods.length == 0
84
+ puts "\033[32m恭喜!!!无需平铺,当前已全部平铺\033[0m"
85
+ else
86
+ puts "\033[32m以下为要平铺的库,直接复制粘贴至Podfile中即可:\033[0m"
87
+ need_add_pods.each do |to_add|
88
+ puts "pod '#{to_add.pod_name}', '#{to_add.pod_version}'"
89
+ end
90
+ end
91
+
92
+ end
93
+ end
94
+ end
95
+
@@ -1,4 +1,4 @@
1
1
  module Itools
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.5"
3
3
 
4
4
  end
data/lib/itools.rb CHANGED
@@ -6,4 +6,5 @@ require "itools/get_size"
6
6
  require "itools/file_handle"
7
7
  require "itools/class_unuse_finder"
8
8
  require "itools/count_code_line"
9
- require "itools/git_sets"
9
+ require "itools/git_sets"
10
+ require "itools/podfile_tiled"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: itools
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - zhanggui
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-02-19 00:00:00.000000000 Z
11
+ date: 2021-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -113,6 +113,7 @@ files:
113
113
  - lib/itools/get_size.rb
114
114
  - lib/itools/git_sets.rb
115
115
  - lib/itools/link_map.rb
116
+ - lib/itools/podfile_tiled.rb
116
117
  - lib/itools/string_searcher.rb
117
118
  - lib/itools/temple-commit-msg.dat
118
119
  - lib/itools/version.rb
@@ -124,7 +125,7 @@ metadata:
124
125
  homepage_uri: https://github.com/ScottZg/itools
125
126
  source_code_uri: https://github.com/ScottZg/itools
126
127
  changelog_uri: https://github.com/ScottZg/itools/blob/master/README.md
127
- post_install_message:
128
+ post_install_message:
128
129
  rdoc_options: []
129
130
  require_paths:
130
131
  - lib
@@ -139,9 +140,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
139
140
  - !ruby/object:Gem::Version
140
141
  version: '0'
141
142
  requirements: []
142
- rubyforge_project:
143
- rubygems_version: 2.7.8
144
- signing_key:
143
+ rubygems_version: 3.0.9
144
+ signing_key:
145
145
  specification_version: 4
146
146
  summary: iOS tools
147
147
  test_files: []