xib_image_validator 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c05a5676e2d5c7bc90efd6b2533430d430fb0c13
4
- data.tar.gz: de9cca400c253deb456c164de283bd030fb216d7
3
+ metadata.gz: 15e1b45cfe3c684dc49965be2df9c1d88655dbc0
4
+ data.tar.gz: 662c5d7aa9b340f13d1e5cf6d83dc2ce91c645ac
5
5
  SHA512:
6
- metadata.gz: d96b489c5cecbb4f30d714fde8a25783eff4cc94f646b284c3f5ba38a50d776ab5eb52978edbe11785644847d5b36faf6bebba74d505664baddcc6cf42476b8b
7
- data.tar.gz: a3f79b917ca30a48c7f41813cb12050e5bd7133933bacc4a091ec1079a852a94366ff9fe7f58e7d2ee121b608a2909222c991df4a798e144c9fcfa0b471d0b20
6
+ metadata.gz: 84510e80ac27f3a3f872554aa6439c90e1d23100bf80bd1836b07823692ec7f83cf67350849b14d42192313cebcc9649ecb6f894119f6f47d0d4dd2f4f786ce7
7
+ data.tar.gz: 5a8639122c2c72550f8deac9e13b6bb4812cb126527e4f35ba239130e90ff949578f79617e2c520a6b0badf4ec61d6165e9833302b469063c74a9955fa144905
data/README.md CHANGED
@@ -1,38 +1,25 @@
1
1
  # XibImageValidator
2
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/xib_image_validator`. 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
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
- TODO: Write usage instructions here
26
-
27
- ## Development
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
- 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.
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
- 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).
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/[USERNAME]/xib_image_validator.
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
@@ -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.") do |v|
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
@@ -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
- Dir["#{dirname}/**/*.xib"].each do |filename|
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")
@@ -1,3 +1,3 @@
1
1
  module XibImageValidator
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: xib_image_validator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Igor Makarov