storyboardlint 0.2.0 → 0.2.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/CHANGELOG.md +5 -0
- data/VERSION +1 -1
- data/lib/storyboardlint.rb +35 -4
- data/spec/fixtures/StoryboardLintTest/Pods/SomePod/Something.h +2 -0
- data/spec/fixtures/StoryboardLintTest/StoryboardLintTest/Base.lproj/Main_iPhone.storyboard +1 -1
- data/spec/fixtures/StoryboardLintTest/StoryboardLintTest/SomeFolder.m/SomeFile.m +1 -0
- data/spec/source_scanner_spec.rb +5 -5
- data/spec/storyboard_scanner_spec.rb +2 -1
- data/storyboardlint.gemspec +4 -2
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 78466ff49fa3a8838f72ad1db1b3d645b3a045e5
|
|
4
|
+
data.tar.gz: a7f32aef4c9a844a5698228f5d28edfefe669a87
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2305ec7e69493f5219a51b57a40fb5afb07a953fb799b4bbefbe56cccb04cdf5b33bb8aea1556a9ff58f0bc3fe1308f78d338afcffebd674d6db018a77778658
|
|
7
|
+
data.tar.gz: 0b14d0b76d1488d11b9234af68bcc71d03593cd7db88e9e07757ad746cf49a1fb097986b055f8e6ab783ddea84d544fbc031c0892f65b683c85d4f575c883562
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.1
|
|
4
|
+
|
|
5
|
+
- StoryboardList does not choke up on directories that are named like files anymore
|
|
6
|
+
- Added a --additional-sources CLI parameter, see https://github.com/jfahrenkrug/StoryboardLint/issues/3
|
|
7
|
+
|
|
3
8
|
## 0.2.0
|
|
4
9
|
|
|
5
10
|
- XIB files are now also scanned for reuse identifiers
|
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.1
|
data/lib/storyboardlint.rb
CHANGED
|
@@ -86,7 +86,7 @@ module StoryboardLint
|
|
|
86
86
|
end
|
|
87
87
|
|
|
88
88
|
class SourceScanner
|
|
89
|
-
def initialize(src_root, matcher)
|
|
89
|
+
def initialize(src_root, matcher, additional_sources = nil)
|
|
90
90
|
if !File.directory?(src_root)
|
|
91
91
|
raise ArgumentError, "The directory '#{src_root}' does not exist."
|
|
92
92
|
end
|
|
@@ -95,6 +95,7 @@ module StoryboardLint
|
|
|
95
95
|
raise ArgumentError, "The matcher cannot be nil."
|
|
96
96
|
end
|
|
97
97
|
|
|
98
|
+
@additional_sources = additional_sources
|
|
98
99
|
@matcher = matcher
|
|
99
100
|
@src_root = src_root
|
|
100
101
|
@scan_performed = false
|
|
@@ -104,7 +105,33 @@ module StoryboardLint
|
|
|
104
105
|
return @source_files if @source_files
|
|
105
106
|
|
|
106
107
|
# find all *.h, *.c, *.m and *.mm files
|
|
107
|
-
|
|
108
|
+
match_string = "**/*.{h,c,m,mm}"
|
|
109
|
+
@source_files = Dir.glob(File.join(@src_root, match_string))
|
|
110
|
+
|
|
111
|
+
if @additional_sources && @additional_sources.size > 0
|
|
112
|
+
@additional_sources.each do |source_path|
|
|
113
|
+
absolute_path = ''
|
|
114
|
+
if source_path.start_with?("/")
|
|
115
|
+
#absolute path
|
|
116
|
+
absolute_path = source_path
|
|
117
|
+
else
|
|
118
|
+
#relative to src_root
|
|
119
|
+
absolute_path = File.join(@src_root, source_path)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if File.directory?(absolute_path)
|
|
123
|
+
@source_files += Dir.glob(File.join(absolute_path, match_string))
|
|
124
|
+
else
|
|
125
|
+
puts "warning: additional source directory '#{absolute_path}' does not exist!"
|
|
126
|
+
end
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
if @source_files and @source_files.size > 0
|
|
131
|
+
@source_files.select! {|sf| File.file?(sf)}
|
|
132
|
+
end
|
|
133
|
+
|
|
134
|
+
@source_files
|
|
108
135
|
end
|
|
109
136
|
|
|
110
137
|
def segue_ids
|
|
@@ -314,6 +341,10 @@ module StoryboardLint
|
|
|
314
341
|
options.reuse_suffix = suffix
|
|
315
342
|
end
|
|
316
343
|
|
|
344
|
+
opts.on( '--additional-sources /absolute/path,../relative/to/target_directory', Array, "List of additional directories to scan for source files") do |source_paths|
|
|
345
|
+
options.additional_sources = source_paths
|
|
346
|
+
end
|
|
347
|
+
|
|
317
348
|
# No argument, shows at tail. This will print an options summary.
|
|
318
349
|
# Try it and see!
|
|
319
350
|
opts.on_tail("-h", "--help", "Show this message") do
|
|
@@ -323,7 +354,7 @@ module StoryboardLint
|
|
|
323
354
|
|
|
324
355
|
# Another typical switch to print the version.
|
|
325
356
|
opts.on_tail("--version", "Show version") do
|
|
326
|
-
puts "StoryboardLint v0.2.
|
|
357
|
+
puts "StoryboardLint v0.2.1"
|
|
327
358
|
exit
|
|
328
359
|
end
|
|
329
360
|
end
|
|
@@ -337,7 +368,7 @@ module StoryboardLint
|
|
|
337
368
|
|
|
338
369
|
matcher = StoryboardLint::Matcher.new(options)
|
|
339
370
|
sb_scanner = StoryboardLint::StoryboardScanner.new(ARGV[0])
|
|
340
|
-
source_scanner = StoryboardLint::SourceScanner.new(ARGV[0], matcher)
|
|
371
|
+
source_scanner = StoryboardLint::SourceScanner.new(ARGV[0], matcher, options.additional_sources)
|
|
341
372
|
|
|
342
373
|
linter = StoryboardLint::Linter.new(sb_scanner, source_scanner, matcher)
|
|
343
374
|
linter.lint
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
|
|
93
93
|
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
|
94
94
|
<subviews>
|
|
95
|
-
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Detail view content goes here" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="Lei-5M-9Gs">
|
|
95
|
+
<label clipsSubviews="YES" userInteractionEnabled="NO" contentMode="scaleToFill" text="Detail view content goes here" textAlignment="center" lineBreakMode="tailTruncation" minimumFontSize="10" translatesAutoresizingMaskIntoConstraints="NO" id="Lei-5M-9Gs" customClass="ClassFromCocoaPod">
|
|
96
96
|
<rect key="frame" x="20" y="276" width="280" height="17"/>
|
|
97
97
|
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
|
|
98
98
|
<fontDescription key="fontDescription" type="system" size="system"/>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
/* intentionally left blank */
|
data/spec/source_scanner_spec.rb
CHANGED
|
@@ -14,14 +14,14 @@ describe StoryboardLint::SourceScanner do
|
|
|
14
14
|
|
|
15
15
|
describe "Default Options" do
|
|
16
16
|
before :all do
|
|
17
|
-
@src = StoryboardLint::SourceScanner.new(File.join(File.dirname(__FILE__), "fixtures", "StoryboardLintTest"), StoryboardLint::Matcher.new(nil))
|
|
17
|
+
@src = StoryboardLint::SourceScanner.new(File.join(File.dirname(__FILE__), "fixtures", "StoryboardLintTest", "StoryboardLintTest"), StoryboardLint::Matcher.new(nil), ["../Pods"])
|
|
18
18
|
end
|
|
19
19
|
|
|
20
20
|
it "should find all source files" do
|
|
21
21
|
file_names = @src.source_files.map {|full_path| File.basename(full_path)}
|
|
22
|
-
file_names.size.should ==
|
|
22
|
+
file_names.size.should == 9
|
|
23
23
|
|
|
24
|
-
["SPWKAppDelegate.h", "SPWKDetailViewController.h", "SPWKMasterViewController.h", "main.m", "SPWKAppDelegate.m", "SPWKDetailViewController.m", "SPWKMasterViewController.m"].each do |fn|
|
|
24
|
+
["SPWKAppDelegate.h", "SPWKDetailViewController.h", "SPWKMasterViewController.h", "main.m", "SPWKAppDelegate.m", "SPWKDetailViewController.m", "SPWKMasterViewController.m", "SomeFile.m", "Something.h"].each do |fn|
|
|
25
25
|
file_names.should include(fn)
|
|
26
26
|
end
|
|
27
27
|
end
|
|
@@ -54,9 +54,9 @@ describe StoryboardLint::SourceScanner do
|
|
|
54
54
|
|
|
55
55
|
it "should find all class names in the project" do
|
|
56
56
|
names = @src.class_names.map {|n| n[:class_name]}
|
|
57
|
-
names.size.should ==
|
|
57
|
+
names.size.should == 6
|
|
58
58
|
|
|
59
|
-
["SPWKAppDelegate", "SPWKDetailViewController", "SPWKMasterViewController", "SPWKDetailViewController", "SPWKMasterViewController"].each do |name|
|
|
59
|
+
["SPWKAppDelegate", "SPWKDetailViewController", "SPWKMasterViewController", "SPWKDetailViewController", "SPWKMasterViewController", "ClassFromCocoaPod"].each do |name|
|
|
60
60
|
names.should include(name)
|
|
61
61
|
end
|
|
62
62
|
end
|
|
@@ -46,11 +46,12 @@ describe StoryboardLint::StoryboardScanner do
|
|
|
46
46
|
|
|
47
47
|
it "should return the custom class names" do
|
|
48
48
|
names = @sbs.custom_class_names
|
|
49
|
-
names.size.should ==
|
|
49
|
+
names.size.should == 6
|
|
50
50
|
name_strings = names.map {|item| item[:class_name]}
|
|
51
51
|
name_strings.should include('SPWKMasterViewController')
|
|
52
52
|
name_strings.should include('SPWKDetailViewController')
|
|
53
53
|
name_strings.should include('NonexistentViewController')
|
|
54
|
+
name_strings.should include('ClassFromCocoaPod')
|
|
54
55
|
end
|
|
55
56
|
|
|
56
57
|
end
|
data/storyboardlint.gemspec
CHANGED
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
|
|
6
6
|
Gem::Specification.new do |s|
|
|
7
7
|
s.name = "storyboardlint"
|
|
8
|
-
s.version = "0.2.
|
|
8
|
+
s.version = "0.2.1"
|
|
9
9
|
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
11
11
|
s.authors = ["Johannes Fahrenkrug"]
|
|
12
|
-
s.date = "2014-
|
|
12
|
+
s.date = "2014-03-11"
|
|
13
13
|
s.description = "It's a pain to to keep identifier strings in your UIStoryboard and in your source code in sync. This tool helps you to do just that."
|
|
14
14
|
s.email = "johannes@springenwerk.com"
|
|
15
15
|
s.executables = ["storyboardlint"]
|
|
@@ -29,6 +29,7 @@ Gem::Specification.new do |s|
|
|
|
29
29
|
"VERSION",
|
|
30
30
|
"bin/storyboardlint",
|
|
31
31
|
"lib/storyboardlint.rb",
|
|
32
|
+
"spec/fixtures/StoryboardLintTest/Pods/SomePod/Something.h",
|
|
32
33
|
"spec/fixtures/StoryboardLintTest/StoryboardLintTest.xcodeproj/project.pbxproj",
|
|
33
34
|
"spec/fixtures/StoryboardLintTest/StoryboardLintTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata",
|
|
34
35
|
"spec/fixtures/StoryboardLintTest/StoryboardLintTest.xcodeproj/project.xcworkspace/xcshareddata/StoryboardLintTest.xccheckout",
|
|
@@ -42,6 +43,7 @@ Gem::Specification.new do |s|
|
|
|
42
43
|
"spec/fixtures/StoryboardLintTest/StoryboardLintTest/SPWKDetailViewController.m",
|
|
43
44
|
"spec/fixtures/StoryboardLintTest/StoryboardLintTest/SPWKMasterViewController.h",
|
|
44
45
|
"spec/fixtures/StoryboardLintTest/StoryboardLintTest/SPWKMasterViewController.m",
|
|
46
|
+
"spec/fixtures/StoryboardLintTest/StoryboardLintTest/SomeFolder.m/SomeFile.m",
|
|
45
47
|
"spec/fixtures/StoryboardLintTest/StoryboardLintTest/StoryboardLintTest-Info.plist",
|
|
46
48
|
"spec/fixtures/StoryboardLintTest/StoryboardLintTest/StoryboardLintTest-Prefix.pch",
|
|
47
49
|
"spec/fixtures/StoryboardLintTest/StoryboardLintTest/TestView.xib",
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: storyboardlint
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.2.
|
|
4
|
+
version: 0.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Johannes Fahrenkrug
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2014-
|
|
11
|
+
date: 2014-03-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: nokogiri
|
|
@@ -87,6 +87,7 @@ files:
|
|
|
87
87
|
- VERSION
|
|
88
88
|
- bin/storyboardlint
|
|
89
89
|
- lib/storyboardlint.rb
|
|
90
|
+
- spec/fixtures/StoryboardLintTest/Pods/SomePod/Something.h
|
|
90
91
|
- spec/fixtures/StoryboardLintTest/StoryboardLintTest.xcodeproj/project.pbxproj
|
|
91
92
|
- spec/fixtures/StoryboardLintTest/StoryboardLintTest.xcodeproj/project.xcworkspace/contents.xcworkspacedata
|
|
92
93
|
- spec/fixtures/StoryboardLintTest/StoryboardLintTest.xcodeproj/project.xcworkspace/xcshareddata/StoryboardLintTest.xccheckout
|
|
@@ -100,6 +101,7 @@ files:
|
|
|
100
101
|
- spec/fixtures/StoryboardLintTest/StoryboardLintTest/SPWKDetailViewController.m
|
|
101
102
|
- spec/fixtures/StoryboardLintTest/StoryboardLintTest/SPWKMasterViewController.h
|
|
102
103
|
- spec/fixtures/StoryboardLintTest/StoryboardLintTest/SPWKMasterViewController.m
|
|
104
|
+
- spec/fixtures/StoryboardLintTest/StoryboardLintTest/SomeFolder.m/SomeFile.m
|
|
103
105
|
- spec/fixtures/StoryboardLintTest/StoryboardLintTest/StoryboardLintTest-Info.plist
|
|
104
106
|
- spec/fixtures/StoryboardLintTest/StoryboardLintTest/StoryboardLintTest-Prefix.pch
|
|
105
107
|
- spec/fixtures/StoryboardLintTest/StoryboardLintTest/TestView.xib
|