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
5de12d4b
Commit
5de12d4b
authored
Sep 19, 2012
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[UI] Refine previous implementation.
parent
a98fd2ee
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
38 additions
and
50 deletions
+38
-50
command.rb
lib/cocoapods/command.rb
+3
-18
repo.rb
lib/cocoapods/command/repo.rb
+14
-12
setup.rb
lib/cocoapods/command/setup.rb
+15
-14
installer.rb
lib/cocoapods/installer.rb
+2
-2
resolver.rb
lib/cocoapods/resolver.rb
+2
-2
user_interface.rb
lib/cocoapods/user_interface.rb
+2
-2
No files found.
lib/cocoapods/command.rb
View file @
5de12d4b
...
@@ -145,24 +145,9 @@ module Pod
...
@@ -145,24 +145,9 @@ module Pod
def
update_spec_repos_if_necessary!
def
update_spec_repos_if_necessary!
if
@update_repo
if
@update_repo
print_title
'Updating Spec Repositories'
,
true
UI
.
title
'Updating Spec Repositories'
do
Repo
.
new
(
ARGV
.
new
([
"update"
])).
run
Repo
.
new
(
ARGV
.
new
([
"update"
])).
run
end
end
end
def
print_title
(
title
,
only_verbose
=
true
)
if
config
.
verbose?
puts
"
\n
"
+
title
.
yellow
elsif
!
config
.
silent?
&&
!
only_verbose
puts
title
end
end
def
print_subtitle
(
title
,
only_verbose
=
false
)
if
config
.
verbose?
puts
"
\n
"
+
title
.
green
elsif
!
config
.
silent?
&&
!
only_verbose
puts
title
end
end
end
end
end
end
...
...
lib/cocoapods/command/repo.rb
View file @
5de12d4b
...
@@ -56,23 +56,25 @@ module Pod
...
@@ -56,23 +56,25 @@ module Pod
end
end
def
add
def
add
print_subtitle
"Cloning spec repo `
#{
@name
}
' from `
#{
@url
}
'
#{
" (branch `
#{
@branch
}
')"
if
@branch
}
"
UI
.
title
(
"Cloning spec repo `
#{
@name
}
' from `
#{
@url
}
'
#{
" (branch `
#{
@branch
}
')"
if
@branch
}
"
)
do
config
.
repos_dir
.
mkpath
config
.
repos_dir
.
mkpath
Dir
.
chdir
(
config
.
repos_dir
)
{
git!
(
"clone '
#{
@url
}
'
#{
@name
}
"
)
}
Dir
.
chdir
(
config
.
repos_dir
)
{
git!
(
"clone '
#{
@url
}
'
#{
@name
}
"
)
}
Dir
.
chdir
(
dir
)
{
git!
(
"checkout
#{
@branch
}
"
)
}
if
@branch
Dir
.
chdir
(
dir
)
{
git!
(
"checkout
#{
@branch
}
"
)
}
if
@branch
check_versions
(
dir
)
check_versions
(
dir
)
end
end
end
def
update
def
update
dirs
=
@name
?
[
dir
]
:
config
.
repos_dir
.
children
.
select
{
|
c
|
c
.
directory?
}
dirs
=
@name
?
[
dir
]
:
config
.
repos_dir
.
children
.
select
{
|
c
|
c
.
directory?
}
dirs
.
each
do
|
dir
|
dirs
.
each
do
|
dir
|
print_subtitle
"Updating spec repo `
#{
dir
.
basename
}
'"
UI
.
title
"Updating spec repo `
#{
dir
.
basename
}
'"
do
Dir
.
chdir
(
dir
)
do
Dir
.
chdir
(
dir
)
do
`git rev-parse >/dev/null 2>&1`
`git rev-parse >/dev/null 2>&1`
if
$?
.
exitstatus
.
zero?
if
$?
.
exitstatus
.
zero?
git!
(
"pull"
)
git!
(
"pull"
)
else
else
puts
(
" Not a git repository"
)
if
config
.
verbose?
UI
.
message
"Not a git repository"
end
end
end
end
end
check_versions
(
dir
)
check_versions
(
dir
)
...
...
lib/cocoapods/command/setup.rb
View file @
5de12d4b
...
@@ -89,21 +89,22 @@ module Pod
...
@@ -89,21 +89,22 @@ module Pod
end
end
def
run
def
run
print_title
"Setting up CocoaPods master repo"
UI
.
title
"Setting up CocoaPods master repo"
do
if
dir
.
exist?
if
dir
.
exist?
set_master_repo_url
set_master_repo_url
set_master_repo_branch
set_master_repo_branch
update_master_repo
update_master_repo
else
else
add_master_repo
add_master_repo
end
end
# Mainly so the specs run with submodule repos
# Mainly so the specs run with submodule repos
if
(
dir
+
'.git/hooks'
).
exist?
if
(
dir
+
'.git/hooks'
).
exist?
hook
=
dir
+
'.git/hooks/pre-commit'
hook
=
dir
+
'.git/hooks/pre-commit'
hook
.
open
(
'w'
)
{
|
f
|
f
<<
"#!/bin/sh
\n
rake lint"
}
hook
.
open
(
'w'
)
{
|
f
|
f
<<
"#!/bin/sh
\n
rake lint"
}
`chmod +x '
#{
hook
}
'`
`chmod +x '
#{
hook
}
'`
end
end
end
print_sub
title
"Setup completed (
#{
push?
?
"push"
:
"read-only"
}
access)"
UI
.
title
"Setup completed (
#{
push?
?
"push"
:
"read-only"
}
access)"
end
end
end
end
end
end
...
...
lib/cocoapods/installer.rb
View file @
5de12d4b
...
@@ -119,12 +119,12 @@ module Pod
...
@@ -119,12 +119,12 @@ module Pod
install_dependencies!
install_dependencies!
end
end
UI
.
title
(
"Generating support files"
,
''
,
2
)
do
UI
.
title
"Generating support files"
do
UI
.
message
"- Running pre install hooks"
do
UI
.
message
"- Running pre install hooks"
do
run_pre_install_hooks
run_pre_install_hooks
end
end
UI
.
message
(
"- Installing targets"
,
''
,
2
)
do
UI
.
message
"- Installing targets"
do
generate_target_support_files
generate_target_support_files
end
end
...
...
lib/cocoapods/resolver.rb
View file @
5de12d4b
...
@@ -69,7 +69,7 @@ module Pod
...
@@ -69,7 +69,7 @@ module Pod
if
@lockfile
if
@lockfile
@pods_by_state
=
@lockfile
.
detect_changes_with_podfile
(
podfile
)
@pods_by_state
=
@lockfile
.
detect_changes_with_podfile
(
podfile
)
UI
.
title
(
"Finding added, modified or removed dependencies:"
,
''
,
2
)
do
UI
.
title
"Finding added, modified or removed dependencies:"
do
marks
=
{
:added
=>
"A"
.
green
,
:changed
=>
"M"
.
yellow
,
:removed
=>
"R"
.
red
,
:unchanged
=>
"-"
}
marks
=
{
:added
=>
"A"
.
green
,
:changed
=>
"M"
.
yellow
,
:removed
=>
"R"
.
red
,
:unchanged
=>
"-"
}
@pods_by_state
.
each
do
|
symbol
,
pod_names
|
@pods_by_state
.
each
do
|
symbol
,
pod_names
|
pod_names
.
each
do
|
pod_name
|
pod_names
.
each
do
|
pod_name
|
...
@@ -81,7 +81,7 @@ module Pod
...
@@ -81,7 +81,7 @@ module Pod
end
end
@podfile
.
target_definitions
.
values
.
each
do
|
target_definition
|
@podfile
.
target_definitions
.
values
.
each
do
|
target_definition
|
UI
.
title
(
"Resolving dependencies for target `
#{
target_definition
.
name
}
' (
#{
target_definition
.
platform
}
):"
,
''
,
2
)
do
UI
.
title
"Resolving dependencies for target `
#{
target_definition
.
name
}
' (
#{
target_definition
.
platform
}
):"
do
@loaded_specs
=
[]
@loaded_specs
=
[]
find_dependency_specs
(
@podfile
,
target_definition
.
dependencies
,
target_definition
)
find_dependency_specs
(
@podfile
,
target_definition
.
dependencies
,
target_definition
)
@specs_by_target
[
target_definition
]
=
@cached_specs
.
values_at
(
*
@loaded_specs
).
sort_by
(
&
:name
)
@specs_by_target
[
target_definition
]
=
@cached_specs
.
values_at
(
*
@loaded_specs
).
sort_by
(
&
:name
)
...
...
lib/cocoapods/user_interface.rb
View file @
5de12d4b
...
@@ -9,7 +9,7 @@ module Pod
...
@@ -9,7 +9,7 @@ module Pod
attr_accessor
:indentation_level
,
:title_level
attr_accessor
:indentation_level
,
:title_level
def
title
(
title
,
verbose_prefix
=
''
,
relative_indentation
=
0
)
def
title
(
title
,
verbose_prefix
=
''
,
relative_indentation
=
2
)
if
config
.
verbose?
if
config
.
verbose?
title
=
verbose_prefix
+
title
if
config
.
verbose?
title
=
verbose_prefix
+
title
if
config
.
verbose?
title
=
"
\n
#{
title
}
"
if
@title_level
<
2
title
=
"
\n
#{
title
}
"
if
@title_level
<
2
...
@@ -28,7 +28,7 @@ module Pod
...
@@ -28,7 +28,7 @@ module Pod
self
.
title_level
-=
1
self
.
title_level
-=
1
end
end
def
message
(
message
,
verbose_prefix
=
''
,
relative_indentation
=
0
)
def
message
(
message
,
verbose_prefix
=
''
,
relative_indentation
=
2
)
message
=
verbose_prefix
+
message
if
config
.
verbose?
message
=
verbose_prefix
+
message
if
config
.
verbose?
puts_indented
message
if
config
.
verbose?
puts_indented
message
if
config
.
verbose?
...
...
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