ensure_xcode_has_no_ci_sources 1.0.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.
- checksums.yaml +7 -0
- data/.gitignore +10 -0
- data/.travis.yml +4 -0
- data/Gemfile +3 -0
- data/LICENSE.txt +21 -0
- data/README.md +51 -0
- data/Rakefile +10 -0
- data/alert.png +0 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/ensure_xcode_has_no_ci_sources.gemspec +27 -0
- data/exe/ensure_xcode_has_no_ci_sources +7 -0
- data/lib/ensure_xcode_has_no_ci_sources/cli.rb +49 -0
- data/lib/ensure_xcode_has_no_ci_sources/test.rb +40 -0
- data/lib/ensure_xcode_has_no_ci_sources/version.rb +3 -0
- data/lib/ensure_xcode_has_no_ci_sources.rb +9 -0
- metadata +131 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 16738b9559a57fdca33a884c0fe40266c79072b7
|
4
|
+
data.tar.gz: a5fd18e1e8aacbfeb8f54dad122781da3c9c7b5a
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 0baf92fe9618d6d70d0fecaf6e6af5250a32db4d86e7245f37b0e137c7ad368f6a0cc2d8f1a3cb86b835bbd13ce4897533e5174d68886334f6a61e118e6b3959
|
7
|
+
data.tar.gz: df5fc5adc8a3633f66719305ecef658bb1ad34d1f02b0762d6ef5aad7d6a84d0a80951004faeca8369bfb6e81b8091b99bf85a7f63ba00d953a4da07ed955227
|
data/.gitignore
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 Soutaro Matsumoto
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
# ensure_xcode_has_no_ci_sources
|
2
|
+
|
3
|
+
This is true story.
|
4
|
+
|
5
|
+
One day, I added a utility class for JSON parsing, as `UBTypedJsonDictionary`.
|
6
|
+
My teammate suggested to rename it to `UBTypedJSONDictionary`, since Foundation framework has `NSJSONSerialization` class.
|
7
|
+
I agreed, and rename the class on Xcode.
|
8
|
+
And, it broke the build on another teammate's Mac, because his Mac has case sensitive file system.
|
9
|
+
|
10
|
+
Xcode renamed filename in its project, but does not rename real file.
|
11
|
+
|
12
|
+
This command is to find such files: an source code which has differently cased name in file system than Xcode project.
|
13
|
+
Run this during CI build to make sure your project can build on Mac with case sensitive file system :beer:
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
Add this line to your application's Gemfile:
|
18
|
+
|
19
|
+
```ruby
|
20
|
+
gem 'ensure_xcode_has_no_ci_sources'
|
21
|
+
```
|
22
|
+
|
23
|
+
And then execute:
|
24
|
+
|
25
|
+
$ bundle
|
26
|
+
|
27
|
+
Or install it yourself as:
|
28
|
+
|
29
|
+
$ gem install ensure_xcode_has_no_ci_sources
|
30
|
+
|
31
|
+
## Usage
|
32
|
+
|
33
|
+
$ ensure_xcode_has_no_ci_sources YourProject.xcodeproj
|
34
|
+
|
35
|
+

