Commit 992ecf20 authored by Eloy Duran's avatar Eloy Duran

Use real Ruby accessor writer and reader methods.

parent 39d16c07
dependency 'AFNetworking' dependency 'AFNetworking'
dependency 'JSONKit'
dependency 'FormatterKit' dependency 'FormatterKit'
...@@ -26,7 +26,7 @@ module Pod ...@@ -26,7 +26,7 @@ module Pod
def run def run
Source.search_by_name(@query.strip, @full_text_search).each do |set| Source.search_by_name(@query.strip, @full_text_search).each do |set|
puts "==> #{set.name} (#{set.versions.reverse.join(", ")})" puts "==> #{set.name} (#{set.versions.reverse.join(", ")})"
puts " #{set.specification.read(:summary).strip}" puts " #{set.specification.summary.strip}"
puts puts
end end
end end
......
...@@ -31,24 +31,23 @@ module Pod ...@@ -31,24 +31,23 @@ module Pod
author = `git config --get user.name`.strip author = `git config --get user.name`.strip
email = `git config --get user.email`.strip email = `git config --get user.email`.strip
spec = <<-SPEC.gsub(/^ /, '') spec = <<-SPEC.gsub(/^ /, '')
Pod::Spec.new do Pod::Spec.new do |s|
name '#{@name}' s.name = '#{@name}'
version '1.0.0' s.version = '1.0.0'
summary 'A short description of #{@name}.' s.summary = 'A short description of #{@name}.'
homepage 'http://example.com/#{@name}' s.homepage = 'http://example.com/#{@name}'
author '#{author}' => '#{email}' s.author = { '#{author}' => '#{email}' }
source :git => 'http://example.com/#{@name}.git', s.source = { :git => 'http://example.com/#{@name}.git', :tag => '1.0.0' }
:tag => '1.0.0'
description 'An optional longer description of #{@name}.' s.description = 'An optional longer description of #{@name}.'
# A list of file patterns. If the pattern is a directory then the path will # A list of file patterns. If the pattern is a directory then the path will
# automatically have '*.{h,m,mm,c,cpp' appended. # automatically have '*.{h,m,mm,c,cpp' appended.
source_files 'Classes', 'Classes/**/*.{h,m}' s.source_files = 'Classes', 'Classes/**/*.{h,m}'
xcconfig 'OTHER_LDFLAGS' => '-framework SomeRequiredFramework' s.xcconfig = { 'OTHER_LDFLAGS' => '-framework SomeRequiredFramework' }
dependency 'SomeLibraryThat#{@name}DependsOn', '>= 1.0.0' s.dependency 'SomeLibraryThat#{@name}DependsOn', '>= 1.0.0'
end end
SPEC SPEC
(Pathname.pwd + "#{@name}.podspec").open('w') { |f| f << spec } (Pathname.pwd + "#{@name}.podspec").open('w') { |f| f << spec }
......
...@@ -20,7 +20,7 @@ module Pod ...@@ -20,7 +20,7 @@ module Pod
source_files = [] source_files = []
build_specification_sets.each do |set| build_specification_sets.each do |set|
spec = set.specification spec = set.specification
spec.read(:source_files).each do |pattern| spec.source_files.each do |pattern|
pattern = spec.pod_destroot + pattern pattern = spec.pod_destroot + pattern
pattern = pattern + '*.{h,m,mm,c,cpp}' if pattern.directory? pattern = pattern + '*.{h,m,mm,c,cpp}' if pattern.directory?
pattern.glob.each do |file| pattern.glob.each do |file|
...@@ -48,7 +48,7 @@ module Pod ...@@ -48,7 +48,7 @@ module Pod
def generate_project def generate_project
source_files.each { |file| xcodeproj.add_source_file(file) } source_files.each { |file| xcodeproj.add_source_file(file) }
build_specification_sets.each do |set| build_specification_sets.each do |set|
xcconfig << set.specification.read(:xcconfig) xcconfig << set.specification.xcconfig
end end
end end
......
...@@ -11,7 +11,7 @@ module Pod ...@@ -11,7 +11,7 @@ module Pod
end end
def find_dependency_sets(specification) def find_dependency_sets(specification)
specification.read(:dependencies).each do |dependency| specification.dependencies.each do |dependency|
set = Source.search(dependency) set = Source.search(dependency)
set.required_by(specification) set.required_by(specification)
unless @sets.include?(set) unless @sets.include?(set)
......
...@@ -48,7 +48,7 @@ module Pod ...@@ -48,7 +48,7 @@ module Pod
pod_sets.map do |set| pod_sets.map do |set|
text = if full_text_search text = if full_text_search
s = set.specification s = set.specification
"#{s.read(:name)} #{s.read(:summary)} #{s.read(:description)}" "#{s.name} #{s.summary} #{s.description}"
else else
set.name set.name
end end
......
...@@ -19,88 +19,81 @@ module Pod ...@@ -19,88 +19,81 @@ module Pod
attr_accessor :defined_in_file attr_accessor :defined_in_file
def initialize(&block) def initialize
@dependencies = [] @dependencies = []
@xcconfig = Xcode::Config.new @xcconfig = Xcode::Config.new
instance_eval(&block) if block_given? yield self if block_given?
end end
# Attributes # Attributes
def read(name) attr_accessor :name
instance_variable_get("@#{name}") attr_accessor :homepage
end attr_accessor :description
attr_accessor :source
def name(name)
@name = name
end
def version(version) attr_reader :version
def version=(version)
@version = Version.new(version) @version = Version.new(version)
end end
def authors(*names_and_email_addresses) def authors=(*names_and_email_addresses)
list = names_and_email_addresses list = names_and_email_addresses.flatten
unless list.first.is_a?(Hash) unless list.first.is_a?(Hash)
authors = list.last.is_a?(Hash) ? list.pop : {} authors = list.last.is_a?(Hash) ? list.pop : {}
list.each { |name| authors[name] = nil } list.each { |name| authors[name] = nil }
end end
@authors = authors || list.first @authors = authors || list.first
end end
alias_method :author, :authors alias_method :author=, :authors=
attr_reader :authors
def homepage(url)
@homepage = url
end
def summary(summary) def summary=(summary)
@summary = summary @summary = summary
@description ||= summary @description ||= summary
end end
attr_reader :summary
def description(description) def part_of=(*name_and_version_requirements)
@description = description self.part_of_dependency = *name_and_version_requirements
end
def part_of(name, *version_requirements)
part_of_dependency(name, *version_requirements)
@part_of.only_part_of_other_pod = true @part_of.only_part_of_other_pod = true
end end
attr_reader :part_of
def part_of_dependency(name, *version_requirements) def part_of_dependency=(*name_and_version_requirements)
@part_of = dependency(name, *version_requirements) @part_of = dependency(*name_and_version_requirements)
end
def source_files(*patterns)
@source_files = patterns.map { |p| Pathname.new(p) }
end end
def source(remote) def source_files=(*patterns)
@source = remote @source_files = patterns.flatten.map { |p| Pathname.new(p) }
end end
attr_reader :source_files
attr_reader :dependencies def dependency(*name_and_version_requirements)
def dependency(name, *version_requirements) name, *version_requirements = name_and_version_requirements.flatten
dep = Dependency.new(name, *version_requirements) dep = Dependency.new(name, *version_requirements)
@dependencies << dep @dependencies << dep
dep dep
end end
attr_reader :dependencies
def xcconfig(hash) def xcconfig=(hash)
@xcconfig.merge!(hash) @xcconfig.merge!(hash)
end end
attr_reader :xcconfig
def frameworks(*frameworks) def frameworks=(*frameworks)
frameworks.unshift('') frameworks.unshift('')
xcconfig 'OTHER_LDFLAGS' => frameworks.join(' -framework ').strip self.xcconfig = { 'OTHER_LDFLAGS' => frameworks.join(' -framework ').strip }
end end
alias_method :framework, :frameworks alias_method :framework=, :frameworks=
def libraries(*libraries) def libraries=(*libraries)
libraries.unshift('') libraries.unshift('')
xcconfig 'OTHER_LDFLAGS' => libraries.join(' -l ').strip self.xcconfig = { 'OTHER_LDFLAGS' => libraries.join(' -l ').strip }
end end
alias_method :library, :libraries alias_method :library=, :libraries=
# Not attributes # Not attributes
...@@ -108,8 +101,8 @@ module Pod ...@@ -108,8 +101,8 @@ module Pod
def ==(other) def ==(other)
self.class === other && self.class === other &&
@name && @name == other.read(:name) && @name && @name == other.name &&
@version && @version == other.read(:version) @version && @version == other.version
end end
def dependency_by_name(name) def dependency_by_name(name)
......
...@@ -44,16 +44,16 @@ describe "Pod::Command" do ...@@ -44,16 +44,16 @@ describe "Pod::Command" do
end end
path = temporary_directory + 'Bananas.podspec' path = temporary_directory + 'Bananas.podspec'
spec = Pod::Specification.from_podspec(path) spec = Pod::Specification.from_podspec(path)
spec.read(:name).should == 'Bananas' spec.name.should == 'Bananas'
spec.read(:version).should == Pod::Version.new('1.0.0') spec.version.should == Pod::Version.new('1.0.0')
spec.read(:summary).should == 'A short description of Bananas.' spec.summary.should == 'A short description of Bananas.'
spec.read(:homepage).should == 'http://example.com/Bananas' spec.homepage.should == 'http://example.com/Bananas'
spec.read(:authors).should == { `git config --get user.name`.strip => `git config --get user.email`.strip } spec.authors.should == { `git config --get user.name`.strip => `git config --get user.email`.strip }
spec.read(:source).should == { :git => 'http://example.com/Bananas.git', :tag => '1.0.0' } spec.source.should == { :git => 'http://example.com/Bananas.git', :tag => '1.0.0' }
spec.read(:description).should == 'An optional longer description of Bananas.' spec.description.should == 'An optional longer description of Bananas.'
spec.read(:source_files).should == [Pathname.new('Classes'), Pathname.new('Classes/**/*.{h,m}')] spec.source_files.should == [Pathname.new('Classes'), Pathname.new('Classes/**/*.{h,m}')]
spec.read(:xcconfig).to_hash.should == { 'OTHER_LDFLAGS' => '-framework SomeRequiredFramework' } spec.xcconfig.to_hash.should == { 'OTHER_LDFLAGS' => '-framework SomeRequiredFramework' }
spec.read(:dependencies).should == [Pod::Dependency.new('SomeLibraryThatBananasDependsOn', '>= 1.0.0')] spec.dependencies.should == [Pod::Dependency.new('SomeLibraryThatBananasDependsOn', '>= 1.0.0')]
end end
before do before do
...@@ -77,7 +77,7 @@ describe "Pod::Command" do ...@@ -77,7 +77,7 @@ describe "Pod::Command" do
"images and stylesheets.\n\n" \ "images and stylesheets.\n\n" \
"==> JSONKit (1.4)\n" \ "==> JSONKit (1.4)\n" \
" A Very High Performance Objective-C JSON Library.\n\n" \ " A Very High Performance Objective-C JSON Library.\n\n" \
"==> SSZipArchive (1.0)\n" \ "==> SSZipArchive (0.1.0)\n" \
" Utility class for unzipping files on iOS and Mac.\n\n" " Utility class for unzipping files on iOS and Mac.\n\n"
], ],
[ [
...@@ -110,7 +110,7 @@ describe "Pod::Command" do ...@@ -110,7 +110,7 @@ describe "Pod::Command" do
"Mac OS X and iPhone\n\n" \ "Mac OS X and iPhone\n\n" \
"==> Reachability (2.0.4)\n" \ "==> Reachability (2.0.4)\n" \
" A wrapper for the SystemConfiguration Reachablity APIs.\n\n" \ " A wrapper for the SystemConfiguration Reachablity APIs.\n\n" \
"==> SSZipArchive (1.0)\n" \ "==> SSZipArchive (0.1.0)\n" \
" Utility class for unzipping files on iOS and Mac.\n\n" " Utility class for unzipping files on iOS and Mac.\n\n"
] ]
].each do |query, result| ].each do |query, result|
......
...@@ -9,9 +9,9 @@ module SpecHelper ...@@ -9,9 +9,9 @@ module SpecHelper
def set.specification def set.specification
spec = super spec = super
unless spec.part_of_other_pod? unless spec.part_of_other_pod?
source = spec.read(:source) source = spec.source
source[:git] = SpecHelper.fixture("integration/#{spec.read(:name)}").to_s source[:git] = SpecHelper.fixture("integration/#{spec.name}").to_s
spec.source(source) spec.source = source
end end
spec spec
end end
...@@ -48,10 +48,10 @@ else ...@@ -48,10 +48,10 @@ else
# TODO add a simple source file which uses the compiled lib to check that it really really works # TODO add a simple source file which uses the compiled lib to check that it really really works
it "should activate required pods and create a working static library xcode project" do it "should activate required pods and create a working static library xcode project" do
spec = Pod::Spec.new do spec = Pod::Spec.new do |s|
dependency 'ASIWebPageRequest', '>= 1.8.1' s.dependency 'ASIWebPageRequest', '>= 1.8.1'
dependency 'JSONKit', '>= 1.0' s.dependency 'JSONKit', '>= 1.0'
dependency 'SSZipArchive', '< 2' s.dependency 'SSZipArchive', '< 2'
end end
installer = SpecHelper::Installer.new(spec) installer = SpecHelper::Installer.new(spec)
...@@ -69,15 +69,16 @@ else ...@@ -69,15 +69,16 @@ else
project_file = (root + 'Pods.xcodeproj/project.pbxproj').to_s project_file = (root + 'Pods.xcodeproj/project.pbxproj').to_s
NSDictionary.dictionaryWithContentsOfFile(project_file).should == installer.xcodeproj.to_hash NSDictionary.dictionaryWithContentsOfFile(project_file).should == installer.xcodeproj.to_hash
puts "\n[!] Compiling static library..." #puts "\n[!] Compiling static library..."
Dir.chdir(config.project_pods_root) do #Dir.chdir(config.project_pods_root) do
system("xcodebuild > /dev/null 2>&1").should == true #system("xcodebuild > /dev/null 2>&1").should == true
end #system("xcodebuild").should == true
#end
end end
it "does not activate pods that are only part of other pods" do it "does not activate pods that are only part of other pods" do
spec = Pod::Spec.new do spec = Pod::Spec.new do |s|
dependency 'Reachability' s.dependency 'Reachability'
end end
installer = SpecHelper::Installer.new(spec) installer = SpecHelper::Installer.new(spec)
...@@ -89,16 +90,16 @@ else ...@@ -89,16 +90,16 @@ else
# TODO we need to do more cleaning and/or add a --prune task # TODO we need to do more cleaning and/or add a --prune task
it "overwrites an existing project.pbxproj file" do it "overwrites an existing project.pbxproj file" do
spec = Pod::Spec.new do spec = Pod::Spec.new do |s|
dependency 'JSONKit' s.dependency 'JSONKit'
end end
installer = SpecHelper::Installer.new(spec) installer = SpecHelper::Installer.new(spec)
installer.install! installer.install!
Pod::Source.reset! Pod::Source.reset!
Pod::Spec::Set.reset! Pod::Spec::Set.reset!
spec = Pod::Spec.new do spec = Pod::Spec.new do |s|
dependency 'SSZipArchive' s.dependency 'SSZipArchive'
end end
installer = SpecHelper::Installer.new(spec) installer = SpecHelper::Installer.new(spec)
installer.install! installer.install!
......
...@@ -22,7 +22,7 @@ describe "Pod::Installer" do ...@@ -22,7 +22,7 @@ describe "Pod::Installer" do
"USER_HEADER_SEARCH_PATHS" => "$(BUILT_PRODUCTS_DIR)/Pods", "USER_HEADER_SEARCH_PATHS" => "$(BUILT_PRODUCTS_DIR)/Pods",
"ALWAYS_SEARCH_USER_PATHS" => "YES", "ALWAYS_SEARCH_USER_PATHS" => "YES",
"OTHER_LDFLAGS" => "-framework SystemConfiguration -framework CFNetwork " \ "OTHER_LDFLAGS" => "-framework SystemConfiguration -framework CFNetwork " \
"-framework MobileCoreServices -l z.1.2.3" "-framework MobileCoreServices -l z.1"
} }
], ],
[ [
...@@ -43,13 +43,13 @@ describe "Pod::Installer" do ...@@ -43,13 +43,13 @@ describe "Pod::Installer" do
"ALWAYS_SEARCH_USER_PATHS" => "YES", "ALWAYS_SEARCH_USER_PATHS" => "YES",
"HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2", "HEADER_SEARCH_PATHS" => "$(SDKROOT)/usr/include/libxml2",
"OTHER_LDFLAGS" => "-l xml2.2.7.3 -framework SystemConfiguration " \ "OTHER_LDFLAGS" => "-l xml2.2.7.3 -framework SystemConfiguration " \
"-framework CFNetwork -framework MobileCoreServices -l z.1.2.3" "-framework CFNetwork -framework MobileCoreServices -l z.1"
} }
], ],
].each do |name, patterns, expected_pattern, xcconfig| ].each do |name, patterns, expected_pattern, xcconfig|
Pod::Source.reset! Pod::Source.reset!
Pod::Spec::Set.reset! Pod::Spec::Set.reset!
installer = Pod::Installer.new(Pod::Spec.new { dependency(name); source_files(*patterns) }) installer = Pod::Installer.new(Pod::Spec.new { |s| s.dependency(name); s.source_files = *patterns })
expected = (stubbed_destroot(installer) + expected_pattern).glob.map do |file| expected = (stubbed_destroot(installer) + expected_pattern).glob.map do |file|
file.relative_path_from(config.project_pods_root) file.relative_path_from(config.project_pods_root)
end end
......
...@@ -15,7 +15,7 @@ describe "Pod::Resolver" do ...@@ -15,7 +15,7 @@ describe "Pod::Resolver" do
sets << Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/Reachability')) sets << Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/Reachability'))
sets << Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/ASIHTTPRequest')) sets << Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/ASIHTTPRequest'))
sets << Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/ASIWebPageRequest')) sets << Pod::Spec::Set.by_pod_dir(fixture('spec-repos/master/ASIWebPageRequest'))
resolver = Pod::Resolver.new(Pod::Spec.new { dependency 'ASIWebPageRequest' }) resolver = Pod::Resolver.new(Pod::Spec.new { |s| s.dependency 'ASIWebPageRequest' })
resolver.resolve.sort_by(&:name).should == sets.sort_by(&:name) resolver.resolve.sort_by(&:name).should == sets.sort_by(&:name)
end end
end end
......
...@@ -34,23 +34,23 @@ describe "Pod::Specification::Set" do ...@@ -34,23 +34,23 @@ describe "Pod::Specification::Set" do
end end
it "checks if the dependency of the specification is compatible with existing requirements" do it "checks if the dependency of the specification is compatible with existing requirements" do
@set.required_by(Pod::Spec.new { dependency 'ASIHTTPRequest', '1.8' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '1.8' })
@set.required_by(Pod::Spec.new { dependency 'ASIHTTPRequest', '< 1.8.1' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '< 1.8.1' })
@set.required_by(Pod::Spec.new { dependency 'ASIHTTPRequest', '> 1.7.9' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '> 1.7.9' })
@set.required_by(Pod::Spec.new { dependency 'ASIHTTPRequest', '~> 1.8.0' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '~> 1.8.0' })
@set.required_by(Pod::Spec.new { dependency 'ASIHTTPRequest' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest' })
lambda { lambda {
@set.required_by(Pod::Spec.new { dependency 'ASIHTTPRequest', '< 1.8' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '< 1.8' })
}.should.raise Pod::Informative }.should.raise Pod::Informative
end end
it "raises if the required version doesn't exist" do it "raises if the required version doesn't exist" do
@set.required_by(Pod::Spec.new { dependency 'ASIHTTPRequest', '< 1.8' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '< 1.8' })
lambda { @set.required_version }.should.raise Pod::Informative lambda { @set.required_version }.should.raise Pod::Informative
end end
before do before do
@set.required_by(Pod::Spec.new { dependency 'ASIHTTPRequest', '< 1.8.1' }) @set.required_by(Pod::Spec.new { |s| s.dependency 'ASIHTTPRequest', '< 1.8.1' })
end end
it "returns the version required for the dependency" do it "returns the version required for the dependency" do
...@@ -62,18 +62,18 @@ describe "Pod::Specification::Set" do ...@@ -62,18 +62,18 @@ describe "Pod::Specification::Set" do
end end
it "returns the specification for the required version" do it "returns the specification for the required version" do
@set.specification.should == Pod::Spec.new { name 'ASIHTTPRequest'; version '1.8' } @set.specification.should == Pod::Spec.new { |s| s.name = 'ASIHTTPRequest'; s.version = '1.8' }
end end
it "returns that this set is not only part for other pods" do it "returns that this set is not only part for other pods" do
@set.required_by(Pod::Spec.new { part_of 'ASIHTTPRequest' }) @set.required_by(Pod::Spec.new { |s| s.part_of = 'ASIHTTPRequest' })
@set.should.not.be.only_part_of_other_pod @set.should.not.be.only_part_of_other_pod
end end
it "returns that this set is only part for other pods" do it "returns that this set is only part for other pods" do
@set.reset! @set.reset!
@set.required_by(Pod::Spec.new { part_of 'ASIHTTPRequest' }) @set.required_by(Pod::Spec.new { |s| s.part_of = 'ASIHTTPRequest' })
@set.required_by(Pod::Spec.new { part_of 'ASIHTTPRequest' }) @set.required_by(Pod::Spec.new { |s| s.part_of = 'ASIHTTPRequest' })
@set.should.be.only_part_of_other_pod @set.should.be.only_part_of_other_pod
end end
end end
...@@ -45,41 +45,41 @@ describe "A Pod::Specification loaded from a podspec" do ...@@ -45,41 +45,41 @@ describe "A Pod::Specification loaded from a podspec" do
end end
it "returns the pod's name" do it "returns the pod's name" do
@spec.read(:name).should == 'BananaLib' @spec.name.should == 'BananaLib'
end end
it "returns the pod's version" do it "returns the pod's version" do
@spec.read(:version).should == Pod::Version.new('1.0') @spec.version.should == Pod::Version.new('1.0')
end end
it "returns a list of authors and their email addresses" do it "returns a list of authors and their email addresses" do
@spec.read(:authors).should == { @spec.authors.should == {
'Banana Corp' => nil, 'Banana Corp' => nil,
'Monkey Boy' => 'monkey@banana-corp.local' 'Monkey Boy' => 'monkey@banana-corp.local'
} }
end end
it "returns the pod's homepage" do it "returns the pod's homepage" do
@spec.read(:homepage).should == 'http://banana-corp.local/banana-lib.html' @spec.homepage.should == 'http://banana-corp.local/banana-lib.html'
end end
it "returns the pod's summary" do it "returns the pod's summary" do
@spec.read(:summary).should == 'Chunky bananas!' @spec.summary.should == 'Chunky bananas!'
end end
it "returns the pod's description" do it "returns the pod's description" do
@spec.read(:description).should == 'Full of chunky bananas.' @spec.description.should == 'Full of chunky bananas.'
end end
it "returns the pod's source" do it "returns the pod's source" do
@spec.read(:source).should == { @spec.source.should == {
:git => 'http://banana-corp.local/banana-lib.git', :git => 'http://banana-corp.local/banana-lib.git',
:tag => 'v1.0' :tag => 'v1.0'
} }
end end
it "returns the pod's source files" do it "returns the pod's source files" do
@spec.read(:source_files).should == [ @spec.source_files.should == [
Pathname.new('Classes/*.{h,m}'), Pathname.new('Classes/*.{h,m}'),
Pathname.new('Vendor') Pathname.new('Vendor')
] ]
...@@ -87,19 +87,19 @@ describe "A Pod::Specification loaded from a podspec" do ...@@ -87,19 +87,19 @@ describe "A Pod::Specification loaded from a podspec" do
it "returns the pod's dependencies" do it "returns the pod's dependencies" do
expected = Pod::Dependency.new('monkey', '~> 1.0.1', '< 1.0.9') expected = Pod::Dependency.new('monkey', '~> 1.0.1', '< 1.0.9')
@spec.read(:dependencies).should == [expected] @spec.dependencies.should == [expected]
@spec.dependency_by_name('monkey').should == expected @spec.dependency_by_name('monkey').should == expected
end end
it "returns the pod's xcconfig settings" do it "returns the pod's xcconfig settings" do
@spec.read(:xcconfig).to_hash.should == { @spec.xcconfig.to_hash.should == {
'OTHER_LDFLAGS' => '-framework SystemConfiguration' 'OTHER_LDFLAGS' => '-framework SystemConfiguration'
} }
end end
it "has a shortcut to add frameworks to the xcconfig" do it "has a shortcut to add frameworks to the xcconfig" do
@spec.frameworks('CFNetwork', 'CoreText') @spec.frameworks = 'CFNetwork', 'CoreText'
@spec.read(:xcconfig).to_hash.should == { @spec.xcconfig.to_hash.should == {
'OTHER_LDFLAGS' => '-framework SystemConfiguration ' \ 'OTHER_LDFLAGS' => '-framework SystemConfiguration ' \
'-framework CFNetwork ' \ '-framework CFNetwork ' \
'-framework CoreText' '-framework CoreText'
...@@ -107,16 +107,16 @@ describe "A Pod::Specification loaded from a podspec" do ...@@ -107,16 +107,16 @@ describe "A Pod::Specification loaded from a podspec" do
end end
it "has a shortcut to add libraries to the xcconfig" do it "has a shortcut to add libraries to the xcconfig" do
@spec.libraries('z', 'xml2') @spec.libraries = 'z', 'xml2'
@spec.read(:xcconfig).to_hash.should == { @spec.xcconfig.to_hash.should == {
'OTHER_LDFLAGS' => '-framework SystemConfiguration -l z -l xml2' 'OTHER_LDFLAGS' => '-framework SystemConfiguration -l z -l xml2'
} }
end end
it "returns that it's equal to another specification if the name and version are equal" do it "returns that it's equal to another specification if the name and version are equal" do
@spec.should == Pod::Spec.new { name 'BananaLib'; version '1.0' } @spec.should == Pod::Spec.new { |s| s.name = 'BananaLib'; s.version = '1.0' }
@spec.should.not == Pod::Spec.new { name 'OrangeLib'; version '1.0' } @spec.should.not == Pod::Spec.new { |s| s.name = 'OrangeLib'; s.version = '1.0' }
@spec.should.not == Pod::Spec.new { name 'BananaLib'; version '1.1' } @spec.should.not == Pod::Spec.new { |s| s.name = 'BananaLib'; s.version = '1.1' }
@spec.should.not == Pod::Spec.new @spec.should.not == Pod::Spec.new
end end
...@@ -131,18 +131,18 @@ describe "A Pod::Specification that's part of another pod's source" do ...@@ -131,18 +131,18 @@ describe "A Pod::Specification that's part of another pod's source" do
end end
it "adds a dependency on the other pod's source, but not the library" do it "adds a dependency on the other pod's source, but not the library" do
@spec.part_of 'monkey', '>= 1' @spec.part_of = 'monkey', '>= 1'
@spec.should.be.part_of_other_pod @spec.should.be.part_of_other_pod
dep = Pod::Dependency.new('monkey', '>= 1') dep = Pod::Dependency.new('monkey', '>= 1')
@spec.read(:dependencies).should.not == [dep] @spec.dependencies.should.not == [dep]
dep.only_part_of_other_pod = true dep.only_part_of_other_pod = true
@spec.read(:dependencies).should == [dep] @spec.dependencies.should == [dep]
end end
it "adds a dependency on the other pod's source *and* the library" do it "adds a dependency on the other pod's source *and* the library" do
@spec.part_of_dependency 'monkey', '>= 1' @spec.part_of_dependency = 'monkey', '>= 1'
@spec.should.be.part_of_other_pod @spec.should.be.part_of_other_pod
@spec.read(:dependencies).should == [Pod::Dependency.new('monkey', '>= 1')] @spec.dependencies.should == [Pod::Dependency.new('monkey', '>= 1')]
end end
# TODO # TODO
......
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