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
ac1a9551
Commit
ac1a9551
authored
Mar 24, 2018
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Sandbox] Allow storing specs directly
This also allows up to only create the `Local Podspecs` dir once
parent
0f6b1feb
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
23 additions
and
8 deletions
+23
-8
abstract_external_source.rb
lib/cocoapods/external_sources/abstract_external_source.rb
+1
-1
sandbox.rb
lib/cocoapods/sandbox.rb
+12
-5
downloader_source_spec.rb
spec/unit/external_sources/downloader_source_spec.rb
+1
-0
path_source_spec.rb
spec/unit/external_sources/path_source_spec.rb
+1
-0
podspec_source_spec.rb
spec/unit/external_sources/podspec_source_spec.rb
+1
-0
target_validator_spec.rb
spec/unit/installer/xcode/target_validator_spec.rb
+1
-0
sandbox_spec.rb
spec/unit/sandbox_spec.rb
+6
-2
No files found.
lib/cocoapods/external_sources/abstract_external_source.rb
View file @
ac1a9551
...
@@ -172,7 +172,7 @@ module Pod
...
@@ -172,7 +172,7 @@ module Pod
end
end
spec
.
defined_in_file
=
nil
spec
.
defined_in_file
=
nil
validate_podspec
(
spec
)
validate_podspec
(
spec
)
sandbox
.
store_podspec
(
name
,
spec
.
to_pretty_json
,
true
,
true
)
sandbox
.
store_podspec
(
name
,
spec
,
true
,
true
)
end
end
def
validate_podspec
(
podspec
)
def
validate_podspec
(
podspec
)
...
...
lib/cocoapods/sandbox.rb
View file @
ac1a9551
...
@@ -242,7 +242,7 @@ module Pod
...
@@ -242,7 +242,7 @@ module Pod
# @param [String] name
# @param [String] name
# the name of the pod
# the name of the pod
#
#
# @param [String, Pathname] podspec
# @param [String, Pathname
, Specification
] podspec
# The contents of the specification (String) or the path to a
# The contents of the specification (String) or the path to a
# podspec file (Pathname).
# podspec file (Pathname).
#
#
...
@@ -252,22 +252,29 @@ module Pod
...
@@ -252,22 +252,29 @@ module Pod
def
store_podspec
(
name
,
podspec
,
_external_source
=
false
,
json
=
false
)
def
store_podspec
(
name
,
podspec
,
_external_source
=
false
,
json
=
false
)
file_name
=
json
?
"
#{
name
}
.podspec.json"
:
"
#{
name
}
.podspec"
file_name
=
json
?
"
#{
name
}
.podspec.json"
:
"
#{
name
}
.podspec"
output_path
=
specifications_root
+
file_name
output_path
=
specifications_root
+
file_name
output_path
.
dirname
.
mkpath
if
podspec
.
is_a?
(
String
)
case
podspec
when
String
output_path
.
open
(
'w'
)
{
|
f
|
f
.
puts
(
podspec
)
}
output_path
.
open
(
'w'
)
{
|
f
|
f
.
puts
(
podspec
)
}
els
e
when
Pathnam
e
unless
podspec
.
exist?
unless
podspec
.
exist?
raise
Informative
,
"No podspec found for `
#{
name
}
` in
#{
podspec
}
"
raise
Informative
,
"No podspec found for `
#{
name
}
` in
#{
podspec
}
"
end
end
FileUtils
.
copy
(
podspec
,
output_path
)
FileUtils
.
copy
(
podspec
,
output_path
)
when
Specification
output_path
.
open
(
'w'
)
{
|
f
|
f
.
puts
(
podspec
.
to_pretty_json
)
}
spec
=
podspec
.
dup
spec
.
defined_in_file
=
output_path
end
end
Dir
.
chdir
(
podspec
.
is_a?
(
Pathname
)
?
File
.
dirname
(
podspec
)
:
Dir
.
pwd
)
do
spec
||=
Dir
.
chdir
(
podspec
.
is_a?
(
Pathname
)
?
File
.
dirname
(
podspec
)
:
Dir
.
pwd
)
do
spec
=
Specification
.
from_file
(
output_path
)
spec
=
Specification
.
from_file
(
output_path
)
unless
spec
.
name
==
name
unless
spec
.
name
==
name
raise
Informative
,
"The name of the given podspec `
#{
spec
.
name
}
` doesn't match the expected one `
#{
name
}
`"
raise
Informative
,
"The name of the given podspec `
#{
spec
.
name
}
` doesn't match the expected one `
#{
name
}
`"
end
end
spec
end
end
end
end
...
...
spec/unit/external_sources/downloader_source_spec.rb
View file @
ac1a9551
...
@@ -9,6 +9,7 @@ module Pod
...
@@ -9,6 +9,7 @@ module Pod
}
}
dep
=
Dependency
.
new
(
'Reachability'
,
params
)
dep
=
Dependency
.
new
(
'Reachability'
,
params
)
@subject
=
ExternalSources
.
from_dependency
(
dep
,
nil
,
true
)
@subject
=
ExternalSources
.
from_dependency
(
dep
,
nil
,
true
)
config
.
sandbox
.
specifications_root
.
mkpath
end
end
it
'creates a copy of the podspec'
do
it
'creates a copy of the podspec'
do
...
...
spec/unit/external_sources/path_source_spec.rb
View file @
ac1a9551
...
@@ -7,6 +7,7 @@ module Pod
...
@@ -7,6 +7,7 @@ module Pod
dependency
=
Dependency
.
new
(
'Reachability'
,
params
)
dependency
=
Dependency
.
new
(
'Reachability'
,
params
)
podfile_path
=
fixture
(
'integration/Podfile'
)
podfile_path
=
fixture
(
'integration/Podfile'
)
@subject
=
ExternalSources
.
from_dependency
(
dependency
,
podfile_path
,
true
)
@subject
=
ExternalSources
.
from_dependency
(
dependency
,
podfile_path
,
true
)
config
.
sandbox
.
specifications_root
.
mkpath
end
end
it
'creates a copy of the podspec'
do
it
'creates a copy of the podspec'
do
...
...
spec/unit/external_sources/podspec_source_spec.rb
View file @
ac1a9551
...
@@ -11,6 +11,7 @@ module Pod
...
@@ -11,6 +11,7 @@ module Pod
end
end
it
'creates a copy of the podspec'
do
it
'creates a copy of the podspec'
do
config
.
sandbox
.
specifications_root
.
mkpath
@subject
.
fetch
(
config
.
sandbox
)
@subject
.
fetch
(
config
.
sandbox
)
path
=
config
.
sandbox
.
specifications_root
+
'Reachability.podspec.json'
path
=
config
.
sandbox
.
specifications_root
+
'Reachability.podspec.json'
path
.
should
.
exist?
path
.
should
.
exist?
...
...
spec/unit/installer/xcode/target_validator_spec.rb
View file @
ac1a9551
...
@@ -22,6 +22,7 @@ module Pod
...
@@ -22,6 +22,7 @@ module Pod
options
.
integrate_targets
=
integrate_targets
options
.
integrate_targets
=
integrate_targets
end
end
sandbox
.
specifications_root
.
mkpath
@analyzer
=
Analyzer
.
new
(
sandbox
,
podfile
,
lockfile
).
tap
do
|
analyzer
|
@analyzer
=
Analyzer
.
new
(
sandbox
,
podfile
,
lockfile
).
tap
do
|
analyzer
|
analyzer
.
installation_options
=
installation_options
analyzer
.
installation_options
=
installation_options
end
end
...
...
spec/unit/sandbox_spec.rb
View file @
ac1a9551
...
@@ -38,6 +38,7 @@ module Pod
...
@@ -38,6 +38,7 @@ module Pod
it
'cleans any trace of the Pod with the given name'
do
it
'cleans any trace of the Pod with the given name'
do
pod_root
=
@sandbox
.
pod_dir
(
'BananaLib'
)
pod_root
=
@sandbox
.
pod_dir
(
'BananaLib'
)
pod_root
.
mkpath
pod_root
.
mkpath
@sandbox
.
specifications_root
.
mkpath
@sandbox
.
store_podspec
(
'BananaLib'
,
fixture
(
'banana-lib/BananaLib.podspec'
))
@sandbox
.
store_podspec
(
'BananaLib'
,
fixture
(
'banana-lib/BananaLib.podspec'
))
specification_path
=
@sandbox
.
specification_path
(
'BananaLib'
)
specification_path
=
@sandbox
.
specification_path
(
'BananaLib'
)
@sandbox
.
clean_pod
(
'BananaLib'
)
@sandbox
.
clean_pod
(
'BananaLib'
)
...
@@ -93,8 +94,12 @@ module Pod
...
@@ -93,8 +94,12 @@ module Pod
#-------------------------------------------------------------------------#
#-------------------------------------------------------------------------#
describe
'Specification store'
do
describe
'Specification store'
do
before
do
# This is normally done in #prepare
@sandbox
.
specifications_root
.
mkdir
end
it
'loads the stored specification with the given name'
do
it
'loads the stored specification with the given name'
do
(
@sandbox
.
specifications_root
).
mkdir
FileUtils
.
cp
(
fixture
(
'banana-lib/BananaLib.podspec'
),
@sandbox
.
specifications_root
)
FileUtils
.
cp
(
fixture
(
'banana-lib/BananaLib.podspec'
),
@sandbox
.
specifications_root
)
@sandbox
.
specification
(
'BananaLib'
).
name
.
should
==
'BananaLib'
@sandbox
.
specification
(
'BananaLib'
).
name
.
should
==
'BananaLib'
end
end
...
@@ -121,7 +126,6 @@ module Pod
...
@@ -121,7 +126,6 @@ module Pod
end
end
it
"returns the path to a spec file in the 'Local Podspecs' dir"
do
it
"returns the path to a spec file in the 'Local Podspecs' dir"
do
(
@sandbox
.
root
+
'Local Podspecs'
).
mkdir
FileUtils
.
cp
(
fixture
(
'banana-lib/BananaLib.podspec'
),
@sandbox
.
root
+
'Local Podspecs'
)
FileUtils
.
cp
(
fixture
(
'banana-lib/BananaLib.podspec'
),
@sandbox
.
root
+
'Local Podspecs'
)
@sandbox
.
specification_path
(
'BananaLib'
).
should
==
@sandbox
.
specification_path
(
'BananaLib'
).
should
==
@sandbox
.
root
+
'Local Podspecs/BananaLib.podspec'
@sandbox
.
root
+
'Local Podspecs/BananaLib.podspec'
...
...
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