big_resources 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6d428f54ace9b80a062158796dd85217bda84296
4
+ data.tar.gz: 00a86f2339b2b1265bf346e134fe35235d095d68
5
+ SHA512:
6
+ metadata.gz: d1776edb5e38b751f921e8b3bf17df89df81bf9f9ab1c5528ddb7a14a9221599d1867c98d3204f7a2ebd4ba721c70487a290ea3650c75b72911c53aeed041b84
7
+ data.tar.gz: b3945d39b475564a12f1802fcada84bedf5b84dfecfaadb8ea133e83bb5f115ba29e9001b53df962b21cecd3107903465d0744882baf39b60ec901ccc5b7e562
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at lirui050716@163.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,6 @@
1
+ source "https://rubygems.org"
2
+
3
+ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
+
5
+ # Specify your gem's dependencies in bigToolBox.gemspec
6
+ gemspec
@@ -0,0 +1,113 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ big_resources (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ CFPropertyList (3.0.0)
10
+ activesupport (4.2.10)
11
+ i18n (~> 0.7)
12
+ minitest (~> 5.1)
13
+ thread_safe (~> 0.3, >= 0.3.4)
14
+ tzinfo (~> 1.1)
15
+ ast (2.4.0)
16
+ atomos (0.1.2)
17
+ big_stash (0.6.0)
18
+ gli (~> 2.16)
19
+ chunky_png (1.3.10)
20
+ claide (1.0.2)
21
+ cocoapods (1.4.0)
22
+ activesupport (>= 4.0.2, < 5)
23
+ claide (>= 1.0.2, < 2.0)
24
+ cocoapods-core (= 1.4.0)
25
+ cocoapods-deintegrate (>= 1.0.2, < 2.0)
26
+ cocoapods-downloader (>= 1.1.3, < 2.0)
27
+ cocoapods-plugins (>= 1.0.0, < 2.0)
28
+ cocoapods-search (>= 1.0.0, < 2.0)
29
+ cocoapods-stats (>= 1.0.0, < 2.0)
30
+ cocoapods-trunk (>= 1.3.0, < 2.0)
31
+ cocoapods-try (>= 1.1.0, < 2.0)
32
+ colored2 (~> 3.1)
33
+ escape (~> 0.0.4)
34
+ fourflusher (~> 2.0.1)
35
+ gh_inspector (~> 1.0)
36
+ molinillo (~> 0.6.4)
37
+ nap (~> 1.0)
38
+ ruby-macho (~> 1.1)
39
+ xcodeproj (>= 1.5.4, < 2.0)
40
+ cocoapods-core (1.4.0)
41
+ activesupport (>= 4.0.2, < 6)
42
+ fuzzy_match (~> 2.0.4)
43
+ nap (~> 1.0)
44
+ cocoapods-deintegrate (1.0.2)
45
+ cocoapods-downloader (1.1.3)
46
+ cocoapods-plugins (1.0.0)
47
+ nap
48
+ cocoapods-search (1.0.0)
49
+ cocoapods-stats (1.0.0)
50
+ cocoapods-trunk (1.3.0)
51
+ nap (>= 0.8, < 2.0)
52
+ netrc (~> 0.11)
53
+ cocoapods-try (1.1.0)
54
+ colored2 (3.1.2)
55
+ colorize (0.8.1)
56
+ concurrent-ruby (1.0.5)
57
+ escape (0.0.4)
58
+ fourflusher (2.0.1)
59
+ fuzzy_match (2.0.4)
60
+ gh_inspector (1.1.3)
61
+ gli (2.17.1)
62
+ i18n (0.9.5)
63
+ concurrent-ruby (~> 1.0)
64
+ minitest (5.11.3)
65
+ molinillo (0.6.5)
66
+ nanaimo (0.2.4)
67
+ nap (1.1.0)
68
+ netrc (0.11.0)
69
+ parallel (1.12.1)
70
+ parser (2.5.0.5)
71
+ ast (~> 2.4.0)
72
+ plist (3.4.0)
73
+ powerpack (0.1.1)
74
+ rainbow (2.2.2)
75
+ rake
76
+ rake (10.5.0)
77
+ rubocop (0.50.0)
78
+ parallel (~> 1.10)
79
+ parser (>= 2.3.3.1, < 3.0)
80
+ powerpack (~> 0.1)
81
+ rainbow (>= 2.2.2, < 3.0)
82
+ ruby-progressbar (~> 1.7)
83
+ unicode-display_width (~> 1.0, >= 1.0.1)
84
+ ruby-macho (1.1.0)
85
+ ruby-progressbar (1.9.0)
86
+ thread_safe (0.3.6)
87
+ tzinfo (1.2.5)
88
+ thread_safe (~> 0.1)
89
+ unicode-display_width (1.3.0)
90
+ xcodeproj (1.5.7)
91
+ CFPropertyList (>= 2.3.3, < 4.0)
92
+ atomos (~> 0.1.2)
93
+ claide (>= 1.0.2, < 2.0)
94
+ colored2 (~> 3.1)
95
+ nanaimo (~> 0.2.4)
96
+
97
+ PLATFORMS
98
+ ruby
99
+
100
+ DEPENDENCIES
101
+ big_resources!
102
+ big_stash (~> 0.1)
103
+ bundler (~> 1.16)
104
+ chunky_png
105
+ cocoapods
106
+ colorize
107
+ gli (~> 2.16)
108
+ plist
109
+ rake (~> 10.0)
110
+ rubocop (~> 0.50.0)
111
+
112
+ BUNDLED WITH
113
+ 1.16.1
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2018 Serena_R
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,43 @@
1
+ # BigResources
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/big_resources`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'big_resources'
13
+ ```
14
+
15
+ And then execute:
16
+
17
+ $ bundle
18
+
19
+ Or install it yourself as:
20
+
21
+ $ gem install big_resources
22
+
23
+ ## Usage
24
+
25
+ TODO: Write usage instructions here
26
+
27
+ ## Development
28
+
29
+ After checking out the repo, run `bin/setup` to install dependencies. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
30
+
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
32
+
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Bigkeeper/bigresources. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+
37
+ ## License
38
+
39
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
40
+
41
+ ## Code of Conduct
42
+
43
+ Everyone interacting in the BigToolBox project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/Bigkeeper/bigresources/blob/master/CODE_OF_CONDUCT.md).
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,42 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "big_resources/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "big_resources"
8
+ spec.version = BigResources::VERSION
9
+ spec.authors = ["Serena_R"]
10
+ spec.email = ["lirui050716@163.com"]
11
+
12
+ spec.summary = %q{A tools collection of iOS projects.}
13
+ spec.description = %q{A tools collection of iOS projects for iOS developer.}
14
+ spec.homepage = "https://github.com/Serena1993/bigResources"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ if spec.respond_to?(:metadata)
20
+ spec.metadata["allowed_push_host"] = "https://rubygems.org"
21
+ else
22
+ raise "RubyGems 2.0 or newer is required to protect against " \
23
+ "public gem pushes."
24
+ end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features)/})
28
+ end
29
+ spec.bindir = "bin"
30
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.16"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "gli", "~> 2.16"
36
+ spec.add_development_dependency "big_stash", "~> 0.1"
37
+ spec.add_development_dependency "cocoapods"
38
+ spec.add_development_dependency "plist"
39
+ spec.add_development_dependency "colorize"
40
+ spec.add_development_dependency "rubocop", "~> 0.50.0"
41
+ spec.add_development_dependency "chunky_png"
42
+ end
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "big_resources"
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__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,24 @@
1
+ require "big_resources/version"
2
+ require "big_resources/command/image_command"
3
+ require 'gli'
4
+
5
+ include GLI::App
6
+
7
+ module BigResources
8
+ # Your code goes here...
9
+ program_desc 'A collection of tools to improve iOS development efficiency.'
10
+
11
+ flag %i[p path], default_value: './'
12
+ flag %i[v ver], default_value: 'Version in Bigkeeper file'
13
+
14
+ image_resource_command
15
+
16
+ desc 'Show version of BigResources'
17
+ command :version do |version|
18
+ version.action do |global_options, options, args|
19
+ p "BigResources (#{VERSION})"
20
+ end
21
+ end
22
+
23
+ exit run(ARGV)
24
+ end
@@ -0,0 +1,29 @@
1
+ require 'big_resources/util/image/name_analyze_util'
2
+ require 'big_resources/util/image/diff_analyze_util'
3
+ require 'big_resources/util/image/file_scan_util'
4
+ require 'big_resources/model/file_type'
5
+
6
+ module BigResources
7
+
8
+ def self.image_resource_command
9
+ desc "Detect image resource"
10
+ command :image do | c |
11
+ c.desc "Detect duplicate name image resources."
12
+ c.command :name do | name |
13
+ name.action do | global_options, options, args |
14
+ path = File.expand_path(global_options[:path])
15
+ ImageAnalyzeUtil.get_duplicate_name_file_with_type(path, PNG)
16
+ end
17
+ end
18
+
19
+ c.desc "Detect duplicate content image resources."
20
+ c.command :content do | content |
21
+ content.action do | global_options, options, args |
22
+ path = File.expand_path(global_options[:path])
23
+ ImageAnalyzeUtil.get_duplicate_content_file_with_type(path, PNG)
24
+ end
25
+ end
26
+
27
+ end
28
+ end
29
+ end
@@ -0,0 +1,18 @@
1
+
2
+ module BigResources
3
+ class FileInfoModel
4
+ attr_accessor :file_path, :file_name, :total_count
5
+ def initialize(file_name)
6
+ @file_path = []
7
+ @total_count = 0
8
+ @file_name = file_name
9
+ end
10
+
11
+ def add_file_path(file_path)
12
+ if file_path.length > 0
13
+ @file_path << file_path
14
+ @total_count += 1
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,56 @@
1
+ module BigResources
2
+
3
+ UNKNOWN = -1
4
+ PNG = 1
5
+ PDF = 2
6
+ JPG = 3
7
+ JPEG = 4
8
+ BMP = 5
9
+
10
+ class PictureFileType
11
+ include Enumerable
12
+ def each
13
+ yield PNG
14
+ yield PDF
15
+ yield JPG
16
+ yield JPEG
17
+ yield BMP
18
+ end
19
+
20
+ def self.is_type(file_name,type)
21
+ PictureFileType.each do | type |
22
+ regexStr = "^[\w-]+(\.#{type})$"
23
+ regex = Regex.create(regexStr)
24
+ if regex =~ file_name
25
+ end
26
+ end
27
+ # if file_name ~= /.*[.png]$/
28
+ # PNG
29
+ # elsif file_name ~= /.*[.pdf]$/
30
+ # PDF
31
+ # elsif file_name ~= /.*[.png]$/
32
+ # JPG
33
+ # elsif file_name ~= /$.jpeg/
34
+ # JPEG
35
+ # elsif file_name ~= /$.bmp/
36
+ # BMP
37
+ # else
38
+ # UNKNOWN
39
+ # end
40
+ end
41
+
42
+ def self.type_name(type)
43
+ if type == PNG
44
+ ".png"
45
+ elsif type == PDF
46
+ ".pdf"
47
+ elsif type == JPG
48
+ ".jpg"
49
+ elsif type == JPEG
50
+ ".jpeg"
51
+ elsif type == BMP
52
+ ".bmp"
53
+ end
54
+ end
55
+ end
56
+ end
@@ -0,0 +1,29 @@
1
+
2
+ module BigResources
3
+ FILE = 1
4
+ DIRECTORY = 2
5
+ class TreeHierarchyType
6
+ include Enumerable
7
+ def each
8
+ yield 'file'
9
+ yield 'directory'
10
+ end
11
+
12
+ def self.type(file_name)
13
+ if file_name == "file"
14
+ FILE
15
+ elsif file_name == "directory"
16
+ DIRECTORY
17
+ end
18
+ end
19
+
20
+ def self.file_type_name(file_name)
21
+ if file_name == "file"
22
+ "file"
23
+ elsif file_name == "directory"
24
+ "directory"
25
+ end
26
+ end
27
+ end
28
+
29
+ end
@@ -0,0 +1,26 @@
1
+ require 'chunky_png'
2
+
3
+ module BigResources
4
+ class DifferAnalyzeUtil
5
+ def self.image_diff_analyze(path,compare_path)
6
+
7
+ images = [
8
+ ChunkyPNG::Image.from_file(path),
9
+ ChunkyPNG::Image.from_file(compare_path)
10
+ ]
11
+
12
+ diff = []
13
+ #size compare
14
+ return false unless images.first.height == images.last.height
15
+ return false unless images.first.width == images.last.width
16
+
17
+ #pixel compare
18
+ images.first.height.times do | y |
19
+ images.first.row(y).each_with_index do | pixel, x |
20
+ diff << [x, y] unless pixel == images.last[x, y]
21
+ end
22
+ end
23
+ diff.length.zero?
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,114 @@
1
+ require 'json'
2
+ require 'big_resources/model/file_type'
3
+ require 'big_resources/util/image/diff_analyze_util'
4
+
5
+ module BigResources
6
+ class FileScanUtil
7
+ def self.file_with_type(name, type)
8
+ PictureFileType.is_type(name, type)
9
+ end
10
+
11
+ #分析同名文件
12
+ def self.detect_file_by_name(dic, file_type, last_path, result_dic)
13
+ current_path = get_current_path(last_path,dic["name"])
14
+ current_path = last_path if last_path == dic["name"]
15
+ if TreeHierarchyType.type(dic["type"]) == DIRECTORY
16
+ dic["contents"].collect do | contents_dic |
17
+ detect_file_by_name(contents_dic, file_type, current_path, result_dic)
18
+ end
19
+ elsif TreeHierarchyType.type(dic["type"]) == FILE
20
+ if dic["contents"] == nil
21
+ if dic["name"] != nil && dic["name"].include?(file_type)
22
+ if result_dic[dic["name"]] == nil
23
+ result_dic[dic["name"]] = {:count => 1, :path => [current_path]}
24
+ else
25
+ result_dic[dic["name"]][:count] += 1
26
+ result_dic[dic["name"]][:path] << current_path
27
+ end
28
+ end
29
+
30
+ else
31
+ dic["contents"].collect do | contents_dic |
32
+ detect_file_by_name(contents_dic, file_type, current_path, result_dic)
33
+ end
34
+ end
35
+ end
36
+ end
37
+
38
+ #分析图片文件大小
39
+ def self.detect_file_by_size(dic, file_type, last_path, result_dic)
40
+ current_path = get_current_path(last_path,dic["name"])
41
+ current_path = last_path if last_path == dic["name"]
42
+ if TreeHierarchyType.type(dic["type"]) == DIRECTORY
43
+ dic["contents"].collect do | contents_dic |
44
+ detect_file_by_size(contents_dic, file_type, current_path, result_dic)
45
+ end
46
+ elsif TreeHierarchyType.type(dic["type"]) == FILE
47
+ if dic["contents"] == nil
48
+ if dic["name"] != nil && dic["name"].include?(file_type)
49
+ file_size = File.size(current_path)
50
+ if file_size && result_dic["#{file_size} kb"] == nil
51
+ result_dic["#{file_size} kb"] = {:count => 1, :path => [current_path]}
52
+ else
53
+ result_dic["#{file_size} kb"][:count] += 1
54
+ result_dic["#{file_size} kb"][:path] << current_path
55
+ end
56
+ end
57
+
58
+ else
59
+ dic["contents"].collect do | contents_dic |
60
+ detect_file_by_size(contents_dic, file_type, current_path, result_dic)
61
+ end
62
+ end
63
+ end
64
+ end
65
+
66
+ def self.get_duplicate_name_file(dic)
67
+ duplicate = []
68
+ dic.keys.select do | file_name_key |
69
+ if dic[file_name_key][:count] > 1
70
+ duplicate << {"file_name" => file_name_key,
71
+ "count" => dic[file_name_key][:count],
72
+ "path" => dic[file_name_key][:path]}
73
+ end
74
+ end
75
+ duplicate
76
+ end
77
+
78
+ #根据字节大小相等 分出相同数据
79
+ def self.get_same_file(dic)
80
+ duplicate = []
81
+ dic.keys.select do | file_size |
82
+ patterns = []
83
+ if dic[file_size][:count] > 1
84
+ dic[file_size][:path].each do | file_path |
85
+ if patterns.count == 0
86
+ patterns << [file_path]
87
+ next
88
+ end
89
+
90
+ is_same = false
91
+ patterns.each do | a_pattern |
92
+ is_same = DifferAnalyzeUtil.image_diff_analyze(file_path,a_pattern.first)
93
+ if is_same
94
+ a_pattern << file_path
95
+ break
96
+ end
97
+ end
98
+ patterns << [file_path] unless is_same
99
+ end
100
+ end
101
+ duplicate << {:file_size => file_size,
102
+ :count => dic[file_size][:count],
103
+ :path => dic[file_size][:path],
104
+ :pattern => patterns
105
+ }
106
+ end
107
+ duplicate
108
+ end
109
+
110
+ def self.get_current_path(last_path,file_name)
111
+ "#{last_path}/#{file_name}"
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,40 @@
1
+ require 'json'
2
+ require 'big_resources/model/hierarchy_type'
3
+ require 'big_resources/model/file_model'
4
+ require 'big_resources/util/image/file_scan_util'
5
+
6
+ module BigResources
7
+ class ImageAnalyzeUtil
8
+ def self.get_duplicate_name_file_with_type(path, file_type)
9
+ file_filter_dic = {}
10
+ Dir.chdir(path) do
11
+ `tree -J #{path} > fileHierarchy.json`
12
+ end
13
+ json_data = File.read("#{path}/fileHierarchy.json")
14
+ result_array = JSON.parse(json_data)
15
+ result_array.select do | dic |
16
+ FileScanUtil.detect_file_by_name(dic, PictureFileType.type_name(file_type), path, file_filter_dic)
17
+ end
18
+ array = FileScanUtil.get_duplicate_name_file(file_filter_dic)
19
+ p array
20
+ end
21
+
22
+ def self.get_duplicate_content_file_with_type(path, file_type)
23
+ file_filter_dic = {}
24
+ Dir.chdir(path) do
25
+ `tree -J #{path} > fileHierarchy.json`
26
+ end
27
+ json_data = File.read("#{path}/fileHierarchy.json")
28
+ result_array = JSON.parse(json_data)
29
+
30
+ result_array.select do | dic |
31
+ FileScanUtil.detect_file_by_size(dic, PictureFileType.type_name(file_type), path, file_filter_dic)
32
+ end
33
+ array = FileScanUtil.get_same_file(file_filter_dic)
34
+ # file = File.new("#{path}/test.txt", 'w')
35
+ # file << array.to_json
36
+ # file.close
37
+ p array
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,3 @@
1
+ module BigResources
2
+ VERSION = "0.1.0"
3
+ end
metadata ADDED
@@ -0,0 +1,191 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: big_resources
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Serena_R
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-07-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: bundler
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '1.16'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '1.16'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rake
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '10.0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '10.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: gli
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.16'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.16'
55
+ - !ruby/object:Gem::Dependency
56
+ name: big_stash
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '0.1'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '0.1'
69
+ - !ruby/object:Gem::Dependency
70
+ name: cocoapods
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: plist
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: colorize
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - ">="
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: 0.50.0
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: 0.50.0
125
+ - !ruby/object:Gem::Dependency
126
+ name: chunky_png
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - ">="
130
+ - !ruby/object:Gem::Version
131
+ version: '0'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: '0'
139
+ description: A tools collection of iOS projects for iOS developer.
140
+ email:
141
+ - lirui050716@163.com
142
+ executables:
143
+ - big_resources
144
+ - setup
145
+ extensions: []
146
+ extra_rdoc_files: []
147
+ files:
148
+ - CODE_OF_CONDUCT.md
149
+ - Gemfile
150
+ - Gemfile.lock
151
+ - LICENSE.txt
152
+ - README.md
153
+ - Rakefile
154
+ - big_resources.gemspec
155
+ - bin/big_resources
156
+ - bin/setup
157
+ - lib/big_resources.rb
158
+ - lib/big_resources/command/image_command.rb
159
+ - lib/big_resources/model/file_model.rb
160
+ - lib/big_resources/model/file_type.rb
161
+ - lib/big_resources/model/hierarchy_type.rb
162
+ - lib/big_resources/util/image/diff_analyze_util.rb
163
+ - lib/big_resources/util/image/file_scan_util.rb
164
+ - lib/big_resources/util/image/name_analyze_util.rb
165
+ - lib/big_resources/version.rb
166
+ homepage: https://github.com/Serena1993/bigResources
167
+ licenses:
168
+ - MIT
169
+ metadata:
170
+ allowed_push_host: https://rubygems.org
171
+ post_install_message:
172
+ rdoc_options: []
173
+ require_paths:
174
+ - lib
175
+ required_ruby_version: !ruby/object:Gem::Requirement
176
+ requirements:
177
+ - - ">="
178
+ - !ruby/object:Gem::Version
179
+ version: '0'
180
+ required_rubygems_version: !ruby/object:Gem::Requirement
181
+ requirements:
182
+ - - ">="
183
+ - !ruby/object:Gem::Version
184
+ version: '0'
185
+ requirements: []
186
+ rubyforge_project:
187
+ rubygems_version: 2.6.13
188
+ signing_key:
189
+ specification_version: 4
190
+ summary: A tools collection of iOS projects.
191
+ test_files: []