Class: Pod::Sandbox::FileAccessor
- Inherits:
-
Object
- Object
- Pod::Sandbox::FileAccessor
- Defined in:
- lib/cocoapods/sandbox/file_accessor.rb
Overview
The FileAccessor always returns absolute paths.
Resolves the file patterns of a specification against its root directory, taking into account any exclude pattern and the default extensions to use for directories.
Constant Summary collapse
- HEADER_EXTENSIONS =
Xcodeproj::Constants::HEADER_FILES_EXTENSIONS
Instance Attribute Summary collapse
-
#path_list ⇒ Sandbox::PathList
readonly
The directory where the source of the Pod is located.
-
#spec_consumer ⇒ Specification::Consumer
readonly
The consumer of the specification for which the file patterns should be resolved.
Paths collapse
-
#headers ⇒ Array<Pathname>
The headers of the specification.
-
#license ⇒ Pathname
The path of the license file as indicated in the specification or auto-detected.
-
#prefix_header ⇒ Pathname
The of the prefix header file of the specification.
-
#preserve_paths ⇒ Array<Pathname>
The files of the specification to preserve.
-
#public_headers ⇒ Array<Pathname>
The public headers of the specification.
-
#readme ⇒ Pathname
The path of the auto-detected README file.
-
#resource_bundle_files ⇒ Array<Pathname>
The paths of the files which should be included in resources bundles by the Pod.
-
#resource_bundles ⇒ Hash{String => Array<Pathname>}
A hash that describes the resource bundles of the Pod.
-
#resources ⇒ Hash{ Symbol => Array<Pathname> }
The resources of the specification grouped by destination.
-
#source_files ⇒ Array<Pathname>
The source files of the specification.
-
#vendored_frameworks ⇒ Array<Pathname>
The paths of the framework bundles that come shipped with the Pod.
-
#vendored_libraries ⇒ Array<Pathname>
The paths of the library bundles that come shipped with the Pod.
Instance Method Summary collapse
-
#initialize(path_list, spec_consumer) ⇒ FileAccessor
constructor
A new instance of FileAccessor.
-
#inspect ⇒ String
A string suitable for debugging.
-
#platform_name ⇒ Specification
The platform used to consume the specification.
-
#root ⇒ Pathname
The directory which contains the files of the Pod.
-
#spec ⇒ Specification
The specification.
Constructor Details
#initialize(path_list, spec_consumer) ⇒ FileAccessor
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 25 def initialize(path_list, spec_consumer) if path_list.is_a?(PathList) @path_list = path_list else @path_list = PathList.new(path_list) end @spec_consumer = spec_consumer unless @spec_consumer raise Informative, 'Attempt to initialize File Accessor without a specification consumer.' end end |
Instance Attribute Details
#path_list ⇒ Sandbox::PathList (readonly)
15 16 17 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 15 def path_list @path_list end |
#spec_consumer ⇒ Specification::Consumer (readonly)
20 21 22 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 20 def spec_consumer @spec_consumer end |
Instance Method Details
#headers ⇒ Array<Pathname>
76 77 78 79 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 76 def headers extensions = HEADER_EXTENSIONS source_files.select { |f| extensions.include?(f.extname) } end |
#inspect ⇒ String
58 59 60 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 58 def inspect "<#{self.class} spec=#{spec.name} platform=#{platform_name} root=#{root}>" end |
#license ⇒ Pathname
158 159 160 161 162 163 164 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 158 def license if spec_consumer.spec.root.license[:file] path_list.root + spec_consumer.spec.root.license[:file] else path_list.glob(%w( licen{c,s}e{*,.*} )).first end end |
#platform_name ⇒ Specification
52 53 54 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 52 def platform_name spec_consumer.platform_name end |
#prefix_header ⇒ Pathname
143 144 145 146 147 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 143 def prefix_header if spec_consumer.prefix_header_file path_list.root + spec_consumer.prefix_header_file end end |
#preserve_paths ⇒ Array<Pathname>
103 104 105 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 103 def preserve_paths paths_for_attribute(:preserve_paths, true) end |
#public_headers ⇒ Array<Pathname>
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 83 def public_headers public_headers = paths_for_attribute(:public_header_files) private_headers = paths_for_attribute(:private_header_files) if public_headers.nil? || public_headers.empty? header_files = headers else header_files = public_headers end header_files - private_headers end |
#readme ⇒ Pathname
151 152 153 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 151 def readme path_list.glob(%w( readme{*,.*} )).first end |
#resource_bundle_files ⇒ Array<Pathname>
137 138 139 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 137 def resource_bundle_files resource_bundles.values.flatten end |
#resource_bundles ⇒ Hash{String => Array<Pathname>}
125 126 127 128 129 130 131 132 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 125 def resource_bundles result = {} spec_consumer.resource_bundles.each do |name, file_patterns| paths = (file_patterns, :include_dirs => true) result[name] = paths end result end |
#resources ⇒ Hash{ Symbol => Array<Pathname> }
97 98 99 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 97 def resources paths_for_attribute(:resources, true) end |
#root ⇒ Pathname
40 41 42 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 40 def root path_list.root if path_list end |
#source_files ⇒ Array<Pathname>
70 71 72 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 70 def source_files paths_for_attribute(:source_files) end |
#spec ⇒ Specification
46 47 48 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 46 def spec spec_consumer.spec end |
#vendored_frameworks ⇒ Array<Pathname>
110 111 112 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 110 def vendored_frameworks paths_for_attribute(:vendored_frameworks, true) end |
#vendored_libraries ⇒ Array<Pathname>
117 118 119 |
# File 'lib/cocoapods/sandbox/file_accessor.rb', line 117 def vendored_libraries paths_for_attribute(:vendored_libraries) end |