Commit 21cede47 authored by Fabio Pelosin's avatar Fabio Pelosin

[ExternalSources] One file per class

parent 57a3cae6
require 'cocoapods/external_sources/abstract_external_source'
require 'cocoapods/external_sources/downloader_source'
require 'cocoapods/external_sources/path_source'
require 'cocoapods/external_sources/podspec_source'
module Pod module Pod
# Provides support for initializing the correct concrete class of an external # Provides support for initializing the correct concrete class of an external
...@@ -36,278 +41,5 @@ module Pod ...@@ -36,278 +41,5 @@ module Pod
DownloaderSource DownloaderSource
end end
end end
#-------------------------------------------------------------------------#
# Abstract class that defines the common behaviour of external sources.
#
class AbstractExternalSource
# @return [String] the name of the Pod described by this external source.
#
attr_reader :name
# @return [Hash{Symbol => String}] the hash representation of the
# external source.
#
attr_reader :params
# @return [String] the path where the podfile is defined to resolve
# relative paths.
#
attr_reader :podfile_path
# @param [String] name @see name
# @param [Hash] params @see params
# @param [String] podfile_path @see podfile_path
#
def initialize(name, params, podfile_path)
@name = name
@params = params
@podfile_path = podfile_path
end
# @return [Bool] whether an external source source is equal to another
# according to the {#name} and to the {#params}.
#
def ==(other)
return false if other.nil?
name == other.name && params == other.params
end
#--------------------------------------#
public
# @!group Subclasses hooks
# Fetches the external source from the remote according to the params.
#
# @param [Sandbox] sandbox
# the sandbox where the specification should be stored.
#
# @return [void]
#
def fetch(sandbox)
raise "Abstract method"
end
# @return [String] a string representation of the source suitable for UI.
#
def description
raise "Abstract method"
end
#--------------------------------------#
protected
# @return [String] The uri of the podspec appending the name of the file
# and expanding it if necessary.
#
# @note If the declared path is expanded only if the represents a path
# relative to the file system.
#
def normalized_podspec_path(declared_path)
if File.extname(declared_path) == '.podspec'
path_with_ext = declared_path
else
path_with_ext = "#{declared_path}/#{name}.podspec"
end
podfile_dir = File.dirname(podfile_path || '')
File.expand_path(path_with_ext, podfile_dir)
end
#--------------------------------------#
private
# @! Subclasses helpers
# Pre-downloads a Pod passing the options to the downloader and informing
# the sandbox.
#
# @param [Sandbox] sandbox
# The sandbox where the Pod should be downloaded.
#
# @note To prevent a double download of the repository the pod is
# marked as pre-downloaded indicating to the installer that only
# clean operations are needed.
#
# @todo The downloader configuration is the same of the
# #{PodSourceInstaller} and it needs to be kept in sync.
#
# @return [void]
#
def pre_download(sandbox)
title = "Pre-downloading: `#{name}` #{description}"
UI.titled_section(title, { :verbose_prefix => "-> " }) do
target = sandbox.root + name
target.rmtree if target.exist?
downloader = Config.instance.downloader(target, params)
downloader.download
store_podspec(sandbox, target + "#{name}.podspec")
sandbox.store_pre_downloaded_pod(name)
if downloader.options_specific?
source = params
else
source = downloader.checkout_options
end
sandbox.store_checkout_source(name, source)
end
end
# Stores the podspec in the sandbox and marks it as from an external
# source.
#
# @param [Sandbox] sandbox
# The sandbox where the specification should be stored.
#
# @param [Pathname, String] spec
# The path of the specification or its contents.
#
# @note All the concrete implementations of #{fetch} should invoke this
# method.
#
# @note The sandbox ensures that the podspec exists and that the names
# match.
#
# @return [void]
#
def store_podspec(sandbox, spec)
sandbox.store_podspec(name, spec, true)
end
end
#-------------------------------------------------------------------------#
# Provides support for fetching a specification file from a source handled
# by the downloader. Supports all the options of the downloader
#
# @note The podspec must be in the root of the repository and should have a
# name matching the one of the dependency.
#
class DownloaderSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
pre_download(sandbox)
end
# @see AbstractExternalSource#description
#
def description
strategy = Downloader.strategy_from_options(params)
options = params.dup
url = options.delete(strategy)
result = "from `#{url}`"
options.each do |key, value|
result << ", #{key} `#{value}`"
end
result
end
end
#-------------------------------------------------------------------------#
# Provides support for fetching a specification file from an URL. Can be
# http, file, etc.
#
class PodspecSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
title = "Fetching podspec for `#{name}` #{description}"
UI.titled_section(title, { :verbose_prefix => "-> " }) do
require 'open-uri'
open(podspec_uri) { |io| store_podspec(sandbox, io.read) }
end
end
# @see AbstractExternalSource#description
#
def description
"from `#{params[:podspec]}`"
end
private
# @!group Helpers
# @return [String] The uri of the podspec appending the name of the file
# and expanding it if necessary.
#
# @note If the declared path is expanded only if the represents a path
# relative to the file system.
#
def podspec_uri
declared_path = params[:podspec].to_s
if declared_path.match(%r{^.+://})
declared_path
else
normalized_podspec_path(declared_path)
end
end
end
#-------------------------------------------------------------------------#
# Provides support for fetching a specification file from a path local to
# the machine running the installation.
#
# Works with the {LocalPod::LocalSourcedPod} class.
#
class PathSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
title = "Fetching podspec for `#{name}` #{description}"
UI.titled_section(title, { :verbose_prefix => "-> " }) do
podspec = podspec_path
unless podspec.exist?
raise Informative, "No podspec found for `#{name}` in " \
"`#{declared_path}`"
end
store_podspec(sandbox, podspec)
is_absolute = absolute?(podspec)
sandbox.store_local_path(name, podspec.dirname, is_absolute)
end
end
# @see AbstractExternalSource#description
#
def description
"from `#{params[:path] || params[:local]}`"
end
private
# @!group Helpers
# @return [String] The path as declared by the user.
#
def declared_path
result = params[:path] || params[:local]
result.to_s if result
end
# @return [Pathname] The absolute path of the podspec.
#
def podspec_path
Pathname(normalized_podspec_path(declared_path))
end
# @return [Bool]
#
def absolute?(path)
Pathname(path).absolute? || path.to_s.start_with?('~')
end
end
#-------------------------------------------------------------------------#
end end
end end
module Pod
module ExternalSources
# Abstract class that defines the common behaviour of external sources.
#
class AbstractExternalSource
# @return [String] the name of the Pod described by this external source.
#
attr_reader :name
# @return [Hash{Symbol => String}] the hash representation of the
# external source.
#
attr_reader :params
# @return [String] the path where the podfile is defined to resolve
# relative paths.
#
attr_reader :podfile_path
# @param [String] name @see name
# @param [Hash] params @see params
# @param [String] podfile_path @see podfile_path
#
def initialize(name, params, podfile_path)
@name = name
@params = params
@podfile_path = podfile_path
end
# @return [Bool] whether an external source source is equal to another
# according to the {#name} and to the {#params}.
#
def ==(other)
return false if other.nil?
name == other.name && params == other.params
end
public
# @!group Subclasses hooks
# Fetches the external source from the remote according to the params.
#
# @param [Sandbox] sandbox
# the sandbox where the specification should be stored.
#
# @return [void]
#
def fetch(sandbox)
raise "Abstract method"
end
# @return [String] a string representation of the source suitable for UI.
#
def description
raise "Abstract method"
end
protected
# @return [String] The uri of the podspec appending the name of the file
# and expanding it if necessary.
#
# @note If the declared path is expanded only if the represents a path
# relative to the file system.
#
def normalized_podspec_path(declared_path)
if File.extname(declared_path) == '.podspec'
path_with_ext = declared_path
else
path_with_ext = "#{declared_path}/#{name}.podspec"
end
podfile_dir = File.dirname(podfile_path || '')
File.expand_path(path_with_ext, podfile_dir)
end
private
# @! Subclasses helpers
# Pre-downloads a Pod passing the options to the downloader and informing
# the sandbox.
#
# @param [Sandbox] sandbox
# The sandbox where the Pod should be downloaded.
#
# @note To prevent a double download of the repository the pod is
# marked as pre-downloaded indicating to the installer that only
# clean operations are needed.
#
# @todo The downloader configuration is the same of the
# #{PodSourceInstaller} and it needs to be kept in sync.
#
# @return [void]
#
def pre_download(sandbox)
title = "Pre-downloading: `#{name}` #{description}"
UI.titled_section(title, { :verbose_prefix => "-> " }) do
target = sandbox.root + name
target.rmtree if target.exist?
downloader = Config.instance.downloader(target, params)
downloader.download
store_podspec(sandbox, target + "#{name}.podspec")
sandbox.store_pre_downloaded_pod(name)
if downloader.options_specific?
source = params
else
source = downloader.checkout_options
end
sandbox.store_checkout_source(name, source)
end
end
# Stores the podspec in the sandbox and marks it as from an external
# source.
#
# @param [Sandbox] sandbox
# The sandbox where the specification should be stored.
#
# @param [Pathname, String] spec
# The path of the specification or its contents.
#
# @note All the concrete implementations of #{fetch} should invoke this
# method.
#
# @note The sandbox ensures that the podspec exists and that the names
# match.
#
# @return [void]
#
def store_podspec(sandbox, spec)
sandbox.store_podspec(name, spec, true)
end
end
end
end
module Pod
module ExternalSources
# Provides support for fetching a specification file from a source handled
# by the downloader. Supports all the options of the downloader
#
# @note The podspec must be in the root of the repository and should have a
# name matching the one of the dependency.
#
class DownloaderSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
pre_download(sandbox)
end
# @see AbstractExternalSource#description
#
def description
strategy = Downloader.strategy_from_options(params)
options = params.dup
url = options.delete(strategy)
result = "from `#{url}`"
options.each do |key, value|
result << ", #{key} `#{value}`"
end
result
end
end
end
end
module Pod
module ExternalSources
# Provides support for fetching a specification file from a path local to
# the machine running the installation.
#
# Works with the {LocalPod::LocalSourcedPod} class.
#
class PathSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
title = "Fetching podspec for `#{name}` #{description}"
UI.titled_section(title, { :verbose_prefix => "-> " }) do
podspec = podspec_path
unless podspec.exist?
raise Informative, "No podspec found for `#{name}` in " \
"`#{declared_path}`"
end
store_podspec(sandbox, podspec)
is_absolute = absolute?(podspec)
sandbox.store_local_path(name, podspec.dirname, is_absolute)
end
end
# @see AbstractExternalSource#description
#
def description
"from `#{params[:path] || params[:local]}`"
end
private
# @!group Helpers
# @return [String] The path as declared by the user.
#
def declared_path
result = params[:path] || params[:local]
result.to_s if result
end
# @return [Pathname] The absolute path of the podspec.
#
def podspec_path
Pathname(normalized_podspec_path(declared_path))
end
# @return [Bool]
#
def absolute?(path)
Pathname(path).absolute? || path.to_s.start_with?('~')
end
end
end
end
module Pod
module ExternalSources
# Provides support for fetching a specification file from an URL. Can be
# http, file, etc.
#
class PodspecSource < AbstractExternalSource
# @see AbstractExternalSource#fetch
#
def fetch(sandbox)
title = "Fetching podspec for `#{name}` #{description}"
UI.titled_section(title, { :verbose_prefix => "-> " }) do
require 'open-uri'
open(podspec_uri) { |io| store_podspec(sandbox, io.read) }
end
end
# @see AbstractExternalSource#description
#
def description
"from `#{params[:podspec]}`"
end
private
# @!group Helpers
# @return [String] The uri of the podspec appending the name of the file
# and expanding it if necessary.
#
# @note If the declared path is expanded only if the represents a path
# relative to the file system.
#
def podspec_uri
declared_path = params[:podspec].to_s
if declared_path.match(%r{^.+://})
declared_path
else
normalized_podspec_path(declared_path)
end
end
end
end
end
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe ExternalSources::AbstractExternalSource do
before do
dependency = Dependency.new("Reachability", :git => fixture('integration/Reachability'))
@subject = ExternalSources.from_dependency(dependency, nil)
end
#--------------------------------------#
describe "In general" do
it "compares to another" do
dependency_1 = Dependency.new("Reachability", :git => 'url')
dependency_2 = Dependency.new("Another_name", :git => 'url')
dependency_3 = Dependency.new("Reachability", :git => 'another_url')
dependency_1.should.be == dependency_1
dependency_1.should.not.be == dependency_2
dependency_1.should.not.be == dependency_3
end
it "fetches the specification from the remote stores it in the sandbox" do
config.sandbox.specification('Reachability').should == nil
@subject.fetch(config.sandbox)
config.sandbox.specification('Reachability').name.should == 'Reachability'
end
end
#--------------------------------------#
describe "Subclasses helpers" do
it "pre-downloads the Pod and stores the relevant information in the sandbox" do
sandbox = config.sandbox
@subject.send(:pre_download, sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
sandbox.predownloaded_pods.should == ["Reachability"]
sandbox.checkout_sources.should == {
"Reachability" => {
:git => fixture('integration/Reachability'),
:commit => "4ec575e4b074dcc87c44018cce656672a979b34a"
}
}
end
end
end
end
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe ExternalSources::DownloaderSource do
before do
params = {
:git => fixture('integration/Reachability'),
:branch => 'master'
}
dep = Dependency.new("Reachability", params)
@subject = ExternalSources.from_dependency(dep, nil)
end
it "creates a copy of the podspec" do
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
it "marks the Pod as pre-downloaded" do
@subject.fetch(config.sandbox)
config.sandbox.predownloaded_pods.should == ["Reachability"]
end
it "returns the description" do
expected = /from `.*Reachability`, branch `master`/
@subject.description.should.match(expected)
end
end
end
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe ExternalSources::PathSource do
before do
params = { :path => fixture('integration/Reachability') }
dependency = Dependency.new("Reachability", params)
podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path)
end
it "creates a copy of the podspec" do
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
it "supports the deprecated local key" do
params = { :local => fixture('integration/Reachability') }
dependency = Dependency.new("Reachability", params)
podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path)
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
it "returns the description" do
@subject.description.should.match %r|from `.*integration/Reachability`|
end
it "marks the Pod as local in the sandbox" do
@subject.fetch(config.sandbox)
config.sandbox.development_pods.should == {
"Reachability" => fixture('integration/Reachability').to_s
}
end
it "raises if the podspec cannot be found" do
@subject.stubs(:params).returns(:path => temporary_directory)
should.raise Informative do
@subject.fetch(config.sandbox)
end.message.should.match /No podspec found for `Reachability` in `#{temporary_directory}`/
end
describe "Helpers" do
it "handles absolute paths" do
@subject.stubs(:params).returns(:path => fixture('integration/Reachability'))
path = @subject.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec')
end
it "handles paths when there is no podfile path" do
@subject.stubs(:podfile_path).returns(nil)
@subject.stubs(:params).returns(:path => fixture('integration/Reachability'))
path = @subject.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec')
end
it "handles relative paths" do
@subject.stubs(:params).returns(:path => 'Reachability')
path = @subject.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec')
end
it "expands the tilde" do
File.stubs(:exist?).returns(true)
@subject.stubs(:params).returns(:path => '~/Reachability')
Pathname.any_instance.stubs(:exist?).returns(true)
path = @subject.send(:podspec_path)
path.should == Pathname(ENV['HOME']) + 'Reachability/Reachability.podspec'
end
end
end
end
require File.expand_path('../../../spec_helper', __FILE__)
module Pod
describe ExternalSources::PodspecSource do
before do
podspec_path = fixture('integration/Reachability/Reachability.podspec')
dependency = Dependency.new("Reachability", :podspec => podspec_path.to_s)
podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path)
end
it "creates a copy of the podspec" do
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
it "returns the description" do
@subject.description.should.match %r|from `.*Reachability/Reachability.podspec`|
end
describe "Helpers" do
it "handles absolute paths" do
@subject.stubs(:params).returns(:podspec => fixture('integration/Reachability'))
path = @subject.send(:podspec_uri)
path.should == fixture('integration/Reachability/Reachability.podspec').to_s
end
it "handles paths when there is no podfile path" do
@subject.stubs(:podfile_path).returns(nil)
@subject.stubs(:params).returns(:podspec => fixture('integration/Reachability'))
path = @subject.send(:podspec_uri)
path.should == fixture('integration/Reachability/Reachability.podspec').to_s
end
it "handles relative paths" do
@subject.stubs(:params).returns(:podspec => 'Reachability')
path = @subject.send(:podspec_uri)
path.should == fixture('integration/Reachability/Reachability.podspec').to_s
end
it "expands the tilde" do
File.stubs(:exist?).returns(true)
@subject.stubs(:params).returns(:podspec => '~/Reachability')
path = @subject.send(:podspec_uri)
path.should == ENV['HOME'] + '/Reachability/Reachability.podspec'
end
it "handles URLs" do
@subject.stubs(:params).returns(:podspec => "http://www.example.com/Reachability.podspec")
path = @subject.send(:podspec_uri)
path.should == "http://www.example.com/Reachability.podspec"
end
end
end
end
...@@ -34,224 +34,4 @@ module Pod ...@@ -34,224 +34,4 @@ module Pod
end end
end end
end end
#---------------------------------------------------------------------------#
describe ExternalSources::AbstractExternalSource do
before do
dependency = Dependency.new("Reachability", :git => fixture('integration/Reachability'))
@subject = ExternalSources.from_dependency(dependency, nil)
end
#--------------------------------------#
describe "In general" do
it "compares to another" do
dependency_1 = Dependency.new("Reachability", :git => 'url')
dependency_2 = Dependency.new("Another_name", :git => 'url')
dependency_3 = Dependency.new("Reachability", :git => 'another_url')
dependency_1.should.be == dependency_1
dependency_1.should.not.be == dependency_2
dependency_1.should.not.be == dependency_3
end
it "fetches the specification from the remote stores it in the sandbox" do
config.sandbox.specification('Reachability').should == nil
@subject.fetch(config.sandbox)
config.sandbox.specification('Reachability').name.should == 'Reachability'
end
end
#--------------------------------------#
describe "Subclasses helpers" do
it "pre-downloads the Pod and stores the relevant information in the sandbox" do
sandbox = config.sandbox
@subject.send(:pre_download, sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
sandbox.predownloaded_pods.should == ["Reachability"]
sandbox.checkout_sources.should == {
"Reachability" => {
:git => fixture('integration/Reachability'),
:commit => "4ec575e4b074dcc87c44018cce656672a979b34a"
}
}
end
end
end
#---------------------------------------------------------------------------#
describe ExternalSources::DownloaderSource do
before do
params = {
:git => fixture('integration/Reachability'),
:branch => 'master'
}
dep = Dependency.new("Reachability", params)
@subject = ExternalSources.from_dependency(dep, nil)
end
it "creates a copy of the podspec" do
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
it "marks the Pod as pre-downloaded" do
@subject.fetch(config.sandbox)
config.sandbox.predownloaded_pods.should == ["Reachability"]
end
it "returns the description" do
expected = /from `.*Reachability`, branch `master`/
@subject.description.should.match(expected)
end
end
#---------------------------------------------------------------------------#
describe ExternalSources::PodspecSource do
before do
podspec_path = fixture('integration/Reachability/Reachability.podspec')
dependency = Dependency.new("Reachability", :podspec => podspec_path.to_s)
podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path)
end
it "creates a copy of the podspec" do
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
it "returns the description" do
@subject.description.should.match %r|from `.*Reachability/Reachability.podspec`|
end
describe "Helpers" do
it "handles absolute paths" do
@subject.stubs(:params).returns(:podspec => fixture('integration/Reachability'))
path = @subject.send(:podspec_uri)
path.should == fixture('integration/Reachability/Reachability.podspec').to_s
end
it "handles paths when there is no podfile path" do
@subject.stubs(:podfile_path).returns(nil)
@subject.stubs(:params).returns(:podspec => fixture('integration/Reachability'))
path = @subject.send(:podspec_uri)
path.should == fixture('integration/Reachability/Reachability.podspec').to_s
end
it "handles relative paths" do
@subject.stubs(:params).returns(:podspec => 'Reachability')
path = @subject.send(:podspec_uri)
path.should == fixture('integration/Reachability/Reachability.podspec').to_s
end
it "expands the tilde" do
File.stubs(:exist?).returns(true)
@subject.stubs(:params).returns(:podspec => '~/Reachability')
path = @subject.send(:podspec_uri)
path.should == ENV['HOME'] + '/Reachability/Reachability.podspec'
end
it "handles URLs" do
@subject.stubs(:params).returns(:podspec => "http://www.example.com/Reachability.podspec")
path = @subject.send(:podspec_uri)
path.should == "http://www.example.com/Reachability.podspec"
end
end
end
#---------------------------------------------------------------------------#
describe ExternalSources::PathSource do
before do
params = { :path => fixture('integration/Reachability') }
dependency = Dependency.new("Reachability", params)
podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path)
end
it "creates a copy of the podspec" do
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
it "supports the deprecated local key" do
params = { :local => fixture('integration/Reachability') }
dependency = Dependency.new("Reachability", params)
podfile_path = fixture('integration/Podfile')
@subject = ExternalSources.from_dependency(dependency, podfile_path)
@subject.fetch(config.sandbox)
path = config.sandbox.root + 'Local Podspecs/Reachability.podspec'
path.should.exist?
end
it "returns the description" do
@subject.description.should.match %r|from `.*integration/Reachability`|
end
it "marks the Pod as local in the sandbox" do
@subject.fetch(config.sandbox)
config.sandbox.development_pods.should == {
"Reachability" => fixture('integration/Reachability').to_s
}
end
it "raises if the podspec cannot be found" do
@subject.stubs(:params).returns(:path => temporary_directory)
should.raise Informative do
@subject.fetch(config.sandbox)
end.message.should.match /No podspec found for `Reachability` in `#{temporary_directory}`/
end
describe "Helpers" do
it "handles absolute paths" do
@subject.stubs(:params).returns(:path => fixture('integration/Reachability'))
path = @subject.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec')
end
it "handles paths when there is no podfile path" do
@subject.stubs(:podfile_path).returns(nil)
@subject.stubs(:params).returns(:path => fixture('integration/Reachability'))
path = @subject.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec')
end
it "handles relative paths" do
@subject.stubs(:params).returns(:path => 'Reachability')
path = @subject.send(:podspec_path)
path.should == fixture('integration/Reachability/Reachability.podspec')
end
it "expands the tilde" do
File.stubs(:exist?).returns(true)
@subject.stubs(:params).returns(:path => '~/Reachability')
Pathname.any_instance.stubs(:exist?).returns(true)
path = @subject.send(:podspec_path)
path.should == Pathname(ENV['HOME']) + 'Reachability/Reachability.podspec'
end
end
end
#---------------------------------------------------------------------------#
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