Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
C
cocoapods
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gengmeiios
cocoapods
Commits
9a715213
Commit
9a715213
authored
Apr 19, 2013
by
Jeremy Slater
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into dedicated-targets
parents
5bd2bf76
c82eb037
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
72 additions
and
21 deletions
+72
-21
.travis.yml
.travis.yml
+4
-1
cocoapods.gemspec
cocoapods.gemspec
+1
-0
external_sources.rb
lib/cocoapods/external_sources.rb
+10
-7
installer.rb
lib/cocoapods/installer.rb
+2
-2
analyzer.rb
lib/cocoapods/installer/analyzer.rb
+1
-1
sandbox.rb
lib/cocoapods/sandbox.rb
+2
-0
validator.rb
lib/cocoapods/validator.rb
+1
-1
spec_helper.rb
spec/spec_helper.rb
+9
-1
external_sources_spec.rb
spec/unit/external_sources_spec.rb
+19
-8
installer_spec.rb
spec/unit/installer_spec.rb
+23
-0
No files found.
.travis.yml
View file @
9a715213
...
@@ -3,7 +3,10 @@ env:
...
@@ -3,7 +3,10 @@ env:
# This is what 10.8.x comes with and we want to support that.
# This is what 10.8.x comes with and we want to support that.
-
RVM_RUBY_VERSION=system NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo gem update --system && sudo gem install bundler --no-ri --no-rdoc' GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com
-
RVM_RUBY_VERSION=system NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo gem update --system && sudo gem install bundler --no-ri --no-rdoc' GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com
-
RVM_RUBY_VERSION=1.9.3 NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2 && curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem' SSL_CERT_FILE=/usr/local/share/cacert.pem GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com
-
RVM_RUBY_VERSION=1.9.3 NOEXEC_DISABLE=1 RUBY_VERSION_SPECIFIC='sudo ln -s /usr/bin/llvm-gcc-4.2 /usr/bin/gcc-4.2 && curl http://curl.haxx.se/ca/cacert.pem -o /usr/local/share/cacert.pem' SSL_CERT_FILE=/usr/local/share/cacert.pem GIT_AUTHOR_NAME=CocoaPods GIT_AUTHOR_EMAIL=cocoapods@example.com
before_install
:
source ~/.rvm/scripts/rvm && rvm use $RVM_RUBY_VERSION
before_install
:
-
source ~/.rvm/scripts/rvm && rvm use $RVM_RUBY_VERSION
-
sudo chown -R $USER /usr/local
-
brew install mercurial
install
:
eval $RUBY_VERSION_SPECIFIC && rake bootstrap[use_bundle_dir]
install
:
eval $RUBY_VERSION_SPECIFIC && rake bootstrap[use_bundle_dir]
script
:
bundle exec rake spec:ci
script
:
bundle exec rake spec:ci
notifications
:
notifications
:
...
...
cocoapods.gemspec
View file @
9a715213
...
@@ -46,5 +46,6 @@ Gem::Specification.new do |s|
...
@@ -46,5 +46,6 @@ Gem::Specification.new do |s|
## Make sure you can build the gem on older versions of RubyGems too:
## Make sure you can build the gem on older versions of RubyGems too:
s
.
rubygems_version
=
"1.6.2"
s
.
rubygems_version
=
"1.6.2"
s
.
required_rubygems_version
=
Gem
::
Requirement
.
new
(
">= 0"
)
if
s
.
respond_to?
:required_rubygems_version
=
s
.
required_rubygems_version
=
Gem
::
Requirement
.
new
(
">= 0"
)
if
s
.
respond_to?
:required_rubygems_version
=
s
.
required_ruby_version
=
'>= 1.8.7'
s
.
specification_version
=
3
if
s
.
respond_to?
:specification_version
s
.
specification_version
=
3
if
s
.
respond_to?
:specification_version
end
end
lib/cocoapods/external_sources.rb
View file @
9a715213
...
@@ -17,10 +17,13 @@ module Pod
...
@@ -17,10 +17,13 @@ module Pod
elsif
params
.
key?
(
:svn
)
then
SvnSource
elsif
params
.
key?
(
:svn
)
then
SvnSource
elsif
params
.
key?
(
:hg
)
then
MercurialSource
elsif
params
.
key?
(
:hg
)
then
MercurialSource
elsif
params
.
key?
(
:podspec
)
then
PodspecSource
elsif
params
.
key?
(
:podspec
)
then
PodspecSource
elsif
params
.
key?
(
:local
)
||
elsif
params
.
key?
(
:path
)
then
PathSource
params
.
key?
(
:path
)
then
LocalSource
end
if
params
.
key?
(
:local
)
klass
=
PathSource
UI
.
warn
"The `:local` option of the Podfile has been renamed to `:path` and is deprecated."
\
end
end
UI
.
warn
"Using :local in a Podfile is depricated. Please use :path instead."
if
params
.
key?
(
:local
)
if
klass
if
klass
klass
.
new
(
name
,
params
,
podfile_path
)
klass
.
new
(
name
,
params
,
podfile_path
)
...
@@ -288,7 +291,7 @@ module Pod
...
@@ -288,7 +291,7 @@ module Pod
# @!group Helpers
# @!group Helpers
# @return [String] The uri of the podspec appending the name of the file
# @return [String] The uri of the podspec appending the name of the file
# and expanding it if necessary.
# and expanding it if necessary.
#
#
# @note If the declared path is expanded only if the represents a path
# @note If the declared path is expanded only if the represents a path
...
@@ -314,7 +317,7 @@ module Pod
...
@@ -314,7 +317,7 @@ module Pod
#
#
# Works with the {LocalPod::LocalSourcedPod} class.
# Works with the {LocalPod::LocalSourcedPod} class.
#
#
class
Local
Source
<
AbstractExternalSource
class
Path
Source
<
AbstractExternalSource
# @see AbstractExternalSource#fetch
# @see AbstractExternalSource#fetch
#
#
...
@@ -329,7 +332,7 @@ module Pod
...
@@ -329,7 +332,7 @@ module Pod
# @see AbstractExternalSource#description
# @see AbstractExternalSource#description
#
#
def
description
def
description
"from `
#{
params
[
:local
]
}
`"
"from `
#{
params
[
:
path
]
||
params
[
:
local
]
}
`"
end
end
#--------------------------------------#
#--------------------------------------#
...
@@ -341,7 +344,7 @@ module Pod
...
@@ -341,7 +344,7 @@ module Pod
# @return [Pathname] the path of the podspec.
# @return [Pathname] the path of the podspec.
#
#
def
podspec_path
def
podspec_path
declared_path
=
params
[
:local
]
.
to_s
declared_path
=
(
params
[
:path
]
||
params
[
:local
])
.
to_s
path_with_ext
=
File
.
extname
(
declared_path
)
==
'.podspec'
?
declared_path
:
"
#{
declared_path
}
/
#{
name
}
.podspec"
path_with_ext
=
File
.
extname
(
declared_path
)
==
'.podspec'
?
declared_path
:
"
#{
declared_path
}
/
#{
name
}
.podspec"
podfile_dir
=
File
.
dirname
(
podfile_path
||
''
)
podfile_dir
=
File
.
dirname
(
podfile_path
||
''
)
absolute_path
=
File
.
expand_path
(
path_with_ext
,
podfile_dir
)
absolute_path
=
File
.
expand_path
(
path_with_ext
,
podfile_dir
)
...
...
lib/cocoapods/installer.rb
View file @
9a715213
...
@@ -389,7 +389,7 @@ module Pod
...
@@ -389,7 +389,7 @@ module Pod
executed
=
false
executed
=
false
libraries_using_spec
(
spec
).
each
do
|
lib
|
libraries_using_spec
(
spec
).
each
do
|
lib
|
lib_representation
=
library_rep
(
lib
)
lib_representation
=
library_rep
(
lib
)
executed
|
|
=
run_spec_pre_install_hook
(
spec
,
lib_representation
)
executed
|=
run_spec_pre_install_hook
(
spec
,
lib_representation
)
end
end
UI
.
message
"-
#{
spec
.
name
}
"
if
executed
UI
.
message
"-
#{
spec
.
name
}
"
if
executed
end
end
...
@@ -448,7 +448,7 @@ module Pod
...
@@ -448,7 +448,7 @@ module Pod
executed
=
false
executed
=
false
libraries_using_spec
(
spec
).
each
do
|
lib
|
libraries_using_spec
(
spec
).
each
do
|
lib
|
lib_representation
=
library_rep
(
lib
)
lib_representation
=
library_rep
(
lib
)
executed
|
|
=
run_spec_post_install_hook
(
spec
,
lib_representation
)
executed
|=
run_spec_post_install_hook
(
spec
,
lib_representation
)
end
end
UI
.
message
"-
#{
spec
.
name
}
"
if
executed
UI
.
message
"-
#{
spec
.
name
}
"
if
executed
end
end
...
...
lib/cocoapods/installer/analyzer.rb
View file @
9a715213
...
@@ -247,7 +247,7 @@ module Pod
...
@@ -247,7 +247,7 @@ module Pod
pods_to_fetch
=
result
.
podfile_state
.
added
+
result
.
podfile_state
.
changed
pods_to_fetch
=
result
.
podfile_state
.
added
+
result
.
podfile_state
.
changed
deps_to_fetch
=
deps_with_external_source
.
select
{
|
dep
|
pods_to_fetch
.
include?
(
dep
.
root_name
)
}
deps_to_fetch
=
deps_with_external_source
.
select
{
|
dep
|
pods_to_fetch
.
include?
(
dep
.
root_name
)
}
deps_to_fetch_if_needed
=
deps_with_external_source
.
select
{
|
dep
|
result
.
podfile_state
.
unchanged
.
include?
(
dep
.
root_name
)
}
deps_to_fetch_if_needed
=
deps_with_external_source
.
select
{
|
dep
|
result
.
podfile_state
.
unchanged
.
include?
(
dep
.
root_name
)
}
deps_to_fetch
+=
deps_to_fetch_if_needed
.
select
{
|
dep
|
sandbox
.
specification
(
dep
.
root_name
).
nil?
||
!
dep
.
external_source
[
:local
].
nil?
}
deps_to_fetch
+=
deps_to_fetch_if_needed
.
select
{
|
dep
|
sandbox
.
specification
(
dep
.
root_name
).
nil?
||
!
dep
.
external_source
[
:local
].
nil?
||
!
dep
.
external_source
[
:path
].
nil?
}
end
end
unless
deps_to_fetch
.
empty?
unless
deps_to_fetch
.
empty?
...
...
lib/cocoapods/sandbox.rb
View file @
9a715213
...
@@ -320,6 +320,8 @@ module Pod
...
@@ -320,6 +320,8 @@ module Pod
# @return [Hash{String=>String}] The path of the Pods with a local source
# @return [Hash{String=>String}] The path of the Pods with a local source
# grouped by their name.
# grouped by their name.
#
#
# @todo Rename (e.g. `pods_with_local_path`)
#
attr_reader
:local_pods
attr_reader
:local_pods
# Checks if a Pod is locally sourced?
# Checks if a Pod is locally sourced?
...
...
lib/cocoapods/validator.rb
View file @
9a715213
...
@@ -106,7 +106,7 @@ module Pod
...
@@ -106,7 +106,7 @@ module Pod
# @return [Bool] whether the validation should be performed against the root of
# @return [Bool] whether the validation should be performed against the root of
# the podspec instead to its original source.
# the podspec instead to its original source.
#
#
# @note Uses the `:
local
` option of the Podfile.
# @note Uses the `:
path
` option of the Podfile.
#
#
attr_writer
:local
attr_writer
:local
def
local?
;
@local
;
end
def
local?
;
@local
;
end
...
...
spec/spec_helper.rb
View file @
9a715213
# Set up coverage analysis
# Set up coverage analysis
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
if
ENV
[
'CI'
]
||
ENV
[
'GENERATE_COVERAGE'
]
if
ENV
[
'CI'
]
||
ENV
[
'GENERATE_COVERAGE'
]
require
'simplecov'
require
'simplecov'
#
require 'coveralls'
require
'coveralls'
if
ENV
[
'CI'
]
if
ENV
[
'CI'
]
SimpleCov
.
formatter
=
Coveralls
::
SimpleCov
::
Formatter
SimpleCov
.
formatter
=
Coveralls
::
SimpleCov
::
Formatter
...
@@ -15,6 +16,13 @@ if ENV['CI'] || ENV['GENERATE_COVERAGE']
...
@@ -15,6 +16,13 @@ if ENV['CI'] || ENV['GENERATE_COVERAGE']
end
end
end
end
# TODO: Coverall loads colorize which interferes with colored making certain
# specs fail. This should be removed once Coverall is fixed.
#
# https://github.com/lemurheavy/coveralls-ruby/issues/14
#
require
'colored'
# Set up
# Set up
#-----------------------------------------------------------------------------#
#-----------------------------------------------------------------------------#
...
...
spec/unit/external_sources_spec.rb
View file @
9a715213
...
@@ -8,11 +8,13 @@ module Pod
...
@@ -8,11 +8,13 @@ module Pod
svn
=
Dependency
.
new
(
"Reachability"
,
:svn
=>
nil
)
svn
=
Dependency
.
new
(
"Reachability"
,
:svn
=>
nil
)
podspec
=
Dependency
.
new
(
"Reachability"
,
:podspec
=>
nil
)
podspec
=
Dependency
.
new
(
"Reachability"
,
:podspec
=>
nil
)
local
=
Dependency
.
new
(
"Reachability"
,
:local
=>
nil
)
local
=
Dependency
.
new
(
"Reachability"
,
:local
=>
nil
)
path
=
Dependency
.
new
(
"Reachability"
,
:path
=>
nil
)
ExternalSources
.
from_dependency
(
git
,
nil
).
class
.
should
==
ExternalSources
::
GitSource
ExternalSources
.
from_dependency
(
git
,
nil
).
class
.
should
==
ExternalSources
::
GitSource
ExternalSources
.
from_dependency
(
svn
,
nil
).
class
.
should
==
ExternalSources
::
SvnSource
ExternalSources
.
from_dependency
(
svn
,
nil
).
class
.
should
==
ExternalSources
::
SvnSource
ExternalSources
.
from_dependency
(
podspec
,
nil
).
class
.
should
==
ExternalSources
::
PodspecSource
ExternalSources
.
from_dependency
(
podspec
,
nil
).
class
.
should
==
ExternalSources
::
PodspecSource
ExternalSources
.
from_dependency
(
local
,
nil
).
class
.
should
==
ExternalSources
::
LocalSource
ExternalSources
.
from_dependency
(
local
,
nil
).
class
.
should
==
ExternalSources
::
PathSource
ExternalSources
.
from_dependency
(
path
,
nil
).
class
.
should
==
ExternalSources
::
PathSource
end
end
end
end
...
@@ -202,11 +204,11 @@ module Pod
...
@@ -202,11 +204,11 @@ module Pod
#---------------------------------------------------------------------------#
#---------------------------------------------------------------------------#
describe
ExternalSources
::
Local
Source
do
describe
ExternalSources
::
Path
Source
do
before
do
before
do
podspec_path
=
fixture
(
'integration/Reachability/Reachability.podspec'
)
podspec_path
=
fixture
(
'integration/Reachability/Reachability.podspec'
)
dependency
=
Dependency
.
new
(
"Reachability"
,
:
local
=>
fixture
(
'integration/Reachability'
))
dependency
=
Dependency
.
new
(
"Reachability"
,
:
path
=>
fixture
(
'integration/Reachability'
))
podfile_path
=
fixture
(
'integration/Podfile'
)
podfile_path
=
fixture
(
'integration/Podfile'
)
@external_source
=
ExternalSources
.
from_dependency
(
dependency
,
podfile_path
)
@external_source
=
ExternalSources
.
from_dependency
(
dependency
,
podfile_path
)
end
end
...
@@ -217,6 +219,15 @@ module Pod
...
@@ -217,6 +219,15 @@ module Pod
path
.
should
.
exist?
path
.
should
.
exist?
end
end
it
"creates a copy of the podspec [Deprecated local option]"
do
dependency
=
Dependency
.
new
(
"Reachability"
,
:local
=>
fixture
(
'integration/Reachability'
))
podfile_path
=
fixture
(
'integration/Podfile'
)
external_source
=
ExternalSources
.
from_dependency
(
dependency
,
podfile_path
)
external_source
.
fetch
(
config
.
sandbox
)
path
=
config
.
sandbox
.
root
+
'Local Podspecs/Reachability.podspec'
path
.
should
.
exist?
end
it
"returns the description"
do
it
"returns the description"
do
@external_source
.
description
.
should
.
match
%r|from `.*integration/Reachability`|
@external_source
.
description
.
should
.
match
%r|from `.*integration/Reachability`|
end
end
...
@@ -231,33 +242,33 @@ module Pod
...
@@ -231,33 +242,33 @@ module Pod
describe
"Helpers"
do
describe
"Helpers"
do
it
"handles absolute paths"
do
it
"handles absolute paths"
do
@external_source
.
stubs
(
:params
).
returns
(
:
local
=>
fixture
(
'integration/Reachability'
))
@external_source
.
stubs
(
:params
).
returns
(
:
path
=>
fixture
(
'integration/Reachability'
))
path
=
@external_source
.
send
(
:podspec_path
)
path
=
@external_source
.
send
(
:podspec_path
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
end
end
it
"handles paths when there is no podfile path"
do
it
"handles paths when there is no podfile path"
do
@external_source
.
stubs
(
:podfile_path
).
returns
(
nil
)
@external_source
.
stubs
(
:podfile_path
).
returns
(
nil
)
@external_source
.
stubs
(
:params
).
returns
(
:
local
=>
fixture
(
'integration/Reachability'
))
@external_source
.
stubs
(
:params
).
returns
(
:
path
=>
fixture
(
'integration/Reachability'
))
path
=
@external_source
.
send
(
:podspec_path
)
path
=
@external_source
.
send
(
:podspec_path
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
end
end
it
"handles relative paths"
do
it
"handles relative paths"
do
@external_source
.
stubs
(
:params
).
returns
(
:
local
=>
'Reachability'
)
@external_source
.
stubs
(
:params
).
returns
(
:
path
=>
'Reachability'
)
path
=
@external_source
.
send
(
:podspec_path
)
path
=
@external_source
.
send
(
:podspec_path
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
path
.
should
==
fixture
(
'integration/Reachability/Reachability.podspec'
)
end
end
it
"expands the tilde"
do
it
"expands the tilde"
do
@external_source
.
stubs
(
:params
).
returns
(
:
local
=>
'~/Reachability'
)
@external_source
.
stubs
(
:params
).
returns
(
:
path
=>
'~/Reachability'
)
Pathname
.
any_instance
.
stubs
(
:exist?
).
returns
(
true
)
Pathname
.
any_instance
.
stubs
(
:exist?
).
returns
(
true
)
path
=
@external_source
.
send
(
:podspec_path
)
path
=
@external_source
.
send
(
:podspec_path
)
path
.
should
==
Pathname
(
ENV
[
'HOME'
])
+
'Reachability/Reachability.podspec'
path
.
should
==
Pathname
(
ENV
[
'HOME'
])
+
'Reachability/Reachability.podspec'
end
end
it
"raises if the podspec cannot be found"
do
it
"raises if the podspec cannot be found"
do
@external_source
.
stubs
(
:params
).
returns
(
:
local
=>
temporary_directory
)
@external_source
.
stubs
(
:params
).
returns
(
:
path
=>
temporary_directory
)
e
=
lambda
{
@external_source
.
send
(
:podspec_path
)
}.
should
.
raise
Informative
e
=
lambda
{
@external_source
.
send
(
:podspec_path
)
}.
should
.
raise
Informative
e
.
message
.
should
.
match
/No podspec found/
e
.
message
.
should
.
match
/No podspec found/
end
end
...
...
spec/unit/installer_spec.rb
View file @
9a715213
...
@@ -383,6 +383,29 @@ module Pod
...
@@ -383,6 +383,29 @@ module Pod
@installer
.
send
(
:run_post_install_hooks
)
@installer
.
send
(
:run_post_install_hooks
)
end
end
it
"calls the hooks in the specs for each target"
do
library_ios
=
Library
.
new
(
nil
)
library_osx
=
Library
.
new
(
nil
)
library_ios
.
specs
=
[
@spec
]
library_osx
.
specs
=
[
@spec
]
library_ios
.
stubs
(
:name
).
returns
(
'label'
)
library_osx
.
stubs
(
:name
).
returns
(
'label'
)
library_ios_rep
=
stub
()
library_osx_rep
=
stub
()
@installer
.
stubs
(
:libraries
).
returns
([
library_ios
,
library_osx
])
@installer
.
stubs
(
:installer_rep
).
returns
(
stub
())
@installer
.
stubs
(
:library_rep
).
with
(
library_ios
).
returns
(
library_ios_rep
)
@installer
.
stubs
(
:library_rep
).
with
(
library_osx
).
returns
(
library_osx_rep
)
@installer
.
podfile
.
expects
(
:pre_install!
)
@spec
.
expects
(
:post_install!
).
with
(
library_ios_rep
)
@spec
.
expects
(
:post_install!
).
with
(
library_osx_rep
)
@installer
.
send
(
:run_pre_install_hooks
)
@installer
.
send
(
:run_post_install_hooks
)
end
it
"returns the hook representation of the installer"
do
it
"returns the hook representation of the installer"
do
rep
=
@installer
.
send
(
:installer_rep
)
rep
=
@installer
.
send
(
:installer_rep
)
rep
.
sandbox_root
.
should
==
@installer
.
sandbox
.
root
rep
.
sandbox_root
.
should
==
@installer
.
sandbox
.
root
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment