xib_image_validator 0.1.0 → 0.1.1
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 +8 -21
- data/bin/validate_xib +4 -1
- data/lib/xib_image_validator.rb +5 -1
- data/lib/xib_image_validator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 15e1b45cfe3c684dc49965be2df9c1d88655dbc0
|
4
|
+
data.tar.gz: 662c5d7aa9b340f13d1e5cf6d83dc2ce91c645ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 84510e80ac27f3a3f872554aa6439c90e1d23100bf80bd1836b07823692ec7f83cf67350849b14d42192313cebcc9649ecb6f894119f6f47d0d4dd2f4f786ce7
|
7
|
+
data.tar.gz: 5a8639122c2c72550f8deac9e13b6bb4812cb126527e4f35ba239130e90ff949578f79617e2c520a6b0badf4ec61d6165e9833302b469063c74a9955fa144905
|
data/README.md
CHANGED
@@ -1,38 +1,25 @@
|
|
1
1
|
# XibImageValidator
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
A gem that ensures you have the proper image files that you've referenced in your XIBs.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
Add this line to your application's Gemfile:
|
10
|
-
|
11
|
-
```ruby
|
12
|
-
gem 'xib_image_validator'
|
13
|
-
```
|
14
|
-
|
15
|
-
And then execute:
|
16
|
-
|
17
|
-
$ bundle
|
18
|
-
|
19
|
-
Or install it yourself as:
|
20
|
-
|
21
7
|
$ gem install xib_image_validator
|
22
8
|
|
23
9
|
## Usage
|
24
10
|
|
25
|
-
|
26
|
-
|
27
|
-
|
11
|
+
$ validate_xib [dirname] [options]
|
12
|
+
-v, --verbose Output diagnosic info
|
13
|
+
-s, --storyboard Additionally, scan storyboard files
|
14
|
+
-h, --help Show help message
|
28
15
|
|
29
|
-
|
16
|
+
The script will run over all .XIB files in the directory recursively, looking for all `<image>`, `<imageView>` and `<state>` (UIButton control state) tags, extracting image names and checking whether said image can be found in the directory.
|
30
17
|
|
31
|
-
|
18
|
+
It does not perform advanced checks like ensuring the files are within asset catalogs or in the "Copy Bundle Resources" build phase or even in the right target, although it might be a good idea to add this functionality later.
|
32
19
|
|
33
20
|
## Contributing
|
34
21
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
22
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/igor-makarov/xib-image-validator.
|
36
23
|
|
37
24
|
|
38
25
|
## License
|
data/bin/validate_xib
CHANGED
@@ -9,8 +9,11 @@ options = {}
|
|
9
9
|
|
10
10
|
OptionParser.new do |parser|
|
11
11
|
parser.banner = "Usage: validate_xib [dirname] [options]"
|
12
|
-
parser.on("-v", "--verbose", TrueClass, "Output diagnosic info
|
12
|
+
parser.on("-v", "--verbose", TrueClass, "Output diagnosic info") do |v|
|
13
13
|
options[:verbose] = true
|
14
|
+
end
|
15
|
+
parser.on("-s", "--storyboard", TrueClass, "Additionally, scan storyboard files") do |v|
|
16
|
+
options[:storyboard] = true
|
14
17
|
end
|
15
18
|
parser.on("-h", "--help", "Show this help message") do ||
|
16
19
|
puts parser
|
data/lib/xib_image_validator.rb
CHANGED
@@ -10,7 +10,11 @@ class XIBImageValidator
|
|
10
10
|
images.merge Set.new Dir["#{dirname}/**/*.pdf"] { |f| strip_image_name(f) }
|
11
11
|
STDERR.puts "Found #{images.count} distinct images in directory" if verbose
|
12
12
|
|
13
|
-
|
13
|
+
files = []
|
14
|
+
files << Dir["#{dirname}/**/*.xib"]
|
15
|
+
files << Dir["#{dirname}/**/*.storyboard"] if options[:storyboard]
|
16
|
+
|
17
|
+
files.flatten.each do |filename|
|
14
18
|
xml = REXML::Document.new File.new(filename)
|
15
19
|
xml.elements.each("//image | //state | //imageView") do |elem|
|
16
20
|
if(elem.name == "image")
|