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
8d87150a
Commit
8d87150a
authored
Dec 13, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Comments] General clean up.
parent
11d150bb
Show whitespace changes
Inline
Side-by-side
Showing
20 changed files
with
294 additions
and
84 deletions
+294
-84
cocoapods.rb
lib/cocoapods.rb
+5
-0
command.rb
lib/cocoapods/command.rb
+2
-1
outdated.rb
lib/cocoapods/command/outdated.rb
+3
-4
project.rb
lib/cocoapods/command/project.rb
+10
-0
push.rb
lib/cocoapods/command/push.rb
+15
-7
repo.rb
lib/cocoapods/command/repo.rb
+7
-2
setup.rb
lib/cocoapods/command/setup.rb
+24
-4
spec.rb
lib/cocoapods/command/spec.rb
+18
-4
config.rb
lib/cocoapods/config.rb
+142
-31
file_list.rb
lib/cocoapods/file_list.rb
+3
-1
documentation.rb
lib/cocoapods/generator/documentation.rb
+9
-3
installer.rb
lib/cocoapods/installer.rb
+7
-5
library.rb
lib/cocoapods/library.rb
+1
-1
local_pod.rb
lib/cocoapods/local_pod.rb
+2
-0
path_list.rb
lib/cocoapods/local_pod/path_list.rb
+4
-1
open_uri.rb
lib/cocoapods/open_uri.rb
+7
-5
resolver.rb
lib/cocoapods/resolver.rb
+2
-2
sandbox.rb
lib/cocoapods/sandbox.rb
+22
-5
sources_manager.rb
lib/cocoapods/sources_manager.rb
+5
-2
user_interface.rb
lib/cocoapods/user_interface.rb
+6
-6
No files found.
lib/cocoapods.rb
View file @
8d87150a
...
...
@@ -6,8 +6,13 @@ module Pod
require
'cocoapods/file_list'
require
'cocoapods/config'
# Indicates a runtime error **not** caused by a bug.
#
class
PlainInformative
<
StandardError
;
end
# Indicates a runtime error **not** caused by a bug which should be
# highlighted to the user.
#
class
Informative
<
PlainInformative
def
message
"[!]
#{
super
}
"
.
red
...
...
lib/cocoapods/command.rb
View file @
8d87150a
...
...
@@ -49,11 +49,12 @@ module Pod
# @todo If a command is run inside another one some settings which where
# true might return false.
#
# @todo We should probably not even load colored unless needed.
#
def
initialize
(
argv
)
config
.
silent
||=
argv
.
flag?
(
'silent'
)
super
config
.
verbose
||=
self
.
verbose?
# TODO we should probably not even load colored unless needed
String
.
send
(
:define_method
,
:colorize
)
{
|
string
,
_
|
string
}
unless
self
.
colorize_output?
end
...
...
lib/cocoapods/command/outdated.rb
View file @
8d87150a
...
...
@@ -5,7 +5,7 @@ module Pod
self
.
description
=
<<-
DESC
Shows the outdated pods in the current Podfile.lock, but only those from
spec repos, not those from local/external sources or `:head
'
versions.
spec repos, not those from local/external sources or `:head
`
versions.
DESC
def
self
.
options
...
...
@@ -17,6 +17,8 @@ module Pod
super
end
# @todo the command report new dependencies added to the Podfile as
# updates.
def
run
verify_podfile_exists!
verify_lockfile_exists!
...
...
@@ -27,9 +29,6 @@ module Pod
resolver
.
update_external_specs
=
false
resolver
.
resolve
#TODO: the command report new dependencies (added to by updated ones)
# as updates.
names
=
resolver
.
pods_to_install
-
resolver
.
pods_from_external_sources
specs
=
resolver
.
specs
.
select
do
|
spec
|
names
.
include?
(
spec
.
name
)
&&
!
spec
.
version
.
head?
...
...
lib/cocoapods/command/project.rb
View file @
8d87150a
...
...
@@ -24,6 +24,12 @@ module Pod
super
end
# Runs the installer.
#
# @param [update] whether the installer should be run in update mode.
#
# @return [void]
#
def
run_install_with_update
(
update
)
sandbox
=
Sandbox
.
new
(
config
.
project_pods_root
)
installer
=
Installer
.
new
(
sandbox
,
config
.
podfile
,
config
.
lockfile
)
...
...
@@ -32,6 +38,8 @@ module Pod
end
end
#-------------------------------------------------------------------------#
class
Install
<
Command
include
Project
...
...
@@ -60,6 +68,8 @@ module Pod
end
end
#-------------------------------------------------------------------------#
class
Update
<
Command
include
Project
...
...
lib/cocoapods/command/push.rb
View file @
8d87150a
...
...
@@ -20,9 +20,6 @@ module Pod
[
"--local-only"
,
"Does not perform the step of pushing REPO to its remote"
]
].
concat
(
super
)
end
extend
Executable
executable
:git
def
initialize
(
argv
)
@allow_warnings
=
argv
.
flag?
(
'allow-warnings'
)
@local_only
=
argv
.
flag?
(
'local-only'
)
...
...
@@ -44,12 +41,15 @@ module Pod
push_repo
unless
@local_only
end
#--------------------------------------#
private
extend
Executable
executable
:git
def
update_repo
UI
.
puts
"Updating the `
#{
@repo
}
' repo
\n
"
.
yellow
# show the output of git even if not verbose
# TODO: use the `git!' and find a way to show the output in realtime.
Dir
.
chdir
(
repo_dir
)
{
UI
.
puts
`git pull 2>&1`
}
end
...
...
@@ -64,7 +64,7 @@ module Pod
dir
end
# @todo:
add specs for staged and unstaged files
# @todo:
Add specs for staged and unstaged files.
#
def
check_repo_status
clean
=
Dir
.
chdir
(
repo_dir
)
{
`git status --porcelain 2>&1`
}
==
''
...
...
@@ -96,6 +96,15 @@ module Pod
end
end
# Commits the podspecs to the source, which should be a git repo.
#
# @note The pre commit hook of the repo is skipped as the podspecs have
# already been linted.
#
# @todo Raise if the source is not under git source control.
#
# @return [void]
#
def
add_specs_to_repo
UI
.
puts
"
\n
Adding the
#{
'spec'
.
pluralize
(
count
)
}
to the `
#{
@repo
}
' repo
\n
"
.
yellow
podspec_files
.
each
do
|
spec_file
|
...
...
@@ -114,7 +123,6 @@ module Pod
FileUtils
.
cp
(
Pathname
.
new
(
spec
.
name
+
'.podspec'
),
output_path
)
Dir
.
chdir
(
repo_dir
)
do
git!
(
"add
#{
spec
.
name
}
"
)
# Bypass the pre-commit hook because we already performed validation
git!
(
"commit --no-verify -m '
#{
message
}
'"
)
end
end
...
...
lib/cocoapods/command/repo.rb
View file @
8d87150a
...
...
@@ -5,7 +5,8 @@ module Pod
class
Repo
<
Command
self
.
abstract_command
=
true
# TODO should not show a usage banner!
# @todo should not show a usage banner!
#
self
.
summary
=
'Manage spec-repositories'
class
Add
<
Repo
...
...
@@ -85,6 +86,11 @@ module Pod
super
end
# @todo Part of this logic needs to be ported to cocoapods-core so web
# services can validate the repo.
#
# @todo add UI.print and enable print statements again.
#
def
run
if
@name
dirs
=
File
.
exists?
(
@name
)
?
[
Pathname
.
new
(
@name
)
]
:
[
dir
]
...
...
@@ -123,7 +129,6 @@ module Pod
end
end
# TODO add UI.print
# print "\033[K" unless config.silent?
messages_by_type
.
each
do
|
type
,
messages_by_type
|
messages_by_type
.
each
do
|
message
,
names
|
...
...
lib/cocoapods/command/setup.rb
View file @
8d87150a
...
...
@@ -42,6 +42,8 @@ module Pod
#--------------------------------------#
# @!group Setup steps
# Sets the url of the master repo according to whether it is push.
#
# @return [void]
...
...
@@ -98,26 +100,38 @@ module Pod
#--------------------------------------#
# @!group Private helpers
# @return [String] the url to use according to whether push mode should
# be enabled.
#
def
url
url
=
(
push?
)
?
read_write_url
:
read_only_url
end
def
master_repo_dir
SourcesManager
.
master_repo_dir
end
# @return [String] the read only url of the master repo.
#
def
read_only_url
'https://github.com/CocoaPods/Specs.git'
end
# @return [String] the read-write url of the master repo.
#
def
read_write_url
'git@github.com:CocoaPods/Specs.git'
end
# Checks if the user asked to setup the master repo in push mode or if
# the repo was already in push mode.
#
# @return [String] whether the master repo should be set up in push mode.
#
def
push?
@push
||=
(
@push_option
||
master_repo_is_push?
)
end
# @return [Bool] if the master repo is already configured in push mode.
#
def
master_repo_is_push?
return
false
unless
master_repo_dir
.
exist?
...
...
@@ -126,6 +140,12 @@ module Pod
url
.
chomp
==
read_write_url
end
end
# @return [Pathname] the directory of the master repo.
#
def
master_repo_dir
SourcesManager
.
master_repo_dir
end
end
end
end
lib/cocoapods/command/spec.rb
View file @
8d87150a
...
...
@@ -6,9 +6,10 @@ module Pod
class
Command
class
Spec
<
Command
self
.
abstract_command
=
true
self
.
summary
=
'Manage pod specs'
#-----------------------------------------------------------------------#
class
Create
<
Spec
self
.
summary
=
'Create spec file stub.'
...
...
@@ -142,11 +143,16 @@ module Pod
end
set
=
found_sets
.
first
best_
spec
=
best_spec_from_set
(
set
)
file_name
=
best_
spec
.
defined_in_file
spec
=
best_spec_from_set
(
set
)
file_name
=
spec
.
defined_in_file
UI
.
puts
File
.
open
(
file_name
).
read
end
#--------------------------------------#
# @return [Specification] the highest know specification of the given
# set.
#
def
best_spec_from_set
(
set
)
sources
=
set
.
sources
...
...
@@ -166,6 +172,7 @@ module Pod
#-----------------------------------------------------------------------#
# TODO some of the following methods can probably move to one of the subclasses.
private
def
podspecs_to_lint
...
...
@@ -198,7 +205,14 @@ module Pod
Pathname
.
new
(
'/tmp/CocoaPods/Lint_podspec'
)
end
# Templates and github information retrival for spec create
#--------------------------------------#
# Templates and github information retrieval for spec create
# TODO it would be nice to have a template class that accepts options and
# uses the default ones if not provided.
# TODO The template is outdated.
def
default_data_for_template
(
name
)
data
=
{}
...
...
lib/cocoapods/config.rb
View file @
8d87150a
...
...
@@ -2,28 +2,97 @@ require 'pathname'
module
Pod
class
Config
def
self
.
instance
@instance
||=
new
end
def
self
.
instance
=
(
instance
)
@instance
=
instance
end
# @!group Paths
attr_accessor
:repos_dir
,
:project_root
,
:project_pods_root
attr_accessor
:clean
,
:verbose
,
:silent
attr_accessor
:generate_docs
,
:doc_install
attr_accessor
:integrate_targets
attr_accessor
:new_version_message
,
:skip_repo_update
# @return [Pathname] the directory where the CocoaPods sources are stored.
#
attr_accessor
:repos_dir
alias_method
:clean?
,
:clean
# @return [Pathname] the root of the CocoaPods installation where the
# Podfile is located.
#
attr_accessor
:project_root
# @return [Pathname] The root of the sandbox.
#
# @todo Why is this needed? Can't clients use config.sandbox.root?
#
attr_accessor
:project_pods_root
#--------------------------------------#
# @!group UI
# @return [Bool] Whether CocoaPods should provide detailed output about the
# performed actions.
#
attr_accessor
:verbose
alias_method
:verbose?
,
:verbose
# @return [Bool] Whether CocoaPods should produce not output.
#
attr_accessor
:silent
alias_method
:silent?
,
:silent
# @return [Bool] Whether the generated documentation should be installed to
# Xcode.
#
# @note This is stored by the Config class so a global value value can be
# set.
#
attr_accessor
:new_version_message
alias_method
:new_version_message?
,
:new_version_message
#--------------------------------------#
# @!group Installation
# @return [Bool] Whether the installer should clean after the installation.
#
# @note This is stored by the Config class so a global value value can be
# set.
#
attr_accessor
:clean
alias_method
:clean?
,
:clean
# @return [Bool] Whether the documentation should be generated for the
# installed Pods.
#
# @note This is stored by the Config class so a global value value can be
# set.
#
attr_accessor
:generate_docs
alias_method
:generate_docs?
,
:generate_docs
# @return [Bool] Whether the generated documentation should be installed to
# Xcode.
#
# @note This is stored by the Config class so a global value value can be
# set.
#
attr_accessor
:doc_install
alias_method
:doc_install?
,
:doc_install
# @return [Bool] Whether CocoaPods should integrate a user target and build
# the workspace or just create the Pods project.
#
# @note This is stored by the Config class so a global value value can be
# set.
#
attr_accessor
:integrate_targets
alias_method
:integrate_targets?
,
:integrate_targets
# @return [Bool] Whether the installer should skip the repos update.
#
# @note This is stored by the Config class so a global value value can be
# set.
#
attr_accessor
:skip_repo_update
alias_method
:skip_repo_update?
,
:skip_repo_update
alias_method
:new_version_message?
,
:new_version_message
#--------------------------------------#
def
initialize
@repos_dir
=
Pathname
.
new
(
File
.
expand_path
(
"~/.cocoapods"
))
...
...
@@ -31,14 +100,57 @@ module Pod
@clean
=
@generate_docs
=
@doc_install
=
@integrate_targets
=
@new_version_message
=
true
end
# @return [Pathname] the root of the CocoaPods instance where the Podfile
# is located.
#
# @todo Move to initialization.
#
def
project_root
@project_root
||=
Pathname
.
pwd
end
# @return [Pathname] The root of the sandbox.
#
# @todo Why is this needed? Can't clients use config.sandbox.root?
#
def
project_pods_root
@project_pods_root
||=
project_root
+
'Pods'
end
# @return [Podfile] The Podfile to use for the current execution.
#
def
podfile
@podfile
||=
begin
Podfile
.
from_file
(
project_podfile
)
if
project_podfile
.
exist?
end
end
attr_writer
:podfile
# @return [Lockfile] The Lockfile to use for the current execution.
#
def
lockfile
@lockfile
||=
begin
Lockfile
.
from_file
(
project_lockfile
)
if
project_lockfile
.
exist?
end
end
# @return [Sandbox] The sandbox of the current project.
#
def
sandbox
@sandbox
||=
Sandbox
.
new
(
project_pods_root
)
end
#--------------------------------------#
# @!group Helpers
# Returns the path of the Podfile.
#
# @note The Podfile can be named either `CocoaPods.podfile` or `Podfile`.
# The first is preferred as it allows to specify an OS X UTI.
#
# @todo Rename to podfile_path.
#
def
project_podfile
unless
@project_podfile
@project_podfile
=
project_root
+
'CocoaPods.podfile'
...
...
@@ -49,37 +161,36 @@ module Pod
@project_podfile
end
# Returns the path of the Lockfile.
#
# @note The Lockfile is named `Podfile.lock`.
#
# @todo Rename to lockfile_path.
#
def
project_lockfile
@project_lockfile
||=
project_root
+
'Podfile.lock'
end
# @todo this should be controlled by the sandbox
#
def
headers_symlink_root
@headers_symlink_root
||=
"
#{
project_pods_root
}
/Headers"
end
# @return [Podfile] The Podfile to use for the current execution.
#
def
podfile
@podfile
||=
begin
Podfile
.
from_file
(
project_podfile
)
if
project_podfile
.
exist?
end
end
attr_writer
:podfile
#--------------------------------------#
# @return [Lockfile] The Lockfile to use for the current execution.
#
def
lockfile
@lockfile
||=
begin
Lockfile
.
from_file
(
project_lockfile
)
if
project_lockfile
.
exist?
end
def
self
.
instance
@instance
||=
new
end
# @return [Sandbox]
#
def
sandbox
@sandbox
||=
Sandbox
.
new
(
project_pods_root
)
def
self
.
instance
=
(
instance
)
@instance
=
instance
end
#-------------------------------------------------------------------------#
# Provides support for using the configuration instance in other scopes.
#
module
Mixin
def
config
Config
.
instance
...
...
lib/cocoapods/file_list.rb
View file @
8d87150a
...
...
@@ -6,7 +6,9 @@ end
# This makes Rake::FileList usable with the Specification attributes
# source_files, public_header_files, preserve_paths, and resources.
#
# @todo This needs to be deprecated as we no have the PathList List
#
module
Rake
class
FileList
def
prepend_patterns
(
pathname
)
...
...
lib/cocoapods/generator/documentation.rb
View file @
8d87150a
...
...
@@ -54,6 +54,9 @@ module Pod
@options
[
:appledoc
]
||
[]
end
# @note The appledoc tool terminates with an exits status of 1 if a
# warning was logged
#
def
appledoc_options
options
=
[
'--project-name'
,
name
,
...
...
@@ -65,7 +68,7 @@ module Pod
'--keep-undocumented-objects'
,
'--keep-undocumented-members'
,
'--keep-intermediate-files'
,
'--exit-threshold'
,
'2'
# appledoc terminates with an exits status of 1 if a warning was logged
'--exit-threshold'
,
'2'
]
options
+=
[
'--index-desc'
,
index_file
]
if
index_file
options
+=
spec_appledoc_options
...
...
@@ -77,12 +80,15 @@ module Pod
Pathname
.
new
(
File
.
expand_path
(
"~/Library/Developer/Shared/Documentation/DocSets/
#{
company_id
}
.
#{
name
.
gsub
(
/ /
,
'-'
)
}
.docset"
)).
exist?
end
# @todo passing the files explicitly clutters output and chokes on very
# long list (AWSiOSSDK). It is possible to just pass the dir of
# the pod, however this would include other files like demo
# projects.
#
def
generate
(
install
=
false
)
options
=
appledoc_options
options
+=
[
'--output'
,
@target_path
.
to_s
]
options
+=
install
?
[
'--create-docset'
]
:
[
'--no-create-docset'
]
# TODO: passing the files explicitly clutters output and chokes on very long list (AWSiOSSDK Spec).
# It is possible to just pass the dir of the pod, however this would include other files like demo projects.
options
+=
files
@target_path
.
mkpath
...
...
lib/cocoapods/installer.rb
View file @
8d87150a
...
...
@@ -317,7 +317,8 @@ module Pod
#
# @note This resolves to the lowest deployment target across the user targets.
#
# @todo Finish implementation
# @todo Is assigning the platform to the target definition the best way to
# go?
#
def
compute_platform_for_taget_definition
(
target_definition
,
user_targets
)
return
target_definition
.
platform
if
target_definition
.
platform
...
...
@@ -332,7 +333,6 @@ module Pod
end
end
platform
=
Platform
.
new
(
name
,
deployment_target
)
# TODO
target_definition
.
platform
=
platform
else
raise
Informative
,
"Missing platform for
#{
target_definition
}
."
\
...
...
@@ -642,7 +642,7 @@ module Pod
# Creates and populates the targets of the pods project.
#
# @note Post install hooks run _before_ saving of project, so that they
# can alter it before it is written
t
to the disk.
# can alter it before it is written to the disk.
#
# @return [void]
#
...
...
@@ -709,7 +709,7 @@ module Pod
# Runs the pre install hooks of the installed specs and of the Podfile.
#
# @todo Run the hooks only for the installed pods.
# @todo Print a mess
s
age with the names of the specs.
# @todo Print a message with the names of the specs.
#
# @return [void]
#
...
...
@@ -812,7 +812,9 @@ module Pod
# @return [void]
#
# @todo [#397] The libraries should be cleaned and the re-added on every
# installation. Maybe a clean_user_project phase should be added.
# installation. Maybe a clean_user_project phase should be added. In
# any case it appears to be a good idea store target definition
# information in the lockfile.
#
# @todo [#588] The resources should be added through a build phase instead
# of using a script.
...
...
lib/cocoapods/library.rb
View file @
8d87150a
...
...
@@ -78,7 +78,7 @@ module Pod
#
attr_accessor
:xcconfig
# @todo
# @todo
This is currently unused.
#
attr_accessor
:specifications
...
...
lib/cocoapods/local_pod.rb
View file @
8d87150a
...
...
@@ -377,6 +377,8 @@ module Pod
end
end
# @todo check implementation
#
def
xcconfig
config
=
Xcodeproj
::
Config
.
new
specifications
.
each
do
|
s
|
...
...
lib/cocoapods/local_pod/path_list.rb
View file @
8d87150a
...
...
@@ -42,6 +42,9 @@ module Pod
# @return [void] Reads the file system and populates the files and paths
# lists.
#
# @todo Ruby 2.0 developer preview 1 does not returns directories
# ending with '/.' and '/..'.
#
def
read_file_system
root_length
=
root
.
to_s
.
length
+
1
paths
=
Dir
.
glob
(
root
+
"**/*"
,
File
::
FNM_DOTMATCH
)
...
...
@@ -64,7 +67,7 @@ module Pod
# {Dir#glob} with the {File::FNM_CASEFOLD} option.
#
# @param [String,Array<String>] patterns
# A si
gn
le {Dir#glob} like pattern, or a list of patterns.
# A si
ng
le {Dir#glob} like pattern, or a list of patterns.
#
# @param [String] dir_pattern
# An optional pattern to append to a pattern, if it is the path
...
...
lib/cocoapods/open_uri.rb
View file @
8d87150a
...
...
@@ -2,16 +2,18 @@ require 'open-uri'
# Allow open-uri to follow http to https redirects.
#
# Inspiration from: https://gist.github.com/1271420
# Relevant issue: http://redmine.ruby-lang.org/issues/3719
# Source here: https://github.com/ruby/ruby/blob/trunk/lib/open-uri.rb
#
module
OpenURI
# Whether {#open} should follow a redirect.
#
# Inspiration from: https://gist.github.com/1271420
# Relevant issue: http://redmine.ruby-lang.org/issues/3719
# Source here: https://github.com/ruby/ruby/blob/trunk/lib/open-uri.rb
#
# This test is intended to forbid a redirection from http://... to
# file:///etc/passwd, file:///dev/zero, etc. CVE-2011-1521
# https to http redirect is also forbidden intentionally.
# It avoids sending secure cookie or referer by non-secure HTTP protocol.
# It avoids sending secure cookie or refer
r
er by non-secure HTTP protocol.
# (RFC 2109 4.3.1, RFC 2965 3.3, RFC 2616 15.1.3)
# However this is ad hoc. It should be extensible/configurable.
#
...
...
lib/cocoapods/resolver.rb
View file @
8d87150a
...
...
@@ -35,7 +35,7 @@ module Pod
#
# @note This option is used by `pod outdated`.
#
# @todo
:
This implementation is not clean, because if the spec doesn't
# @todo
This implementation is not clean, because if the spec doesn't
# exists the sandbox will actually download and modify the
# installation.
#
...
...
@@ -165,7 +165,7 @@ module Pod
# definition.
#
#
#
TODO:
The set class should be aware whether it is in head mode.
#
@todo
The set class should be aware whether it is in head mode.
#
# @return [void]
#
...
...
lib/cocoapods/sandbox.rb
View file @
8d87150a
...
...
@@ -85,8 +85,8 @@ module Pod
public
# @todo
r
efactor the pods from a local source should not be cached by the
# sandbox
# @todo
R
efactor the pods from a local source should not be cached by the
# sandbox
.
#
# @return [LocalPod]
#
...
...
@@ -142,7 +142,7 @@ module Pod
# @return [Array<String>] the names of the pods that have been
# pre-downloaded from an external source.
#
# @todo
t
he installer needs to be aware of it.
# @todo
T
he installer needs to be aware of it.
#
attr_reader
:predownloaded_pods
...
...
@@ -192,6 +192,8 @@ module Pod
# Removes the directory as it is regenerated from scratch during each
# installation.
#
# @return [void]
#
def
prepare_for_install
root
.
rmtree
if
root
.
exist?
end
...
...
@@ -202,7 +204,18 @@ module Pod
public
# Adds a header to the directory.
#
# @param [Pathname] namespace_path
# the path where the header file should be stored relative to the
# headers directory.
#
# @param [Pathname] relative_header_path
# the path of the header file relative to the sandbox.
#
# @note This method adds the files are added to the search paths.
#
# @return [void]
#
def
add_file
(
namespace_path
,
relative_header_path
)
namespaced_header_path
=
root
+
namespace_path
...
...
@@ -213,13 +226,15 @@ module Pod
namespaced_header_path
+
relative_header_path
.
basename
end
#
#
@todo Why this variant exits?
#
def
add_files
(
namespace_path
,
relative_header_paths
)
relative_header_paths
.
map
{
|
path
|
add_file
(
namespace_path
,
path
)
}
end
#
# @return [Array<String>] All the search paths of the header directory in
# xcconfig format. The paths are specified relative to the pods
# root with the `${PODS_ROOT}` variable.
#
def
search_paths
@search_paths
.
uniq
.
map
{
|
path
|
"${PODS_ROOT}/
#{
path
}
"
}
...
...
@@ -232,6 +247,8 @@ module Pod
#
# @return [void]
#
# @todo Why this variant exits?
#
def
add_search_path
(
path
)
@search_paths
<<
Pathname
.
new
(
@relative_path
)
+
path
end
...
...
lib/cocoapods/sources_manager.rb
View file @
8d87150a
...
...
@@ -39,7 +39,9 @@ module Pod
#
def
search
(
dependency
)
set
=
aggregate
.
search
(
dependency
)
raise
Informative
,
"Unable to find a pod named `
#{
dependency
.
name
}
`"
unless
set
unless
set
raise
Informative
,
"Unable to find a pod named `
#{
dependency
.
name
}
`"
end
set
end
...
...
@@ -132,7 +134,8 @@ module Pod
unless
repo_compatible?
(
dir
)
min
,
max
=
versions
[
'min'
],
versions
[
'max'
]
version_msg
=
(
min
==
max
)
?
min
:
"
#{
min
}
-
#{
max
}
"
raise
Informative
,
"The `
#{
dir
.
basename
.
to_s
}
` repo requires CocoaPods
#{
version_msg
}
\n
"
.
red
+
raise
Informative
,
"The `
#{
dir
.
basename
}
` repo requires "
\
"CocoaPods
#{
version_msg
}
\n
"
.
red
+
"Update Cocoapods, or checkout the appropriate tag in the repo."
end
...
...
lib/cocoapods/user_interface.rb
View file @
8d87150a
...
...
@@ -2,7 +2,7 @@ require 'cocoapods/user_interface/error_report'
module
Pod
# Provides support for UI output. It provides support for ne
x
ted sections of
# Provides support for UI output. It provides support for ne
s
ted sections of
# information and for a verbose mode.
#
module
UserInterface
...
...
@@ -28,7 +28,7 @@ module Pod
# to their level. In normal mode titles are printed only if
# they have nesting level smaller than 2.
#
#
TODO:
Refactor to title (for always visible titles like search)
#
@todo
Refactor to title (for always visible titles like search)
# and sections (titles that represent collapsible sections).
#
def
section
(
title
,
verbose_prefix
=
''
,
relative_indentation
=
0
)
...
...
@@ -45,7 +45,7 @@ module Pod
self
.
title_level
-=
1
end
# A title oposed to a section is always visible
# A title op
p
osed to a section is always visible
#
def
title
(
title
,
verbose_prefix
=
''
,
relative_indentation
=
2
)
if
(
@treat_titles_as_messages
)
...
...
@@ -73,7 +73,7 @@ module Pod
# a relative indentation valid for the UI action in the passed
# block.
#
#
TODO: c
lean interface.
#
@todo C
lean interface.
#
def
message
(
message
,
verbose_prefix
=
''
,
relative_indentation
=
2
)
message
=
verbose_prefix
+
message
if
config
.
verbose?
...
...
@@ -140,7 +140,7 @@ module Pod
end
end
# Prints the textual rep
pren
sentation of a given set.
# Prints the textual rep
re
sentation of a given set.
#
def
pod
(
set
,
mode
=
:normal
)
if
mode
==
:name
...
...
@@ -224,7 +224,7 @@ module Pod
end
UI
=
UserInterface
# Redirect
co
pods-core UI.
# Redirect
s cocoa
pods-core UI.
#
module
CoreUI
...
...
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