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
613db0bc
Commit
613db0bc
authored
Mar 20, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'setup-push'
* setup-push: [#112] Introduced --push option for setup command
parents
194de448
a4036386
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
4 deletions
+45
-4
command.rb
lib/cocoapods/command.rb
+2
-0
repo.rb
lib/cocoapods/command/repo.rb
+8
-1
setup.rb
lib/cocoapods/command/setup.rb
+35
-3
No files found.
lib/cocoapods/command.rb
View file @
613db0bc
...
...
@@ -8,6 +8,8 @@ module Pod
autoload
:Setup
,
'cocoapods/command/setup'
autoload
:Spec
,
'cocoapods/command/spec'
attr_accessor
:output
class
Help
<
Informative
def
initialize
(
command_class
,
argv
)
@command_class
,
@argv
=
command_class
,
argv
...
...
lib/cocoapods/command/repo.rb
View file @
613db0bc
...
...
@@ -30,7 +30,7 @@ module Pod
unless
(
@name
=
argv
.
arguments
[
1
])
&&
(
@url
=
argv
.
arguments
[
2
])
raise
Informative
,
"
#{
@action
==
'add'
?
'Adding'
:
'Updating the remote of'
}
a repo needs a `name' and a `url'."
end
when
'update'
when
'update'
,
'read-url'
@name
=
argv
.
arguments
[
1
]
else
super
...
...
@@ -64,6 +64,13 @@ module Pod
git
(
"remote set-url origin '
#{
@url
}
'"
)
end
end
def
read_url
Dir
.
chdir
(
dir
)
do
@output
=
git
(
"remote -v"
)
end
end
end
end
end
...
...
lib/cocoapods/command/setup.rb
View file @
613db0bc
...
...
@@ -14,20 +14,52 @@ module Pod
If the clone already exists, it will ensure that it is up-to-date.}
end
def
self
.
options
" --push Use this option to enable push access once granted
\n
"
+
super
end
def
initialize
(
argv
)
@push_access
=
argv
.
option
(
'--push'
)
||
already_push?
puts
"Setup with push access"
if
@push_access
&&
!
config
.
silent
super
unless
argv
.
empty?
end
def
already_push?
if
master_repo_exists?
read_master_repo_remote_command
.
run
read_master_repo_remote_command
.
output
.
include?
master_repo_url_with_push
else
false
end
end
def
master_repo_exists?
(
config
.
repos_dir
+
'master'
).
exist?
end
def
master_repo_url
'git://github.com/CocoaPods/Specs.git'
end
def
master_repo_url_with_push
'git@github.com:CocoaPods/Specs.git'
end
def
repo_url
@push_access
?
master_repo_url_with_push
:
master_repo_url
end
def
add_master_repo_command
@command
||=
Repo
.
new
(
ARGV
.
new
([
'add'
,
'master'
,
master_repo_url
]))
@command
||=
Repo
.
new
(
ARGV
.
new
([
'add'
,
'master'
,
repo_url
]))
end
def
read_master_repo_remote_command
@read_command
||=
Repo
.
new
(
ARGV
.
new
([
'read-url'
,
'master'
]))
end
def
update_master_repo_remote_command
Repo
.
new
(
ARGV
.
new
([
'set-url'
,
'master'
,
master_
repo_url
]))
Repo
.
new
(
ARGV
.
new
([
'set-url'
,
'master'
,
repo_url
]))
end
def
update_master_repo_command
...
...
@@ -35,7 +67,7 @@ module Pod
end
def
run
if
(
config
.
repos_dir
+
'master'
).
exist
?
if
master_repo_exists
?
update_master_repo_remote_command
.
run
update_master_repo_command
.
run
else
...
...
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