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
51e74ff3
Commit
51e74ff3
authored
Jun 18, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add Pod lib command #850
Tests are still missing.
parent
efdedaa6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
159 additions
and
9 deletions
+159
-9
Gemfile.lock
Gemfile.lock
+1
-1
command.rb
lib/cocoapods/command.rb
+4
-3
lib.rb
lib/cocoapods/command/lib.rb
+152
-0
search.rb
lib/cocoapods/command/search.rb
+1
-1
spec.rb
lib/cocoapods/command/spec.rb
+0
-3
validator.rb
lib/cocoapods/validator.rb
+1
-1
No files found.
Gemfile.lock
View file @
51e74ff3
...
...
@@ -17,7 +17,7 @@ GIT
GIT
remote: https://github.com/CocoaPods/Xcodeproj.git
revision:
0571050275fa11c7bb0ad50bd7945624c1d45111
revision:
fd27b6217686358aea5250f006b10ed73d4726e5
branch: master
specs:
xcodeproj (0.6.0)
...
...
lib/cocoapods/command.rb
View file @
51e74ff3
...
...
@@ -8,17 +8,18 @@ module Pod
class
Command
<
CLAide
::
Command
require
'cocoapods/command/help'
require
'cocoapods/command/inter_process_communication'
require
'cocoapods/command/lib'
require
'cocoapods/command/list'
require
'cocoapods/command/outdated'
require
'cocoapods/command/podfile_info'
require
'cocoapods/command/project'
require
'cocoapods/command/push'
require
'cocoapods/command/repo'
require
'cocoapods/command/search'
require
'cocoapods/command/setup'
require
'cocoapods/command/spec'
require
'cocoapods/command/help'
require
'cocoapods/command/inter_process_communication'
require
'cocoapods/command/podfile_info'
self
.
abstract_command
=
true
self
.
default_subcommand
=
'install'
...
...
lib/cocoapods/command/lib.rb
0 → 100644
View file @
51e74ff3
module
Pod
class
Command
class
Lib
<
Command
self
.
abstract_command
=
true
self
.
summary
=
'Develop pods'
#-----------------------------------------------------------------------#
class
Create
<
Lib
self
.
summary
=
'Creates a new Pod'
self
.
description
=
<<-
DESC
Creates a new Pod with the given name from the template in the working directory.
DESC
self
.
arguments
=
'[NAME]'
def
initialize
(
argv
)
@name
=
argv
.
shift_argument
super
end
def
validate!
super
help!
"A name for the Pod is required."
unless
@name
end
def
run
clone_template
configure_template
print_info
end
private
#----------------------------------------#
# !@group Private helpers
extend
Executable
executable
:git
executable
:ruby
TEMPLATE_REPO
=
"/Users/fabio/Projects/CP/pod-template"
TEMPLATE_INFO_URL
=
"/Users/fabio/Projects/CP/pod-template"
# Clones the template from the remote in the working directory using
# the name of the Pod.
#
# @return [void]
#
def
clone_template
UI
.
section
(
"Creating `
#{
@name
}
` Pod"
)
do
git!
"clone '
#{
TEMPLATE_REPO
}
'
#{
@name
}
"
end
end
# Runs the template configuration utilities.
#
# @return [void]
#
def
configure_template
UI
.
section
(
"Configuring template"
)
do
Dir
.
chdir
(
@name
)
do
ruby!
"_CONFIGURE.rb
#{
@name
}
"
end
end
end
# Runs the template configuration utilities.
#
# @return [void]
#
def
print_info
UI
.
puts
"
\n
To learn more about the template see `
#{
TEMPLATE_INFO_URL
}
`."
end
end
#-----------------------------------------------------------------------#
class
Lint
<
Lib
self
.
summary
=
'Validates a Pod'
self
.
description
=
<<-
DESC
Validates the Pod using the files in the working directory.
DESC
def
self
.
options
[
[
"--quick"
,
"Lint skips checks that would require to download and build the spec"
],
[
"--only-errors"
,
"Lint validates even if warnings are present"
],
[
"--no-clean"
,
"Lint leaves the build directory intact for inspection"
]
].
concat
(
super
)
end
def
initialize
(
argv
)
@quick
=
argv
.
flag?
(
'quick'
)
@only_errors
=
argv
.
flag?
(
'only-errors'
)
@clean
=
argv
.
flag?
(
'clean'
,
true
)
super
end
def
validate!
super
end
def
run
UI
.
puts
validator
=
Validator
.
new
(
podspec_to_lint
)
validator
.
local
=
true
validator
.
quick
=
@quick
validator
.
no_clean
=
!
@clean
validator
.
only_errors
=
@only_errors
validator
.
validate
if
validator
.
validated?
UI
.
puts
"
#{
validator
.
spec
.
name
}
passed validation."
.
green
else
raise
Informative
,
"
#{
validator
.
spec
.
name
}
did not pass validation."
end
unless
@clean
UI
.
puts
"Pods project available at `
#{
validator
.
validation_dir
}
/Pods/Pods.xcodeproj` for inspection."
UI
.
puts
end
end
private
#----------------------------------------#
# !@group Private helpers
# @return [Pathname] The path of the podspec found in the current
# working directory.
#
# @raise If no podspec is found.
# @raise If multiple podspecs are found.
#
def
podspec_to_lint
podspecs
=
Pathname
.
glob
(
Pathname
.
pwd
+
'*.podspec{.yaml,}'
)
raise
Informative
,
"Unable to find a podspec in the working directory"
if
podspecs
.
count
.
zero?
raise
Informative
,
"Multiple podspecs detected in the working directory"
if
podspecs
.
count
>
1
podspecs
.
first
end
end
#-----------------------------------------------------------------------#
end
end
end
lib/cocoapods/command/search.rb
View file @
51e74ff3
module
Pod
class
Command
class
Search
<
Command
self
.
summary
=
'Search pods'
self
.
summary
=
'Search
es for
pods'
self
.
description
=
<<-
DESC
Searches for pods, ignoring case, whose name matches `QUERY'. If the
...
...
lib/cocoapods/command/spec.rb
View file @
51e74ff3
...
...
@@ -60,14 +60,12 @@ module Pod
def
self
.
options
[
[
"--quick"
,
"Lint skips checks that would require to download and build the spec"
],
[
"--local"
,
"Lint a podspec against the local files contained in its directory"
],
[
"--only-errors"
,
"Lint validates even if warnings are present"
],
[
"--no-clean"
,
"Lint leaves the build directory intact for inspection"
]
].
concat
(
super
)
end
def
initialize
(
argv
)
@quick
=
argv
.
flag?
(
'quick'
)
@local
=
argv
.
flag?
(
'local'
)
@only_errors
=
argv
.
flag?
(
'only-errors'
)
@clean
=
argv
.
flag?
(
'clean'
,
true
)
@podspecs_paths
=
argv
.
arguments!
...
...
@@ -80,7 +78,6 @@ module Pod
podspecs_to_lint
.
each
do
|
podspec
|
validator
=
Validator
.
new
(
podspec
)
validator
.
quick
=
@quick
validator
.
local
=
@local
validator
.
no_clean
=
!
@clean
validator
.
only_errors
=
@only_errors
validator
.
validate
...
...
lib/cocoapods/validator.rb
View file @
51e74ff3
...
...
@@ -305,7 +305,7 @@ module Pod
podfile
=
Pod
::
Podfile
.
new
do
platform
(
platform_name
,
deployment_target
)
if
(
local
)
pod
name
,
:
local
=>
podspec
.
dirname
.
to_s
pod
name
,
:
path
=>
podspec
.
dirname
.
to_s
else
pod
name
,
:podspec
=>
podspec
.
to_s
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