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
0478e8bf
Commit
0478e8bf
authored
Jul 30, 2013
by
Ian Ynda-Hummel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Migrate existing repos when running setup.
parent
43d71e2e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
34 additions
and
0 deletions
+34
-0
setup.rb
lib/cocoapods/command/setup.rb
+25
-0
config.rb
lib/cocoapods/config.rb
+4
-0
sources_manager.rb
lib/cocoapods/sources_manager.rb
+5
-0
No files found.
lib/cocoapods/command/setup.rb
View file @
0478e8bf
require
'fileutils'
module
Pod
class
Command
class
Setup
<
Command
...
...
@@ -30,6 +32,8 @@ module Pod
set_master_repo_url
set_master_repo_branch
update_master_repo
elsif
old_master_repo_dir
.
exist?
migrate_repos
else
add_master_repo
end
...
...
@@ -43,6 +47,21 @@ module Pod
# @!group Setup steps
# Migrates any repos from the old directory structure to the new directory
# structure.
#
# @return [void]
def
migrate_repos
config
.
repos_dir
.
mkpath
Dir
.
foreach
config
.
old_repos_dir
do
|
repo_dir
|
source_repo_dir
=
config
.
old_repos_dir
+
repo_dir
target_repo_dir
=
config
.
repos_dir
+
repo_dir
if
not
repo_dir
=~
/\.+/
and
source_repo_dir
!=
config
.
repos_dir
FileUtils
.
mv
source_repo_dir
,
target_repo_dir
end
end
end
# Sets the url of the master repo according to whether it is push.
#
# @return [void]
...
...
@@ -129,6 +148,12 @@ module Pod
def
master_repo_dir
SourcesManager
.
master_repo_dir
end
# @return [Pathname] the directory of the old master repo.
#
def
old_master_repo_dir
SourcesManager
.
old_master_repo_dir
end
end
end
end
lib/cocoapods/config.rb
View file @
0478e8bf
...
...
@@ -146,6 +146,10 @@ module Pod
attr_writer
:repos_dir
def
old_repos_dir
@old_repos_dir
||=
Pathname
.
new
(
'~/.cocoapods'
).
expand_path
end
# @return [Pathname] the root of the CocoaPods installation where the
# Podfile is located.
#
...
...
lib/cocoapods/sources_manager.rb
View file @
0478e8bf
...
...
@@ -259,6 +259,11 @@ module Pod
config
.
repos_dir
+
'master'
end
# @return [Pathname] The path of the old master repo.
def
old_master_repo_dir
config
.
old_repos_dir
+
'master'
end
# @return [Bool] Checks if the master repo is usable.
#
# @note Note this is used to automatically setup the master repo if
...
...
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