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
4a6e1e1c
Commit
4a6e1e1c
authored
Apr 28, 2015
by
Samuel E. Giddins
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3464 from CocoaPods/mr-cache-prepare-command
[Cache] Run the prepare_command before cleaning
parents
6cc8ec58
b725ef35
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
91 additions
and
29 deletions
+91
-29
CHANGELOG.md
CHANGELOG.md
+6
-0
cache.rb
lib/cocoapods/downloader/cache.rb
+1
-0
installer.rb
lib/cocoapods/installer.rb
+1
-0
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+1
-24
pod_source_preparer.rb
lib/cocoapods/installer/pod_source_preparer.rb
+70
-0
cocoapods-integration-specs
spec/cocoapods-integration-specs
+1
-1
integration.rb
spec/integration.rb
+9
-2
pod_source_installer_spec.rb
spec/unit/installer/pod_source_installer_spec.rb
+2
-2
No files found.
CHANGELOG.md
View file @
4a6e1e1c
...
@@ -41,6 +41,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
...
@@ -41,6 +41,12 @@ To install release candidates run `[sudo] gem install cocoapods --pre`
[
Boris Bügling
](
https://github.com/neonichu
)
[
Boris Bügling
](
https://github.com/neonichu
)
[
#3106
](
https://github.com/CocoaPods/CocoaPods/issues/3106
)
[
#3106
](
https://github.com/CocoaPods/CocoaPods/issues/3106
)
*
Run a pod's
`prepare_command`
(if it has one) before it is cleaned in the
download cache.
[
Marius Rackwitz
](
https://github.com/mrackwitz
)
[
Samuel Giddins
](
https://github.com/segiddins
)
[
#3436
](
https://github.com/CocoaPods/CocoaPods/issues/3436
)
## 0.37.0.beta.1
## 0.37.0.beta.1
...
...
lib/cocoapods/downloader/cache.rb
View file @
4a6e1e1c
...
@@ -188,6 +188,7 @@ module Pod
...
@@ -188,6 +188,7 @@ module Pod
end
end
destination
.
parent
.
mkpath
destination
.
parent
.
mkpath
FileUtils
.
cp_r
(
source
,
destination
)
FileUtils
.
cp_r
(
source
,
destination
)
Pod
::
Installer
::
PodSourcePreparer
.
new
(
spec
,
destination
).
prepare!
Sandbox
::
PodDirCleaner
.
new
(
destination
,
specs_by_platform
).
clean!
Sandbox
::
PodDirCleaner
.
new
(
destination
,
specs_by_platform
).
clean!
end
end
...
...
lib/cocoapods/installer.rb
View file @
4a6e1e1c
...
@@ -34,6 +34,7 @@ module Pod
...
@@ -34,6 +34,7 @@ module Pod
autoload
:HooksContext
,
'cocoapods/installer/hooks_context'
autoload
:HooksContext
,
'cocoapods/installer/hooks_context'
autoload
:Migrator
,
'cocoapods/installer/migrator'
autoload
:Migrator
,
'cocoapods/installer/migrator'
autoload
:PodSourceInstaller
,
'cocoapods/installer/pod_source_installer'
autoload
:PodSourceInstaller
,
'cocoapods/installer/pod_source_installer'
autoload
:PodSourcePreparer
,
'cocoapods/installer/pod_source_preparer'
autoload
:PodTargetInstaller
,
'cocoapods/installer/target_installer/pod_target_installer'
autoload
:PodTargetInstaller
,
'cocoapods/installer/target_installer/pod_target_installer'
autoload
:TargetInstaller
,
'cocoapods/installer/target_installer'
autoload
:TargetInstaller
,
'cocoapods/installer/target_installer'
autoload
:UserProjectIntegrator
,
'cocoapods/installer/user_project_integrator'
autoload
:UserProjectIntegrator
,
'cocoapods/installer/user_project_integrator'
...
...
lib/cocoapods/installer/pod_source_installer.rb
View file @
4a6e1e1c
...
@@ -43,7 +43,7 @@ module Pod
...
@@ -43,7 +43,7 @@ module Pod
#
#
def
install!
def
install!
download_source
unless
predownloaded?
||
local?
download_source
unless
predownloaded?
||
local?
run_prepare_command
PodSourcePreparer
.
new
(
root_spec
,
root
).
prepare!
if
local?
lock_files!
lock_files!
end
end
...
@@ -109,29 +109,6 @@ module Pod
...
@@ -109,29 +109,6 @@ module Pod
end
end
end
end
extend
Executable
executable
:bash
# Runs the prepare command bash script of the spec.
#
# @note Unsets the `CDPATH` env variable before running the
# shell script to avoid issues with relative paths
# (issue #1694).
#
# @return [void]
#
def
run_prepare_command
return
unless
root_spec
.
prepare_command
UI
.
section
(
' > Running prepare command'
,
''
,
1
)
do
Dir
.
chdir
(
root
)
do
ENV
.
delete
(
'CDPATH'
)
prepare_command
=
root_spec
.
prepare_command
.
strip_heredoc
.
chomp
full_command
=
"
\n
set -e
\n
"
+
prepare_command
bash!
(
'-c'
,
full_command
)
end
end
end
# Removes all the files not needed for the installation according to the
# Removes all the files not needed for the installation according to the
# specs by platform.
# specs by platform.
#
#
...
...
lib/cocoapods/installer/pod_source_preparer.rb
0 → 100644
View file @
4a6e1e1c
module
Pod
class
Installer
# Controller class responsible of executing the prepare command
# of a single Pod.
#
class
PodSourcePreparer
# @return [Specification] the root specification of the Pod.
#
attr_reader
:spec
# @return [Pathname] the folder where the source of the Pod is located.
#
attr_reader
:path
# @param [Specification] spec the root specification of the Pod.
# @param [Pathname] path the folder where the source of the Pod is located.
#
def
initialize
(
spec
,
path
)
raise
"Given spec isn't a root spec, but must be."
unless
spec
.
root?
@spec
=
spec
@path
=
path
end
#-----------------------------------------------------------------------#
public
# @!group Preparation
# Executes the prepare command if there is one.
#
# @return [void]
#
def
prepare!
run_prepare_command
end
#-----------------------------------------------------------------------#
private
# @!group Preparation Steps
extend
Executable
executable
:bash
# Runs the prepare command bash script of the spec.
#
# @note Unsets the `CDPATH` env variable before running the
# shell script to avoid issues with relative paths
# (issue #1694).
#
# @return [void]
#
def
run_prepare_command
return
unless
spec
.
prepare_command
UI
.
section
(
' > Running prepare command'
,
''
,
1
)
do
Dir
.
chdir
(
path
)
do
ENV
.
delete
(
'CDPATH'
)
prepare_command
=
spec
.
prepare_command
.
strip_heredoc
.
chomp
full_command
=
"
\n
set -e
\n
"
+
prepare_command
bash!
(
'-c'
,
full_command
)
end
end
end
#-----------------------------------------------------------------------#
end
end
end
cocoapods-integration-specs
@
e47491f7
Subproject commit
c304744bab51c323cbe9a07d54900b3a372adfdc
Subproject commit
e47491f7c98ccb6eaabb110740556bbb60ce6d6a
spec/integration.rb
View file @
4a6e1e1c
...
@@ -84,8 +84,7 @@ CLIntegracon.configure do |c|
...
@@ -84,8 +84,7 @@ CLIntegracon.configure do |c|
c
.
ignores
%r{/xcuserdata/}
c
.
ignores
%r{/xcuserdata/}
# Needed for some test cases
# Needed for some test cases
c
.
ignores
'Reachability.podspec'
c
.
ignores
'*.podspec'
c
.
ignores
'Moment.podspec'
c
.
ignores
'PodTest-hg-source/**'
c
.
ignores
'PodTest-hg-source/**'
c
.
hook_into
:bacon
c
.
hook_into
:bacon
...
@@ -245,6 +244,14 @@ describe_cli 'pod' do
...
@@ -245,6 +244,14 @@ describe_cli 'pod' do
#--------------------------------------#
#--------------------------------------#
describe
'Pod lint'
do
describe
'Pod lint'
do
describe
'Lints a Pod from source with a prepare_command'
do
# We have to disable verbose mode by adding --no-verbose here,
# otherwise xcodebuild output is included in execution output.
behaves_like
cli_spec
'lib_lint_with_prepare_command'
,
'lib lint'
,
'--no-verbose'
end
describe
'Lints a Pod'
do
describe
'Lints a Pod'
do
behaves_like
cli_spec
'spec_lint'
,
behaves_like
cli_spec
'spec_lint'
,
'spec lint --quick'
'spec lint --quick'
...
...
spec/unit/installer/pod_source_installer_spec.rb
View file @
4a6e1e1c
...
@@ -67,12 +67,12 @@ module Pod
...
@@ -67,12 +67,12 @@ module Pod
describe
'Prepare command'
do
describe
'Prepare command'
do
it
'runs the prepare command if one has been declared in the spec'
do
it
'runs the prepare command if one has been declared in the spec'
do
@spec
.
prepare_command
=
'echo test'
@spec
.
prepare_command
=
'echo test'
@installer
.
expects
(
:bash!
).
once
Installer
::
PodSourcePreparer
.
any_instance
.
expects
(
:bash!
).
once
@installer
.
install!
@installer
.
install!
end
end
it
"doesn't run the prepare command if it hasn't been declared in the spec"
do
it
"doesn't run the prepare command if it hasn't been declared in the spec"
do
@installer
.
expects
(
:bash!
).
never
Installer
::
PodSourcePreparer
.
any_instance
.
expects
(
:bash!
).
never
@installer
.
install!
@installer
.
install!
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