storyboardlint 0.1.1 → 0.1.2
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 +13 -6
- data/VERSION +1 -1
- data/lib/storyboardlint.rb +3 -2
- data/storyboardlint.gemspec +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: 58d343d4d968254f21f6a1e31d508c073a779fc4
|
|
4
|
+
data.tar.gz: a8675e78e75b2d299bbf8e19caa9ce95cf3bf9d9
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 94615f5aa57c7b7152be2f1a406b6a37b486fdff520d1bdf8e1da17ab31d0e91f8fe436b18f834853859acbf108f355b634c672ec6d1b109d08e6f90d50bdf67
|
|
7
|
+
data.tar.gz: 80a5e312da89a90b28c69e4391c0eab9fecb4b5aa0f4288f6bc03738aaac09c6fe1e6f44ea37a1984080d13ea45740fb6ea841ff0c7dd23b793a5d3aa68c62bf
|
data/README.md
CHANGED
|
@@ -14,10 +14,10 @@ Fear Not!
|
|
|
14
14
|
---------
|
|
15
15
|
With StoryboardLint, you can finally make sure that your code and your Storyboards are in sync (at least to a certain degree). StoryboardLint does the following things:
|
|
16
16
|
|
|
17
|
-
- Makes sure your `UITableViewCell` and `UICollectionViewCell` reuse identifiers are named according to StoryboardLint's naming convention.
|
|
18
|
-
- Makes sure your Storyboard and Segue identifiers are named according to StoryboardLint's naming convention.
|
|
17
|
+
- Makes sure your `UITableViewCell` and `UICollectionViewCell` reuse identifiers are named according to either your own or StoryboardLint's default naming convention.
|
|
18
|
+
- Makes sure your Storyboard and Segue identifiers are named according to either your own or StoryboardLint's naming convention.
|
|
19
19
|
- Makes sure that all custom classes that are references from your Storyboard actually exist is your code.
|
|
20
|
-
- Makes sure that all string literals in your code that reference reuse identifiers, Storyboard identifiers and Segue identifiers (according to
|
|
20
|
+
- Makes sure that all string literals in your code that reference reuse identifiers, Storyboard identifiers and Segue identifiers (according to a given or default naming convention) actually exist in your Storyboard(s).
|
|
21
21
|
- Produces output that is parsable by Xcode so you can easily plug StoryboardLint into your build process:
|
|
22
22
|
|
|
23
23
|
**Warnings right in your source code:**
|
|
@@ -30,13 +30,20 @@ With StoryboardLint, you can finally make sure that your code and your Storyboar
|
|
|
30
30
|
|
|
31
31
|
Naming Convention
|
|
32
32
|
-----------------
|
|
33
|
-
In order for StoryboardLint to find the string literals in your code that contain reuse/Storyboard/Segue identifiers, you need to prefix them
|
|
33
|
+
In order for StoryboardLint to find the string literals in your code that contain reuse/Storyboard/Segue identifiers, you need to prefix and/or suffix them in a consistent way. If you don't provide any options, this is the default:
|
|
34
34
|
|
|
35
35
|
- Reuse Identifiers start with `ruid_`. Example: `ruid_ProductTableViewCell`.
|
|
36
36
|
- Storyboard Identifiers start with `sb_`. Example: `sb_ProductsViewController`.
|
|
37
37
|
- Segue Identifiers start with `seg_`. Example: `seg_ProductDetailsSegue`.
|
|
38
38
|
|
|
39
|
-
|
|
39
|
+
However, if you already use a certain naming convention or if you would prefer a different one, you can tell StoryboardLint about it using these commandline arguments:
|
|
40
|
+
|
|
41
|
+
- `--storyboard-prefix`. Example: `storyboardlint ~/Code/MyProject --storyboard-prefix MyGreatPrefix`
|
|
42
|
+
- `--storyboard-suffix`. Example: `storyboardlint ~/Code/MyProject --storyboard-suffix MyGreatSuffix`
|
|
43
|
+
|
|
44
|
+
The same goes for `--segue-prefix`, `--segue-suffix`, `--reuse-prefix` and `--reuse-suffix`. You are even allowed to provide both a prefix and a suffix.
|
|
45
|
+
|
|
46
|
+
Naming your identifiers according to a consistent naming convention should not be too much work and it will be worth it. Ideally you already have string constants for these things in your code, so that you only have to edit two places: your string constant in code and the respective value in your Storyboard.
|
|
40
47
|
|
|
41
48
|
Installation
|
|
42
49
|
------------
|
|
@@ -49,7 +56,7 @@ In your Xcode Project, simply add a "Run Script" build phase in order to run Sto
|
|
|
49
56
|
1. Go to your project and select your project's target in the "Targets" section.
|
|
50
57
|
2. Go to "Build Phases"
|
|
51
58
|
3. Select from the Menu "Editor -> Add Build Phase -> Add Run Script Build Phase"
|
|
52
|
-
4. Paste this command into the Run Script section: `storyboardlint "$SRCROOT"`
|
|
59
|
+
4. Paste this command into the Run Script section: `storyboardlint "$SRCROOT"` (this will use the default naming convention). Alternatively, you can provide options to tell StoryboardLint about our own naming conventions, for example: `storyboardlint "$SRCROOT" --storyboard-suffix Storyboard --segue-suffix Segue --reuse-suffix ReuseID`
|
|
53
60
|
5. That's it!
|
|
54
61
|
|
|
55
62
|
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.1.
|
|
1
|
+
0.1.2
|
data/lib/storyboardlint.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# encoding: UTF-8
|
|
1
2
|
# Have fun. Use at your own risk.
|
|
2
3
|
# Copyright (c) 2014 Johannes Fahrenkrug
|
|
3
4
|
|
|
@@ -86,7 +87,7 @@ module StoryboardLint
|
|
|
86
87
|
@reuse_ids ||= []
|
|
87
88
|
|
|
88
89
|
source_files.each do |source_file|
|
|
89
|
-
File.readlines(source_file).each_with_index do |line, idx|
|
|
90
|
+
File.readlines(source_file, :encoding => 'UTF-8').each_with_index do |line, idx|
|
|
90
91
|
# class names
|
|
91
92
|
line.scan(@matcher.class_regex).each do |match|
|
|
92
93
|
@class_names << {:file => source_file, :line => idx + 1, :class_name => match[0]}
|
|
@@ -278,7 +279,7 @@ module StoryboardLint
|
|
|
278
279
|
|
|
279
280
|
# Another typical switch to print the version.
|
|
280
281
|
opts.on_tail("--version", "Show version") do
|
|
281
|
-
puts "StoryboardLint v0.1.
|
|
282
|
+
puts "StoryboardLint v0.1.2"
|
|
282
283
|
exit
|
|
283
284
|
end
|
|
284
285
|
end
|
data/storyboardlint.gemspec
CHANGED