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
a6564cd0
Commit
a6564cd0
authored
Dec 22, 2014
by
Marius Rackwitz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Linter] Add new option `--use-frameworks`
This let lint use frameworks to install the given spec.
parent
8e697ee2
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
5 deletions
+19
-5
lib.rb
lib/cocoapods/command/lib.rb
+3
-0
spec.rb
lib/cocoapods/command/spec.rb
+3
-0
validator.rb
lib/cocoapods/validator.rb
+10
-2
validator_spec.rb
spec/unit/validator_spec.rb
+3
-3
No files found.
lib/cocoapods/command/lib.rb
View file @
a6564cd0
...
...
@@ -113,6 +113,7 @@ module Pod
[
'--subspec=NAME'
,
'Lint validates only the given subspec'
],
[
'--no-subspecs'
,
'Lint skips validation of subspecs'
],
[
'--no-clean'
,
'Lint leaves the build directory intact for inspection'
],
[
'--use-frameworks'
,
'Lint uses frameworks to install the spec'
],
[
'--sources=https://github.com/artsy/Specs'
,
'The sources from which to pull dependant pods '
\
'(defaults to https://github.com/CocoaPods/Specs.git). '
\
'Multiple sources must be comma-delimited.'
]].
concat
(
super
)
...
...
@@ -124,6 +125,7 @@ module Pod
@clean
=
argv
.
flag?
(
'clean'
,
true
)
@subspecs
=
argv
.
flag?
(
'subspecs'
,
true
)
@only_subspec
=
argv
.
option
(
'subspec'
)
@use_frameworks
=
argv
.
flag?
(
'use-frameworks'
)
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@podspecs_paths
=
argv
.
arguments!
super
...
...
@@ -144,6 +146,7 @@ module Pod
validator
.
allow_warnings
=
@allow_warnings
validator
.
no_subspecs
=
!
@subspecs
||
@only_subspec
validator
.
only_subspec
=
@only_subspec
validator
.
use_frameworks
=
@use_frameworks
validator
.
validate
unless
@clean
...
...
lib/cocoapods/command/spec.rb
View file @
a6564cd0
...
...
@@ -68,6 +68,7 @@ module Pod
[
'--subspec=NAME'
,
'Lint validates only the given subspec'
],
[
'--no-subspecs'
,
'Lint skips validation of subspecs'
],
[
'--no-clean'
,
'Lint leaves the build directory intact for inspection'
],
[
'--use-frameworks'
,
'Lint uses frameworks to install the spec'
],
[
'--sources=https://github.com/artsy/Specs'
,
'The sources from which to pull dependant pods '
\
'(defaults to https://github.com/CocoaPods/Specs.git). '
\
'Multiple sources must be comma-delimited.'
]].
concat
(
super
)
...
...
@@ -79,6 +80,7 @@ module Pod
@clean
=
argv
.
flag?
(
'clean'
,
true
)
@subspecs
=
argv
.
flag?
(
'subspecs'
,
true
)
@only_subspec
=
argv
.
option
(
'subspec'
)
@use_frameworks
=
argv
.
flag?
(
'use-frameworks'
)
@source_urls
=
argv
.
option
(
'sources'
,
'https://github.com/CocoaPods/Specs.git'
).
split
(
','
)
@podspecs_paths
=
argv
.
arguments!
super
...
...
@@ -94,6 +96,7 @@ module Pod
validator
.
allow_warnings
=
@allow_warnings
validator
.
no_subspecs
=
!
@subspecs
||
@only_subspec
validator
.
only_subspec
=
@only_subspec
validator
.
use_frameworks
=
@use_frameworks
validator
.
validate
invalid_count
+=
1
unless
validator
.
validated?
...
...
lib/cocoapods/validator.rb
View file @
a6564cd0
...
...
@@ -143,6 +143,10 @@ module Pod
#
attr_accessor
:no_subspecs
# @return [Bool] Whether frameworks should be used for the installation.
#
attr_accessor
:use_frameworks
#-------------------------------------------------------------------------#
# !@group Lint results
...
...
@@ -299,7 +303,7 @@ module Pod
#
def
install_pod
deployment_target
=
spec
.
subspec_by_name
(
subspec_name
).
deployment_target
(
consumer
.
platform_name
)
podfile
=
podfile_from_spec
(
consumer
.
platform_name
,
deployment_target
)
podfile
=
podfile_from_spec
(
consumer
.
platform_name
,
deployment_target
,
use_frameworks
)
sandbox
=
Sandbox
.
new
(
config
.
sandbox_root
)
installer
=
Installer
.
new
(
sandbox
,
podfile
)
installer
.
install!
...
...
@@ -457,19 +461,23 @@ module Pod
# the deployment target, which should be declared in
# the Podfile.
#
# @param [Bool] use_frameworks
# whether frameworks should be used for the installation
#
# @return [Podfile] a podfile that requires the specification on the
# current platform.
#
# @note The generated podfile takes into account whether the linter is
# in local mode.
#
def
podfile_from_spec
(
platform_name
,
deployment_target
)
def
podfile_from_spec
(
platform_name
,
deployment_target
,
use_frameworks
=
nil
)
name
=
subspec_name
?
subspec_name
:
spec
.
name
podspec
=
file
.
realpath
local
=
local?
urls
=
source_urls
podfile
=
Pod
::
Podfile
.
new
do
urls
.
each
{
|
u
|
source
(
u
)
}
use_frameworks!
(
use_frameworks
)
unless
use_frameworks
.
nil?
platform
(
platform_name
,
deployment_target
)
if
local
pod
name
,
:path
=>
podspec
.
dirname
.
to_s
...
...
spec/unit/validator_spec.rb
View file @
a6564cd0
...
...
@@ -295,9 +295,9 @@ module Pod
s
.
ios
.
deployment_target
=
'7.0'
end
validator
.
spec
.
stubs
(
:subspecs
).
returns
([
subspec
])
validator
.
expects
(
:podfile_from_spec
).
with
(
:osx
,
nil
).
once
validator
.
expects
(
:podfile_from_spec
).
with
(
:ios
,
nil
).
once
validator
.
expects
(
:podfile_from_spec
).
with
(
:ios
,
'7.0'
).
once
validator
.
expects
(
:podfile_from_spec
).
with
(
:osx
,
nil
,
nil
).
once
validator
.
expects
(
:podfile_from_spec
).
with
(
:ios
,
nil
,
nil
).
once
validator
.
expects
(
:podfile_from_spec
).
with
(
:ios
,
'7.0'
,
nil
).
once
podfile
=
validator
.
send
(
:perform_extensive_analysis
,
validator
.
spec
)
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