|
36
|
+
|
37
|
+
## Development
|
38
|
+
|
39
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
40
|
+
|
41
|
+
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).
|
42
|
+
|
43
|
+
## Contributing
|
44
|
+
|
45
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/soutaro/ensure_xcode_has_no_ci_sources.
|
46
|
+
|
47
|
+
|
48
|
+
## License
|
49
|
+
|
50
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
51
|
+
|
data/Rakefile
ADDED
data/alert.png
ADDED
Binary file
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "ensure_xcode_has_no_ci_sources"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start
|
data/bin/setup
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'ensure_xcode_has_no_ci_sources/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "ensure_xcode_has_no_ci_sources"
|
8
|
+
spec.version = EnsureXcodeHasNoCiSources::VERSION
|
9
|
+
spec.authors = ["Soutaro Matsumoto"]
|
10
|
+
spec.email = ["matsumoto@soutaro.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Find out case insensitive sources in your Xcode project.}
|
13
|
+
spec.description = %q{Find out source files which has differently cased names between Xcode project and file system.}
|
14
|
+
spec.homepage = "https://github.com/soutaro/ensure_xcode_has_no_ci_sources"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
18
|
+
spec.bindir = "exe"
|
19
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
|
+
spec.require_paths = ["lib"]
|
21
|
+
|
22
|
+
spec.add_dependency 'xcodeproj', "~> 0.28"
|
23
|
+
spec.add_dependency 'rainbow', "~> 2.1"
|
24
|
+
spec.add_development_dependency "bundler", "~> 1.11"
|
25
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
26
|
+
spec.add_development_dependency "minitest", "~> 5.0"
|
27
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require "optparse"
|
2
|
+
|
3
|
+
module EnsureXcodeHasNoCiSources
|
4
|
+
class CLI
|
5
|
+
attr_reader :argv
|
6
|
+
|
7
|
+
attr_reader :warn
|
8
|
+
attr_reader :silent
|
9
|
+
|
10
|
+
def initialize(argv)
|
11
|
+
@argv = argv
|
12
|
+
|
13
|
+
@warn = false
|
14
|
+
@silent = false
|
15
|
+
end
|
16
|
+
|
17
|
+
def run
|
18
|
+
OptionParser.new do |opts|
|
19
|
+
opts.on("-w", "--warn", "Exit with 0, even if case insensitive files are found") { @warn = true }
|
20
|
+
opts.on("-s", "--silent", "Does not print anything") { @silent = true }
|
21
|
+
end.parse!(argv)
|
22
|
+
|
23
|
+
failed = false
|
24
|
+
|
25
|
+
argv.each do |path|
|
26
|
+
project = Xcodeproj::Project.open(path)
|
27
|
+
ci_sources = EnsureXcodeHasNoCiSources::Test.new(project).case_insensitive_sources
|
28
|
+
if ci_sources.size > 0
|
29
|
+
failed = true
|
30
|
+
|
31
|
+
unless silent
|
32
|
+
puts Rainbow("#{project.path.relative_path_from(Pathname(".").realpath)} has case insensitive sources 💣").red
|
33
|
+
ci_sources.each do |source|
|
34
|
+
puts " In Xcode Project: #{source.project_path.basename}"
|
35
|
+
puts " In File System: #{source.file_path.relative_path_from(project.path.parent)}"
|
36
|
+
end
|
37
|
+
end
|
38
|
+
else
|
39
|
+
unless silent
|
40
|
+
puts Rainbow("#{project.path.relative_path_from(Pathname(".").realpath)} has no case insensitive sources 👍").green
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
exit 1 if !warn
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
@@ -0,0 +1,40 @@
|
|
1
|
+
module EnsureXcodeHasNoCiSources
|
2
|
+
CaseInsensitiveSource = Struct.new(:file_path, :project_path)
|
3
|
+
|
4
|
+
class Test
|
5
|
+
attr_reader :project
|
6
|
+
attr_reader :children
|
7
|
+
|
8
|
+
def initialize(project)
|
9
|
+
@project = project
|
10
|
+
|
11
|
+
@children = {}
|
12
|
+
end
|
13
|
+
|
14
|
+
def case_insensitive_file_path(path)
|
15
|
+
child_paths = @children[path.parent.to_s]
|
16
|
+
|
17
|
+
unless child_paths
|
18
|
+
child_paths = path.parent.children
|
19
|
+
children[path.parent.to_s] = child_paths
|
20
|
+
end
|
21
|
+
|
22
|
+
child_paths.find {|child| child.basename.to_s.upcase == path.basename.to_s.upcase && child.basename != path.basename }
|
23
|
+
end
|
24
|
+
|
25
|
+
def case_insensitive_sources
|
26
|
+
sources = []
|
27
|
+
|
28
|
+
@project.files.each do |source|
|
29
|
+
source_path = source.real_path
|
30
|
+
if source_path.file? || source_path.directory?
|
31
|
+
case_insensitive_file_path(source_path).try do |file_path|
|
32
|
+
sources << CaseInsensitiveSource.new(file_path, source_path)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
sources
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
metadata
ADDED
@@ -0,0 +1,131 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ensure_xcode_has_no_ci_sources
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Soutaro Matsumoto
|
8
|
+
autorequire:
|
9
|
+
bindir: exe
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-03-11 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: xcodeproj
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.28'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.28'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rainbow
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.11'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.11'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: minitest
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '5.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '5.0'
|
83
|
+
description: Find out source files which has differently cased names between Xcode
|
84
|
+
project and file system.
|
85
|
+
email:
|
86
|
+
- matsumoto@soutaro.com
|
87
|
+
executables:
|
88
|
+
- ensure_xcode_has_no_ci_sources
|
89
|
+
extensions: []
|
90
|
+
extra_rdoc_files: []
|
91
|
+
files:
|
92
|
+
- ".gitignore"
|
93
|
+
- ".travis.yml"
|
94
|
+
- Gemfile
|
95
|
+
- LICENSE.txt
|
96
|
+
- README.md
|
97
|
+
- Rakefile
|
98
|
+
- alert.png
|
99
|
+
- bin/console
|
100
|
+
- bin/setup
|
101
|
+
- ensure_xcode_has_no_ci_sources.gemspec
|
102
|
+
- exe/ensure_xcode_has_no_ci_sources
|
103
|
+
- lib/ensure_xcode_has_no_ci_sources.rb
|
104
|
+
- lib/ensure_xcode_has_no_ci_sources/cli.rb
|
105
|
+
- lib/ensure_xcode_has_no_ci_sources/test.rb
|
106
|
+
- lib/ensure_xcode_has_no_ci_sources/version.rb
|
107
|
+
homepage: https://github.com/soutaro/ensure_xcode_has_no_ci_sources
|
108
|
+
licenses:
|
109
|
+
- MIT
|
110
|
+
metadata: {}
|
111
|
+
post_install_message:
|
112
|
+
rdoc_options: []
|
113
|
+
require_paths:
|
114
|
+
- lib
|
115
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - ">="
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
requirements: []
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 2.5.1
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: Find out case insensitive sources in your Xcode project.
|
131
|
+
test_files: []
|