Commit efb81a02 authored by Fabio Pelosin's avatar Fabio Pelosin

[Sandbox] Clean up implementation

parent d5f4684c
...@@ -60,10 +60,10 @@ module Pod ...@@ -60,10 +60,10 @@ module Pod
#--------------------------------------# #--------------------------------------#
# @!group Specifications
public public
# @!group Specifications
# @return [Specification] returns the specification, either from the # @return [Specification] returns the specification, either from the
# sandbox or by fetching the remote source, associated with the # sandbox or by fetching the remote source, associated with the
# external source. # external source.
...@@ -96,6 +96,8 @@ module Pod ...@@ -96,6 +96,8 @@ module Pod
#--------------------------------------# #--------------------------------------#
public
# @!group Subclasses hooks # @!group Subclasses hooks
# Fetches the external source from the remote according to the params. # Fetches the external source from the remote according to the params.
...@@ -117,39 +119,10 @@ module Pod ...@@ -117,39 +119,10 @@ module Pod
#--------------------------------------# #--------------------------------------#
# @! Subclasses helpers
private private
# Stores a specification in the `Local Podspecs` folder. # @! Subclasses helpers
#
# @param [Sandbox] sandbox
# the sandbox where the podspec should be stored.
#
# @param [String, Pathname] podspec
# The contents of the specification (String) or the path to a
# podspec file (Pathname).
#
# @todo This could be done by the sandbox.
# @todo Store all the specifications (including those not originating
# from external sources) so users can check them.
# @todo The check for the podspec string is a bit primitive.
#
def store_podspec(sandbox, podspec)
output_path = sandbox.root + "Local Podspecs/#{name}.podspec"
output_path.dirname.mkpath
if podspec.is_a?(String)
unless podspec.include?('Spec.new')
raise Informative, "The `#{name}.podspec` from `#{description}` appears to be invalid."
end
output_path.open('w') { |f| f.puts(podspec) }
else
unless podspec.exist?
raise Informative, "No podspec found for `#{name}` in #{description}"
end
FileUtils.copy(podspec, output_path)
end
end
# Pre-downloads a Pod passing the options to the downloader and informing # Pre-downloads a Pod passing the options to the downloader and informing
# the sandbox. # the sandbox.
...@@ -165,8 +138,8 @@ module Pod ...@@ -165,8 +138,8 @@ module Pod
target.rmtree if target.exist? target.rmtree if target.exist?
downloader = Downloader.for_target(target, @params) downloader = Downloader.for_target(target, @params)
downloader.download downloader.download
store_podspec(sandbox, target + "#{name}.podspec") sandbox.store_podspec(name, target + "#{name}.podspec", true)
sandbox.predownloaded_pods << name sandbox.store_pre_downloaded_pod(name)
if downloader.options_specific? if downloader.options_specific?
source = @params source = @params
else else
...@@ -291,7 +264,7 @@ module Pod ...@@ -291,7 +264,7 @@ module Pod
path = @params[:podspec] path = @params[:podspec]
path = Pathname.new(path).expand_path if path.to_s.start_with?("~") path = Pathname.new(path).expand_path if path.to_s.start_with?("~")
require 'open-uri' require 'open-uri'
open(path) { |io| store_podspec(sandbox, io.read) } open(path) { |io| sandbox.store_podspec(name, io.read, true) }
end end
end end
...@@ -314,7 +287,7 @@ module Pod ...@@ -314,7 +287,7 @@ module Pod
# @see AbstractExternalSource#copy_external_source_into_sandbox # @see AbstractExternalSource#copy_external_source_into_sandbox
# #
def copy_external_source_into_sandbox(sandbox) def copy_external_source_into_sandbox(sandbox)
store_podspec(sandbox, pod_spec_path) sandbox.store_podspec(name, pod_spec_path, true)
sandbox.store_local_path(name, @params[:local]) sandbox.store_local_path(name, @params[:local])
end end
...@@ -349,10 +322,10 @@ module Pod ...@@ -349,10 +322,10 @@ module Pod
#--------------------------------------# #--------------------------------------#
# @!group Helpers
private private
# @!group Helpers
# @return [Pathname] the path of the podspec. # @return [Pathname] the path of the podspec.
# #
def pod_spec_path def pod_spec_path
......
...@@ -222,7 +222,7 @@ module Pod ...@@ -222,7 +222,7 @@ module Pod
def create_copy_resources_script def create_copy_resources_script
path = library.copy_resources_script_path path = library.copy_resources_script_path
UI.message "- Generating copy resources script at #{UI.path(path)}" do UI.message "- Generating copy resources script at #{UI.path(path)}" do
resources = library.file_accessors.map { |accessor| accessor.resources.values.flatten.map {|res| sandbox.relativize(res)} }.flatten resources = library.file_accessors.map { |accessor| accessor.resources.values.flatten.map {|res| project.relativize(res)} }.flatten
resources << bridge_support_file if bridge_support_file resources << bridge_support_file if bridge_support_file
generator = Generator::CopyResourcesScript.new(resources) generator = Generator::CopyResourcesScript.new(resources)
generator.save_as(path) generator.save_as(path)
......
...@@ -35,6 +35,35 @@ module Pod ...@@ -35,6 +35,35 @@ module Pod
@root ||= path.dirname @root ||= path.dirname
end end
# @return [Pathname] Returns the relative path from the project root.
#
# @param [Pathname] path
# The path that needs to be converted to the relative format.
#
# @note If the two absolute paths don't share the same root directory an
# extra `../` is added to the result of
# {Pathname#relative_path_from}.
#
# @example
#
# path = Pathname.new('/Users/dir')
# @sandbox.root #=> Pathname('/tmp/CocoaPods/Lint/Pods')
#
# @sandbox.relativize(path) #=> '../../../../Users/dir'
# @sandbox.relativize(path) #=> '../../../../../Users/dir'
#
def relativize(path)
unless path.absolute?
raise Informative, "Attempt to add relative path to the Pods project"
end
result = path.relative_path_from(root)
unless root.to_s.split('/')[1] == path.to_s.split('/')[1]
result = Pathname.new('../') + result
end
result
end
# @return [String] a string representation suited for debugging. # @return [String] a string representation suited for debugging.
# #
def inspect def inspect
...@@ -107,7 +136,7 @@ module Pod ...@@ -107,7 +136,7 @@ module Pod
# Adds a file reference for each one of the given files in the specified # Adds a file reference for each one of the given files in the specified
# group, namespaced by specification unless a file reference for the given # group, namespaced by specification unless a file reference for the given
# path alrady exits. # path already exits.
# #
# @note With this set-up different subspecs might not reference the same # @note With this set-up different subspecs might not reference the same
# file (i.e. the first will win). Not sure thought if this is a # file (i.e. the first will win). Not sure thought if this is a
...@@ -149,35 +178,6 @@ module Pod ...@@ -149,35 +178,6 @@ module Pod
refs_by_absolute_path[absolute_path] refs_by_absolute_path[absolute_path]
end end
# @return [Pathname] Returns the relative path from the project root.
#
# @param [Pathname] path
# The path that needs to be converted to the relative format.
#
# @note If the two absolute paths don't share the same root directory an
# extra `../` is added to the result of
# {Pathname#relative_path_from}.
#
# @example
#
# path = Pathname.new('/Users/dir')
# @sandbox.root #=> Pathname('/tmp/CocoaPods/Lint/Pods')
#
# @sandbox.relativize(path) #=> '../../../../Users/dir'
# @sandbox.relativize(path) #=> '../../../../../Users/dir'
#
def relativize(path)
unless path.absolute?
raise Informative, "Attempt to add relative path to the Pods project"
end
result = path.relative_path_from(root)
unless root.to_s.split('/')[1] == path.to_s.split('/')[1]
result = Pathname.new('../') + result
end
result
end
# Adds a file reference to the podfile. # Adds a file reference to the podfile.
# #
# @param [Pathname,String] podfile_path # @param [Pathname,String] podfile_path
......
...@@ -13,7 +13,7 @@ module Pod ...@@ -13,7 +13,7 @@ module Pod
# Pods # Pods
# | # |
# +-- Headers # +-- Headers
# | +-- Build # | +-- Private
# | | +-- [Pod Name] # | | +-- [Pod Name]
# | +-- Public # | +-- Public
# | +-- [Pod Name] # | +-- [Pod Name]
...@@ -22,6 +22,8 @@ module Pod ...@@ -22,6 +22,8 @@ module Pod
# | +-- [Pod Name] # | +-- [Pod Name]
# | # |
# +-- Specifications # +-- Specifications
# | +-- External Sources
# | +-- Normal Sources
# | # |
# +-- Target Support Files # +-- Target Support Files
# | +-- [Target Name] # | +-- [Target Name]
...@@ -84,36 +86,6 @@ module Pod ...@@ -84,36 +86,6 @@ module Pod
root.rmtree root.rmtree
end end
# @return [Pathname] Returns the relative path from the sandbox.
#
# @note If the two absolute paths don't share the same root directory an
# extra `../` is added to the result of {Pathname#relative_path_from}
#
#
# @example
#
# path = Pathname.new('/Users/dir')
# @sandbox.root #=> Pathname('/tmp/CocoaPods/Lint/Pods')
#
# @sandbox.relativize(path) #=> '../../../../Users/dir'
# @sandbox.relativize(path) #=> '../../../../../Users/dir'
#
def relativize(path)
result = path.relative_path_from(root)
unless root.to_s.split('/')[1] == path.to_s.split('/')[1]
result = Pathname.new('../') + result
end
result
end
# Converts a list of paths to their relative variant.
#
# @return [Array<Pathname>] the relative paths.
#
def relativize_paths(paths)
paths.map { |path| relativize(path) }
end
# @return [String] a string representation suitable for debugging. # @return [String] a string representation suitable for debugging.
# #
def inspect def inspect
...@@ -122,6 +94,8 @@ module Pod ...@@ -122,6 +94,8 @@ module Pod
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
public
# @!group Paths # @!group Paths
# @return [Pathname] the path of the manifest. # @return [Pathname] the path of the manifest.
...@@ -149,64 +123,115 @@ module Pod ...@@ -149,64 +123,115 @@ module Pod
root root
end end
# Returns the path where the Pod with the given name is stored, taking into
# account whether the Pod is locally sourced.
#
# @param [String] name
# The name of the Pod.
#
# @return [Pathname] the path of the Pod.
#
def pod_dir(name)
root_name = Specification.root_name(name)
if local?(root_name)
Pathname.new(local_pods[root_name])
else
# root + "Sources/#{name}"
root + root_name
end
end
#-------------------------------------------------------------------------#
public
# @!group Specification store
# Returns the specification for the Pod with the given name.
#
# @param [String] name
# the name of the Pod for which the specification is requested.
#
# @return [Specification] the specification if the file is found.
#
def specification(name)
if file = specification_path(name)
Specification.from_file(file)
end
end
# @return [Pathname] the path for the directory where to store the # @return [Pathname] the path for the directory where to store the
# specifications. # specifications.
# #
def specifications_dir # @todo Migrate old installations and store the for all the pods.
# Two folders should be created `External Sources` and `Podspecs`.
#
def specifications_dir(external_source = false)
# root + "Specifications" # root + "Specifications"
root + "Local Podspecs" root + "Local Podspecs"
end end
# Returns the path of the specification for the Pod with the # Returns the path of the specification for the Pod with the
# given name. # given name, if one is stored.
# #
# @param [String] name # @param [String] name
# the name of the Pod for which the podspec file is requested. # the name of the Pod for which the podspec file is requested.
# #
# @return [Pathname] the path or nil. # @return [Pathname] the path or nil.
# @return [Nil] if the podspec is not stored.
# #
def specification_path(name) def specification_path(name)
path = specifications_dir + "#{name}.podspec" path = specifications_dir + "#{name}.podspec"
path.exist? ? path : nil path.exist? ? path : nil
end end
#-------------------------------------------------------------------------# # Stores a specification in the `Local Podspecs` folder.
# @!group Pods storage & source
# Returns the specification for the Pod with the given name.
# #
# @param [String] name # @param [Sandbox] sandbox
# the name of the Pod for which the specification is requested. # the sandbox where the podspec should be stored.
# #
# @return [Specification] the specification if the file is found. # @param [String, Pathname] podspec
# The contents of the specification (String) or the path to a
# podspec file (Pathname).
# #
def specification(name) # @todo Store all the specifications (including those not originating
if file = specification_path(name) # from external sources) so users can check them.
Specification.from_file(file) #
def store_podspec(name, podspec, external_source = false)
output_path = specifications_dir(external_source) + "#{name}.podspec"
output_path.dirname.mkpath
if podspec.is_a?(String)
output_path.open('w') { |f| f.puts(podspec) }
else
unless podspec.exist?
raise Informative, "No podspec found for `#{name}` in #{podspec}"
end
FileUtils.copy(podspec, output_path)
end
spec = Specification.from_file(output_path)
unless spec.name == name
raise Informative, "The name of the given podspec `#{spec.name}` doesn't match the expected one `#{name}`"
end end
end end
# Returns the path where the Pod with the given name is stored, taking into #-------------------------------------------------------------------------#
# account whether the Pod is locally sourced.
public
# @!group Pods information
# Marks a Pod as pre-downloaded
# #
# @param [String] name # @param [String] name
# The name of the Pod. # The name of the Pod.
# #
# @return [Pathname] the path of the Pod. # @return [void]
# #
def pod_dir(name) def store_pre_downloaded_pod(name)
root_name = Specification.root_name(name) root_name = Specification.root_name(name)
if local?(root_name) predownloaded_pods << root_name
Pathname.new(local_pods[root_name])
else
# root + "Sources/#{name}"
root + root_name
end
end end
#--------------------------------------#
# @return [Array<String>] The names of the pods that have been # @return [Array<String>] The names of the pods that have been
# pre-downloaded from an external source. # pre-downloaded from an external source.
# #
......
...@@ -20,6 +20,15 @@ module Pod ...@@ -20,6 +20,15 @@ module Pod
describe ExternalSources::AbstractExternalSource do describe ExternalSources::AbstractExternalSource do
before do
dependency = Dependency.new("Reachability", :git => fixture('integration/Reachability'))
@external_source = ExternalSources.from_dependency(dependency)
end
#--------------------------------------#
describe "In general" do
it "compares to another" do it "compares to another" do
dependency_1 = Dependency.new("Reachability", :git => 'url') dependency_1 = Dependency.new("Reachability", :git => 'url')
dependency_2 = Dependency.new("Another_name", :git => 'url') dependency_2 = Dependency.new("Another_name", :git => 'url')
...@@ -30,27 +39,22 @@ module Pod ...@@ -30,27 +39,22 @@ module Pod
dependency_1.should.not.be == dependency_3 dependency_1.should.not.be == dependency_3
end end
before do
dependency = Dependency.new("Reachability", :git => fixture('integration/Reachability'))
@external_source = ExternalSources.from_dependency(dependency)
end
it "returns the specification from the sandbox if available" do it "returns the specification from the sandbox if available" do
@external_source.specification_from_external(config.sandbox) config.sandbox.store_podspec('Reachability', fixture('integration/Reachability/Reachability.podspec'))
@external_source.expects(:specification_from_external).never @external_source.expects(:specification_from_external).never
@external_source.specification(config.sandbox).name.should == 'Reachability' @external_source.specification(config.sandbox).name.should == 'Reachability'
end end
it "returns the specification from the remote if needed" do it "fetches the remote if needed to return the specification" do
@external_source.specification(config.sandbox).name.should == 'Reachability' @external_source.specification(config.sandbox).name.should == 'Reachability'
end end
it "returns the specification from the sandbox if available" do it "returns the specification as stored in the sandbox if available" do
@external_source.specification_from_external(config.sandbox) @external_source.specification_from_external(config.sandbox)
@external_source.specification_from_local(config.sandbox).name.should == 'Reachability' @external_source.specification_from_local(config.sandbox).name.should == 'Reachability'
end end
it "returns nil if the specification from the sandbox is not available" do it "returns nil if the specification requested from local is not available in the sandbox" do
@external_source.specification_from_local(config.sandbox).should.be.nil @external_source.specification_from_local(config.sandbox).should.be.nil
end end
...@@ -58,19 +62,21 @@ module Pod ...@@ -58,19 +62,21 @@ module Pod
@external_source.specification_from_external(config.sandbox).name.should == 'Reachability' @external_source.specification_from_external(config.sandbox).name.should == 'Reachability'
end end
#--------------------------------------# it "stores the specification in the sandbox after fetching it from the remote" do
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
describe "Subclasses helpers" do path.should.not.exist?
@external_source.specification_from_external(config.sandbox).name.should == 'Reachability'
it "stores the podspec in the sandbox" do
sandbox = config.sandbox
podspec_path = fixture('integration/Reachability/Reachability.podspec')
@external_source.send(:store_podspec, sandbox, podspec_path)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec' path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist? path.should.exist?
end end
it "pre-downloads the Pod and store the relevant information in the sandbox" do end
#--------------------------------------#
describe "Subclasses helpers" do
it "pre-downloads the Pod and stores the relevant information in the sandbox" do
sandbox = config.sandbox sandbox = config.sandbox
@external_source.send(:pre_download, sandbox) @external_source.send(:pre_download, sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec' path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
......
require File.expand_path('../../spec_helper', __FILE__) require File.expand_path('../../spec_helper', __FILE__)
describe Pod::Project do module Pod
describe "In general" do describe Project do
before do before do
@project = Pod::Project.new(config.sandbox.project_path) @project = Project.new(config.sandbox.project_path)
end end
#-------------------------------------------------------------------------#
describe "In general" do
it "creates the support file group on initialization" do it "creates the support file group on initialization" do
@project.support_files_group.name.should == 'Targets Support Files' @project.support_files_group.name.should == 'Targets Support Files'
end end
it "can return the relative path of a given absolute path" do
path = temporary_directory + 'Pods/BananaLib/file'
@project.relativize(path).should == Pathname.new('BananaLib/file')
end
it "can return the relative path of a given absolute path outside its root" do
path = temporary_directory + 'file'
@project.relativize(path).should == Pathname.new('../file')
end
it "can return the relative path of a given absolute path with another root directory" do
path = Pathname('/tmp/Lint')
expected = Pathname.new('../../../tmp/Lint')
@project.instance_variable_set(:@root, Pathname.new('/Users/sandbox'))
@project.relativize(path).should == expected
end
end
#-------------------------------------------------------------------------#
describe "Groups" do
it "returns the `Pods` group" do it "returns the `Pods` group" do
@project.pods.name.should == 'Pods' @project.pods.name.should == 'Pods'
end end
...@@ -38,16 +66,11 @@ describe Pod::Project do ...@@ -38,16 +66,11 @@ describe Pod::Project do
g.children.should.be.empty? g.children.should.be.empty?
end end
it "adds the Podfile configured as a Ruby file" do
@project.add_podfile(config.sandbox.root + '../Podfile')
f = @project['Podfile']
f.name.should == 'Podfile'
f.source_tree.should == 'SOURCE_ROOT'
f.xc_language_specification_identifier.should == 'xcode.lang.ruby'
f.path.should == '../Podfile'
end end
#--------------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe "File references" do
it "adds the file references for the given source files" do it "adds the file references for the given source files" do
source_files = [ config.sandbox.root + "A_POD/some_file.m" ] source_files = [ config.sandbox.root + "A_POD/some_file.m" ]
...@@ -72,6 +95,35 @@ describe Pod::Project do ...@@ -72,6 +95,35 @@ describe Pod::Project do
file_reference = @project.file_reference(file) file_reference = @project.file_reference(file)
file_reference.path.should == "A_POD/some_file.m" file_reference.path.should == "A_POD/some_file.m"
end end
it "adds the Podfile configured as a Ruby file" do
@project.add_podfile(config.sandbox.root + '../Podfile')
f = @project['Podfile']
f.name.should == 'Podfile'
f.source_tree.should == 'SOURCE_ROOT'
f.xc_language_specification_identifier.should == 'xcode.lang.ruby'
f.path.should == '../Podfile'
end
end
#-------------------------------------------------------------------------#
describe "File references" do
it "stores the references by absolute path" do
file = config.sandbox.root + "A_POD/some_file.m"
@project.add_file_references([file], 'BananaLib', @project.pods)
refs_by_absolute_path = @project.send(:refs_by_absolute_path)
refs_by_absolute_path.should == {
file => @project.file_reference(file)
}
end
end
#-------------------------------------------------------------------------#
end end
end end
......
...@@ -7,6 +7,10 @@ module Pod ...@@ -7,6 +7,10 @@ module Pod
@sandbox = Pod::Sandbox.new(temporary_directory + 'Sandbox') @sandbox = Pod::Sandbox.new(temporary_directory + 'Sandbox')
end end
#-------------------------------------------------------------------------#
describe "In general" do
it "automatically creates its root if it doesn't exist" do it "automatically creates its root if it doesn't exist" do
File.directory?(temporary_directory + 'Sandbox').should.be.true File.directory?(temporary_directory + 'Sandbox').should.be.true
end end
...@@ -32,30 +36,12 @@ module Pod ...@@ -32,30 +36,12 @@ module Pod
File.directory?(temporary_directory + 'Sandbox').should.be.false File.directory?(temporary_directory + 'Sandbox').should.be.false
end end
it "can return the relative path of a given absolute path" do
path = temporary_directory + 'Sandbox/file'
@sandbox.relativize(path).should == Pathname.new('file')
end
it "can return the relative path of a given absolute path outside the sandbox root" do
path = temporary_directory + 'file'
@sandbox.relativize(path).should == Pathname.new('../file')
end
it "can return the relative path of a given absolute path with another root directory" do
path = Pathname('/tmp/Lint')
expected = Pathname.new('../../../tmp/Lint')
@sandbox.instance_variable_set(:@root, Pathname.new('/Users/sandbox'))
@sandbox.relativize(path).should == expected
end
it "converts a list of paths to the relative paths respect to the sandbox" do
paths = [temporary_directory + 'Sandbox/file_1', temporary_directory + 'Sandbox/file_2' ]
@sandbox.relativize_paths(paths).should == [Pathname.new('file_1'), Pathname.new('file_2')]
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe "Paths" do
it "returns the path of the manifest" do it "returns the path of the manifest" do
@sandbox.manifest_path.should == temporary_directory + 'Sandbox/Manifest.lock' @sandbox.manifest_path.should == temporary_directory + 'Sandbox/Manifest.lock'
end end
...@@ -68,19 +54,15 @@ module Pod ...@@ -68,19 +54,15 @@ module Pod
@sandbox.library_support_files_dir('Pods').should == temporary_directory + 'Sandbox' @sandbox.library_support_files_dir('Pods').should == temporary_directory + 'Sandbox'
end end
it "returns the directory where to store the specifications" do it "returns the directory where a Pod is stored" do
@sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Local Podspecs' @sandbox.pod_dir('JSONKit').should == temporary_directory + 'Sandbox/JSONKit'
end end
it "returns the path to a spec file in the 'Local Podspecs' dir" do
(@sandbox.root + 'Local Podspecs').mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Local Podspecs')
@sandbox.specification_path('BananaLib').should == @sandbox.root + 'Local Podspecs/BananaLib.podspec'
end end
#-------------------------------------------------------------------------# #-------------------------------------------------------------------------#
describe "Pods storage & source" do describe "Specification store" do
it "loads the stored specification with the given name" do it "loads the stored specification with the given name" do
(@sandbox.root + 'Local Podspecs').mkdir (@sandbox.root + 'Local Podspecs').mkdir
...@@ -88,10 +70,37 @@ module Pod ...@@ -88,10 +70,37 @@ module Pod
@sandbox.specification('BananaLib').name.should == 'BananaLib' @sandbox.specification('BananaLib').name.should == 'BananaLib'
end end
it "returns the directory where a Pod is stored" do it "returns the directory where to store the specifications" do
@sandbox.pod_dir('JSONKit').should == temporary_directory + 'Sandbox/JSONKit' @sandbox.specifications_dir.should == temporary_directory + 'Sandbox/Local Podspecs'
end
it "returns the path to a spec file in the 'Local Podspecs' dir" do
(@sandbox.root + 'Local Podspecs').mkdir
FileUtils.cp(fixture('banana-lib/BananaLib.podspec'), @sandbox.root + 'Local Podspecs')
@sandbox.specification_path('BananaLib').should == @sandbox.root + 'Local Podspecs/BananaLib.podspec'
end
it "stores a podspec with a given path into the sandbox" do
@sandbox.store_podspec('BananaLib', fixture('banana-lib/BananaLib.podspec'))
path = @sandbox.root + 'Local Podspecs/BananaLib.podspec'
path.should.exist
@sandbox.specification_path('BananaLib').should == path
end
it "stores a podspec with the given string into the sandbox" do
podspec_string = fixture('banana-lib/BananaLib.podspec').read
@sandbox.store_podspec('BananaLib', podspec_string)
path = @sandbox.root + 'Local Podspecs/BananaLib.podspec'
path.should.exist
@sandbox.specification_path('BananaLib').should == path
end end
end
#-------------------------------------------------------------------------#
describe "Pods information" do
it "returns the directory where a local Pod is stored" do it "returns the directory where a local Pod is stored" do
@sandbox.store_local_path('BananaLib', Pathname.new('Some Path')) @sandbox.store_local_path('BananaLib', Pathname.new('Some Path'))
@sandbox.pod_dir('BananaLib').should.be == Pathname.new('Some Path') @sandbox.pod_dir('BananaLib').should.be == Pathname.new('Some Path')
...@@ -100,7 +109,12 @@ module Pod ...@@ -100,7 +109,12 @@ module Pod
#--------------------------------------# #--------------------------------------#
it "stores the list of the names of the pre-downloaded pods" do it "stores the list of the names of the pre-downloaded pods" do
@sandbox.predownloaded_pods << 'BananaLib' @sandbox.store_pre_downloaded_pod('BananaLib')
@sandbox.predownloaded_pods.should == ['BananaLib']
end
it "returns the checkout sources of the Pods" do
@sandbox.store_pre_downloaded_pod('BananaLib/Subspec')
@sandbox.predownloaded_pods.should == ['BananaLib'] @sandbox.predownloaded_pods.should == ['BananaLib']
end end
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment