Class: EnsureXcodeHasNoCiSources::Test
- Inherits:
-
Object
- Object
- EnsureXcodeHasNoCiSources::Test
- Defined in:
- lib/ensure_xcode_has_no_ci_sources/test.rb
Instance Attribute Summary collapse
-
#children ⇒ Object
readonly
Returns the value of attribute children.
-
#project ⇒ Object
readonly
Returns the value of attribute project.
Instance Method Summary collapse
- #case_insensitive_file_path(path) ⇒ Object
- #case_insensitive_sources ⇒ Object
-
#initialize(project) ⇒ Test
constructor
A new instance of Test.
Constructor Details
#initialize(project) ⇒ Test
Returns a new instance of Test.
8 9 10 11 12 |
# File 'lib/ensure_xcode_has_no_ci_sources/test.rb', line 8 def initialize(project) @project = project @children = {} end |
Instance Attribute Details
#children ⇒ Object (readonly)
Returns the value of attribute children.
6 7 8 |
# File 'lib/ensure_xcode_has_no_ci_sources/test.rb', line 6 def children @children end |
#project ⇒ Object (readonly)
Returns the value of attribute project.
5 6 7 |
# File 'lib/ensure_xcode_has_no_ci_sources/test.rb', line 5 def project @project end |
Instance Method Details
#case_insensitive_file_path(path) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ensure_xcode_has_no_ci_sources/test.rb', line 14 def case_insensitive_file_path(path) child_paths = @children[path.parent.to_s] unless child_paths child_paths = path.parent.children children[path.parent.to_s] = child_paths end child_paths.find {|child| child.basename.to_s.upcase == path.basename.to_s.upcase && child.basename != path.basename } end |
#case_insensitive_sources ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/ensure_xcode_has_no_ci_sources/test.rb', line 25 def case_insensitive_sources sources = [] @project.files.each do |source| source_path = source.real_path if source_path.file? || source_path.directory? case_insensitive_file_path(source_path).try do |file_path| sources << CaseInsensitiveSource.new(file_path, source_path) end end end sources end |