ios-png-check 1.0.0 → 1.1.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.
- data/README.markdown +56 -0
- data/VERSION +1 -1
- data/bin/ios-png-check +33 -3
- metadata +30 -11
- data/README.rdoc +0 -17
data/README.markdown
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# ios-png-check
|
2
|
+
|
3
|
+
A simple utility to check that your @2x iOS PNG assets targeting iPhone 4 are in a good shape.
|
4
|
+
|
5
|
+
Note: This is a ruby gem. A Python version can be found in the `contrib/` folder.
|
6
|
+
It has been kindly contributed by [Matt Galloway](http://iphone.galloway.me.uk/).
|
7
|
+
|
8
|
+
## How to Install
|
9
|
+
|
10
|
+
$ gem update --system
|
11
|
+
$ gem install ios-png-check
|
12
|
+
|
13
|
+
## How to Use
|
14
|
+
|
15
|
+
$ cd folder-where-you-have-your-png-assets
|
16
|
+
$ ios-png-check
|
17
|
+
|
18
|
+
## What it Does in Details
|
19
|
+
|
20
|
+
For each PNG image in the current folder it tries to find a @2x version and checks that the size of the @2x version is twice the size of the @1x version.
|
21
|
+
|
22
|
+
When done it outputs the summary of possible issues.
|
23
|
+
|
24
|
+
## Output Example
|
25
|
+
|
26
|
+
FILES WITHOUT @1x VERSION ============================================
|
27
|
+
status-new@2x.png
|
28
|
+
|
29
|
+
FILES WITHOUT @2x VERSION ============================================
|
30
|
+
Icon-Small.png
|
31
|
+
logo.png
|
32
|
+
message-bubble-left.png
|
33
|
+
message-bubble-right.png
|
34
|
+
no-photo-icon-boy-small.png
|
35
|
+
no-photo-icon-girl-small.png
|
36
|
+
nofriendsbg.png
|
37
|
+
profile-gallery-super-star.png
|
38
|
+
send-button.png
|
39
|
+
share-on-network-bounds-rect.png
|
40
|
+
|
41
|
+
INVALID IMAGE SIZES DETECTED FOR THE FOLLOWING FILES =================
|
42
|
+
dashboard-checkin-button-full@2x.png: SIZE IS 506 x 94, EXPECTED 596 x 94
|
43
|
+
|
44
|
+
## Note on Patches/Pull Requests
|
45
|
+
|
46
|
+
* Fork the project.
|
47
|
+
* Make your feature addition or bug fix.
|
48
|
+
* Add tests for it. This is important so I don't break it in a
|
49
|
+
future version unintentionally.
|
50
|
+
* Commit, do not mess with rakefile, version, or history.
|
51
|
+
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
52
|
+
* Send me a pull request. Bonus points for topic branches.
|
53
|
+
|
54
|
+
## Copyright
|
55
|
+
|
56
|
+
Copyright (c) 2010 Andrey Subbotin. See LICENSE for details.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.1.0
|
data/bin/ios-png-check
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
3
|
require 'rubygems'
|
4
|
+
require 'escape'
|
4
5
|
require 'fileutils'
|
5
6
|
|
6
7
|
# Main block
|
@@ -9,11 +10,19 @@ def main
|
|
9
10
|
files_wo_1x_version = []
|
10
11
|
files_wo_2x_version = []
|
11
12
|
size_errors = []
|
13
|
+
empty_files = []
|
12
14
|
|
13
15
|
png_files = Dir.glob('*.png')
|
14
16
|
|
15
17
|
png_files.each { |png_file|
|
16
18
|
name_parts = png_file.split(/[@\.]/)
|
19
|
+
# next if name_parts.include? "&"
|
20
|
+
|
21
|
+
png_file_size = File.size?(png_file)
|
22
|
+
unless png_file_size
|
23
|
+
empty_files << png_file
|
24
|
+
next
|
25
|
+
end
|
17
26
|
|
18
27
|
v1x_exists = false
|
19
28
|
v2x_exists = false
|
@@ -24,10 +33,18 @@ def main
|
|
24
33
|
v1x_exists = File.exists?(v1_name)
|
25
34
|
v2x_exists = File.exists?(v2_name)
|
26
35
|
files_wo_1x_version << png_file unless v1x_exists
|
27
|
-
|
36
|
+
|
37
|
+
v2_file_size = File.size?(v2_name)
|
38
|
+
unless v2_file_size
|
39
|
+
empty_files << v2_name
|
40
|
+
next
|
41
|
+
end
|
42
|
+
|
28
43
|
if v1x_exists and v2x_exists then
|
29
|
-
|
30
|
-
|
44
|
+
cmd1 = Escape.shell_command(["file", v1_name])
|
45
|
+
cmd2 = Escape.shell_command(["file", v2_name])
|
46
|
+
v1_info = `#{cmd1}`.match(/(\d+) x (\d+)/)
|
47
|
+
v2_info = `#{cmd2}`.match(/(\d+) x (\d+)/)
|
31
48
|
v1w = v1_info[1].to_i
|
32
49
|
v1h = v1_info[2].to_i
|
33
50
|
v2w = v2_info[1].to_i
|
@@ -46,6 +63,12 @@ def main
|
|
46
63
|
v1x_exists = File.exists?(v1_name)
|
47
64
|
v2x_exists = File.exists?(v2_name)
|
48
65
|
files_wo_2x_version << png_file unless v2x_exists
|
66
|
+
|
67
|
+
v1_file_size = File.size?(v1_name)
|
68
|
+
unless v1_file_size
|
69
|
+
empty_files << v1_name
|
70
|
+
next
|
71
|
+
end
|
49
72
|
end
|
50
73
|
}
|
51
74
|
|
@@ -77,6 +100,13 @@ def main
|
|
77
100
|
is_all_okay = false
|
78
101
|
end
|
79
102
|
|
103
|
+
unless empty_files.empty? then
|
104
|
+
puts "IMAGE FILES OF ZERO SIZE ============================================="
|
105
|
+
puts empty_files
|
106
|
+
puts
|
107
|
+
is_all_okay = false
|
108
|
+
end
|
109
|
+
|
80
110
|
if is_all_okay then
|
81
111
|
puts "YOUR PNG ASSETS IN THE CURRENT FOLDER ARE FINE, DUDE."
|
82
112
|
end
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ios-png-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 19
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 1
|
8
|
+
- 1
|
7
9
|
- 0
|
8
|
-
|
9
|
-
version: 1.0.0
|
10
|
+
version: 1.1.0
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Andrey Subbotin
|
@@ -14,11 +15,24 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date:
|
18
|
+
date: 2011-12-20 00:00:00 +04:00
|
18
19
|
default_executable:
|
19
20
|
- ios-png-check
|
20
|
-
dependencies:
|
21
|
-
|
21
|
+
dependencies:
|
22
|
+
- !ruby/object:Gem::Dependency
|
23
|
+
name: escape
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 3
|
31
|
+
segments:
|
32
|
+
- 0
|
33
|
+
version: "0"
|
34
|
+
type: :runtime
|
35
|
+
version_requirements: *id001
|
22
36
|
description: A simple utility to check that your @2x iOS PNG assets targeting iPhone 4 are in a good shape
|
23
37
|
email: andrey@subbotin.me
|
24
38
|
executables:
|
@@ -27,39 +41,44 @@ extensions: []
|
|
27
41
|
|
28
42
|
extra_rdoc_files:
|
29
43
|
- LICENSE
|
30
|
-
- README.
|
44
|
+
- README.markdown
|
31
45
|
files:
|
32
46
|
- CHANGELOG
|
33
47
|
- LICENSE
|
34
|
-
- README.
|
48
|
+
- README.markdown
|
35
49
|
- VERSION
|
50
|
+
- bin/ios-png-check
|
36
51
|
has_rdoc: true
|
37
52
|
homepage: http://github.com/eploko/ios-png-check
|
38
53
|
licenses: []
|
39
54
|
|
40
55
|
post_install_message:
|
41
|
-
rdoc_options:
|
42
|
-
|
56
|
+
rdoc_options: []
|
57
|
+
|
43
58
|
require_paths:
|
44
59
|
- lib
|
45
60
|
required_ruby_version: !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
46
62
|
requirements:
|
47
63
|
- - ">="
|
48
64
|
- !ruby/object:Gem::Version
|
65
|
+
hash: 3
|
49
66
|
segments:
|
50
67
|
- 0
|
51
68
|
version: "0"
|
52
69
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
none: false
|
53
71
|
requirements:
|
54
72
|
- - ">="
|
55
73
|
- !ruby/object:Gem::Version
|
74
|
+
hash: 3
|
56
75
|
segments:
|
57
76
|
- 0
|
58
77
|
version: "0"
|
59
78
|
requirements: []
|
60
79
|
|
61
80
|
rubyforge_project:
|
62
|
-
rubygems_version: 1.
|
81
|
+
rubygems_version: 1.6.2
|
63
82
|
signing_key:
|
64
83
|
specification_version: 3
|
65
84
|
summary: iPhone 4 @2x assets made easy
|
data/README.rdoc
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
= ios-png-check
|
2
|
-
|
3
|
-
A simple utility to check that your @2x iOS PNG assets targeting iPhone 4 are in a good shape.
|
4
|
-
|
5
|
-
== Note on Patches/Pull Requests
|
6
|
-
|
7
|
-
* Fork the project.
|
8
|
-
* Make your feature addition or bug fix.
|
9
|
-
* Add tests for it. This is important so I don't break it in a
|
10
|
-
future version unintentionally.
|
11
|
-
* Commit, do not mess with rakefile, version, or history.
|
12
|
-
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
|
13
|
-
* Send me a pull request. Bonus points for topic branches.
|
14
|
-
|
15
|
-
== Copyright
|
16
|
-
|
17
|
-
Copyright (c) 2010 Andrey Subbotin. See LICENSE for details.
|