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
d7506754
Commit
d7506754
authored
Sep 13, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
More work on help system.
parent
422cc7eb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
39 additions
and
29 deletions
+39
-29
command.rb
lib/cocoa_pods/command.rb
+17
-8
install.rb
lib/cocoa_pods/command/install.rb
+4
-4
repo.rb
lib/cocoa_pods/command/repo.rb
+10
-12
setup.rb
lib/cocoa_pods/command/setup.rb
+8
-5
No files found.
lib/cocoa_pods/command.rb
View file @
d7506754
...
@@ -5,7 +5,7 @@ module Pod
...
@@ -5,7 +5,7 @@ module Pod
autoload
:Setup
,
'cocoa_pods/command/setup'
autoload
:Setup
,
'cocoa_pods/command/setup'
autoload
:Spec
,
'cocoa_pods/command/spec'
autoload
:Spec
,
'cocoa_pods/command/spec'
class
Help
class
Help
<
Exception
def
initialize
(
command_class
,
argv
)
def
initialize
(
command_class
,
argv
)
@command_class
,
@argv
=
command_class
,
argv
@command_class
,
@argv
=
command_class
,
argv
end
end
...
@@ -20,6 +20,13 @@ module Pod
...
@@ -20,6 +20,13 @@ module Pod
end
end
end
end
class
ARGV
<
Array
def
options
;
select
{
|
x
|
x
[
0
,
1
]
==
'-'
};
end
def
arguments
;
self
-
options
;
end
def
option
(
name
);
!!
delete
(
name
);
end
def
shift_argument
;
(
arg
=
arguments
[
0
])
&&
delete
(
arg
);
end
end
def
self
.
banner
def
self
.
banner
"### Commands
\n
"
+
"### Commands
\n
"
+
"
\n
"
+
"
\n
"
+
...
@@ -35,11 +42,11 @@ module Pod
...
@@ -35,11 +42,11 @@ module Pod
end
end
def
self
.
parse
(
*
argv
)
def
self
.
parse
(
*
argv
)
argv
=
argv
.
dup
argv
=
ARGV
.
new
(
argv
)
show_help
=
argv
.
delete
(
'--help'
)
show_help
=
argv
.
option
(
'--help'
)
Config
.
instance
.
verbose
=
!!
argv
.
delete
(
'--verbose'
)
Config
.
instance
.
verbose
=
argv
.
option
(
'--verbose'
)
command_class
=
case
argv
.
shift
command_class
=
case
argv
.
shift
_argument
when
'install'
then
Install
when
'install'
then
Install
when
'repo'
then
Repo
when
'repo'
then
Repo
when
'setup'
then
Setup
when
'setup'
then
Setup
...
@@ -49,14 +56,16 @@ module Pod
...
@@ -49,14 +56,16 @@ module Pod
if
show_help
||
command_class
.
nil?
if
show_help
||
command_class
.
nil?
Help
.
new
(
command_class
||
self
,
argv
)
Help
.
new
(
command_class
||
self
,
argv
)
else
else
command_class
.
new
(
*
argv
)
command_class
.
new
(
argv
)
end
end
rescue
Help
=>
help
return
help
end
end
include
Config
::
Mixin
include
Config
::
Mixin
def
initialize
(
*
argv
)
def
initialize
(
argv
)
raise
ArgumentError
,
"unknown argument(s):
#{
argv
.
join
(
', '
)
}
"
unless
argv
.
empty?
raise
Help
.
new
(
self
.
class
,
argv
)
end
end
end
end
end
end
lib/cocoa_pods/command/install.rb
View file @
d7506754
...
@@ -18,12 +18,12 @@ module Pod
...
@@ -18,12 +18,12 @@ module Pod
super
super
end
end
def
initialize
(
*
argv
)
def
initialize
(
argv
)
config
.
clean
=
!
argv
.
delete
(
'--no-clean'
)
config
.
clean
=
!
argv
.
option
(
'--no-clean'
)
if
podspec
=
argv
.
shift
if
podspec
=
argv
.
shift
_argument
@podspec
=
Pathname
.
new
(
podspec
)
@podspec
=
Pathname
.
new
(
podspec
)
end
end
super
super
unless
argv
.
empty?
end
end
def
run
def
run
...
...
lib/cocoa_pods/command/repo.rb
View file @
d7506754
...
@@ -26,25 +26,21 @@ module Pod
...
@@ -26,25 +26,21 @@ module Pod
include
Executioner
include
Executioner
executable
:git
executable
:git
def
initialize
(
*
argv
)
def
initialize
(
argv
)
case
@action
=
argv
[
0
]
case
@action
=
argv
.
arguments
[
0
]
when
'add'
when
'add'
unless
(
@name
=
argv
[
1
])
&&
(
@url
=
argv
[
2
])
unless
(
@name
=
argv
[
1
])
&&
(
@url
=
argv
[
2
])
raise
ArgumentError
,
"needs a NAME and URL"
raise
ArgumentError
,
"needs a NAME and URL"
end
end
when
'update'
when
'update'
@name
=
argv
[
1
]
@name
=
argv
[
1
]
when
'cd'
unless
@name
=
argv
[
1
]
raise
ArgumentError
,
"needs a NAME"
end
else
else
super
super
end
end
end
end
def
dir
def
dir
File
.
join
(
config
.
repos_dir
,
@name
)
config
.
repos_dir
+
@name
end
end
def
run
def
run
...
@@ -52,14 +48,16 @@ module Pod
...
@@ -52,14 +48,16 @@ module Pod
end
end
def
add
def
add
FileUtils
.
mkdir_p
(
config
.
repos_dir
)
puts
"==> Cloning spec repo `
#{
@name
}
' from `
#{
@url
}
'"
config
.
repos_dir
.
mkpath
Dir
.
chdir
(
config
.
repos_dir
)
{
git
(
"clone
#{
@url
}
#{
@name
}
"
)
}
Dir
.
chdir
(
config
.
repos_dir
)
{
git
(
"clone
#{
@url
}
#{
@name
}
"
)
}
end
end
def
update
def
update
names
=
@name
?
[
@name
]
:
Dir
.
entries
(
config
.
repos_dir
)[
2
..-
1
]
dirs
=
@name
?
[
dir
]
:
config
.
repos_dir
.
children
names
.
each
do
|
name
|
dirs
.
each
do
|
dir
|
Dir
.
chdir
(
File
.
join
(
config
.
repos_dir
,
name
))
{
git
(
"pull"
)
}
puts
"==> Updating spec repo `
#{
dir
.
basename
}
'"
Dir
.
chdir
(
dir
)
{
git
(
"pull"
)
}
end
end
end
end
end
end
...
...
lib/cocoa_pods/command/setup.rb
View file @
d7506754
...
@@ -4,13 +4,16 @@ module Pod
...
@@ -4,13 +4,16 @@ module Pod
class
Command
class
Command
class
Setup
<
Command
class
Setup
<
Command
def
self
.
banner
def
self
.
banner
%{### Setup
%{### Setup
CocoaPods environment
$ pod
help
setup
$ pod setup
pod setup
Creates a directory at `~/.cocoa-pods' which will hold your spec-repos.
Creates a directory at `~/.cocoa-pods' which will hold your spec-repos.
This is where it will create a clone of the public `master' spec-repo.}
This is where it will create a clone of the public `master' spec-repo.}
end
def
initialize
(
argv
)
super
unless
argv
.
empty?
end
end
def
master_repo_url
def
master_repo_url
...
...
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