xcodeprojfiler 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +6 -3
- data/lib/xcodeprojfiler.rb +37 -7
- data/lib/xcodeprojfiler/command.rb +26 -6
- data/lib/xcodeprojfiler/string_extensions.rb +102 -0
- data/lib/xcodeprojfiler/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce25545584fc5478850efb0bf6aacfaa3b00e13ab9253b29e1e6ca09d1197111
|
4
|
+
data.tar.gz: 3d4c9c0f2860e69e7d74cd84611144a7d060cad9673db93a80eb8fa249399a55
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 017e15f0998db65d44d5a0915c8f47cf9322bb18f740469211712e484231d98d98263b1f026b1d0f0934eaef56cd168bcc238c84574a2eff313908201fe7752a
|
7
|
+
data.tar.gz: 5c85e430d897ac2d62f8f4cb2ddcc8ef75515781b316d720eda1887cbe131c5e9a3e8c696496437bc511797327be015df6f363365e4d865ef0cbe475e4a0b283
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -15,15 +15,18 @@ sudo gem install xcodeprojfiler
|
|
15
15
|
```shell
|
16
16
|
cd path/to/a-xcode-project-dir
|
17
17
|
|
18
|
-
# show the excluded code files
|
19
|
-
xcodeprojfiler show_excluded_code_files
|
20
|
-
|
21
18
|
# show the files which not included in xcworkspace
|
22
19
|
xcodeprojfiler show_excluded_files
|
23
20
|
|
24
21
|
# show the code files(C/C++/Objective-C/Objective-C++/Swift/xib/storyboard) which not included in xcworkspace
|
25
22
|
xcodeprojfiler show_excluded_code_files
|
26
23
|
|
24
|
+
# show and delete the code files which not included in xcworkspace, except those in LocalComponent directory
|
25
|
+
xcodeprojfiler show_excluded_code_files --ignores $(pwd)/LocalComponent/\*\*/\* --delete
|
26
|
+
|
27
|
+
# show and delete the code files which not included in xcworkspace, except those in Pods and Fastlane directory
|
28
|
+
xcodeprojfiler show_excluded_code_files --ignores $(pwd)/Pods/\*\*/\* $(pwd)/Fastlane/\*\*/\* --delete
|
29
|
+
|
27
30
|
# Describe available commands or one specific command
|
28
31
|
xcodeprojfiler help
|
29
32
|
```
|
data/lib/xcodeprojfiler.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'thor'
|
2
2
|
require "xcodeprojfiler/version"
|
3
3
|
require 'xcodeprojfiler/command'
|
4
|
+
require 'xcodeprojfiler/string_extensions'
|
4
5
|
|
5
6
|
module Xcodeprojfiler
|
6
7
|
|
@@ -33,24 +34,53 @@ For example, Xcodeprojfiler can scan the current xcode project dir and find out
|
|
33
34
|
end
|
34
35
|
map %w[-v --version] => :version
|
35
36
|
|
36
|
-
desc "show_excluded_files", "show the files which not included in xcworkspace"
|
37
|
+
desc "show_excluded_files [--ignores] [--delete]", "show and delete(if you choose) the files which not included in xcworkspace"
|
37
38
|
long_desc <<-LONGDESC
|
38
39
|
|
39
|
-
|
40
|
+
#{"With no option".bold}, #{"Xcodeprojfiler".bold} will scan the current xcode project directory and find out the files which not included in xcworkspace.
|
41
|
+
|
42
|
+
#{"With".bold} #{"--ignores".red.bold} #{"option".bold}, #{"Xcodeprojfiler".bold} will ignore the files which match the any ignored regular expression.
|
43
|
+
|
44
|
+
#{"With".bold} #{"--delete".red.bold} #{"option".bold}, #{"Xcodeprojfiler".bold} will delete the excluded files after scan done.
|
45
|
+
|
46
|
+
#{"Example:".red.bold}
|
47
|
+
|
48
|
+
# show and delete the files which not included in xcworkspace, except those in Pods and Fastlane directory
|
49
|
+
|
50
|
+
xcodeprojfiler show_excluded_files #{"--ignores".red} $(pwd)/Pods/\\*\\*/\\* $(pwd)/Fastlane/\\*\\*/\\* #{"--delete".red}
|
40
51
|
|
41
52
|
LONGDESC
|
53
|
+
option :delete, :type => :boolean, :default => false
|
54
|
+
option :ignores, :type => :array, :default => []
|
42
55
|
def show_excluded_files
|
43
|
-
|
56
|
+
should_delete = options[:delete]
|
57
|
+
ignored_regex_array = options[:ignores]
|
58
|
+
|
59
|
+
Command.show_excluded_files(should_delete, ignored_regex_array)
|
44
60
|
end
|
45
61
|
|
46
|
-
desc "show_excluded_code_files", "show the code files(C/C++/Objective-C/Objective-C++/Swift/xib/storyboard) which not included in xcworkspace"
|
62
|
+
desc "show_excluded_code_files [--ignores] [--delete]", "show and delete(if you choose) the code files(C/C++/Objective-C/Objective-C++/Swift/xib/storyboard) which not included in xcworkspace"
|
47
63
|
long_desc <<-LONGDESC
|
48
|
-
|
49
|
-
|
64
|
+
#{"With no option".bold}, #{"Xcodeprojfiler".bold} will scan the current xcode project directory and find out the code files(C/C++/Objective-C/Objective-C++/Swift/xib/storyboard) which not included in xcworkspace.
|
65
|
+
|
66
|
+
#{"With".bold} #{"--ignores".red.bold} #{"option".bold}, #{"Xcodeprojfiler".bold} will ignore the files which match the any ignored regular expression.
|
67
|
+
|
68
|
+
#{"With".bold} #{"--delete".red.bold} #{"option".bold}, #{"Xcodeprojfiler".bold} will delete the excluded code files after scan done.
|
69
|
+
|
70
|
+
#{"Example:".red.bold}
|
71
|
+
|
72
|
+
# show and delete the code files which not included in xcworkspace, except those in Pods and Fastlane directory
|
73
|
+
|
74
|
+
xcodeprojfiler show_excluded_files #{"--ignores".red} $(pwd)/Pods/\\*\\*/\\* $(pwd)/Fastlane/\\*\\*/\\* #{"--delete".red}
|
50
75
|
|
51
76
|
LONGDESC
|
77
|
+
option :delete, :type => :boolean, :default => false
|
78
|
+
option :ignores, :type => :array, :default => []
|
52
79
|
def show_excluded_code_files
|
53
|
-
|
80
|
+
should_delete = options[:delete]
|
81
|
+
ignored_regex_array = options[:ignores]
|
82
|
+
|
83
|
+
Command.show_excluded_code_files(should_delete, ignored_regex_array)
|
54
84
|
end
|
55
85
|
|
56
86
|
end
|
@@ -16,7 +16,7 @@ module Xcodeprojfiler
|
|
16
16
|
# xcluded_file_result_tuple = [included_file_array, excluded_file_array]
|
17
17
|
#
|
18
18
|
# @return [included_file_array, excluded_file_array]
|
19
|
-
def self.find_xclued_files
|
19
|
+
def self.find_xclued_files(ignored_regex_array)
|
20
20
|
included_file_array = []
|
21
21
|
excluded_file_array = []
|
22
22
|
|
@@ -70,6 +70,7 @@ PS: Xcodeprojfiler will ignore the following files:
|
|
70
70
|
- *.sh
|
71
71
|
- *.log
|
72
72
|
- *.config
|
73
|
+
- *.properties
|
73
74
|
|
74
75
|
MESSAGE
|
75
76
|
puts("#{ignore_file_tips}")
|
@@ -87,9 +88,13 @@ PS: Xcodeprojfiler will ignore the following files:
|
|
87
88
|
"#{root_dir}/**/Pods/**/*",
|
88
89
|
"#{root_dir}/**/Podfile",
|
89
90
|
"#{root_dir}/**/Gemfile",
|
90
|
-
"#{root_dir}/**/*{.xcworkspace,.xcodeproj,.lproj,.xcassets,.xctemplate,.framework,.bundle,.lock,.rb,.py,.sh,.log,.config}"
|
91
|
+
"#{root_dir}/**/*{.xcworkspace,.xcodeproj,.lproj,.xcassets,.xctemplate,.framework,.bundle,.lock,.rb,.py,.sh,.log,.config,.properties}"
|
91
92
|
]
|
92
93
|
all_files = all_files - Dir.glob(excluded_file_regex_array)
|
94
|
+
if ignored_regex_array.empty? == false
|
95
|
+
puts("ignored_regex_array: #{ignored_regex_array}")
|
96
|
+
all_files = all_files - Dir.glob(ignored_regex_array)
|
97
|
+
end
|
93
98
|
|
94
99
|
included_file_array = xcworkspace_file_array
|
95
100
|
excluded_file_array = all_files - included_file_array
|
@@ -133,14 +138,22 @@ PS: Xcodeprojfiler will ignore the following files:
|
|
133
138
|
return true
|
134
139
|
end
|
135
140
|
|
136
|
-
def self.show_excluded_files
|
137
|
-
xcluded_file_result_tuple = self.find_xclued_files
|
141
|
+
def self.show_excluded_files(shouldDelete, ignored_regex_array)
|
142
|
+
xcluded_file_result_tuple = self.find_xclued_files(ignored_regex_array)
|
138
143
|
excluded_file_array = xcluded_file_result_tuple[1]
|
144
|
+
|
145
|
+
if shouldDelete
|
146
|
+
puts("")
|
147
|
+
puts("delete the excluded files now ...")
|
148
|
+
FileUtils.rm_f(excluded_file_array)
|
149
|
+
puts("delete the excluded files done !!!")
|
150
|
+
end
|
151
|
+
|
139
152
|
dump_excluded_files_to_file(excluded_file_array)
|
140
153
|
end
|
141
154
|
|
142
|
-
def self.show_excluded_code_files
|
143
|
-
xcluded_file_result_tuple = self.find_xclued_files
|
155
|
+
def self.show_excluded_code_files(shouldDelete, ignored_regex_array)
|
156
|
+
xcluded_file_result_tuple = self.find_xclued_files(ignored_regex_array)
|
144
157
|
excluded_file_array = xcluded_file_result_tuple[1]
|
145
158
|
|
146
159
|
code_file_types = [
|
@@ -161,6 +174,13 @@ PS: Xcodeprojfiler will ignore the following files:
|
|
161
174
|
end
|
162
175
|
end
|
163
176
|
|
177
|
+
if shouldDelete
|
178
|
+
puts("")
|
179
|
+
puts("delete the excluded files now ...")
|
180
|
+
FileUtils.rm_f(excluded_code_file_array)
|
181
|
+
puts("delete the excluded files done !!!")
|
182
|
+
end
|
183
|
+
|
164
184
|
dump_excluded_files_to_file(excluded_code_file_array)
|
165
185
|
end
|
166
186
|
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
# 参考:https://gist.github.com/lnznt/2663516
|
2
|
+
class String
|
3
|
+
def black
|
4
|
+
"\e[30m#{self}\e[m"
|
5
|
+
end
|
6
|
+
|
7
|
+
def red
|
8
|
+
"\e[31m#{self}\e[m"
|
9
|
+
end
|
10
|
+
|
11
|
+
def green
|
12
|
+
"\e[32m#{self}\e[m"
|
13
|
+
end
|
14
|
+
|
15
|
+
def yellow
|
16
|
+
"\e[33m#{self}\e[m"
|
17
|
+
end
|
18
|
+
|
19
|
+
def blue
|
20
|
+
"\e[34m#{self}\e[m"
|
21
|
+
end
|
22
|
+
|
23
|
+
def magenta
|
24
|
+
"\e[35m#{self}\e[m"
|
25
|
+
end
|
26
|
+
|
27
|
+
def cyan
|
28
|
+
"\e[36m#{self}\e[m"
|
29
|
+
end
|
30
|
+
|
31
|
+
def white
|
32
|
+
"\e[37m#{self}\e[m"
|
33
|
+
end
|
34
|
+
|
35
|
+
def bg_black
|
36
|
+
"\e[40m#{self}\e[m"
|
37
|
+
end
|
38
|
+
|
39
|
+
def bg_red
|
40
|
+
"\e[41m#{self}\e[m"
|
41
|
+
end
|
42
|
+
|
43
|
+
def bg_green
|
44
|
+
"\e[42m#{self}\e[m"
|
45
|
+
end
|
46
|
+
|
47
|
+
def bg_yellow
|
48
|
+
"\e[43m#{self}\e[m"
|
49
|
+
end
|
50
|
+
|
51
|
+
def bg_blue
|
52
|
+
"\e[44m#{self}\e[m"
|
53
|
+
end
|
54
|
+
|
55
|
+
def bg_magenta
|
56
|
+
"\e[45m#{self}\e[m"
|
57
|
+
end
|
58
|
+
|
59
|
+
def bg_cyan
|
60
|
+
"\e[46m#{self}\e[m"
|
61
|
+
end
|
62
|
+
|
63
|
+
def bg_white
|
64
|
+
"\e[47m#{self}\e[m"
|
65
|
+
end
|
66
|
+
|
67
|
+
def bold
|
68
|
+
"\e[1m#{self}\e[m"
|
69
|
+
end
|
70
|
+
|
71
|
+
def bright
|
72
|
+
"\e[2m#{self}\e[m"
|
73
|
+
end
|
74
|
+
|
75
|
+
def italic
|
76
|
+
"\e[3m#{self}\e[m"
|
77
|
+
end
|
78
|
+
|
79
|
+
def underline
|
80
|
+
"\e[4m#{self}\e[m"
|
81
|
+
end
|
82
|
+
|
83
|
+
def blink
|
84
|
+
"\e[5m#{self}\e[m"
|
85
|
+
end
|
86
|
+
|
87
|
+
def reverse_color
|
88
|
+
"\e[7m#{self}\e[m"
|
89
|
+
end
|
90
|
+
|
91
|
+
def error_style
|
92
|
+
self.red
|
93
|
+
end
|
94
|
+
|
95
|
+
def warning_style
|
96
|
+
self.yellow
|
97
|
+
end
|
98
|
+
|
99
|
+
def tips_style
|
100
|
+
self.green
|
101
|
+
end
|
102
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcodeprojfiler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- York
|
@@ -94,6 +94,7 @@ files:
|
|
94
94
|
- bin/xcodeprojfiler
|
95
95
|
- lib/xcodeprojfiler.rb
|
96
96
|
- lib/xcodeprojfiler/command.rb
|
97
|
+
- lib/xcodeprojfiler/string_extensions.rb
|
97
98
|
- lib/xcodeprojfiler/version.rb
|
98
99
|
- xcodeprojfiler.gemspec
|
99
100
|
homepage: https://github.com/YK-Unit/Xcodeprojfiler
|