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
44f594bf
Commit
44f594bf
authored
Sep 25, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Linter] Support for local option.
parent
a79d0468
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
53 additions
and
14 deletions
+53
-14
CHANGELOG.md
CHANGELOG.md
+3
-2
linter.rb
lib/cocoapods/command/linter.rb
+14
-1
spec.rb
lib/cocoapods/command/spec.rb
+8
-5
dependency.rb
lib/cocoapods/dependency.rb
+2
-1
local_pod.rb
lib/cocoapods/local_pod.rb
+26
-5
No files found.
CHANGELOG.md
View file @
44f594bf
...
@@ -5,12 +5,13 @@
...
@@ -5,12 +5,13 @@
###### Enhancements
###### Enhancements
-
Pod
`install`
will update the specs repo only if needed.
-
Pod
`install`
will update the specs repo only if needed.
[
#533
](
https://github.com/CocoaPods/CocoaPods/issues/533
)
[
#533
](
https://github.com/CocoaPods/CocoaPods/issues/533
)
-
CocoaPods now searches for the highest version of a Pod on
-
CocoaPods now searches for the highest version of a Pod on all the repos.
all the repos.
[
#85
](
https://github.com/CocoaPods/CocoaPods/issues/85
)
[
#85
](
https://github.com/CocoaPods/CocoaPods/issues/85
)
-
Added a pre install hook to the Podfile and to root specifications.
-
Added a pre install hook to the Podfile and to root specifications.
[
#486
](
https://github.com/CocoaPods/CocoaPods/issues/486
)
[
#486
](
https://github.com/CocoaPods/CocoaPods/issues/486
)
-
Support for
`header_mappings_dir`
attribute in subspecs.
-
Support for
`header_mappings_dir`
attribute in subspecs.
-
Added support for linting a Podspec using the files from its folder
`pod spec
lint --local`
-
Refactored UI.
-
Refactored UI.
-
Added support for Podfiles named
`Podfile.cocoapods`
which allows to
-
Added support for Podfiles named
`Podfile.cocoapods`
which allows to
associate an editor application in Mac OS X.
associate an editor application in Mac OS X.
...
...
lib/cocoapods/command/linter.rb
View file @
44f594bf
...
@@ -6,6 +6,14 @@ module Pod
...
@@ -6,6 +6,14 @@ module Pod
# TODO: Add check to ensure that attributes inherited by subspecs are not duplicated ?
# TODO: Add check to ensure that attributes inherited by subspecs are not duplicated ?
attr_accessor
:quick
,
:no_clean
,
:repo_path
attr_accessor
:quick
,
:no_clean
,
:repo_path
# @return [Bool] Wether the lint should be performed against the root of
# the podspec instead to its original source. Uses the `:local` option
# of the Podfile.
#
attr_accessor
:local
alias
:local?
:local
attr_reader
:spec
,
:file
attr_reader
:spec
,
:file
attr_reader
:errors
,
:warnings
,
:notes
attr_reader
:errors
,
:warnings
,
:notes
...
@@ -116,9 +124,14 @@ module Pod
...
@@ -116,9 +124,14 @@ module Pod
name
=
spec
.
name
name
=
spec
.
name
podspec
=
file
.
realpath
.
to_s
podspec
=
file
.
realpath
.
to_s
platform
=
@platform
platform
=
@platform
local
=
local?
podfile
=
Pod
::
Podfile
.
new
do
podfile
=
Pod
::
Podfile
.
new
do
platform
(
platform
.
to_sym
,
platform
.
deployment_target
)
platform
(
platform
.
to_sym
,
platform
.
deployment_target
)
pod
name
,
:podspec
=>
podspec
if
(
local
)
pod
name
,
:local
=>
'/Users/fabio/Desktop/RegexHighlightView'
else
pod
name
,
:podspec
=>
podspec
end
end
end
podfile
podfile
end
end
...
...
lib/cocoapods/command/spec.rb
View file @
44f594bf
...
@@ -20,6 +20,7 @@ module Pod
...
@@ -20,6 +20,7 @@ module Pod
def
self
.
options
def
self
.
options
[
[
"--quick"
,
"Lint skips checks that would require to download and build the spec"
],
[
[
"--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"
],
[
"--only-errors"
,
"Lint validates even if warnings are present"
],
[
"--no-clean"
,
"Lint leaves the build directory intact for inspection"
]
].
concat
(
super
)
[
"--no-clean"
,
"Lint leaves the build directory intact for inspection"
]
].
concat
(
super
)
end
end
...
@@ -32,9 +33,10 @@ module Pod
...
@@ -32,9 +33,10 @@ module Pod
super
if
@name_or_url
.
nil?
super
if
@name_or_url
.
nil?
super
unless
argv
.
empty?
super
unless
argv
.
empty?
elsif
@action
==
'lint'
elsif
@action
==
'lint'
@quick
=
argv
.
option
(
'--quick'
)
@quick
=
argv
.
option
(
'--quick'
)
@only_errors
=
argv
.
option
(
'--only-errors'
)
@local
=
argv
.
option
(
'--local'
)
@no_clean
=
argv
.
option
(
'--no-clean'
)
@only_errors
=
argv
.
option
(
'--only-errors'
)
@no_clean
=
argv
.
option
(
'--no-clean'
)
@podspecs_paths
=
argv
@podspecs_paths
=
argv
else
else
super
super
...
@@ -72,8 +74,9 @@ module Pod
...
@@ -72,8 +74,9 @@ module Pod
UI
.
puts
UI
.
puts
invalid_count
=
0
invalid_count
=
0
podspecs_to_lint
.
each
do
|
podspec
|
podspecs_to_lint
.
each
do
|
podspec
|
linter
=
Linter
.
new
(
podspec
)
linter
=
Linter
.
new
(
podspec
)
linter
.
quick
=
@quick
linter
.
quick
=
@quick
linter
.
local
=
@local
linter
.
no_clean
=
@no_clean
linter
.
no_clean
=
@no_clean
# Show immediatly which pod is being processed.
# Show immediatly which pod is being processed.
...
...
lib/cocoapods/dependency.rb
View file @
44f594bf
...
@@ -231,7 +231,8 @@ module Pod
...
@@ -231,7 +231,8 @@ module Pod
class
LocalSource
<
AbstractExternalSource
class
LocalSource
<
AbstractExternalSource
def
pod_spec_path
def
pod_spec_path
path
=
Pathname
.
new
(
@params
[
:local
]).
expand_path
+
"
#{
name
}
.podspec"
path
=
Pathname
.
new
(
@params
[
:local
]).
expand_path
path
+=
"
#{
name
}
.podspec"
# unless path.to_s.include?("#{name}.podspec")
raise
Informative
,
"No podspec found for `
#{
name
}
' in `
#{
@params
[
:local
]
}
'"
unless
path
.
exist?
raise
Informative
,
"No podspec found for `
#{
name
}
' in `
#{
@params
[
:local
]
}
'"
unless
path
.
exist?
path
path
end
end
...
...
lib/cocoapods/local_pod.rb
View file @
44f594bf
...
@@ -187,6 +187,27 @@ module Pod
...
@@ -187,6 +187,27 @@ module Pod
# @!group Files
# @!group Files
# @return [Pathname] Returns the relative path from the sandbox.
#
# @note If the two abosule paths don't share the same root directory an
# extra `../` is added to the result of {Pathname#relative_path_from}
#
# path = Pathname.new('/Users/dir')
# @sandbox
# #=> Pathname('/tmp/CocoaPods/Lint/Pods')
#
# p.relative_path_from(@sandbox
# #=> '../../../../Users/dir'
#
# relativize_from_sandbox(path)
# #=> '../../../../../Users/dir'
#
def
relativize_from_sandbox
(
path
)
result
=
path
.
relative_path_from
(
@sandbox
.
root
)
result
=
Pathname
.
new
(
'../'
)
+
result
unless
@sandbox
.
root
.
to_s
.
split
(
'/'
)[
1
]
==
path
.
to_s
.
split
(
'/'
)[
1
]
result
end
# @return [Array<Pathname>] The paths of the source files.
# @return [Array<Pathname>] The paths of the source files.
#
#
def
source_files
def
source_files
...
@@ -196,13 +217,13 @@ module Pod
...
@@ -196,13 +217,13 @@ module Pod
# @return [Array<Pathname>] The *relative* paths of the source files.
# @return [Array<Pathname>] The *relative* paths of the source files.
#
#
def
relative_source_files
def
relative_source_files
source_files
.
map
{
|
p
|
p
.
relative_path_from
(
@sandbox
.
root
)
}
source_files
.
map
{
|
p
|
relativize_from_sandbox
(
p
)
}
end
end
def
relative_source_files_by_spec
def
relative_source_files_by_spec
result
=
{}
result
=
{}
source_files_by_spec
.
each
do
|
spec
,
paths
|
source_files_by_spec
.
each
do
|
spec
,
paths
|
result
[
spec
]
=
paths
.
map
{
|
p
|
p
.
relative_path_from
(
@sandbox
.
root
)
}
result
[
spec
]
=
paths
.
map
{
|
p
|
relativize_from_sandbox
(
p
)
}
end
end
result
result
end
end
...
@@ -230,7 +251,7 @@ module Pod
...
@@ -230,7 +251,7 @@ module Pod
# @return [Array<Pathname>] The *relative* paths of the source files.
# @return [Array<Pathname>] The *relative* paths of the source files.
#
#
def
relative_header_files
def
relative_header_files
header_files
.
map
{
|
p
|
p
.
relative_path_from
(
@sandbox
.
root
)
}
header_files
.
map
{
|
p
|
relativize_from_sandbox
(
p
)
}
end
end
# @return [Hash{Specification => Array<Pathname>}] The paths of the header
# @return [Hash{Specification => Array<Pathname>}] The paths of the header
...
@@ -276,7 +297,7 @@ module Pod
...
@@ -276,7 +297,7 @@ module Pod
# @return [Array<Pathname>] The *relative* paths of the resources.
# @return [Array<Pathname>] The *relative* paths of the resources.
#
#
def
relative_resource_files
def
relative_resource_files
resource_files
.
map
{
|
p
|
p
.
relative_path_from
(
@sandbox
.
root
)
}
resource_files
.
map
{
|
p
|
relativize_from_sandbox
(
p
)
}
end
end
# @return [Pathname] The absolute path of the prefix header file
# @return [Pathname] The absolute path of the prefix header file
...
@@ -390,7 +411,7 @@ module Pod
...
@@ -390,7 +411,7 @@ module Pod
source_files_by_spec
.
each
do
|
spec
,
files
|
source_files_by_spec
.
each
do
|
spec
,
files
|
compiler_flags
=
spec
.
compiler_flags
.
strip
compiler_flags
=
spec
.
compiler_flags
.
strip
files
.
each
do
|
file
|
files
.
each
do
|
file
|
file
=
file
.
relative_path_from
(
@sandbox
.
root
)
file
=
relativize_from_sandbox
(
file
)
desc
=
Xcodeproj
::
Project
::
PBXNativeTarget
::
SourceFileDescription
.
new
(
file
,
compiler_flags
,
nil
)
desc
=
Xcodeproj
::
Project
::
PBXNativeTarget
::
SourceFileDescription
.
new
(
file
,
compiler_flags
,
nil
)
result
<<
desc
result
<<
desc
end
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