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
...
@@ -6,8 +6,13 @@ module Pod
require
'cocoapods/file_list'
require
'cocoapods/file_list'
require
'cocoapods/config'
require
'cocoapods/config'
# Indicates a runtime error **not** caused by a bug.
#
class
PlainInformative
<
StandardError
;
end
class
PlainInformative
<
StandardError
;
end
# Indicates a runtime error **not** caused by a bug which should be
# highlighted to the user.
#
class
Informative
<
PlainInformative
class
Informative
<
PlainInformative
def
message
def
message
"[!]
#{
super
}
"
.
red
"[!]
#{
super
}
"
.
red
...
...
lib/cocoapods/command.rb
View file @
8d87150a
...
@@ -49,11 +49,12 @@ module Pod
...
@@ -49,11 +49,12 @@ module Pod
# @todo If a command is run inside another one some settings which where
# @todo If a command is run inside another one some settings which where
# true might return false.
# true might return false.
#
#
# @todo We should probably not even load colored unless needed.
#
def
initialize
(
argv
)
def
initialize
(
argv
)
config
.
silent
||=
argv
.
flag?
(
'silent'
)
config
.
silent
||=
argv
.
flag?
(
'silent'
)
super
super
config
.
verbose
||=
self
.
verbose?
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?
String
.
send
(
:define_method
,
:colorize
)
{
|
string
,
_
|
string
}
unless
self
.
colorize_output?
end
end
...
...
lib/cocoapods/command/outdated.rb
View file @
8d87150a
...
@@ -5,7 +5,7 @@ module Pod
...
@@ -5,7 +5,7 @@ module Pod
self
.
description
=
<<-
DESC
self
.
description
=
<<-
DESC
Shows the outdated pods in the current Podfile.lock, but only those from
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
DESC
def
self
.
options
def
self
.
options
...
@@ -17,6 +17,8 @@ module Pod
...
@@ -17,6 +17,8 @@ module Pod
super
super
end
end
# @todo the command report new dependencies added to the Podfile as
# updates.
def
run
def
run
verify_podfile_exists!
verify_podfile_exists!
verify_lockfile_exists!
verify_lockfile_exists!
...
@@ -27,9 +29,6 @@ module Pod
...
@@ -27,9 +29,6 @@ module Pod
resolver
.
update_external_specs
=
false
resolver
.
update_external_specs
=
false
resolver
.
resolve
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
names
=
resolver
.
pods_to_install
-
resolver
.
pods_from_external_sources
specs
=
resolver
.
specs
.
select
do
|
spec
|
specs
=
resolver
.
specs
.
select
do
|
spec
|
names
.
include?
(
spec
.
name
)
&&
!
spec
.
version
.
head?
names
.
include?
(
spec
.
name
)
&&
!
spec
.
version
.
head?
...
...
lib/cocoapods/command/project.rb
View file @
8d87150a
...
@@ -24,6 +24,12 @@ module Pod
...
@@ -24,6 +24,12 @@ module Pod
super
super
end
end
# Runs the installer.
#
# @param [update] whether the installer should be run in update mode.
#
# @return [void]
#
def
run_install_with_update
(
update
)
def
run_install_with_update
(
update
)
sandbox
=
Sandbox
.
new
(
config
.
project_pods_root
)
sandbox
=
Sandbox
.
new
(
config
.
project_pods_root
)
installer
=
Installer
.
new
(
sandbox
,
config
.
podfile
,
config
.
lockfile
)
installer
=
Installer
.
new
(
sandbox
,
config
.
podfile
,
config
.
lockfile
)
...
@@ -32,6 +38,8 @@ module Pod
...
@@ -32,6 +38,8 @@ module Pod
end
end
end
end
#-------------------------------------------------------------------------#
class
Install
<
Command
class
Install
<
Command
include
Project
include
Project
...
@@ -60,6 +68,8 @@ module Pod
...
@@ -60,6 +68,8 @@ module Pod
end
end
end
end
#-------------------------------------------------------------------------#
class
Update
<
Command
class
Update
<
Command
include
Project
include
Project
...
...
lib/cocoapods/command/push.rb
View file @
8d87150a
...
@@ -20,9 +20,6 @@ module Pod
...
@@ -20,9 +20,6 @@ module Pod
[
"--local-only"
,
"Does not perform the step of pushing REPO to its remote"
]
].
concat
(
super
)
[
"--local-only"
,
"Does not perform the step of pushing REPO to its remote"
]
].
concat
(
super
)
end
end
extend
Executable
executable
:git
def
initialize
(
argv
)
def
initialize
(
argv
)
@allow_warnings
=
argv
.
flag?
(
'allow-warnings'
)
@allow_warnings
=
argv
.
flag?
(
'allow-warnings'
)
@local_only
=
argv
.
flag?
(
'local-only'
)
@local_only
=
argv
.
flag?
(
'local-only'
)
...
@@ -44,12 +41,15 @@ module Pod
...
@@ -44,12 +41,15 @@ module Pod
push_repo
unless
@local_only
push_repo
unless
@local_only
end
end
#--------------------------------------#
private
private
extend
Executable
executable
:git
def
update_repo
def
update_repo
UI
.
puts
"Updating the `
#{
@repo
}
' repo
\n
"
.
yellow
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`
}
Dir
.
chdir
(
repo_dir
)
{
UI
.
puts
`git pull 2>&1`
}
end
end
...
@@ -64,7 +64,7 @@ module Pod
...
@@ -64,7 +64,7 @@ module Pod
dir
dir
end
end
# @todo:
add specs for staged and unstaged files
# @todo:
Add specs for staged and unstaged files.
#
#
def
check_repo_status
def
check_repo_status
clean
=
Dir
.
chdir
(
repo_dir
)
{
`git status --porcelain 2>&1`
}
==
''
clean
=
Dir
.
chdir
(
repo_dir
)
{
`git status --porcelain 2>&1`
}
==
''
...
@@ -96,6 +96,15 @@ module Pod
...
@@ -96,6 +96,15 @@ module Pod
end
end
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
def
add_specs_to_repo
UI
.
puts
"
\n
Adding the
#{
'spec'
.
pluralize
(
count
)
}
to the `
#{
@repo
}
' repo
\n
"
.
yellow
UI
.
puts
"
\n
Adding the
#{
'spec'
.
pluralize
(
count
)
}
to the `
#{
@repo
}
' repo
\n
"
.
yellow
podspec_files
.
each
do
|
spec_file
|
podspec_files
.
each
do
|
spec_file
|
...
@@ -114,7 +123,6 @@ module Pod
...
@@ -114,7 +123,6 @@ module Pod
FileUtils
.
cp
(
Pathname
.
new
(
spec
.
name
+
'.podspec'
),
output_path
)
FileUtils
.
cp
(
Pathname
.
new
(
spec
.
name
+
'.podspec'
),
output_path
)
Dir
.
chdir
(
repo_dir
)
do
Dir
.
chdir
(
repo_dir
)
do
git!
(
"add
#{
spec
.
name
}
"
)
git!
(
"add
#{
spec
.
name
}
"
)
# Bypass the pre-commit hook because we already performed validation
git!
(
"commit --no-verify -m '
#{
message
}
'"
)
git!
(
"commit --no-verify -m '
#{
message
}
'"
)
end
end
end
end
...
...
lib/cocoapods/command/repo.rb
View file @
8d87150a
...
@@ -5,7 +5,8 @@ module Pod
...
@@ -5,7 +5,8 @@ module Pod
class
Repo
<
Command
class
Repo
<
Command
self
.
abstract_command
=
true
self
.
abstract_command
=
true
# TODO should not show a usage banner!
# @todo should not show a usage banner!
#
self
.
summary
=
'Manage spec-repositories'
self
.
summary
=
'Manage spec-repositories'
class
Add
<
Repo
class
Add
<
Repo
...
@@ -85,6 +86,11 @@ module Pod
...
@@ -85,6 +86,11 @@ module Pod
super
super
end
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
def
run
if
@name
if
@name
dirs
=
File
.
exists?
(
@name
)
?
[
Pathname
.
new
(
@name
)
]
:
[
dir
]
dirs
=
File
.
exists?
(
@name
)
?
[
Pathname
.
new
(
@name
)
]
:
[
dir
]
...
@@ -123,7 +129,6 @@ module Pod
...
@@ -123,7 +129,6 @@ module Pod
end
end
end
end
# TODO add UI.print
# print "\033[K" unless config.silent?
# print "\033[K" unless config.silent?
messages_by_type
.
each
do
|
type
,
messages_by_type
|
messages_by_type
.
each
do
|
type
,
messages_by_type
|
messages_by_type
.
each
do
|
message
,
names
|
messages_by_type
.
each
do
|
message
,
names
|
...
...
lib/cocoapods/command/setup.rb
View file @
8d87150a
...
@@ -42,6 +42,8 @@ module Pod
...
@@ -42,6 +42,8 @@ module Pod
#--------------------------------------#
#--------------------------------------#
# @!group Setup steps
# Sets the url of the master repo according to whether it is push.
# Sets the url of the master repo according to whether it is push.
#
#
# @return [void]
# @return [void]
...
@@ -98,26 +100,38 @@ module Pod
...
@@ -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
def
url
url
=
(
push?
)
?
read_write_url
:
read_only_url
url
=
(
push?
)
?
read_write_url
:
read_only_url
end
end
def
master_repo_dir
# @return [String] the read only url of the master repo.
SourcesManager
.
master_repo_dir
#
end
def
read_only_url
def
read_only_url
'https://github.com/CocoaPods/Specs.git'
'https://github.com/CocoaPods/Specs.git'
end
end
# @return [String] the read-write url of the master repo.
#
def
read_write_url
def
read_write_url
'git@github.com:CocoaPods/Specs.git'
'git@github.com:CocoaPods/Specs.git'
end
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?
def
push?
@push
||=
(
@push_option
||
master_repo_is_push?
)
@push
||=
(
@push_option
||
master_repo_is_push?
)
end
end
# @return [Bool] if the master repo is already configured in push mode.
#
def
master_repo_is_push?
def
master_repo_is_push?
return
false
unless
master_repo_dir
.
exist?
return
false
unless
master_repo_dir
.
exist?
...
@@ -126,6 +140,12 @@ module Pod
...
@@ -126,6 +140,12 @@ module Pod
url
.
chomp
==
read_write_url
url
.
chomp
==
read_write_url
end
end
end
end
# @return [Pathname] the directory of the master repo.
#
def
master_repo_dir
SourcesManager
.
master_repo_dir
end
end
end
end
end
end
end
lib/cocoapods/command/spec.rb
View file @
8d87150a
...
@@ -6,9 +6,10 @@ module Pod
...
@@ -6,9 +6,10 @@ module Pod
class
Command
class
Command
class
Spec
<
Command
class
Spec
<
Command
self
.
abstract_command
=
true
self
.
abstract_command
=
true
self
.
summary
=
'Manage pod specs'
self
.
summary
=
'Manage pod specs'
#-----------------------------------------------------------------------#
class
Create
<
Spec
class
Create
<
Spec
self
.
summary
=
'Create spec file stub.'
self
.
summary
=
'Create spec file stub.'
...
@@ -142,11 +143,16 @@ module Pod
...
@@ -142,11 +143,16 @@ module Pod
end
end
set
=
found_sets
.
first
set
=
found_sets
.
first
best_
spec
=
best_spec_from_set
(
set
)
spec
=
best_spec_from_set
(
set
)
file_name
=
best_
spec
.
defined_in_file
file_name
=
spec
.
defined_in_file
UI
.
puts
File
.
open
(
file_name
).
read
UI
.
puts
File
.
open
(
file_name
).
read
end
end
#--------------------------------------#
# @return [Specification] the highest know specification of the given
# set.
#
def
best_spec_from_set
(
set
)
def
best_spec_from_set
(
set
)
sources
=
set
.
sources
sources
=
set
.
sources
...
@@ -166,6 +172,7 @@ module Pod
...
@@ -166,6 +172,7 @@ module Pod
#-----------------------------------------------------------------------#
#-----------------------------------------------------------------------#
# TODO some of the following methods can probably move to one of the subclasses.
# TODO some of the following methods can probably move to one of the subclasses.
private
private
def
podspecs_to_lint
def
podspecs_to_lint
...
@@ -198,7 +205,14 @@ module Pod
...
@@ -198,7 +205,14 @@ module Pod
Pathname
.
new
(
'/tmp/CocoaPods/Lint_podspec'
)
Pathname
.
new
(
'/tmp/CocoaPods/Lint_podspec'
)
end
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
)
def
default_data_for_template
(
name
)
data
=
{}
data
=
{}
...
...
lib/cocoapods/config.rb
View file @
8d87150a
...
@@ -2,28 +2,97 @@ require 'pathname'
...
@@ -2,28 +2,97 @@ require 'pathname'
module
Pod
module
Pod
class
Config
class
Config
def
self
.
instance
@instance
||=
new
end
def
self
.
instance
=
(
instance
)
# @!group Paths
@instance
=
instance
end
attr_accessor
:repos_dir
,
:project_root
,
:project_pods_root
# @return [Pathname] the directory where the CocoaPods sources are stored.
attr_accessor
:clean
,
:verbose
,
:silent
#
attr_accessor
:generate_docs
,
:doc_install
attr_accessor
:repos_dir
attr_accessor
:integrate_targets
attr_accessor
:new_version_message
,
:skip_repo_update
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
alias_method
:verbose?
,
:verbose
# @return [Bool] Whether CocoaPods should produce not output.
#
attr_accessor
:silent
alias_method
:silent?
,
: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
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
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
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
:skip_repo_update?
,
:skip_repo_update
alias_method
:new_version_message?
,
:new_version_message
#--------------------------------------#
def
initialize
def
initialize
@repos_dir
=
Pathname
.
new
(
File
.
expand_path
(
"~/.cocoapods"
))
@repos_dir
=
Pathname
.
new
(
File
.
expand_path
(
"~/.cocoapods"
))
...
@@ -31,14 +100,57 @@ module Pod
...
@@ -31,14 +100,57 @@ module Pod
@clean
=
@generate_docs
=
@doc_install
=
@integrate_targets
=
@new_version_message
=
true
@clean
=
@generate_docs
=
@doc_install
=
@integrate_targets
=
@new_version_message
=
true
end
end
# @return [Pathname] the root of the CocoaPods instance where the Podfile
# is located.
#
# @todo Move to initialization.
#
def
project_root
def
project_root
@project_root
||=
Pathname
.
pwd
@project_root
||=
Pathname
.
pwd
end
end
# @return [Pathname] The root of the sandbox.
#
# @todo Why is this needed? Can't clients use config.sandbox.root?
#
def
project_pods_root
def
project_pods_root
@project_pods_root
||=
project_root
+
'Pods'
@project_pods_root
||=
project_root
+
'Pods'
end
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
def
project_podfile
unless
@project_podfile
unless
@project_podfile
@project_podfile
=
project_root
+
'CocoaPods.podfile'
@project_podfile
=
project_root
+
'CocoaPods.podfile'
...
@@ -49,37 +161,36 @@ module Pod
...
@@ -49,37 +161,36 @@ module Pod
@project_podfile
@project_podfile
end
end
# Returns the path of the Lockfile.
#
# @note The Lockfile is named `Podfile.lock`.
#
# @todo Rename to lockfile_path.
#
def
project_lockfile
def
project_lockfile
@project_lockfile
||=
project_root
+
'Podfile.lock'
@project_lockfile
||=
project_root
+
'Podfile.lock'
end
end
# @todo this should be controlled by the sandbox
#
def
headers_symlink_root
def
headers_symlink_root
@headers_symlink_root
||=
"
#{
project_pods_root
}
/Headers"
@headers_symlink_root
||=
"
#{
project_pods_root
}
/Headers"
end
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
self
.
instance
#
@instance
||=
new
def
lockfile
@lockfile
||=
begin
Lockfile
.
from_file
(
project_lockfile
)
if
project_lockfile
.
exist?
end
end
end
# @return [Sandbox]
def
self
.
instance
=
(
instance
)
#
@instance
=
instance
def
sandbox
@sandbox
||=
Sandbox
.
new
(
project_pods_root
)
end
end
#-------------------------------------------------------------------------#
# Provides support for using the configuration instance in other scopes.
#
module
Mixin
module
Mixin
def
config
def
config
Config
.
instance
Config
.
instance
...
...
lib/cocoapods/file_list.rb
View file @
8d87150a
...
@@ -6,7 +6,9 @@ end
...
@@ -6,7 +6,9 @@ end
# This makes Rake::FileList usable with the Specification attributes
# This makes Rake::FileList usable with the Specification attributes
# source_files, public_header_files, preserve_paths, and resources.
# source_files, public_header_files, preserve_paths, and resources.
#
# @todo This needs to be deprecated as we no have the PathList List
#
module
Rake
module
Rake
class
FileList
class
FileList
def
prepend_patterns
(
pathname
)
def
prepend_patterns
(
pathname
)
...
...
lib/cocoapods/generator/documentation.rb
View file @
8d87150a
...
@@ -54,6 +54,9 @@ module Pod
...
@@ -54,6 +54,9 @@ module Pod
@options
[
:appledoc
]
||
[]
@options
[
:appledoc
]
||
[]
end
end
# @note The appledoc tool terminates with an exits status of 1 if a
# warning was logged
#
def
appledoc_options
def
appledoc_options
options
=
[
options
=
[
'--project-name'
,
name
,
'--project-name'
,
name
,
...
@@ -65,7 +68,7 @@ module Pod
...
@@ -65,7 +68,7 @@ module Pod
'--keep-undocumented-objects'
,
'--keep-undocumented-objects'
,
'--keep-undocumented-members'
,
'--keep-undocumented-members'
,
'--keep-intermediate-files'
,
'--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
+=
[
'--index-desc'
,
index_file
]
if
index_file
options
+=
spec_appledoc_options
options
+=
spec_appledoc_options
...
@@ -77,12 +80,15 @@ module Pod
...
@@ -77,12 +80,15 @@ module Pod
Pathname
.
new
(
File
.
expand_path
(
"~/Library/Developer/Shared/Documentation/DocSets/
#{
company_id
}
.
#{
name
.
gsub
(
/ /
,
'-'
)
}
.docset"
)).
exist?
Pathname
.
new
(
File
.
expand_path
(
"~/Library/Developer/Shared/Documentation/DocSets/
#{
company_id
}
.
#{
name
.
gsub
(
/ /
,
'-'
)
}
.docset"
)).
exist?
end
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
)
def
generate
(
install
=
false
)
options
=
appledoc_options
options
=
appledoc_options
options
+=
[
'--output'
,
@target_path
.
to_s
]
options
+=
[
'--output'
,
@target_path
.
to_s
]
options
+=
install
?
[
'--create-docset'
]
:
[
'--no-create-docset'
]
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
options
+=
files
@target_path
.
mkpath
@target_path
.
mkpath
...
...
lib/cocoapods/installer.rb
View file @
8d87150a
...
@@ -317,7 +317,8 @@ module Pod
...
@@ -317,7 +317,8 @@ module Pod
#
#
# @note This resolves to the lowest deployment target across the user targets.
# @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
)
def
compute_platform_for_taget_definition
(
target_definition
,
user_targets
)
return
target_definition
.
platform
if
target_definition
.
platform
return
target_definition
.
platform
if
target_definition
.
platform
...
@@ -332,7 +333,6 @@ module Pod
...
@@ -332,7 +333,6 @@ module Pod
end
end
end
end
platform
=
Platform
.
new
(
name
,
deployment_target
)
platform
=
Platform
.
new
(
name
,
deployment_target
)
# TODO
target_definition
.
platform
=
platform
target_definition
.
platform
=
platform
else
else
raise
Informative
,
"Missing platform for
#{
target_definition
}
."
\
raise
Informative
,
"Missing platform for
#{
target_definition
}
."
\
...
@@ -642,7 +642,7 @@ module Pod
...
@@ -642,7 +642,7 @@ module Pod
# Creates and populates the targets of the pods project.
# Creates and populates the targets of the pods project.
#
#
# @note Post install hooks run _before_ saving of project, so that they
# @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]
# @return [void]
#
#
...
@@ -709,7 +709,7 @@ module Pod
...
@@ -709,7 +709,7 @@ module Pod
# Runs the pre install hooks of the installed specs and of the Podfile.
# Runs the pre install hooks of the installed specs and of the Podfile.
#
#
# @todo Run the hooks only for the installed pods.
# @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]
# @return [void]
#
#
...
@@ -812,7 +812,9 @@ module Pod
...
@@ -812,7 +812,9 @@ module Pod
# @return [void]
# @return [void]
#
#
# @todo [#397] The libraries should be cleaned and the re-added on every
# @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
# @todo [#588] The resources should be added through a build phase instead
# of using a script.
# of using a script.
...
...
lib/cocoapods/library.rb
View file @
8d87150a
...
@@ -78,7 +78,7 @@ module Pod
...
@@ -78,7 +78,7 @@ module Pod
#
#
attr_accessor
:xcconfig
attr_accessor
:xcconfig
# @todo
# @todo
This is currently unused.
#
#
attr_accessor
:specifications
attr_accessor
:specifications
...
...
lib/cocoapods/local_pod.rb
View file @
8d87150a
...
@@ -377,6 +377,8 @@ module Pod
...
@@ -377,6 +377,8 @@ module Pod
end
end
end
end
# @todo check implementation
#
def
xcconfig
def
xcconfig
config
=
Xcodeproj
::
Config
.
new
config
=
Xcodeproj
::
Config
.
new
specifications
.
each
do
|
s
|
specifications
.
each
do
|
s
|
...
...
lib/cocoapods/local_pod/path_list.rb
View file @
8d87150a
...
@@ -42,6 +42,9 @@ module Pod
...
@@ -42,6 +42,9 @@ module Pod
# @return [void] Reads the file system and populates the files and paths
# @return [void] Reads the file system and populates the files and paths
# lists.
# lists.
#
#
# @todo Ruby 2.0 developer preview 1 does not returns directories
# ending with '/.' and '/..'.
#
def
read_file_system
def
read_file_system
root_length
=
root
.
to_s
.
length
+
1
root_length
=
root
.
to_s
.
length
+
1
paths
=
Dir
.
glob
(
root
+
"**/*"
,
File
::
FNM_DOTMATCH
)
paths
=
Dir
.
glob
(
root
+
"**/*"
,
File
::
FNM_DOTMATCH
)
...
@@ -64,7 +67,7 @@ module Pod
...
@@ -64,7 +67,7 @@ module Pod
# {Dir#glob} with the {File::FNM_CASEFOLD} option.
# {Dir#glob} with the {File::FNM_CASEFOLD} option.
#
#
# @param [String,Array<String>] patterns
# @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
# @param [String] dir_pattern
# An optional pattern to append to a pattern, if it is the path
# 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'
...
@@ -2,16 +2,18 @@ require 'open-uri'
# Allow open-uri to follow http to https redirects.
# 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
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
# This test is intended to forbid a redirection from http://... to
# file:///etc/passwd, file:///dev/zero, etc. CVE-2011-1521
# file:///etc/passwd, file:///dev/zero, etc. CVE-2011-1521
# https to http redirect is also forbidden intentionally.
# 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)
# (RFC 2109 4.3.1, RFC 2965 3.3, RFC 2616 15.1.3)
# However this is ad hoc. It should be extensible/configurable.
# However this is ad hoc. It should be extensible/configurable.
#
#
...
...
lib/cocoapods/resolver.rb
View file @
8d87150a
...
@@ -35,7 +35,7 @@ module Pod
...
@@ -35,7 +35,7 @@ module Pod
#
#
# @note This option is used by `pod outdated`.
# @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
# exists the sandbox will actually download and modify the
# installation.
# installation.
#
#
...
@@ -165,7 +165,7 @@ module Pod
...
@@ -165,7 +165,7 @@ module Pod
# definition.
# 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]
# @return [void]
#
#
...
...
lib/cocoapods/sandbox.rb
View file @
8d87150a
...
@@ -85,8 +85,8 @@ module Pod
...
@@ -85,8 +85,8 @@ module Pod
public
public
# @todo
r
efactor the pods from a local source should not be cached by the
# @todo
R
efactor the pods from a local source should not be cached by the
# sandbox
# sandbox
.
#
#
# @return [LocalPod]
# @return [LocalPod]
#
#
...
@@ -142,7 +142,7 @@ module Pod
...
@@ -142,7 +142,7 @@ module Pod
# @return [Array<String>] the names of the pods that have been
# @return [Array<String>] the names of the pods that have been
# pre-downloaded from an external source.
# 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
attr_reader
:predownloaded_pods
...
@@ -192,6 +192,8 @@ module Pod
...
@@ -192,6 +192,8 @@ module Pod
# Removes the directory as it is regenerated from scratch during each
# Removes the directory as it is regenerated from scratch during each
# installation.
# installation.
#
#
# @return [void]
#
def
prepare_for_install
def
prepare_for_install
root
.
rmtree
if
root
.
exist?
root
.
rmtree
if
root
.
exist?
end
end
...
@@ -202,7 +204,18 @@ module Pod
...
@@ -202,7 +204,18 @@ module Pod
public
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
)
def
add_file
(
namespace_path
,
relative_header_path
)
namespaced_header_path
=
root
+
namespace_path
namespaced_header_path
=
root
+
namespace_path
...
@@ -213,13 +226,15 @@ module Pod
...
@@ -213,13 +226,15 @@ module Pod
namespaced_header_path
+
relative_header_path
.
basename
namespaced_header_path
+
relative_header_path
.
basename
end
end
#
#
@todo Why this variant exits?
#
#
def
add_files
(
namespace_path
,
relative_header_paths
)
def
add_files
(
namespace_path
,
relative_header_paths
)
relative_header_paths
.
map
{
|
path
|
add_file
(
namespace_path
,
path
)
}
relative_header_paths
.
map
{
|
path
|
add_file
(
namespace_path
,
path
)
}
end
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
def
search_paths
@search_paths
.
uniq
.
map
{
|
path
|
"${PODS_ROOT}/
#{
path
}
"
}
@search_paths
.
uniq
.
map
{
|
path
|
"${PODS_ROOT}/
#{
path
}
"
}
...
@@ -232,6 +247,8 @@ module Pod
...
@@ -232,6 +247,8 @@ module Pod
#
#
# @return [void]
# @return [void]
#
#
# @todo Why this variant exits?
#
def
add_search_path
(
path
)
def
add_search_path
(
path
)
@search_paths
<<
Pathname
.
new
(
@relative_path
)
+
path
@search_paths
<<
Pathname
.
new
(
@relative_path
)
+
path
end
end
...
...
lib/cocoapods/sources_manager.rb
View file @
8d87150a
...
@@ -39,7 +39,9 @@ module Pod
...
@@ -39,7 +39,9 @@ module Pod
#
#
def
search
(
dependency
)
def
search
(
dependency
)
set
=
aggregate
.
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
set
end
end
...
@@ -132,7 +134,8 @@ module Pod
...
@@ -132,7 +134,8 @@ module Pod
unless
repo_compatible?
(
dir
)
unless
repo_compatible?
(
dir
)
min
,
max
=
versions
[
'min'
],
versions
[
'max'
]
min
,
max
=
versions
[
'min'
],
versions
[
'max'
]
version_msg
=
(
min
==
max
)
?
min
:
"
#{
min
}
-
#{
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."
"Update Cocoapods, or checkout the appropriate tag in the repo."
end
end
...
...
lib/cocoapods/user_interface.rb
View file @
8d87150a
...
@@ -2,7 +2,7 @@ require 'cocoapods/user_interface/error_report'
...
@@ -2,7 +2,7 @@ require 'cocoapods/user_interface/error_report'
module
Pod
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.
# information and for a verbose mode.
#
#
module
UserInterface
module
UserInterface
...
@@ -28,7 +28,7 @@ module Pod
...
@@ -28,7 +28,7 @@ module Pod
# to their level. In normal mode titles are printed only if
# to their level. In normal mode titles are printed only if
# they have nesting level smaller than 2.
# 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).
# and sections (titles that represent collapsible sections).
#
#
def
section
(
title
,
verbose_prefix
=
''
,
relative_indentation
=
0
)
def
section
(
title
,
verbose_prefix
=
''
,
relative_indentation
=
0
)
...
@@ -45,7 +45,7 @@ module Pod
...
@@ -45,7 +45,7 @@ module Pod
self
.
title_level
-=
1
self
.
title_level
-=
1
end
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
)
def
title
(
title
,
verbose_prefix
=
''
,
relative_indentation
=
2
)
if
(
@treat_titles_as_messages
)
if
(
@treat_titles_as_messages
)
...
@@ -73,7 +73,7 @@ module Pod
...
@@ -73,7 +73,7 @@ module Pod
# a relative indentation valid for the UI action in the passed
# a relative indentation valid for the UI action in the passed
# block.
# block.
#
#
#
TODO: c
lean interface.
#
@todo C
lean interface.
#
#
def
message
(
message
,
verbose_prefix
=
''
,
relative_indentation
=
2
)
def
message
(
message
,
verbose_prefix
=
''
,
relative_indentation
=
2
)
message
=
verbose_prefix
+
message
if
config
.
verbose?
message
=
verbose_prefix
+
message
if
config
.
verbose?
...
@@ -140,7 +140,7 @@ module Pod
...
@@ -140,7 +140,7 @@ module Pod
end
end
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
)
def
pod
(
set
,
mode
=
:normal
)
if
mode
==
:name
if
mode
==
:name
...
@@ -224,7 +224,7 @@ module Pod
...
@@ -224,7 +224,7 @@ module Pod
end
end
UI
=
UserInterface
UI
=
UserInterface
# Redirect
co
pods-core UI.
# Redirect
s cocoa
pods-core UI.
#
#
module
CoreUI
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