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
b64c0c1f
Commit
b64c0c1f
authored
Sep 14, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix command specs
parent
ed5e5674
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
12 additions
and
17 deletions
+12
-17
command.rb
lib/cocoa_pods/command.rb
+1
-1
setup.rb
lib/cocoa_pods/command/setup.rb
+1
-1
command_spec.rb
spec/functional/command_spec.rb
+7
-12
git.rb
spec/spec_helper/git.rb
+3
-3
No files found.
lib/cocoa_pods/command.rb
View file @
b64c0c1f
...
@@ -23,7 +23,7 @@ module Pod
...
@@ -23,7 +23,7 @@ module Pod
end
end
class
ARGV
<
Array
class
ARGV
<
Array
def
options
;
select
{
|
x
|
x
[
0
,
1
]
==
'-'
};
end
def
options
;
select
{
|
x
|
x
.
to_s
[
0
,
1
]
==
'-'
};
end
def
arguments
;
self
-
options
;
end
def
arguments
;
self
-
options
;
end
def
option
(
name
);
!!
delete
(
name
);
end
def
option
(
name
);
!!
delete
(
name
);
end
def
shift_argument
;
(
arg
=
arguments
[
0
])
&&
delete
(
arg
);
end
def
shift_argument
;
(
arg
=
arguments
[
0
])
&&
delete
(
arg
);
end
...
...
lib/cocoa_pods/command/setup.rb
View file @
b64c0c1f
...
@@ -21,7 +21,7 @@ module Pod
...
@@ -21,7 +21,7 @@ module Pod
end
end
def
add_master_repo_command
def
add_master_repo_command
@command
||=
Repo
.
new
(
'add'
,
'master'
,
master_repo_url
)
@command
||=
Repo
.
new
(
ARGV
.
new
([
'add'
,
'master'
,
master_repo_url
])
)
end
end
def
run
def
run
...
...
spec/functional/command_spec.rb
View file @
b64c0c1f
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
require
'executioner'
describe
"Pod::Command"
do
describe
"Pod::Command"
do
extend
SpecHelper
::
Fixture
extend
SpecHelper
::
Git
extend
SpecHelper
::
Git
extend
SpecHelper
::
Log
extend
SpecHelper
::
Log
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryDirectory
...
@@ -14,33 +12,30 @@ describe "Pod::Command" do
...
@@ -14,33 +12,30 @@ describe "Pod::Command" do
it
"creates the local spec-repos directory and creates a clone of the `master' repo"
do
it
"creates the local spec-repos directory and creates a clone of the `master' repo"
do
command
=
Pod
::
Command
.
parse
(
'setup'
)
command
=
Pod
::
Command
.
parse
(
'setup'
)
def
command
.
master_repo_url
;
SpecHelper
.
fixture
(
'master-spec-repo.git'
);
end
def
command
.
master_repo_url
;
SpecHelper
.
fixture
(
'master-spec-repo.git'
);
end
def
(
command
.
add_master_repo_command
)
.
repos_dir
;
SpecHelper
.
tmp_repos_path
;
end
command
.
run
command
.
run
git_config
(
'master'
,
'remote.origin.url'
).
should
==
fixture
(
'master-spec-repo.git'
)
git_config
(
'master'
,
'remote.origin.url'
).
should
==
fixture
(
'master-spec-repo.git'
)
.
to_s
end
end
def
command
(
*
argv
)
def
command
(
*
argv
)
command
=
Pod
::
Command
.
parse
(
*
argv
)
command
=
Pod
::
Command
.
parse
(
*
argv
)
def
command
.
repos_dir
;
SpecHelper
.
tmp_repos_path
;
end
command
.
run
command
.
run
command
command
end
end
it
"adds a spec-repo"
do
it
"adds a spec-repo"
do
command
(
'repo'
,
'add'
,
'private'
,
fixture
(
'master-spec-repo.git'
))
command
(
'repo'
,
'add'
,
'private'
,
fixture
(
'master-spec-repo.git'
))
git_config
(
'private'
,
'remote.origin.url'
).
should
==
fixture
(
'master-spec-repo.git'
)
git_config
(
'private'
,
'remote.origin.url'
).
should
==
fixture
(
'master-spec-repo.git'
)
.
to_s
end
end
it
"updates a spec-repo"
do
it
"updates a spec-repo"
do
repo1
=
command
(
'repo'
,
'add'
,
'repo1'
,
fixture
(
'master-spec-repo.git'
))
repo1
=
command
(
'repo'
,
'add'
,
'repo1'
,
fixture
(
'master-spec-repo.git'
))
repo2
=
command
(
'repo'
,
'add'
,
'repo2'
,
repo1
.
dir
)
repo2
=
command
(
'repo'
,
'add'
,
'repo2'
,
repo1
.
dir
)
File
.
open
(
File
.
join
(
repo1
.
dir
,
'README'
),
'a'
)
{
|
f
|
f
<<
'updated!'
}
(
repo1
.
dir
+
'README'
).
open
(
'a'
)
{
|
f
|
f
<<
'updated!'
}
git
(
'repo1'
,
'commit -a -m "update"'
)
git
(
'repo1'
,
'commit -a -m "update"'
)
command
(
'repo'
,
'update'
,
'repo2'
)
command
(
'repo'
,
'update'
,
'repo2'
)
File
.
read
(
File
.
join
(
repo2
.
dir
,
'README'
))
.
should
.
include
'updated!'
(
repo2
.
dir
+
'README'
).
read
.
should
.
include
'updated!'
end
end
it
"updates all the spec-repos"
do
it
"updates all the spec-repos"
do
...
@@ -48,11 +43,11 @@ describe "Pod::Command" do
...
@@ -48,11 +43,11 @@ describe "Pod::Command" do
repo2
=
command
(
'repo'
,
'add'
,
'repo2'
,
repo1
.
dir
)
repo2
=
command
(
'repo'
,
'add'
,
'repo2'
,
repo1
.
dir
)
repo3
=
command
(
'repo'
,
'add'
,
'repo3'
,
repo1
.
dir
)
repo3
=
command
(
'repo'
,
'add'
,
'repo3'
,
repo1
.
dir
)
File
.
open
(
File
.
join
(
repo1
.
dir
,
'README'
),
'a'
)
{
|
f
|
f
<<
'updated!'
}
(
repo1
.
dir
+
'README'
).
open
(
'a'
)
{
|
f
|
f
<<
'updated!'
}
git
(
'repo1'
,
'commit -a -m "update"'
)
git
(
'repo1'
,
'commit -a -m "update"'
)
command
(
'repo'
,
'update'
)
command
(
'repo'
,
'update'
)
File
.
read
(
File
.
join
(
repo2
.
dir
,
'README'
))
.
should
.
include
'updated!'
(
repo2
.
dir
+
'README'
).
read
.
should
.
include
'updated!'
File
.
read
(
File
.
join
(
repo3
.
dir
,
'README'
))
.
should
.
include
'updated!'
(
repo3
.
dir
+
'README'
).
read
.
should
.
include
'updated!'
end
end
end
end
spec/spec_helper/git.rb
View file @
b64c0c1f
...
@@ -8,12 +8,12 @@ module SpecHelper
...
@@ -8,12 +8,12 @@ module SpecHelper
module
Git
module
Git
def
tmp_repos_path
def
tmp_repos_path
File
.
join
(
SpecHelper
.
temporary_directory
,
'cocoa-pods'
)
SpecHelper
.
temporary_directory
+
'cocoa-pods'
end
end
module_function
:tmp_repos_path
module_function
:tmp_repos_path
def
tmp_master_repo_path
def
tmp_master_repo_path
File
.
join
(
tmp_repos_path
,
'master'
)
tmp_repos_path
+
'master'
end
end
include
Executioner
include
Executioner
...
@@ -21,7 +21,7 @@ module SpecHelper
...
@@ -21,7 +21,7 @@ module SpecHelper
alias_method
:git_super
,
:git
alias_method
:git_super
,
:git
def
git
(
repo
,
command
)
def
git
(
repo
,
command
)
Dir
.
chdir
(
File
.
join
(
tmp_repos_path
,
repo
)
)
{
git_super
(
command
).
strip
}
Dir
.
chdir
(
tmp_repos_path
+
repo
)
{
git_super
(
command
).
strip
}
end
end
def
git_config
(
repo
,
attr
)
def
git_config
(
repo
,
attr
)
...
...
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