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
3d0d6edd
Commit
3d0d6edd
authored
Jul 31, 2013
by
Ian Ynda-Hummel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a test for migrating repos to new repo dir.
parent
c4641c52
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
42 additions
and
2 deletions
+42
-2
config.rb
lib/cocoapods/config.rb
+2
-0
setup_spec.rb
spec/functional/command/setup_spec.rb
+22
-0
temporary_repos.rb
spec/spec_helper/temporary_repos.rb
+18
-2
No files found.
lib/cocoapods/config.rb
View file @
3d0d6edd
...
@@ -154,6 +154,8 @@ module Pod
...
@@ -154,6 +154,8 @@ module Pod
@old_repos_dir
||=
Pathname
.
new
(
'~/.cocoapods'
).
expand_path
@old_repos_dir
||=
Pathname
.
new
(
'~/.cocoapods'
).
expand_path
end
end
attr_writer
:old_repos_dir
# @return [Pathname] the root of the CocoaPods installation where the
# @return [Pathname] the root of the CocoaPods installation where the
# Podfile is located.
# Podfile is located.
#
#
...
...
spec/functional/command/setup_spec.rb
View file @
3d0d6edd
...
@@ -25,6 +25,7 @@ module Pod
...
@@ -25,6 +25,7 @@ module Pod
set_up_test_repo
set_up_test_repo
Command
::
Setup
.
any_instance
.
stubs
(
:read_only_url
).
returns
(
test_repo_path
.
to_s
)
Command
::
Setup
.
any_instance
.
stubs
(
:read_only_url
).
returns
(
test_repo_path
.
to_s
)
config
.
repos_dir
=
SpecHelper
.
temporary_directory
config
.
repos_dir
=
SpecHelper
.
temporary_directory
config
.
old_repos_dir
=
SpecHelper
.
temporary_directory
+
'..'
end
end
it
"runs with correct parameters"
do
it
"runs with correct parameters"
do
...
@@ -45,5 +46,26 @@ module Pod
...
@@ -45,5 +46,26 @@ module Pod
Dir
.
chdir
(
config
.
repos_dir
+
'master'
)
{
`git remote set-url origin git@github.com:CocoaPods/Specs.git`
}
Dir
.
chdir
(
config
.
repos_dir
+
'master'
)
{
`git remote set-url origin git@github.com:CocoaPods/Specs.git`
}
command
(
'setup'
).
url
.
should
==
'git@github.com:CocoaPods/Specs.git'
command
(
'setup'
).
url
.
should
==
'git@github.com:CocoaPods/Specs.git'
end
end
before
do
FileUtils
.
rm_rf
(
test_repo_path
)
set_up_old_test_repo
config
.
repos_dir
=
SpecHelper
.
temporary_directory
+
'cocoapods/repos'
config
.
old_repos_dir
=
SpecHelper
.
temporary_directory
+
'cocoapods'
end
it
"migrates repos from the old directory structure to the new one"
do
source
=
config
.
old_repos_dir
+
'master'
target
=
config
.
repos_dir
+
'master'
source
.
should
.
exist?
target
.
should
.
not
.
exist?
output
=
run_command
(
'setup'
)
source
.
should
.
not
.
exist?
target
.
should
.
exist?
end
end
end
end
end
spec/spec_helper/temporary_repos.rb
View file @
3d0d6edd
...
@@ -45,7 +45,7 @@ module SpecHelper
...
@@ -45,7 +45,7 @@ module SpecHelper
repo_path
(
'master'
)
repo_path
(
'master'
)
end
end
# Sets up a lighweight master repo in `tmp/cocoapods/master` with the
# Sets up a lighweight master repo in `tmp/cocoapods/
repos/
master` with the
# contents of `spec/fixtures/spec-repos/test_repo`.
# contents of `spec/fixtures/spec-repos/test_repo`.
#
#
def
set_up_test_repo
def
set_up_test_repo
...
@@ -57,10 +57,26 @@ module SpecHelper
...
@@ -57,10 +57,26 @@ module SpecHelper
repo_make
(
'master'
)
repo_make
(
'master'
)
end
end
def
test_old_repo_path
repo_path
(
'../master'
)
end
# Sets up a lighweight master repo in `tmp/cocoapods/master` with the
# contents of `spec/fixtures/spec-repos/test_repo`.
#
def
set_up_old_test_repo
require
'fileutils'
test_old_repo_path
.
mkpath
origin
=
ROOT
+
'spec/fixtures/spec-repos/test_repo/.'
destination
=
tmp_repos_path
+
'../master'
FileUtils
.
cp_r
(
origin
,
destination
)
repo_make
(
'../master'
)
end
#--------------------------------------#
#--------------------------------------#
def
tmp_repos_path
def
tmp_repos_path
SpecHelper
.
temporary_directory
+
'cocoapods/
master
'
SpecHelper
.
temporary_directory
+
'cocoapods/
repos
'
end
end
module_function
:tmp_repos_path
module_function
:tmp_repos_path
...
...
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