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
579c1a73
Commit
579c1a73
authored
Feb 10, 2012
by
Luke Redpath
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow specifications to have a local source that exists outside the Pods root (and doesn't
need downloading or copying).
parent
2ae6ddfb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
61 additions
and
21 deletions
+61
-21
Rakefile
Rakefile
+3
-3
file_list.rb
lib/cocoapods/file_list.rb
+0
-2
installer.rb
lib/cocoapods/installer.rb
+4
-2
specification.rb
lib/cocoapods/specification.rb
+10
-0
downloader_spec.rb
spec/functional/downloader_spec.rb
+13
-14
specification_spec.rb
spec/unit/specification_spec.rb
+31
-0
No files found.
Rakefile
View file @
579c1a73
...
@@ -40,7 +40,7 @@ end
...
@@ -40,7 +40,7 @@ end
namespace
:gem
do
namespace
:gem
do
def
gem_version
def
gem_version
require
'lib/cocoapods'
require
File
.
join
(
File
.
dirname
(
__FILE__
),
*
%w[lib cocoapods]
)
Pod
::
VERSION
Pod
::
VERSION
end
end
...
@@ -55,8 +55,8 @@ namespace :gem do
...
@@ -55,8 +55,8 @@ namespace :gem do
desc
"Install a gem version of the current code"
desc
"Install a gem version of the current code"
task
:install
=>
:build
do
task
:install
=>
:build
do
sh
"sudo
mac
gem install
#{
gem_filename
}
"
sh
"sudo gem install
#{
gem_filename
}
"
#sh "sudo
mac
gem compile cocoapods"
#sh "sudo gem compile cocoapods"
end
end
desc
"Run all specs, build and install gem, commit version change, tag version change, and push everything"
desc
"Run all specs, build and install gem, commit version change, tag version change, and push everything"
...
...
lib/cocoapods/file_list.rb
View file @
579c1a73
...
@@ -38,5 +38,3 @@ class Pathname
...
@@ -38,5 +38,3 @@ class Pathname
end
end
end
end
end
end
lib/cocoapods/installer.rb
View file @
579c1a73
...
@@ -55,8 +55,10 @@ module Pod
...
@@ -55,8 +55,10 @@ module Pod
def
install_dependencies!
def
install_dependencies!
build_specifications
.
each
do
|
spec
|
build_specifications
.
each
do
|
spec
|
if
spec
.
pod_destroot
.
exist?
if
spec
.
pod_destroot
.
exist?
||
spec
.
local?
puts
"Using
#{
spec
}
"
unless
config
.
silent?
message
=
"Using
#{
spec
}
"
message
+=
" [LOCAL]"
if
spec
.
local?
puts
message
unless
config
.
silent?
else
else
puts
"Installing
#{
spec
}
"
unless
config
.
silent?
puts
"Installing
#{
spec
}
"
unless
config
.
silent?
spec
=
spec
.
part_of_specification
if
spec
.
part_of_other_pod?
spec
=
spec
.
part_of_specification
if
spec
.
part_of_other_pod?
...
...
lib/cocoapods/specification.rb
View file @
579c1a73
...
@@ -152,6 +152,14 @@ module Pod
...
@@ -152,6 +152,14 @@ module Pod
attr_accessor
:defined_in_set
attr_accessor
:defined_in_set
include
Config
::
Mixin
include
Config
::
Mixin
def
local?
!
source
[
:local
].
nil?
end
def
local_path
Pathname
.
new
(
File
.
expand_path
(
source
[
:local
]))
end
def
wrapper?
def
wrapper?
source_files
.
empty?
&&
!
subspecs
.
empty?
source_files
.
empty?
&&
!
subspecs
.
empty?
...
@@ -195,6 +203,8 @@ module Pod
...
@@ -195,6 +203,8 @@ module Pod
def
pod_destroot
def
pod_destroot
if
part_of_other_pod?
if
part_of_other_pod?
part_of_specification
.
pod_destroot
part_of_specification
.
pod_destroot
elsif
local?
local_path
else
else
config
.
project_pods_root
+
@name
config
.
project_pods_root
+
@name
end
end
...
...
spec/functional/downloader_spec.rb
View file @
579c1a73
...
@@ -7,7 +7,7 @@ describe "Pod::Downloader" do
...
@@ -7,7 +7,7 @@ describe "Pod::Downloader" do
describe
"for Git"
do
describe
"for Git"
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryDirectory
it
"check's out a specific commit"
do
it
"check's out a specific commit"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:git
=>
fixture
(
'banana-lib'
),
:commit
=>
'02467b074d4dc9f6a75b8cd3ab80d9bf37887b01'
:git
=>
fixture
(
'banana-lib'
),
:commit
=>
'02467b074d4dc9f6a75b8cd3ab80d9bf37887b01'
...
@@ -15,7 +15,7 @@ describe "Pod::Downloader" do
...
@@ -15,7 +15,7 @@ describe "Pod::Downloader" do
downloader
.
download
downloader
.
download
(
@dir
+
'README'
).
read
.
strip
.
should
==
'first commit'
(
@dir
+
'README'
).
read
.
strip
.
should
==
'first commit'
end
end
it
"check's out a specific tag"
do
it
"check's out a specific tag"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:git
=>
fixture
(
'banana-lib'
),
:tag
=>
'v1.0'
:git
=>
fixture
(
'banana-lib'
),
:tag
=>
'v1.0'
...
@@ -23,7 +23,7 @@ describe "Pod::Downloader" do
...
@@ -23,7 +23,7 @@ describe "Pod::Downloader" do
downloader
.
download
downloader
.
download
(
@dir
+
'README'
).
read
.
strip
.
should
==
'v1.0'
(
@dir
+
'README'
).
read
.
strip
.
should
==
'v1.0'
end
end
it
"removes the .git directory"
do
it
"removes the .git directory"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:git
=>
fixture
(
'banana-lib'
),
:tag
=>
'v1.0'
:git
=>
fixture
(
'banana-lib'
),
:tag
=>
'v1.0'
...
@@ -32,7 +32,7 @@ describe "Pod::Downloader" do
...
@@ -32,7 +32,7 @@ describe "Pod::Downloader" do
downloader
.
clean
downloader
.
clean
(
@dir
+
'.git'
).
should
.
not
.
exist
(
@dir
+
'.git'
).
should
.
not
.
exist
end
end
it
"removes the clean_paths files and directories"
do
it
"removes the clean_paths files and directories"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:git
=>
fixture
(
'banana-lib'
),
:tag
=>
'v1.0'
:git
=>
fixture
(
'banana-lib'
),
:tag
=>
'v1.0'
...
@@ -42,10 +42,10 @@ describe "Pod::Downloader" do
...
@@ -42,10 +42,10 @@ describe "Pod::Downloader" do
(
@dir
+
'README'
).
should
.
not
.
exist
(
@dir
+
'README'
).
should
.
not
.
exist
end
end
end
end
describe
"for Mercurial"
do
describe
"for Mercurial"
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryDirectory
it
"check's out a specific revision"
do
it
"check's out a specific revision"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:hg
=>
fixture
(
'mercurial-repo'
),
:revision
=>
'46198bb3af96'
:hg
=>
fixture
(
'mercurial-repo'
),
:revision
=>
'46198bb3af96'
...
@@ -53,7 +53,7 @@ describe "Pod::Downloader" do
...
@@ -53,7 +53,7 @@ describe "Pod::Downloader" do
downloader
.
download
downloader
.
download
(
@dir
+
'README'
).
read
.
strip
.
should
==
'first commit'
(
@dir
+
'README'
).
read
.
strip
.
should
==
'first commit'
end
end
it
"removes the .hg directory"
do
it
"removes the .hg directory"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:hg
=>
fixture
(
'mercurial-repo'
)
:hg
=>
fixture
(
'mercurial-repo'
)
...
@@ -62,7 +62,7 @@ describe "Pod::Downloader" do
...
@@ -62,7 +62,7 @@ describe "Pod::Downloader" do
downloader
.
clean
downloader
.
clean
(
@dir
+
'.hg'
).
should
.
not
.
exist
(
@dir
+
'.hg'
).
should
.
not
.
exist
end
end
it
"removes the clean_paths files and directories"
do
it
"removes the clean_paths files and directories"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:hg
=>
fixture
(
'mercurial-repo'
)
:hg
=>
fixture
(
'mercurial-repo'
)
...
@@ -72,10 +72,10 @@ describe "Pod::Downloader" do
...
@@ -72,10 +72,10 @@ describe "Pod::Downloader" do
(
@dir
+
'README'
).
should
.
not
.
exist
(
@dir
+
'README'
).
should
.
not
.
exist
end
end
end
end
describe
"for Subversion"
do
describe
"for Subversion"
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryDirectory
it
"check's out a specific revision"
do
it
"check's out a specific revision"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:svn
=>
"file://
#{
fixture
(
'subversion-repo'
)
}
"
,
:revision
=>
'1'
:svn
=>
"file://
#{
fixture
(
'subversion-repo'
)
}
"
,
:revision
=>
'1'
...
@@ -83,7 +83,7 @@ describe "Pod::Downloader" do
...
@@ -83,7 +83,7 @@ describe "Pod::Downloader" do
downloader
.
download
downloader
.
download
(
@dir
+
'README'
).
read
.
strip
.
should
==
'first commit'
(
@dir
+
'README'
).
read
.
strip
.
should
==
'first commit'
end
end
it
"check's out a specific tag"
do
it
"check's out a specific tag"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:svn
=>
"file://
#{
fixture
(
'subversion-repo'
)
}
/tags/tag-1"
:svn
=>
"file://
#{
fixture
(
'subversion-repo'
)
}
/tags/tag-1"
...
@@ -91,7 +91,7 @@ describe "Pod::Downloader" do
...
@@ -91,7 +91,7 @@ describe "Pod::Downloader" do
downloader
.
download
downloader
.
download
(
@dir
+
'README'
).
read
.
strip
.
should
==
'tag 1'
(
@dir
+
'README'
).
read
.
strip
.
should
==
'tag 1'
end
end
it
"removes the .svn directories"
do
it
"removes the .svn directories"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:svn
=>
"file://
#{
fixture
(
'subversion-repo'
)
}
/trunk"
:svn
=>
"file://
#{
fixture
(
'subversion-repo'
)
}
/trunk"
...
@@ -100,7 +100,7 @@ describe "Pod::Downloader" do
...
@@ -100,7 +100,7 @@ describe "Pod::Downloader" do
downloader
.
clean
downloader
.
clean
(
@dir
+
'.svn'
).
should
.
not
.
exist
(
@dir
+
'.svn'
).
should
.
not
.
exist
end
end
it
"removes the clean_paths files and directories"
do
it
"removes the clean_paths files and directories"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:svn
=>
"file://
#{
fixture
(
'subversion-repo'
)
}
/trunk"
:svn
=>
"file://
#{
fixture
(
'subversion-repo'
)
}
/trunk"
...
@@ -110,6 +110,5 @@ describe "Pod::Downloader" do
...
@@ -110,6 +110,5 @@ describe "Pod::Downloader" do
(
@dir
+
'README'
).
should
.
not
.
exist
(
@dir
+
'README'
).
should
.
not
.
exist
end
end
end
end
end
end
spec/unit/specification_spec.rb
View file @
579c1a73
...
@@ -340,3 +340,34 @@ describe "A Pod::Specification subspec" do
...
@@ -340,3 +340,34 @@ describe "A Pod::Specification subspec" do
@spec
.
subspec_by_name
(
'MainSpec/FirstSubSpec/SecondSubSpec'
).
should
==
@spec
.
subspecs
.
first
.
subspecs
.
first
@spec
.
subspec_by_name
(
'MainSpec/FirstSubSpec/SecondSubSpec'
).
should
==
@spec
.
subspecs
.
first
.
subspecs
.
first
end
end
end
end
describe
"A Pod::Specification with :local source"
do
before
do
@spec
=
Pod
::
Spec
.
new
do
|
s
|
s
.
name
=
'MainSpec'
s
.
source
=
{
:local
=>
fixture
(
"integration/JSONKit"
)
}
s
.
source_files
=
"."
end
end
it
"is marked as local"
do
@spec
.
should
.
be
.
local
end
it
"it returns the expanded local path"
do
@spec
.
local_path
.
should
==
fixture
(
"integration/JSONKit"
)
end
it
"returns the list of files that the source_files pattern expand to within the local path"
do
files
=
fixture
(
"integration/JSONKit"
).
glob
(
'**/*.{h,m}'
)
files
=
files
.
map
{
|
file
|
file
.
relative_path_from
(
config
.
project_pods_root
)
}
@spec
.
expanded_source_files
.
sort
.
should
==
files
.
sort
end
it
"returns the list of headers that the source_files pattern expand to within the local path"
do
files
=
fixture
(
"integration/JSONKit"
).
glob
(
'**/*.{h}'
)
files
=
files
.
map
{
|
file
|
file
.
relative_path_from
(
config
.
project_pods_root
)
}
@spec
.
header_files
.
sort
.
should
==
files
.
sort
end
end
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