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
ac38ef86
Commit
ac38ef86
authored
Dec 03, 2015
by
Samuel Giddins
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Installer] Add specs for deintegrating on major version changes
parent
f4f8e112
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
4 deletions
+36
-4
installer.rb
lib/cocoapods/installer.rb
+2
-2
installer_spec.rb
spec/unit/installer_spec.rb
+34
-2
No files found.
lib/cocoapods/installer.rb
View file @
ac38ef86
...
@@ -494,8 +494,8 @@ module Pod
...
@@ -494,8 +494,8 @@ module Pod
# @return [void]
# @return [void]
#
#
def
deintegrate_if_different_major_version
def
deintegrate_if_different_major_version
return
unless
config
.
lockfile
return
unless
lockfile
return
if
config
.
lockfile
.
cocoapods_version
.
major
==
Version
.
new
(
VERSION
).
major
return
if
lockfile
.
cocoapods_version
.
major
==
Version
.
create
(
VERSION
).
major
UI
.
section
(
'Fully deintegrating due to major version update'
)
do
UI
.
section
(
'Fully deintegrating due to major version update'
)
do
projects
=
Pathname
.
glob
(
config
.
installation_root
+
'*.xcodeproj'
).
map
{
|
path
|
Xcodeproj
::
Project
.
open
(
path
)
}
projects
=
Pathname
.
glob
(
config
.
installation_root
+
'*.xcodeproj'
).
map
{
|
path
|
Xcodeproj
::
Project
.
open
(
path
)
}
deintegrator
=
Deintegrator
.
new
deintegrator
=
Deintegrator
.
new
...
...
spec/unit/installer_spec.rb
View file @
ac38ef86
...
@@ -4,12 +4,12 @@ require 'cocoapods_stats/sender'
...
@@ -4,12 +4,12 @@ require 'cocoapods_stats/sender'
# @return [Lockfile]
# @return [Lockfile]
#
#
def
generate_lockfile
def
generate_lockfile
(
lockfile_version:
Pod
::
VERSION
)
hash
=
{}
hash
=
{}
hash
[
'PODS'
]
=
[]
hash
[
'PODS'
]
=
[]
hash
[
'DEPENDENCIES'
]
=
[]
hash
[
'DEPENDENCIES'
]
=
[]
hash
[
'SPEC CHECKSUMS'
]
=
[]
hash
[
'SPEC CHECKSUMS'
]
=
[]
hash
[
'COCOAPODS'
]
=
Pod
::
VERSION
hash
[
'COCOAPODS'
]
=
lockfile_version
Pod
::
Lockfile
.
new
(
hash
)
Pod
::
Lockfile
.
new
(
hash
)
end
end
...
@@ -177,6 +177,38 @@ module Pod
...
@@ -177,6 +177,38 @@ module Pod
end
.
message
.
should
.
match
/should.*run.*outside.*Pods directory.*Current directory.*\./m
end
.
message
.
should
.
match
/should.*run.*outside.*Pods directory.*Current directory.*\./m
end
end
end
end
describe
'handling CocoaPods version updates'
do
it
'does not deintegrate when there is no lockfile'
do
installer
=
Pod
::
Installer
.
new
(
config
.
sandbox
,
generate_podfile
,
nil
)
UI
.
expects
(
:section
).
never
installer
.
send
(
:deintegrate_if_different_major_version
)
end
it
'does not deintegrate when the major version is the same'
do
VERSION
.
stubs
(
:to_s
).
returns
(
'1.1.0'
)
should_not_deintegrate
=
%w(1.0.0 1.0.1 1.1.0 1.2.2)
should_not_deintegrate
.
each
do
|
version
|
lockfile
=
generate_lockfile
(
:lockfile_version
=>
version
)
installer
=
Pod
::
Installer
.
new
(
config
.
sandbox
,
generate_podfile
,
lockfile
)
Pathname
.
expects
(
:glob
).
never
installer
.
send
(
:deintegrate_if_different_major_version
)
end
end
it
'does deintegrate when the major version is the same'
do
VERSION
.
stubs
(
:to_s
).
returns
(
'1.1.0'
)
should_not_deintegrate
=
%w(0.39.0 2.0.0 10.0-beta)
should_not_deintegrate
.
each
do
|
version
|
lockfile
=
generate_lockfile
(
:lockfile_version
=>
version
)
installer
=
Pod
::
Installer
.
new
(
config
.
sandbox
,
generate_podfile
,
lockfile
)
project
=
fixture
(
'SampleProject/SampleProject.xcodeproj'
)
Pathname
.
expects
(
:glob
).
with
(
config
.
installation_root
+
'*.xcodeproj'
).
returns
([
project
])
Deintegrator
.
any_instance
.
expects
(
:deintegrate_project
)
installer
.
send
(
:deintegrate_if_different_major_version
)
end
end
end
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