Class: Pod::Sandbox::HeadersStore
- Inherits:
-
Object
- Object
- Pod::Sandbox::HeadersStore
- Defined in:
- lib/cocoapods/sandbox/headers_store.rb
Overview
Provides support for managing a header directory. It also keeps track of the header search paths.
Instance Attribute Summary collapse
-
#sandbox ⇒ Sandbox
readonly
The sandbox where this header directory is stored.
Adding headers collapse
-
#add_files(namespace, relative_header_paths, platform) ⇒ Array<Pathname>
Adds headers to the directory.
-
#add_search_path(path, platform) ⇒ void
Adds an header search path to the sandbox.
Instance Method Summary collapse
-
#implode! ⇒ void
Removes the directory as it is regenerated from scratch during each installation.
-
#initialize(sandbox, relative_path) ⇒ HeadersStore
constructor
A new instance of HeadersStore.
-
#root ⇒ Pathname
The absolute path of this header directory.
-
#search_paths(platform) ⇒ Array<String>
All the search paths of the header directory in xcconfig format.
Constructor Details
#initialize(sandbox, relative_path) ⇒ HeadersStore
Returns a new instance of HeadersStore.
23 24 25 26 27 |
# File 'lib/cocoapods/sandbox/headers_store.rb', line 23 def initialize(sandbox, relative_path) @sandbox = sandbox @relative_path = relative_path @search_paths = [] end |
Instance Attribute Details
#sandbox ⇒ Sandbox (readonly)
Returns the sandbox where this header directory is stored.
15 16 17 |
# File 'lib/cocoapods/sandbox/headers_store.rb', line 15 def sandbox @sandbox end |
Instance Method Details
#add_files(namespace, relative_header_paths, platform) ⇒ Array<Pathname>
This method adds the files to the search paths.
Adds headers to the directory.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/cocoapods/sandbox/headers_store.rb', line 73 def add_files(namespace, relative_header_paths, platform) add_search_path(namespace, platform) namespaced_path = root + namespace namespaced_path.mkpath unless File.exist?(namespaced_path) relative_header_paths.map do |relative_header_path| absolute_source = (sandbox.root + relative_header_path) source = absolute_source.relative_path_from(namespaced_path) Dir.chdir(namespaced_path) do FileUtils.ln_sf(source, relative_header_path.basename) end namespaced_path + relative_header_path.basename end end |
#add_search_path(path, platform) ⇒ void
This method returns an undefined value.
Adds an header search path to the sandbox.
98 99 100 |
# File 'lib/cocoapods/sandbox/headers_store.rb', line 98 def add_search_path(path, platform) @search_paths << { :platform => platform, :path => (Pathname.new(@relative_path) + path) } end |
#implode! ⇒ void
This method returns an undefined value.
Removes the directory as it is regenerated from scratch during each installation.
49 50 51 |
# File 'lib/cocoapods/sandbox/headers_store.rb', line 49 def implode! root.rmtree if root.exist? end |
#root ⇒ Pathname
Returns the absolute path of this header directory.
9 10 11 |
# File 'lib/cocoapods/sandbox/headers_store.rb', line 9 def root sandbox.headers_root + @relative_path end |
#search_paths(platform) ⇒ Array<String>
Returns All the search paths of the header directory in xcconfig format. The paths are specified relative to the pods root with the ‘$PODS_ROOT` variable.
37 38 39 40 41 42 |
# File 'lib/cocoapods/sandbox/headers_store.rb', line 37 def search_paths(platform) platform_search_paths = @search_paths.select { |entry| entry[:platform] == platform } headers_dir = root.relative_path_from(sandbox.root).dirname ["${PODS_ROOT}/#{headers_dir}/#{@relative_path}"] + platform_search_paths.uniq.map { |entry| "${PODS_ROOT}/#{headers_dir}/#{entry[:path]}" } end |