xcodeproj_utils 0.1.4 → 0.2.0
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/README.md +2 -0
- data/bin/xcp_utils +11 -2
- data/lib/xcodeproj_utils/version.rb +1 -1
- data/lib/xcodeproj_utils.rb +23 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d8bd072ef293b206fe30b0b191a5ae30cb92c474
|
4
|
+
data.tar.gz: dcb1229a9f4dd94050a74230222e3ae4d56152a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb5f27a321695e4b5f9393fd3ecec24036b521ec1a2a1c294966f28b43c235291dbba398970f3d0cdb0aca51a4f7740db45717461bda4ce2a2bb7bec97a0991a
|
7
|
+
data.tar.gz: 210c9def213ac2c254e43ff4953859982addc2e615ea0285cc376d6223238feeeecdb18aeb42c06afb38e33215ebceb063e4ba3defed17004bf13d7a34f3b1f1
|
data/README.md
CHANGED
@@ -7,6 +7,7 @@ Util commands for xcode project. Following commands are supported for now.
|
|
7
7
|
|
8
8
|
- Count source lines of files in xcode project
|
9
9
|
- Show source / resource files in xcode project
|
10
|
+
- Show possibly unused images in xcode project
|
10
11
|
|
11
12
|
## Installation
|
12
13
|
|
@@ -27,6 +28,7 @@ Or install it yourself as:
|
|
27
28
|
$ xcp_utils lines <PATH_TO_XCODE_PROJECT> <TARGET_NAME>
|
28
29
|
$ xcp_utils lines --header_only <PATH_TO_XCODE_PROJECT> <TARGET_NAME>
|
29
30
|
$ xcp_utils lines --source_only <PATH_TO_XCODE_PROJECT> <TARGET_NAME>
|
31
|
+
$ xcp_utils unused_images <PATH_TO_XCODE_PROJECT> <TARGET_NAME>
|
30
32
|
|
31
33
|
## License
|
32
34
|
|
data/bin/xcp_utils
CHANGED
@@ -4,7 +4,7 @@ require 'thor'
|
|
4
4
|
require 'xcodeproj_utils'
|
5
5
|
|
6
6
|
class CLI < Thor
|
7
|
-
desc "xcp_utils lines
|
7
|
+
desc "xcp_utils lines PROJECT_PATH TARGET_NAME", "Count source lines of files"
|
8
8
|
option :header_only, :type => :boolean, :default => false, :desc => 'Count only header files'
|
9
9
|
option :source_only, :type => :boolean, :default => false, :desc => 'Count only source files'
|
10
10
|
def lines(proj_name, target_name)
|
@@ -18,7 +18,7 @@ class CLI < Thor
|
|
18
18
|
end
|
19
19
|
end
|
20
20
|
|
21
|
-
desc "xcp_utils show
|
21
|
+
desc "xcp_utils show PROJECT_PATH TARGET_NAME", "Show files in specified target"
|
22
22
|
option :kind, :type => :string, :default => 'source', :desc => 'source or resource'
|
23
23
|
option :fullpath, :type => :boolean, :default => false, :desc => 'full paths will be shown if specified'
|
24
24
|
def show(proj_name, target_name)
|
@@ -27,6 +27,15 @@ class CLI < Thor
|
|
27
27
|
proj = XcodeprojUtils::Project.new(proj_name, target_name)
|
28
28
|
proj.show(kind, fullpath)
|
29
29
|
end
|
30
|
+
|
31
|
+
desc "xcp_utils unused_images PROJECT_PATH TARGET_NAME", "Show unused images"
|
32
|
+
def unused_images(proj_name, target_name)
|
33
|
+
proj = XcodeprojUtils::Project.new(proj_name, target_name)
|
34
|
+
for image in proj.search_unused_images
|
35
|
+
puts image.display_name
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
30
39
|
end
|
31
40
|
|
32
41
|
CLI.start(ARGV)
|
data/lib/xcodeproj_utils.rb
CHANGED
@@ -62,5 +62,28 @@ module XcodeprojUtils
|
|
62
62
|
end
|
63
63
|
return nil
|
64
64
|
end
|
65
|
+
|
66
|
+
def search_unused_images
|
67
|
+
sources = ""
|
68
|
+
for file in @target.source_build_phase.files_references
|
69
|
+
sources += File.read file.real_path
|
70
|
+
end
|
71
|
+
|
72
|
+
images = []
|
73
|
+
for file in @target.resources_build_phase.files_references
|
74
|
+
if not file.last_known_file_type or not file.last_known_file_type.match /^image/
|
75
|
+
next
|
76
|
+
end
|
77
|
+
|
78
|
+
name = File.basename(file.display_name, '.*')
|
79
|
+
name = name.split('@').first
|
80
|
+
|
81
|
+
if sources.scan(name).count == 0
|
82
|
+
images << file
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
images.sort {|x,y| x.display_name <=> y.display_name}
|
87
|
+
end
|
65
88
|
end
|
66
89
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: xcodeproj_utils
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matsumoto Taichi
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|