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
ab69dd46
Commit
ab69dd46
authored
Mar 08, 2015
by
Samuel E. Giddins
Committed by
Kyle Fuller
Mar 29, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[Executable] Properly execute things using Open4.spawn using an array of arguments
parent
86424fc3
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
31 additions
and
30 deletions
+31
-30
Gemfile.lock
Gemfile.lock
+1
-1
lib.rb
lib/cocoapods/command/lib.rb
+1
-1
add.rb
lib/cocoapods/command/repo/add.rb
+3
-3
push.rb
lib/cocoapods/command/repo/push.rb
+3
-3
setup.rb
lib/cocoapods/command/setup.rb
+2
-2
executable.rb
lib/cocoapods/executable.rb
+8
-7
bridge_support.rb
lib/cocoapods/generator/bridge_support.rb
+1
-1
pod_source_installer.rb
lib/cocoapods/installer/pod_source_installer.rb
+1
-1
sources_manager.rb
lib/cocoapods/sources_manager.rb
+2
-2
lib_spec.rb
spec/functional/command/lib_spec.rb
+3
-3
executable_spec.rb
spec/unit/executable_spec.rb
+3
-3
bridge_support_spec.rb
spec/unit/generator/bridge_support_spec.rb
+2
-2
sources_manager_spec.rb
spec/unit/sources_manager_spec.rb
+1
-1
No files found.
Gemfile.lock
View file @
ab69dd46
...
@@ -33,7 +33,7 @@ GIT
...
@@ -33,7 +33,7 @@ GIT
GIT
GIT
remote: https://github.com/CocoaPods/cocoapods-downloader.git
remote: https://github.com/CocoaPods/cocoapods-downloader.git
revision:
a5a642e572937eb08097fbf65b30e1e7a3c449e9
revision:
217c49204845916071eb3bd160bd7357000f0f62
branch: master
branch: master
specs:
specs:
cocoapods-downloader (0.8.1)
cocoapods-downloader (0.8.1)
...
...
lib/cocoapods/command/lib.rb
View file @
ab69dd46
...
@@ -60,7 +60,7 @@ module Pod
...
@@ -60,7 +60,7 @@ module Pod
#
#
def
clone_template
def
clone_template
UI
.
section
(
"Cloning `
#{
template_repo_url
}
` into `
#{
@name
}
`."
)
do
UI
.
section
(
"Cloning `
#{
template_repo_url
}
` into `
#{
@name
}
`."
)
do
git!
"clone '
#{
template_repo_url
}
'
#{
@name
}
"
git!
[
'clone'
,
template_repo_url
,
@name
]
end
end
end
end
...
...
lib/cocoapods/command/repo/add.rb
View file @
ab69dd46
...
@@ -39,11 +39,11 @@ module Pod
...
@@ -39,11 +39,11 @@ module Pod
UI
.
section
(
"
#{
prefix
}
spec repo `
#{
@name
}
` from `
#{
@url
}
`
#{
" (branch `
#{
@branch
}
`)"
if
@branch
}
"
)
do
UI
.
section
(
"
#{
prefix
}
spec repo `
#{
@name
}
` from `
#{
@url
}
`
#{
" (branch `
#{
@branch
}
`)"
if
@branch
}
"
)
do
config
.
repos_dir
.
mkpath
config
.
repos_dir
.
mkpath
Dir
.
chdir
(
config
.
repos_dir
)
do
Dir
.
chdir
(
config
.
repos_dir
)
do
command
=
"clone '
#{
@url
}
'
#{
@name
}
"
command
=
[
'clone'
,
@url
,
@name
]
command
<<
'
--depth=1'
if
@shallow
command
<<
'--depth=1'
if
@shallow
git!
(
command
)
git!
(
command
)
end
end
Dir
.
chdir
(
dir
)
{
git!
(
"checkout
#{
@branch
}
"
)
}
if
@branch
Dir
.
chdir
(
dir
)
{
git!
(
'checkout'
,
@branch
)
}
if
@branch
SourcesManager
.
check_version_information
(
dir
)
SourcesManager
.
check_version_information
(
dir
)
end
end
end
end
...
...
lib/cocoapods/command/repo/push.rb
View file @
ab69dd46
...
@@ -146,10 +146,10 @@ module Pod
...
@@ -146,10 +146,10 @@ module Pod
FileUtils
.
cp
(
spec_file
,
output_path
)
FileUtils
.
cp
(
spec_file
,
output_path
)
Dir
.
chdir
(
repo_dir
)
do
Dir
.
chdir
(
repo_dir
)
do
# only commit if modified
# only commit if modified
if
git!
(
'status
--porcelain 2>&1
'
).
include?
(
spec
.
name
)
if
git!
(
'status
'
,
'--porcelain
'
).
include?
(
spec
.
name
)
UI
.
puts
" -
#{
message
}
"
UI
.
puts
" -
#{
message
}
"
git!
(
"add
#{
spec
.
name
}
"
)
git!
(
'add'
,
spec
.
name
)
git!
(
"commit --no-verify -m '
#{
message
}
'"
)
git!
(
'commit'
,
'--no-verify'
,
'-m'
,
message
)
else
else
UI
.
puts
" - [No change]
#{
spec
}
"
UI
.
puts
" - [No change]
#{
spec
}
"
end
end
...
...
lib/cocoapods/command/setup.rb
View file @
ab69dd46
...
@@ -70,7 +70,7 @@ module Pod
...
@@ -70,7 +70,7 @@ module Pod
#
#
def
set_master_repo_url
def
set_master_repo_url
Dir
.
chdir
(
master_repo_dir
)
do
Dir
.
chdir
(
master_repo_dir
)
do
git
(
"remote set-url origin '
#{
url
}
'"
)
git
(
'remote'
,
'set-url'
,
'origin'
,
url
)
end
end
end
end
...
@@ -101,7 +101,7 @@ module Pod
...
@@ -101,7 +101,7 @@ module Pod
#
#
def
set_master_repo_branch
def
set_master_repo_branch
Dir
.
chdir
(
master_repo_dir
)
do
Dir
.
chdir
(
master_repo_dir
)
do
git
(
'checkout master'
)
git
%w(checkout master
)
end
end
end
end
...
...
lib/cocoapods/executable.rb
View file @
ab69dd46
...
@@ -19,12 +19,12 @@ module Pod
...
@@ -19,12 +19,12 @@ module Pod
# @return [void]
# @return [void]
#
#
def
executable
(
name
)
def
executable
(
name
)
define_method
(
name
)
do
|
command
|
define_method
(
name
)
do
|
*
command
|
Executable
.
execute_command
(
name
,
command
,
false
)
Executable
.
execute_command
(
name
,
Array
(
command
).
flatten
,
false
)
end
end
define_method
(
name
.
to_s
+
'!'
)
do
|
command
|
define_method
(
name
.
to_s
+
'!'
)
do
|
*
command
|
Executable
.
execute_command
(
name
,
command
,
true
)
Executable
.
execute_command
(
name
,
Array
(
command
).
flatten
,
true
)
end
end
end
end
...
@@ -33,7 +33,7 @@ module Pod
...
@@ -33,7 +33,7 @@ module Pod
# @param [String] bin
# @param [String] bin
# The binary to use.
# The binary to use.
#
#
# @param [
String
] command
# @param [
Array<#to_s>
] command
# The command to send to the binary.
# The command to send to the binary.
#
#
# @param [Bool] raise_on_failure
# @param [Bool] raise_on_failure
...
@@ -54,7 +54,8 @@ module Pod
...
@@ -54,7 +54,8 @@ module Pod
require
'open4'
require
'open4'
require
'shellwords'
require
'shellwords'
full_command
=
"
#{
bin
.
shellescape
}
#{
command
}
"
command
=
command
.
map
(
&
:to_s
)
full_command
=
"
#{
bin
.
shellescape
}
#{
command
.
map
(
&
:shellescape
).
join
(
' '
)
}
"
if
Config
.
instance
.
verbose?
if
Config
.
instance
.
verbose?
UI
.
message
(
"$
#{
full_command
}
"
)
UI
.
message
(
"$
#{
full_command
}
"
)
...
@@ -64,7 +65,7 @@ module Pod
...
@@ -64,7 +65,7 @@ module Pod
end
end
options
=
{
:stdout
=>
stdout
,
:stderr
=>
stderr
,
:status
=>
true
}
options
=
{
:stdout
=>
stdout
,
:stderr
=>
stderr
,
:status
=>
true
}
status
=
Open4
.
spawn
(
full_
command
,
options
)
status
=
Open4
.
spawn
(
bin
,
command
,
options
)
output
=
stdout
.
join
(
"
\n
"
)
+
stderr
.
join
(
"
\n
"
)
output
=
stdout
.
join
(
"
\n
"
)
+
stderr
.
join
(
"
\n
"
)
unless
status
.
success?
unless
status
.
success?
if
raise_on_failure
if
raise_on_failure
...
...
lib/cocoapods/generator/bridge_support.rb
View file @
ab69dd46
...
@@ -15,7 +15,7 @@ module Pod
...
@@ -15,7 +15,7 @@ module Pod
end
end
def
save_as
(
pathname
)
def
save_as
(
pathname
)
gen_bridge_metadata
%(-c "#{search_paths.join(' ')}" -o '#{pathname}' '#{headers.join("' '")}'
)
gen_bridge_metadata
(
'-c'
,
search_paths
.
join
(
' '
),
'-o'
,
pathname
,
*
headers
)
end
end
end
end
end
end
...
...
lib/cocoapods/installer/pod_source_installer.rb
View file @
ab69dd46
...
@@ -124,7 +124,7 @@ module Pod
...
@@ -124,7 +124,7 @@ module Pod
ENV
.
delete
(
'CDPATH'
)
ENV
.
delete
(
'CDPATH'
)
prepare_command
=
root_spec
.
prepare_command
.
strip_heredoc
.
chomp
prepare_command
=
root_spec
.
prepare_command
.
strip_heredoc
.
chomp
full_command
=
"
\n
set -e
\n
"
+
prepare_command
full_command
=
"
\n
set -e
\n
"
+
prepare_command
bash!
(
full_command
)
bash!
(
'-c'
,
full_command
)
end
end
end
end
end
end
...
...
lib/cocoapods/sources_manager.rb
View file @
ab69dd46
...
@@ -210,7 +210,7 @@ module Pod
...
@@ -210,7 +210,7 @@ module Pod
UI
.
section
"Updating spec repo `
#{
source
.
name
}
`"
do
UI
.
section
"Updating spec repo `
#{
source
.
name
}
`"
do
Dir
.
chdir
(
source
.
repo
)
do
Dir
.
chdir
(
source
.
repo
)
do
begin
begin
output
=
git!
(
'pull --ff-only'
)
output
=
git!
%w(pull --ff-only
)
UI
.
puts
output
if
show_output
&&
!
config
.
verbose?
UI
.
puts
output
if
show_output
&&
!
config
.
verbose?
rescue
Informative
rescue
Informative
UI
.
warn
'CocoaPods was not able to update the '
\
UI
.
warn
'CocoaPods was not able to update the '
\
...
@@ -232,7 +232,7 @@ module Pod
...
@@ -232,7 +232,7 @@ module Pod
# @return [Bool] Whether the given source is a GIT repo.
# @return [Bool] Whether the given source is a GIT repo.
#
#
def
git_repo?
(
dir
)
def
git_repo?
(
dir
)
Dir
.
chdir
(
dir
)
{
git
(
'rev-parse >/dev/null 2>&1'
)
}
Dir
.
chdir
(
dir
)
{
`git rev-parse >/dev/null 2>&1`
}
$?
.
success?
$?
.
success?
end
end
...
...
spec/functional/command/lib_spec.rb
View file @
ab69dd46
...
@@ -21,7 +21,7 @@ module Pod
...
@@ -21,7 +21,7 @@ module Pod
it
'should create a new dir for the newly created pod'
do
it
'should create a new dir for the newly created pod'
do
@sut
.
any_instance
.
stubs
(
:configure_template
)
@sut
.
any_instance
.
stubs
(
:configure_template
)
url
=
@sut
::
TEMPLATE_REPO
url
=
@sut
::
TEMPLATE_REPO
@sut
.
any_instance
.
expects
(
:git!
).
with
(
"clone '
#{
url
}
' TestPod"
).
once
@sut
.
any_instance
.
expects
(
:git!
).
with
(
[
'clone'
,
url
,
'TestPod'
]
).
once
run_command
(
'lib'
,
'create'
,
'TestPod'
)
run_command
(
'lib'
,
'create'
,
'TestPod'
)
end
end
...
@@ -47,13 +47,13 @@ module Pod
...
@@ -47,13 +47,13 @@ module Pod
it
'should use the given template URL'
do
it
'should use the given template URL'
do
template_url
=
'https://github.com/custom/template.git'
template_url
=
'https://github.com/custom/template.git'
@sut
.
any_instance
.
expects
(
:git!
).
with
(
"clone '
#{
template_url
}
' TestPod"
).
once
@sut
.
any_instance
.
expects
(
:git!
).
with
(
[
'clone'
,
template_url
,
'TestPod'
]
).
once
run_command
(
'lib'
,
'create'
,
'TestPod'
,
template_url
)
run_command
(
'lib'
,
'create'
,
'TestPod'
,
template_url
)
end
end
it
'should use the default URL if no template URL is given'
do
it
'should use the default URL if no template URL is given'
do
template_url
=
'https://github.com/CocoaPods/pod-template.git'
template_url
=
'https://github.com/CocoaPods/pod-template.git'
@sut
.
any_instance
.
expects
(
:git!
).
with
(
"clone '
#{
template_url
}
' TestPod"
).
once
@sut
.
any_instance
.
expects
(
:git!
).
with
(
[
'clone'
,
template_url
,
'TestPod'
]
).
once
run_command
(
'lib'
,
'create'
,
'TestPod'
)
run_command
(
'lib'
,
'create'
,
'TestPod'
)
end
end
end
end
...
...
spec/unit/executable_spec.rb
View file @
ab69dd46
...
@@ -5,7 +5,7 @@ module Pod
...
@@ -5,7 +5,7 @@ module Pod
it
'shows the actual command on failure'
do
it
'shows the actual command on failure'
do
e
=
lambda
do
e
=
lambda
do
Executable
.
execute_command
(
'false'
,
Executable
.
execute_command
(
'false'
,
''
,
true
)
[
''
]
,
true
)
end
.
should
.
raise
Informative
end
.
should
.
raise
Informative
e
.
message
.
should
.
match
(
/false/
)
e
.
message
.
should
.
match
(
/false/
)
end
end
...
@@ -16,8 +16,8 @@ module Pod
...
@@ -16,8 +16,8 @@ module Pod
result
=
mock
result
=
mock
result
.
stubs
(
:success?
).
returns
(
true
)
result
.
stubs
(
:success?
).
returns
(
true
)
Open4
.
expects
(
:spawn
).
with
(
'/Spa
\\ ces/are\\"/fun/false '
,
:stdout
=>
[],
:stderr
=>
[],
:status
=>
true
).
once
.
returns
(
result
)
Open4
.
expects
(
:spawn
).
with
(
'/Spa
ces/are"/fun/false'
,
[]
,
:stdout
=>
[],
:stderr
=>
[],
:status
=>
true
).
once
.
returns
(
result
)
Executable
.
execute_command
(
cmd
,
''
,
true
)
Executable
.
execute_command
(
cmd
,
[]
,
true
)
end
end
end
end
end
end
spec/unit/generator/bridge_support_spec.rb
View file @
ab69dd46
...
@@ -7,8 +7,8 @@ describe 'Pod::Generator::BridgeSupport' do
...
@@ -7,8 +7,8 @@ describe 'Pod::Generator::BridgeSupport' do
it
'generates a metadata file with the appropriate search paths'
do
it
'generates a metadata file with the appropriate search paths'
do
headers
=
%w(/some/dir/foo.h /some/dir/bar.h /some/other/dir/baz.h)
.
map
{
|
h
|
Pathname
.
new
(
h
)
}
headers
=
%w(/some/dir/foo.h /some/dir/bar.h /some/other/dir/baz.h)
.
map
{
|
h
|
Pathname
.
new
(
h
)
}
generator
=
Pod
::
Generator
::
BridgeSupport
.
new
(
headers
)
generator
=
Pod
::
Generator
::
BridgeSupport
.
new
(
headers
)
expected
=
%(-c "-I '/some/dir' -I '/some/other/dir'" -o '/path/to/Pods.bridgesupport' '#{headers.join("' '")}')
expected
=
[
'-c'
,
"-I '/some/dir' -I '/some/other/dir'"
,
'-o'
,
'/path/to/Pods.bridgesupport'
,
*
headers
]
generator
.
expects
(
:gen_bridge_metadata
).
with
(
expected
)
generator
.
expects
(
:gen_bridge_metadata
).
with
{
|*
command
|
command
.
map
(
&
:to_s
)
==
expected
.
map
(
&
:to_s
)
}
generator
.
save_as
(
Pathname
.
new
(
'/path/to/Pods.bridgesupport'
))
generator
.
save_as
(
Pathname
.
new
(
'/path/to/Pods.bridgesupport'
))
end
end
end
end
...
...
spec/unit/sources_manager_spec.rb
View file @
ab69dd46
...
@@ -242,7 +242,7 @@ module Pod
...
@@ -242,7 +242,7 @@ module Pod
it
'uses the only fast forward git option'
do
it
'uses the only fast forward git option'
do
set_up_test_repo_for_update
set_up_test_repo_for_update
SourcesManager
.
expects
(
:git!
).
with
{
|
options
|
options
.
should
.
match
/--ff-only/
}
SourcesManager
.
expects
(
:git!
).
with
{
|
options
|
options
.
should
.
include?
'--ff-only'
}
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
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