happy_day_plugin 0.1.0 → 0.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 +4 -4
- data/bin/happy_day_plugin +37 -0
- data/happy_day_plugin-0.1.0.gem +0 -0
- data/happy_day_plugin-0.1.1.gem +0 -0
- data/happy_day_plugin-0.1.2.gem +0 -0
- data/happy_day_plugin-0.1.3.gem +0 -0
- data/happy_day_plugin-0.1.4.gem +0 -0
- data/happy_day_plugin.gemspec +3 -2
- data/lib/happy_day_plugin.rb +118 -7
- data/lib/happy_day_plugin/version.rb +1 -1
- data/unused.txt +44 -0
- metadata +12 -6
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9946d94b7fdb2545a346bd6f1d58f95fc03e51b59f72f23b31432dc56b3779a6
|
4
|
+
data.tar.gz: d5ebb1a6fda9e6b888145b9d06f212850d485e052b0be91e7e64e1c373da3ed8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ee79f5f203b465061ad4cd26836ede0b085785c0a99900c8d5766dbe3ff7f3e204162be287beb5f7a1d883149fb3072fae67930cdad80959cc8bf5f89839c09
|
7
|
+
data.tar.gz: b8953c3e3962bf58d6ead2457e6bc7b94b0822386be755276c45ebbfd0c65a4aca59acfcf27eea60ce6d83511baa473aa1c4d3ee677e611f3f095e79553bc9f4
|
@@ -0,0 +1,37 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# require "bundler/setup"
|
4
|
+
# require "happy_day_plugin"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require 'optparse'
|
14
|
+
|
15
|
+
require 'happy_day_plugin'
|
16
|
+
require 'happy_day_plugin/version'
|
17
|
+
|
18
|
+
options = {}
|
19
|
+
option_parser = OptionParser.new do |opts|
|
20
|
+
opts.banner = "杰杰子帮助信息呀:"
|
21
|
+
|
22
|
+
opts.on('-v', '--version', '版本信息') do
|
23
|
+
options[:verson] = HappyDayPlugin::VERSION
|
24
|
+
puts "当前版本:" + HappyDayPlugin::VERSION
|
25
|
+
end
|
26
|
+
|
27
|
+
opts.on('-p path', '--path path', '输入路径,可以排查冗余图片') do |value|
|
28
|
+
options[:path] = value
|
29
|
+
cc = FindImage.new(value)
|
30
|
+
cc.find
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
|
35
|
+
option_parser.parse!(ARGV)
|
36
|
+
# puts options.inspect
|
37
|
+
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
Binary file
|
data/happy_day_plugin.gemspec
CHANGED
@@ -32,8 +32,9 @@ Gem::Specification.new do |spec|
|
|
32
32
|
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
33
33
|
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
34
34
|
end
|
35
|
-
|
36
|
-
spec.
|
35
|
+
|
36
|
+
spec.bindir = "bin"
|
37
|
+
spec.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
37
38
|
spec.require_paths = ["lib"]
|
38
39
|
|
39
40
|
spec.add_development_dependency "bundler", "~> 1.17"
|
data/lib/happy_day_plugin.rb
CHANGED
@@ -1,9 +1,120 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
1
3
|
require "happy_day_plugin/version"
|
2
4
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
5
|
+
|
6
|
+
|
7
|
+
|
8
|
+
# module HappyDayPlugin
|
9
|
+
# class Error < StandardError; end
|
10
|
+
|
11
|
+
# def self.hi(p)
|
12
|
+
# cc = FindImage.new(p)
|
13
|
+
# cc.find
|
14
|
+
# end
|
15
|
+
|
16
|
+
# # class CH
|
17
|
+
# # def initialize(p)
|
18
|
+
# # @v = p
|
19
|
+
# # end
|
20
|
+
# # def hello
|
21
|
+
# # puts "hello" + @v
|
22
|
+
# # end
|
23
|
+
# # end
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
# end
|
28
|
+
|
29
|
+
|
30
|
+
class FindImage
|
31
|
+
def initialize(dir)
|
32
|
+
@imgs = Array.new
|
33
|
+
@mFiles = Array.new
|
34
|
+
@dir = dir
|
35
|
+
end
|
36
|
+
|
37
|
+
# 获得文件夹内的所有图片
|
38
|
+
def findImageWithPathDir(pathDir)
|
39
|
+
|
40
|
+
Dir.foreach(pathDir) do |file|
|
41
|
+
|
42
|
+
if file != '.' && file != '..' && !file.eql?('Pods')
|
43
|
+
if File.directory? ("#{pathDir}/#{file}")
|
44
|
+
|
45
|
+
findImageWithPathDir("#{pathDir}/#{file}")
|
46
|
+
else
|
47
|
+
isPng = file.end_with? ".png"
|
48
|
+
isJpg = file.end_with? ".jpg"
|
49
|
+
if isPng || isJpg
|
50
|
+
@imgs.push("#{pathDir}/#{file}")
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
57
|
+
# 获得文件夹内所有.m文件
|
58
|
+
def findMwithPathDir(pathDir)
|
59
|
+
Dir.foreach(pathDir) do |file|
|
60
|
+
|
61
|
+
if file != '.' && file != '..'
|
62
|
+
if File.directory? ("#{pathDir}/#{file}")
|
63
|
+
|
64
|
+
findMwithPathDir("#{pathDir}/#{file}")
|
65
|
+
else
|
66
|
+
isM = file.end_with? ".m"
|
67
|
+
isJson = file.end_with? ".json"
|
68
|
+
if isM || isJson
|
69
|
+
@mFiles.push("#{pathDir}/#{file}")
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
# 检查图片是否有被使用
|
77
|
+
def checkImageUsing
|
78
|
+
@imgs.each do |img|
|
79
|
+
_isUsed = false
|
80
|
+
@mFiles.each do |file|
|
81
|
+
# 在file中检查 img
|
82
|
+
content = File.read(file)
|
83
|
+
# puts content
|
84
|
+
is2 = content =~ /#{File.basename(img, '@2x.png')}(.*)/
|
85
|
+
is3 = content =~ /#{File.basename(img, '@3x.png')}(.*)/
|
86
|
+
if (is2 || is3)
|
87
|
+
_isUsed = true
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
unless _isUsed
|
92
|
+
outFile = File.new("unused.txt", "a+")
|
93
|
+
if outFile
|
94
|
+
outFile.syswrite(img)
|
95
|
+
outFile.syswrite("\n")
|
96
|
+
end
|
97
|
+
puts img
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
|
102
|
+
def find
|
103
|
+
puts "|--开始"
|
104
|
+
|
105
|
+
findImageWithPathDir(@dir)
|
106
|
+
findMwithPathDir(@dir)
|
107
|
+
puts "|--没有使用\n"
|
108
|
+
checkImageUsing
|
109
|
+
|
110
|
+
# @imgs.each do |img|
|
111
|
+
# puts img
|
112
|
+
# end
|
113
|
+
|
114
|
+
# @mFiles.each do |file|
|
115
|
+
# puts file
|
116
|
+
# end
|
117
|
+
|
118
|
+
puts "|--结束"
|
119
|
+
end
|
120
|
+
end
|
data/unused.txt
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/jrcommunity_hot_list_icon_0@2x.png
|
2
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/jrcommunity_hot_list_icon_2@3x.png
|
3
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/jrcommunity_hot_list_icon_2@2x.png
|
4
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/jrcommunity_hot_list_icon_0@3x.png
|
5
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/JRCommunityReport_Edit.png
|
6
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/jrcommunity_hot_list_icon_1@2x.png
|
7
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_6.png
|
8
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_7.png
|
9
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_5.png
|
10
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_4.png
|
11
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_1.png
|
12
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_3.png
|
13
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_2.png
|
14
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_8.png
|
15
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/jrcommunity_hot_list_icon_1@3x.png
|
16
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/share_common/JRCommunity_userinfo_share_avatar_vip@2x.png
|
17
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/share_common/JRCommunity_userinfo_share_avatar_vip@3x.png
|
18
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/share_common/JRCommunity_articleShare_jd_finance@3x.png
|
19
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/share_common/JRCommunity_articleShare_jd_finance@2x.png
|
20
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/community_315cell_icon.png
|
21
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/no_message_icon.png
|
22
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/reply_icon_blue.png
|
23
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/jrcommunity_hot_list_icon_0@2x.png
|
24
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/jrcommunity_hot_list_icon_2@3x.png
|
25
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/jrcommunity_hot_list_icon_2@2x.png
|
26
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/jrcommunity_hot_list_icon_0@3x.png
|
27
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/JRCommunityReport_Edit.png
|
28
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/jrcommunity_hot_list_icon_1@2x.png
|
29
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_6.png
|
30
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_7.png
|
31
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_5.png
|
32
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_4.png
|
33
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_1.png
|
34
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_3.png
|
35
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_2.png
|
36
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/LivePraise/live_img_8.png
|
37
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/jrcommunity_hot_list_icon_1@3x.png
|
38
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/share_common/JRCommunity_userinfo_share_avatar_vip@2x.png
|
39
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/share_common/JRCommunity_userinfo_share_avatar_vip@3x.png
|
40
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/share_common/JRCommunity_articleShare_jd_finance@3x.png
|
41
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/share_common/JRCommunity_articleShare_jd_finance@2x.png
|
42
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/community_315cell_icon.png
|
43
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/no_message_icon.png
|
44
|
+
/Users/zhujiabao3/jrCommunityTools/JRCommunityTools/Assets/reply_icon_blue.png
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: happy_day_plugin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- 朱佳宝
|
8
8
|
autorequire:
|
9
|
-
bindir:
|
9
|
+
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-05-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -41,7 +41,8 @@ dependencies:
|
|
41
41
|
description: we love day
|
42
42
|
email:
|
43
43
|
- 13051132827@163.com
|
44
|
-
executables:
|
44
|
+
executables:
|
45
|
+
- happy_day_plugin
|
45
46
|
extensions: []
|
46
47
|
extra_rdoc_files: []
|
47
48
|
files:
|
@@ -51,11 +52,16 @@ files:
|
|
51
52
|
- LICENSE.txt
|
52
53
|
- README.md
|
53
54
|
- Rakefile
|
54
|
-
- bin/
|
55
|
-
-
|
55
|
+
- bin/happy_day_plugin
|
56
|
+
- happy_day_plugin-0.1.0.gem
|
57
|
+
- happy_day_plugin-0.1.1.gem
|
58
|
+
- happy_day_plugin-0.1.2.gem
|
59
|
+
- happy_day_plugin-0.1.3.gem
|
60
|
+
- happy_day_plugin-0.1.4.gem
|
56
61
|
- happy_day_plugin.gemspec
|
57
62
|
- lib/happy_day_plugin.rb
|
58
63
|
- lib/happy_day_plugin/version.rb
|
64
|
+
- unused.txt
|
59
65
|
homepage: https://rubygems.org
|
60
66
|
licenses:
|
61
67
|
- MIT
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "happy_day_plugin"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|