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
6f2f1499
Commit
6f2f1499
authored
Oct 12, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Pod::File which is a subclass of Pod::Specification, but meant for a Podfile.
parent
26641970
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
38 additions
and
34 deletions
+38
-34
install.rb
lib/cocoapods/command/install.rb
+2
-2
spec.rb
lib/cocoapods/command/spec.rb
+1
-1
config.rb
lib/cocoapods/config.rb
+1
-1
specification.rb
lib/cocoapods/specification.rb
+18
-17
set.rb
lib/cocoapods/specification/set.rb
+1
-1
project.rb
lib/cocoapods/xcode/project.rb
+2
-2
Podfile
spec/fixtures/Podfile
+7
-4
command_spec.rb
spec/functional/command_spec.rb
+1
-1
specification_spec.rb
spec/unit/specification_spec.rb
+5
-5
No files found.
lib/cocoapods/command/install.rb
View file @
6f2f1499
...
@@ -30,13 +30,13 @@ module Pod
...
@@ -30,13 +30,13 @@ module Pod
spec
=
nil
spec
=
nil
if
@podspec
if
@podspec
if
@podspec
.
exist?
if
@podspec
.
exist?
spec
=
Specification
.
from_
podspec
(
@podspec
)
spec
=
Specification
.
from_
file
(
@podspec
)
else
else
raise
Informative
,
"The specified podspec `
#{
@podspec
}
' doesn't exist."
raise
Informative
,
"The specified podspec `
#{
@podspec
}
' doesn't exist."
end
end
else
else
if
config
.
project_podfile
if
config
.
project_podfile
spec
=
Specification
.
from_
pod
file
(
config
.
project_podfile
)
spec
=
Specification
.
from_file
(
config
.
project_podfile
)
else
else
raise
Informative
,
"No `Podfile' or `.podspec' file found in the current working directory."
raise
Informative
,
"No `Podfile' or `.podspec' file found in the current working directory."
end
end
...
...
lib/cocoapods/command/spec.rb
View file @
6f2f1499
...
@@ -55,7 +55,7 @@ module Pod
...
@@ -55,7 +55,7 @@ module Pod
def
lint
def
lint
file
=
@name
?
Pathname
.
new
(
@name
)
:
Pathname
.
pwd
.
glob
(
'*.podspec'
).
first
file
=
@name
?
Pathname
.
new
(
@name
)
:
Pathname
.
pwd
.
glob
(
'*.podspec'
).
first
spec
=
Specification
.
from_
podspec
(
file
)
spec
=
Specification
.
from_
file
(
file
)
spec
.
validate!
spec
.
validate!
end
end
end
end
...
...
lib/cocoapods/config.rb
View file @
6f2f1499
...
@@ -16,7 +16,7 @@ module Pod
...
@@ -16,7 +16,7 @@ module Pod
alias_method
:silent?
,
:silent
alias_method
:silent?
,
:silent
def
initialize
def
initialize
@repos_dir
=
Pathname
.
new
(
File
.
expand_path
(
"~/.cocoapods"
))
@repos_dir
=
Pathname
.
new
(
::
File
.
expand_path
(
"~/.cocoapods"
))
@clean
=
true
@clean
=
true
@verbose
=
false
@verbose
=
false
@silent
=
false
@silent
=
false
...
...
lib/cocoapods/specification.rb
View file @
6f2f1499
...
@@ -6,16 +6,8 @@ module Pod
...
@@ -6,16 +6,8 @@ module Pod
class
Specification
class
Specification
autoload
:Set
,
'cocoapods/specification/set'
autoload
:Set
,
'cocoapods/specification/set'
def
self
.
from_podfile
(
path
)
# The file is expected to define and return either a Pods::Specification or a Pod::File.
if
path
.
exist?
def
self
.
from_file
(
path
)
spec
=
new
spec
.
instance_eval
(
path
.
read
)
spec
.
defined_in_file
=
path
spec
end
end
def
self
.
from_podspec
(
path
)
spec
=
Pod
.
_eval_podspec
(
path
)
spec
=
Pod
.
_eval_podspec
(
path
)
spec
.
defined_in_file
=
path
spec
.
defined_in_file
=
path
spec
spec
...
@@ -143,7 +135,6 @@ module Pod
...
@@ -143,7 +135,6 @@ module Pod
end
end
def
pod_destroot
def
pod_destroot
return
if
from_podfile?
if
part_of_other_pod?
if
part_of_other_pod?
part_of_specification
.
pod_destroot
part_of_specification
.
pod_destroot
else
else
...
@@ -161,8 +152,8 @@ module Pod
...
@@ -161,8 +152,8 @@ module Pod
!
@part_of
.
nil?
!
@part_of
.
nil?
end
end
def
from_
podfile?
def
podfile?
@name
.
nil?
&&
@version
.
nil?
false
end
end
def
any_platform?
def
any_platform?
...
@@ -221,12 +212,8 @@ module Pod
...
@@ -221,12 +212,8 @@ module Pod
end
end
def
to_s
def
to_s
if
from_podfile?
"podfile at `
#{
@defined_in_file
}
'"
else
"`
#{
@name
}
' version `
#{
@version
}
'"
"`
#{
@name
}
' version `
#{
@version
}
'"
end
end
end
def
inspect
def
inspect
"#<
#{
self
.
class
.
name
}
for
#{
to_s
}
>"
"#<
#{
self
.
class
.
name
}
for
#{
to_s
}
>"
...
@@ -310,4 +297,18 @@ module Pod
...
@@ -310,4 +297,18 @@ module Pod
end
end
Spec
=
Specification
Spec
=
Specification
class
File
<
Specification
def
podfile?
true
end
def
to_s
"podfile at `
#{
@defined_in_file
}
'"
end
def
pod_destroot
# A Podfile has none
end
end
end
end
lib/cocoapods/specification/set.rb
View file @
6f2f1499
...
@@ -54,7 +54,7 @@ module Pod
...
@@ -54,7 +54,7 @@ module Pod
end
end
def
specification
def
specification
Specification
.
from_
podspec
(
specification_path
)
Specification
.
from_
file
(
specification_path
)
end
end
# Return the first version that matches the current dependency.
# Return the first version that matches the current dependency.
...
...
lib/cocoapods/xcode/project.rb
View file @
6f2f1499
...
@@ -219,9 +219,9 @@ module Pod
...
@@ -219,9 +219,9 @@ module Pod
# TODO this is a workaround for an issue with MacRuby with compiled files
# TODO this is a workaround for an issue with MacRuby with compiled files
# that makes the use of __FILE__ impossible.
# that makes the use of __FILE__ impossible.
#
#
#TEMPLATES_DIR = Pathname.new(File.expand_path('../../../../xcode-project-templates', __FILE__))
#TEMPLATES_DIR = Pathname.new(
::
File.expand_path('../../../../xcode-project-templates', __FILE__))
file
=
$LOADED_FEATURES
.
find
{
|
file
|
file
=~
%r{cocoapods/xcode/project
\.
rbo?$}
}
file
=
$LOADED_FEATURES
.
find
{
|
file
|
file
=~
%r{cocoapods/xcode/project
\.
rbo?$}
}
TEMPLATES_DIR
=
Pathname
.
new
(
File
.
expand_path
(
'../../../../xcode-project-templates'
,
file
))
TEMPLATES_DIR
=
Pathname
.
new
(
::
File
.
expand_path
(
'../../../../xcode-project-templates'
,
file
))
# TODO see if we really need different templates for iOS and OS X
# TODO see if we really need different templates for iOS and OS X
def
self
.
ios_static_library
def
self
.
ios_static_library
...
...
spec/fixtures/Podfile
View file @
6f2f1499
dependency
'SSZipArchive'
,
'>= 1'
Pod
::
File
.
new
do
|
f
|
dependency
'ASIHTTPRequest'
,
'~> 1.8.0'
f
.
platform
=
:ios
dependency
'Reachability'
# part of ASIHTTPRequest
f
.
dependency
'SSZipArchive'
,
'>= 1'
dependency
'ASIWebPageRequest'
,
'< 1.8.2'
# part of ASIHTTPRequest
f
.
dependency
'ASIHTTPRequest'
,
'~> 1.8.0'
f
.
dependency
'Reachability'
# part of ASIHTTPRequest
f
.
dependency
'ASIWebPageRequest'
,
'< 1.8.2'
# part of ASIHTTPRequest
end
spec/functional/command_spec.rb
View file @
6f2f1499
...
@@ -43,7 +43,7 @@ describe "Pod::Command" do
...
@@ -43,7 +43,7 @@ describe "Pod::Command" do
command
(
'spec'
,
'create'
,
'Bananas'
)
command
(
'spec'
,
'create'
,
'Bananas'
)
end
end
path
=
temporary_directory
+
'Bananas.podspec'
path
=
temporary_directory
+
'Bananas.podspec'
spec
=
Pod
::
Specification
.
from_
podspec
(
path
)
spec
=
Pod
::
Specification
.
from_
file
(
path
)
spec
.
name
.
should
==
'Bananas'
spec
.
name
.
should
==
'Bananas'
spec
.
version
.
should
==
Pod
::
Version
.
new
(
'1.0.0'
)
spec
.
version
.
should
==
Pod
::
Version
.
new
(
'1.0.0'
)
spec
.
summary
.
should
==
'A short description of Bananas.'
spec
.
summary
.
should
==
'A short description of Bananas.'
...
...
spec/unit/specification_spec.rb
View file @
6f2f1499
...
@@ -2,7 +2,7 @@ require File.expand_path('../../spec_helper', __FILE__)
...
@@ -2,7 +2,7 @@ require File.expand_path('../../spec_helper', __FILE__)
describe
"A Pod::Specification loaded from a Podfile"
do
describe
"A Pod::Specification loaded from a Podfile"
do
before
do
before
do
@spec
=
Pod
::
Specification
.
from_
pod
file
(
fixture
(
'Podfile'
))
@spec
=
Pod
::
Specification
.
from_file
(
fixture
(
'Podfile'
))
end
end
it
"lists the project's dependencies"
do
it
"lists the project's dependencies"
do
...
@@ -19,7 +19,7 @@ describe "A Pod::Specification loaded from a Podfile" do
...
@@ -19,7 +19,7 @@ describe "A Pod::Specification loaded from a Podfile" do
end
end
it
"returns that it's loaded from a Podfile"
do
it
"returns that it's loaded from a Podfile"
do
@spec
.
should
.
be
.
from_
podfile
@spec
.
should
.
be
.
podfile
end
end
it
"does not have a destroot"
do
it
"does not have a destroot"
do
...
@@ -29,11 +29,11 @@ end
...
@@ -29,11 +29,11 @@ end
describe
"A Pod::Specification loaded from a podspec"
do
describe
"A Pod::Specification loaded from a podspec"
do
before
do
before
do
@spec
=
Pod
::
Specification
.
from_
podspec
(
fixture
(
'banana-lib/BananaLib.podspec'
))
@spec
=
Pod
::
Specification
.
from_
file
(
fixture
(
'banana-lib/BananaLib.podspec'
))
end
end
it
"returns that it's not loaded from a podfile"
do
it
"returns that it's not loaded from a podfile"
do
@spec
.
should
.
not
.
be
.
from_
podfile
@spec
.
should
.
not
.
be
.
podfile
end
end
it
"returns the path to the podspec"
do
it
"returns the path to the podspec"
do
...
@@ -169,7 +169,7 @@ describe "A Pod::Specification, with installed source," do
...
@@ -169,7 +169,7 @@ describe "A Pod::Specification, with installed source," do
before
do
before
do
config
.
project_pods_root
=
fixture
(
'integration'
)
config
.
project_pods_root
=
fixture
(
'integration'
)
podspec
=
fixture
(
'spec-repos/master/SSZipArchive/0.1.0/SSZipArchive.podspec'
)
podspec
=
fixture
(
'spec-repos/master/SSZipArchive/0.1.0/SSZipArchive.podspec'
)
@spec
=
Pod
::
Specification
.
from_
podspec
(
podspec
)
@spec
=
Pod
::
Specification
.
from_
file
(
podspec
)
@destroot
=
fixture
(
'integration/SSZipArchive'
)
@destroot
=
fixture
(
'integration/SSZipArchive'
)
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