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
b255de76
Commit
b255de76
authored
Oct 25, 2012
by
Eloy Durán
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make specs green.
parent
054fe5c8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
272 additions
and
298 deletions
+272
-298
Gemfile.lock
Gemfile.lock
+1
-1
push.rb
lib/cocoapods/command/push.rb
+1
-1
repo.rb
lib/cocoapods/command/repo.rb
+7
-7
setup.rb
lib/cocoapods/command/setup.rb
+1
-1
spec.rb
lib/cocoapods/command/spec.rb
+3
-1
resolver.rb
lib/cocoapods/resolver.rb
+1
-1
install_spec.rb
spec/functional/command/install_spec.rb
+6
-12
list_spec.rb
spec/functional/command/list_spec.rb
+26
-36
outdated_spec.rb
spec/functional/command/outdated_spec.rb
+15
-14
push_spec.rb
spec/functional/command/push_spec.rb
+61
-61
repo_spec.rb
spec/functional/command/repo_spec.rb
+0
-12
search_spec.rb
spec/functional/command/search_spec.rb
+38
-40
setup_spec.rb
spec/functional/command/setup_spec.rb
+54
-54
spec_spec.rb
spec/functional/command/spec_spec.rb
+0
-0
update_spec.rb
spec/functional/command/update_spec.rb
+15
-14
command_spec.rb
spec/functional/command_spec.rb
+0
-11
spec_helper.rb
spec/spec_helper.rb
+6
-1
command.rb
spec/spec_helper/command.rb
+4
-2
temporary_repos.rb
spec/spec_helper/temporary_repos.rb
+1
-1
command_spec.rb
spec/unit/command_spec.rb
+17
-13
resolver_spec.rb
spec/unit/resolver_spec.rb
+15
-15
No files found.
Gemfile.lock
View file @
b255de76
...
...
@@ -8,7 +8,7 @@ GIT
GIT
remote: git://github.com/alloy/CLAide.git
revision:
fdcc73837ff0c67b440fa9a20dc6366c78f06f09
revision:
324ceaf81365eb6e5936c010037887a2c8d44f3e
specs:
claide (0.0.1)
...
...
lib/cocoapods/command/push.rb
View file @
b255de76
...
...
@@ -89,7 +89,7 @@ module Pod
lint_argv
<<
"--silent"
if
config
.
silent
all_valid
=
true
podspec_files
.
each
do
|
podspec
|
Spec
.
new
(
ARGV
.
new
(
lint_argv
+
[
podspec
.
to_s
])
).
run
Spec
.
parse
(
lint_argv
+
[
podspec
.
to_s
]
).
run
end
end
...
...
lib/cocoapods/command/repo.rb
View file @
b255de76
...
...
@@ -149,17 +149,10 @@ module Pod
# TODO some of the following methods can probably move to one of the subclasses.
protected
def
dir
config
.
repos_dir
+
@name
end
def
print_messages
(
type
,
messages
)
return
if
config
.
silent?
messages
.
each
{
|
msg
|
UI
.
puts
" -
#{
type
.
ljust
(
5
)
}
|
#{
msg
}
"
}
end
def
check_versions
(
dir
)
versions
=
versions
(
dir
)
unless
is_compatilbe
(
versions
)
...
...
@@ -172,6 +165,13 @@ module Pod
UI
.
puts
"
\n
Cocoapods
#{
versions
[
'last'
]
}
is available.
\n
"
.
green
if
has_update
(
versions
)
&&
config
.
new_version_message?
end
protected
def
print_messages
(
type
,
messages
)
return
if
config
.
silent?
messages
.
each
{
|
msg
|
UI
.
puts
" -
#{
type
.
ljust
(
5
)
}
|
#{
msg
}
"
}
end
def
self
.
compatible?
(
name
)
dir
=
Config
.
instance
.
repos_dir
+
name
versions
=
versions
(
dir
)
...
...
lib/cocoapods/command/setup.rb
View file @
b255de76
...
...
@@ -69,7 +69,7 @@ module Pod
end
def
add_master_repo
@command
||=
Repo
.
new
(
ARGV
.
new
([
'add'
,
'master'
,
url
,
'master'
])
).
run
@command
||=
Repo
::
Add
.
parse
([
'master'
,
url
,
'master'
]
).
run
end
def
update_master_repo
...
...
lib/cocoapods/command/spec.rb
View file @
b255de76
...
...
@@ -5,6 +5,8 @@ require 'active_support/core_ext/string/inflections'
module
Pod
class
Command
class
Spec
<
Command
self
.
abstract_command
=
true
self
.
summary
=
'Manage pod specs'
class
Create
<
Spec
...
...
@@ -18,7 +20,7 @@ module Pod
self
.
arguments
=
'[ NAME | https://github.com/USER/REPO ]'
def
initialize
(
argv
)
@
url
,
@name_or_
url
=
argv
.
shift_argument
,
argv
.
shift_argument
@
name_or_url
,
@
url
=
argv
.
shift_argument
,
argv
.
shift_argument
super
end
...
...
lib/cocoapods/resolver.rb
View file @
b255de76
...
...
@@ -82,7 +82,7 @@ module Pod
unless
config
.
skip_repo_update?
UI
.
section
'Updating spec repositories'
do
Command
::
Repo
.
new
(
Command
::
ARGV
.
new
([
"update"
])
).
run
Command
::
Repo
::
Update
.
parse
([]
).
run
end
if
!
@lockfile
||
!
(
@pods_by_state
[
:added
]
+
@pods_by_state
[
:changed
]).
empty?
||
update_mode
end
...
...
spec/functional/command/install_spec.rb
View file @
b255de76
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
"Pod::Command::Install"
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
it
"should include instructions on how to reference the xcode project"
do
Pod
::
Command
::
Install
.
banner
.
should
.
match
%r{xcodeproj 'path/to/XcodeProject'}
end
it
"tells the user that no Podfile or podspec was found in the current working dir"
do
exception
=
lambda
{
run_command
(
'install'
,
'--no-update'
)
}.
should
.
raise
Pod
::
Informative
exception
.
message
.
should
.
include
"No `Podfile' found in the current working directory."
module
Pod
describe
Command
::
Install
do
it
"tells the user that no Podfile or podspec was found in the current working dir"
do
exception
=
lambda
{
run_command
(
'install'
,
'--no-update'
)
}.
should
.
raise
Informative
exception
.
message
.
should
.
include
"No `Podfile' found in the current working directory."
end
end
end
spec/functional/command/list_spec.rb
View file @
b255de76
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
"Pod::Command::List"
do
extend
SpecHelper
::
TemporaryRepos
module
Pod
describe
Command
::
List
do
extend
SpecHelper
::
TemporaryRepos
def
command
(
arguments
=
argv
)
command
=
Pod
::
Command
::
List
.
new
(
arguments
)
end
it
"complains for wrong parameters"
do
lambda
{
command
(
argv
(
'wrong'
)).
run
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
command
(
argv
(
'--wrong'
)).
run
}.
should
.
raise
Pod
::
Command
::
Help
end
it
"lists the known pods"
do
out
=
run_command
(
'list'
)
[
/ZBarSDK/
,
/TouchJSON/
,
/SDURLCache/
,
/MagicalRecord/
,
/A2DynamicDelegate/
,
/\d+ pods were found/
].
each
{
|
regex
|
out
.
should
=~
regex
}
end
it
"presents the known pods"
do
list
=
command
()
list
.
run
[
/ZBarSDK/
,
/TouchJSON/
,
/SDURLCache/
,
/MagicalRecord/
,
/A2DynamicDelegate/
,
/\d+ pods were found/
].
each
{
|
regex
|
Pod
::
UI
.
output
.
should
=~
regex
}
end
it
"returns the new pods"
do
Time
.
stubs
(
:now
).
returns
(
Time
.
mktime
(
2012
,
2
,
3
))
list
=
command
(
argv
(
'new'
))
list
.
run
[
'iCarousel'
,
'libPusher'
,
'SSCheckBoxView'
,
'KKPasscodeLock'
,
'SOCKit'
,
'FileMD5Hash'
,
'cocoa-oauth'
,
'iRate'
].
each
{
|
s
|
Pod
::
UI
.
output
.
should
.
include
s
}
it
"lists the new pods"
do
Time
.
stubs
(
:now
).
returns
(
Time
.
mktime
(
2012
,
2
,
3
))
out
=
run_command
(
'list'
,
'new'
)
[
'iCarousel'
,
'libPusher'
,
'SSCheckBoxView'
,
'KKPasscodeLock'
,
'SOCKit'
,
'FileMD5Hash'
,
'cocoa-oauth'
,
'iRate'
].
each
{
|
s
|
out
.
should
.
include
s
}
end
end
end
spec/functional/command/outdated_spec.rb
View file @
b255de76
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
Pod
::
Command
::
Outdated
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
module
Pod
describe
Command
::
Outdated
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
it
"tells the user that no Podfile was found in the current working dir"
do
exception
=
lambda
{
run_command
(
'outdated'
,
'--no-update'
)
}.
should
.
raise
Pod
::
Informative
exception
.
message
.
should
.
include
"No `Podfile' found in the current working directory."
end
it
"tells the user that no Podfile was found in the current working dir"
do
exception
=
lambda
{
run_command
(
'outdated'
,
'--no-update'
)
}.
should
.
raise
Informative
exception
.
message
.
should
.
include
"No `Podfile' found in the current working directory."
end
it
"tells the user that no Lockfile was found in the current working dir"
do
file
=
temporary_directory
+
'Podfile'
File
.
open
(
file
,
'w'
)
{
|
f
|
f
.
write
(
'platform :ios'
)
}
Dir
.
chdir
(
temporary_directory
)
do
exception
=
lambda
{
run_command
(
'outdated'
,
'--no-update'
)
}.
should
.
raise
Pod
::
Informative
exception
.
message
.
should
.
include
"No `Podfile.lock' found in the current working directory"
it
"tells the user that no Lockfile was found in the current working dir"
do
file
=
temporary_directory
+
'Podfile'
File
.
open
(
file
,
'w'
)
{
|
f
|
f
.
write
(
'platform :ios'
)
}
Dir
.
chdir
(
temporary_directory
)
do
exception
=
lambda
{
run_command
(
'outdated'
,
'--no-update'
)
}.
should
.
raise
Informative
exception
.
message
.
should
.
include
"No `Podfile.lock' found in the current working directory"
end
end
end
end
...
...
spec/functional/command/push_spec.rb
View file @
b255de76
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
Pod
::
Command
::
Push
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
module
Pod
describe
Command
::
Push
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
before
do
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
end
before
do
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
end
def
master_repo
fixture
(
'spec-repos/master'
)
end
def
master_repo
fixture
(
'spec-repos/master'
)
end
it
"complains for wrong parameters"
do
lambda
{
run_command
(
'push'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'push'
,
'--allow-warnings'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'push'
,
'--wrong-option'
)
}.
should
.
raise
Pod
::
Command
::
Help
end
it
"requires a spec-repo name"
do
lambda
{
command
(
'push'
).
validate!
}.
should
.
raise
Command
::
Help
end
it
"complains if it can't find the repo"
do
repo1
=
add_repo
(
'repo1'
,
master_repo
)
Dir
.
chdir
(
fixture
(
'banana-lib'
))
do
lambda
{
run_command
(
'push'
,
'repo2'
)
}.
should
.
raise
Pod
::
Informative
it
"complains if it can't find the repo"
do
repo1
=
add_repo
(
'repo1'
,
master_repo
)
Dir
.
chdir
(
fixture
(
'banana-lib'
))
do
lambda
{
run_command
(
'push'
,
'repo2'
)
}.
should
.
raise
Informative
end
end
end
it
"complains if it can't find a spec"
do
repo1
=
add_repo
(
'repo1'
,
master_repo
)
lambda
{
run_command
(
'push'
,
'repo1'
)
}.
should
.
raise
Pod
::
Informative
end
it
"complains if it can't find a spec"
do
repo1
=
add_repo
(
'repo1'
,
master_repo
)
lambda
{
run_command
(
'push'
,
'repo1'
)
}.
should
.
raise
Informative
end
it
"it raises if the pod is not validated"
do
repo1
=
add_repo
(
'repo1'
,
master_repo
)
repo2
=
add_repo
(
'repo2'
,
repo1
.
dir
)
git_config
(
'repo2'
,
'remote.origin.url'
).
should
==
(
tmp_repos_path
+
'repo1'
).
to_s
Dir
.
chdir
(
fixture
(
'banana-lib'
))
do
lambda
{
command
(
'push'
,
'repo2'
,
'--silent'
).
run
}.
should
.
raise
Pod
::
Informative
it
"it raises if the pod is not validated"
do
repo1
=
add_repo
(
'repo1'
,
master_repo
)
repo2
=
add_repo
(
'repo2'
,
repo1
.
dir
)
git_config
(
'repo2'
,
'remote.origin.url'
).
should
==
(
tmp_repos_path
+
'repo1'
).
to_s
Dir
.
chdir
(
fixture
(
'banana-lib'
))
do
lambda
{
run_command
(
'push'
,
'repo2'
,
'--silent'
)
}.
should
.
raise
Informative
end
# (repo1.dir + 'BananaLib/1.0/BananaLib.podspec').read.should.include 'Added!'
end
# (repo1.dir + 'BananaLib/1.0/BananaLib.podspec').read.should.include 'Added!'
end
before
do
# prepare the repos
@upstream
=
add_repo
(
'upstream'
,
master_repo
)
@local_repo
=
add_repo
(
'local_repo'
,
@upstream
.
dir
)
git_config
(
'local_repo'
,
'remote.origin.url'
).
should
==
(
tmp_repos_path
+
'upstream'
).
to_s
before
do
# prepare the repos
@upstream
=
add_repo
(
'upstream'
,
master_repo
)
@local_repo
=
add_repo
(
'local_repo'
,
@upstream
.
dir
)
git_config
(
'local_repo'
,
'remote.origin.url'
).
should
==
(
tmp_repos_path
+
'upstream'
).
to_s
# prepare the spec
spec
=
(
fixture
(
'spec-repos'
)
+
'master/JSONKit/1.4/JSONKit.podspec'
).
read
spec_fix
=
spec
.
gsub
(
/https:\/\/github\.com\/johnezang\/JSONKit\.git/
,
fixture
(
'integration/JSONKit'
).
to_s
)
spec_add
=
spec
.
gsub
(
/'JSONKit'/
,
"'PushTest'"
)
File
.
open
(
temporary_directory
+
'JSONKit.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec_fix
)
}
File
.
open
(
temporary_directory
+
'PushTest.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec_add
)
}
end
# prepare the spec
spec
=
(
fixture
(
'spec-repos'
)
+
'master/JSONKit/1.4/JSONKit.podspec'
).
read
spec_fix
=
spec
.
gsub
(
/https:\/\/github\.com\/johnezang\/JSONKit\.git/
,
fixture
(
'integration/JSONKit'
).
to_s
)
spec_add
=
spec
.
gsub
(
/'JSONKit'/
,
"'PushTest'"
)
File
.
open
(
temporary_directory
+
'JSONKit.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec_fix
)
}
File
.
open
(
temporary_directory
+
'PushTest.podspec'
,
'w'
)
{
|
f
|
f
.
write
(
spec_add
)
}
end
it
"refuses to push if the repo is not clean"
do
File
.
open
(
@local_repo
.
dir
+
'README'
,
'w'
)
{
|
f
|
f
.
write
(
'Added!'
)
}
(
@local_repo
.
dir
+
'README'
).
read
.
should
.
include
'Added!'
cmd
=
command
(
'push'
,
'local_repo'
)
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
Dir
.
chdir
(
temporary_directory
)
{
lambda
{
cmd
.
run
}.
should
.
raise
Pod
::
Informative
}
it
"refuses to push if the repo is not clean"
do
File
.
open
(
@local_repo
.
dir
+
'README'
,
'w'
)
{
|
f
|
f
.
write
(
'Added!'
)
}
(
@local_repo
.
dir
+
'README'
).
read
.
should
.
include
'Added!'
cmd
=
command
(
'push'
,
'local_repo'
)
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
Dir
.
chdir
(
temporary_directory
)
{
lambda
{
cmd
.
run
}.
should
.
raise
Informative
}
(
@upstream
.
dir
+
'PushTest/1.4/PushTest.podspec'
).
should
.
not
.
exist?
end
(
@upstream
.
dir
+
'PushTest/1.4/PushTest.podspec'
).
should
.
not
.
exist?
end
it
"sucessfully pushes a spec"
do
git
(
'upstream'
,
'checkout master'
)
# checkout master, to allow push in a non-bare repository
cmd
=
command
(
'push'
,
'local_repo'
)
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
Dir
.
chdir
(
temporary_directory
)
{
cmd
.
run
}
it
"sucessfully pushes a spec"
do
git
(
'upstream'
,
'checkout master'
)
# checkout master, to allow push in a non-bare repository
cmd
=
command
(
'push'
,
'local_repo'
)
cmd
.
expects
(
:validate_podspec_files
).
returns
(
true
)
Dir
.
chdir
(
temporary_directory
)
{
cmd
.
run
}
Pod
::
UI
.
output
.
should
.
include
(
'[Add] PushTest (1.4)'
)
Pod
::
UI
.
output
.
should
.
include
(
'[Fix] JSONKit (1.4)'
)
UI
.
output
.
should
.
include
(
'[Add] PushTest (1.4)'
)
UI
.
output
.
should
.
include
(
'[Fix] JSONKit (1.4)'
)
git
(
'upstream'
,
'checkout test'
)
# checkout because test because is it the branch used in the specs.
(
@upstream
.
dir
+
'PushTest/1.4/PushTest.podspec'
).
read
.
should
.
include
(
'PushTest'
)
git
(
'upstream'
,
'checkout test'
)
# checkout because test because is it the branch used in the specs.
(
@upstream
.
dir
+
'PushTest/1.4/PushTest.podspec'
).
read
.
should
.
include
(
'PushTest'
)
end
end
end
spec/functional/command/repo_spec.rb
View file @
b255de76
...
...
@@ -7,20 +7,9 @@ describe "Pod::Command::Repo" do
end
describe
"In general"
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
it
"runs with correct parameters"
do
lambda
{
run_command
(
'repo'
,
'update'
)
}.
should
.
not
.
raise
lambda
{
run_command
(
'repo'
,
'lint'
,
temporary_directory
.
to_s
)
}.
should
.
not
.
raise
end
it
"complains for wrong parameters"
do
lambda
{
run_command
(
'repo'
,
'add'
)
}.
should
.
raise
Pod
::
Informative
lambda
{
run_command
(
'repo'
,
'add'
,
'NAME'
)
}.
should
.
raise
Pod
::
Informative
end
it
"adds a spec-repo"
do
run_command
(
'repo'
,
'add'
,
'private'
,
fixture
(
'spec-repos/master'
))
git_config
(
'private'
,
'remote.origin.url'
).
should
==
fixture
(
'spec-repos/master'
).
to_s
...
...
@@ -67,7 +56,6 @@ describe "Pod::Command::Repo" do
end
describe
"Concerning a repo support"
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
...
...
spec/functional/command/search_spec.rb
View file @
b255de76
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
"Pod::Command::Search"
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
module
Pod
describe
Command
::
Search
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
before
do
config
.
repos_dir
=
fixture
(
'spec-repos'
)
end
before
do
config
.
repos_dir
=
fixture
(
'spec-repos'
)
end
it
"runs with correct parameters"
do
lambda
{
run_command
(
'search'
,
'table'
)
}.
should
.
not
.
raise
lambda
{
run_command
(
'search'
,
'table'
,
'--full'
)
}.
should
.
not
.
raise
end
it
"runs with correct parameters"
do
lambda
{
run_command
(
'search'
,
'table'
)
}.
should
.
not
.
raise
lambda
{
run_command
(
'search'
,
'table'
,
'--full'
)
}.
should
.
not
.
raise
end
it
"complains for wrong parameters"
do
lambda
{
run_command
(
'search'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'search'
,
'too'
,
'many'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'search'
,
'too'
,
'--wrong'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'search'
,
'--wrong'
)
}.
should
.
raise
Pod
::
Command
::
Help
end
it
"complains for wrong parameters"
do
lambda
{
run_command
(
'search'
)
}.
should
.
raise
Command
::
Help
lambda
{
run_command
(
'search'
,
'too'
,
'many'
)
}.
should
.
raise
Command
::
Help
lambda
{
run_command
(
'search'
,
'too'
,
'--wrong'
)
}.
should
.
raise
Command
::
Help
lambda
{
run_command
(
'search'
,
'--wrong'
)
}.
should
.
raise
Command
::
Help
end
it
"presents the search results"
do
output
=
run_command
(
'search'
,
'table'
)
output
.
should
.
include
'EGOTableViewPullRefresh'
end
it
"presents the search results"
do
output
=
run_command
(
'search'
,
'table'
)
output
.
should
.
include
'EGOTableViewPullRefresh'
end
it
"searches for a pod with name matching the given query ignoring case"
do
[
[
' s '
,
%w{ ASIHTTPRequest ASIWebPageRequest JSONKit SSZipArchive }
],
[
'json'
,
%w{ JSONKit SBJson }
],
].
each
do
|
query
,
results
|
output
=
run_command
(
'search'
,
query
)
results
.
each
{
|
pod
|
output
.
should
.
include?
pod
}
it
"searches for a pod with name matching the given query ignoring case"
do
[
[
' s '
,
%w{ ASIHTTPRequest ASIWebPageRequest JSONKit SSZipArchive }
],
[
'json'
,
%w{ JSONKit SBJson }
],
].
each
do
|
query
,
results
|
output
=
run_command
(
'search'
,
query
)
results
.
each
{
|
pod
|
output
.
should
.
include?
pod
}
end
end
end
it
"searches for a pod with name, summary, or description matching the given query ignoring case"
do
[
[
'dROP'
,
%w{ Reachability }
],
[
'is'
,
%w{ ASIHTTPRequest SSZipArchive }
],
[
'luke redpath'
,
%w{ Kiwi libPusher LRMocky LRResty LRTableModel}
],
].
each
do
|
query
,
results
|
output
=
run_command
(
'search'
,
'--full'
,
query
)
results
.
each
{
|
pod
|
output
.
should
.
include?
pod
}
it
"searches for a pod with name, summary, or description matching the given query ignoring case"
do
[
[
'dROP'
,
%w{ Reachability }
],
[
'is'
,
%w{ ASIHTTPRequest SSZipArchive }
],
[
'luke redpath'
,
%w{ Kiwi libPusher LRMocky LRResty LRTableModel}
],
].
each
do
|
query
,
results
|
output
=
run_command
(
'search'
,
query
,
'--full'
)
results
.
each
{
|
pod
|
output
.
should
.
include?
pod
}
end
end
end
end
spec/functional/command/setup_spec.rb
View file @
b255de76
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
"Pod::Command::Setup"
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
before
do
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
end
it
"runs with correct parameters"
do
lambda
{
run_command
(
'setup'
)
}.
should
.
not
.
raise
end
it
"complains for wrong parameters"
do
lambda
{
run_command
(
'setup'
,
'wrong'
)
}.
should
.
raise
Pod
::
Command
::
Help
lambda
{
run_command
(
'setup'
,
'--wrong'
)
}.
should
.
raise
Pod
::
Command
::
Help
end
it
"returns the read only URL of the `master' spec-repo"
do
cmd
=
Pod
::
Command
::
Setup
.
new
(
argv
)
cmd
.
url
.
should
==
'https://github.com/CocoaPods/Specs.git'
end
it
"returns the push URL of the `master' spec-repo"
do
config
.
silent
=
true
cmd
=
Pod
::
Command
::
Setup
.
new
(
argv
(
'--push'
))
cmd
.
url
.
should
==
'git@github.com:CocoaPods/Specs.git'
end
class
Pod
::
Command
::
Setup
def
read_only_url
;
SpecHelper
.
fixture
(
'spec-repos/master'
);
end
end
it
"creates the local spec-repos directory and creates a clone of the `master' repo"
do
output
=
run_command
(
'setup'
)
output
.
should
.
include
"Setup completed
"
output
.
should
.
not
.
include
"push"
git_config
(
'master'
,
'remote.origin.url'
).
should
==
fixture
(
'spec-repos/master'
).
to_s
end
it
"preserves push access for the `master' repo"
do
output
=
run_command
(
'setup'
)
output
.
should
.
not
.
include
"push"
git
(
'master'
,
'remote set-url origin git@github.com:CocoaPods/Specs.git'
)
command
(
'setup'
).
url
.
should
==
'git@github.com:CocoaPods/Specs.git'
end
it
"can run if needed"
do
output
=
run_command
(
'setup'
)
output
.
should
.
include
"Setup completed"
Pod
::
UI
.
output
=
''
command
(
'setup'
).
run_if_needed
Pod
::
UI
.
output
.
should
==
''
module
Pod
describe
Command
::
Setup
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
before
do
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
end
it
"runs with correct parameters"
do
lambda
{
run_command
(
'setup'
)
}.
should
.
not
.
raise
end
it
"complains for wrong parameters"
do
lambda
{
run_command
(
'setup'
,
'wrong'
)
}.
should
.
raise
Command
::
Help
lambda
{
run_command
(
'setup'
,
'--wrong'
)
}.
should
.
raise
Command
::
Help
end
it
"returns the read only URL of the `master' spec-repo"
do
cmd
=
Command
::
Setup
.
new
(
argv
)
cmd
.
url
.
should
==
'https://github.com/CocoaPods/Specs.git'
end
it
"returns the push URL of the `master' spec-repo"
do
config
.
silent
=
true
cmd
=
Command
::
Setup
.
new
(
argv
(
'--push'
))
cmd
.
url
.
should
==
'git@github.com:CocoaPods/Specs.git'
end
class
Command
::
Setup
def
read_only_url
;
SpecHelper
.
fixture
(
'spec-repos/master'
);
end
end
it
"creates the local spec-repos directory and creates a clone of the `master' repo"
do
output
=
run_command
(
'setup'
)
output
.
should
.
include
"Setup completed"
output
.
should
.
not
.
include
"push
"
git_config
(
'master'
,
'remote.origin.url'
).
should
==
fixture
(
'spec-repos/master'
).
to_s
end
it
"preserves push access for the `master' repo"
do
output
=
run_command
(
'setup'
)
output
.
should
.
not
.
include
"push"
git
(
'master'
,
'remote set-url origin git@github.com:CocoaPods/Specs.git'
)
command
(
'setup'
).
url
.
should
==
'git@github.com:CocoaPods/Specs.git'
end
it
"can run if needed"
do
output
=
run_command
(
'setup'
)
output
.
should
.
include
"Setup completed"
UI
.
output
=
''
command
(
'setup'
).
run_if_needed
UI
.
output
.
should
==
''
end
end
end
spec/functional/command/spec_spec.rb
View file @
b255de76
This diff is collapsed.
Click to expand it.
spec/functional/command/update_spec.rb
View file @
b255de76
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
Pod
::
Command
::
Update
do
extend
SpecHelper
::
Command
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
module
Pod
describe
Command
::
Update
do
extend
SpecHelper
::
TemporaryDirectory
extend
SpecHelper
::
TemporaryRepos
it
"tells the user that no Podfile was found in the current working dir"
do
exception
=
lambda
{
run_command
(
'update'
,
'--no-update'
)
}.
should
.
raise
Pod
::
Informative
exception
.
message
.
should
.
include
"No `Podfile' found in the current working directory."
end
it
"tells the user that no Podfile was found in the current working dir"
do
exception
=
lambda
{
run_command
(
'update'
,
'--no-update'
)
}.
should
.
raise
Informative
exception
.
message
.
should
.
include
"No `Podfile' found in the current working directory."
end
it
"tells the user that no Lockfile was found in the current working dir"
do
file
=
temporary_directory
+
'Podfile'
File
.
open
(
file
,
'w'
)
{
|
f
|
f
.
write
(
'platform :ios'
)
}
Dir
.
chdir
(
temporary_directory
)
do
exception
=
lambda
{
run_command
(
'update'
,
'--no-update'
)
}.
should
.
raise
Pod
::
Informative
exception
.
message
.
should
.
include
"No `Podfile.lock' found in the current working directory"
it
"tells the user that no Lockfile was found in the current working dir"
do
file
=
temporary_directory
+
'Podfile'
File
.
open
(
file
,
'w'
)
{
|
f
|
f
.
write
(
'platform :ios'
)
}
Dir
.
chdir
(
temporary_directory
)
do
exception
=
lambda
{
run_command
(
'update'
,
'--no-update'
)
}.
should
.
raise
Informative
exception
.
message
.
should
.
include
"No `Podfile.lock' found in the current working directory"
end
end
end
end
...
...
spec/functional/command_spec.rb
deleted
100644 → 0
View file @
054fe5c8
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
# describe "Pod::Command" do
# extend SpecHelper::Command
# extend SpecHelper::TemporaryDirectory
# extend SpecHelper::TemporaryRepos
#
# TODO:
# it "raises help informative if an unknown parameter is passed"
# it "performs setup if needed"
# end
spec/spec_helper.rb
View file @
b255de76
...
...
@@ -21,13 +21,18 @@ require 'spec_helper/temporary_repos'
require
'spec_helper/user_interface'
require
'spec_helper/pre_flight'
ENV
[
'SKIP_SETUP'
]
=
'true'
require
'claide'
module
Bacon
class
Context
include
Pod
::
Config
::
Mixin
include
SpecHelper
::
Fixture
include
SpecHelper
::
Command
def
argv
(
*
argv
)
Pod
::
Command
::
ARGV
.
new
(
argv
)
CLAide
::
ARGV
.
new
(
argv
)
end
end
end
...
...
spec/spec_helper/command.rb
View file @
b255de76
...
...
@@ -4,7 +4,7 @@ module SpecHelper
module
Command
def
command
(
*
argv
)
argv
<<
'--no-color'
Pod
::
Command
.
parse
(
*
argv
)
Pod
::
Command
.
parse
(
argv
)
end
def
run_command
(
*
args
)
...
...
@@ -14,7 +14,9 @@ module SpecHelper
# been converted to use the UI.puts
config_silent
=
config
.
silent?
config
.
silent
=
false
command
(
*
args
).
run
cmd
=
command
(
*
args
)
cmd
.
validate!
cmd
.
run
config
.
silent
=
config_silent
Pod
::
UI
.
output
end
...
...
spec/spec_helper/temporary_repos.rb
View file @
b255de76
...
...
@@ -28,7 +28,7 @@ module SpecHelper
end
def
add_repo
(
name
,
from
)
command
=
command
(
'repo'
,
'add'
,
name
,
from
)
command
=
Pod
::
Command
.
parse
([
'repo'
,
'add'
,
name
,
from
]
)
command
.
run
# The test branch is used by the push specs
Dir
.
chdir
(
command
.
dir
)
do
...
...
spec/unit/command_spec.rb
View file @
b255de76
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
describe
"Pod::Command"
do
it
"returns the proper command class"
do
Pod
::
Command
.
parse
(
'setup'
).
should
.
be
.
instance_of
Pod
::
Command
::
Setup
Pod
::
Command
.
parse
(
'spec'
,
'create'
,
'name'
).
should
.
be
.
instance_of
Pod
::
Command
::
Spec
Pod
::
Command
.
parse
(
'repo'
,
'update'
).
should
.
be
.
instance_of
Pod
::
Command
::
Repo
module
Pod
describe
Command
do
it
"returns the proper command class"
do
Command
.
parse
(
%w{ install }
).
should
.
be
.
instance_of
Command
::
Install
Command
.
parse
(
%w{ list }
).
should
.
be
.
instance_of
Command
::
List
Command
.
parse
(
%w{ outdated }
).
should
.
be
.
instance_of
Command
::
Outdated
Command
.
parse
(
%w{ push }
).
should
.
be
.
instance_of
Command
::
Push
Command
.
parse
(
%w{ repo }
).
should
.
be
.
instance_of
Command
::
Repo
Command
.
parse
(
%w{ repo add }
).
should
.
be
.
instance_of
Command
::
Repo
::
Add
Command
.
parse
(
%w{ repo lint }
).
should
.
be
.
instance_of
Command
::
Repo
::
Lint
Command
.
parse
(
%w{ repo update }
).
should
.
be
.
instance_of
Command
::
Repo
::
Update
Command
.
parse
(
%w{ search }
).
should
.
be
.
instance_of
Command
::
Search
Command
.
parse
(
%w{ setup }
).
should
.
be
.
instance_of
Command
::
Setup
Command
.
parse
(
%w{ spec create }
).
should
.
be
.
instance_of
Command
::
Spec
::
Create
Command
.
parse
(
%w{ spec lint }
).
should
.
be
.
instance_of
Command
::
Spec
::
Lint
Command
.
parse
(
%w{ repo update }
).
should
.
be
.
instance_of
Command
::
Repo
::
Update
end
end
end
describe
"Pod::Command::Repo"
do
it
"complains about unknown arguments"
do
lambda
{
Pod
::
Command
::
Repo
.
new
(
argv
(
'something'
))
}.
should
.
raise
Pod
::
Command
::
Help
end
end
spec/unit/resolver_spec.rb
View file @
b255de76
...
...
@@ -14,9 +14,9 @@ module Pod
it
"holds the context state, such as cached specification sets"
do
@resolver
.
resolve
@resolver
.
cached_sets
.
values
.
sort_by
(
&
:name
).
should
==
[
Pod
::
Source
.
search_by_name
(
'A2DynamicDelegate'
).
first
,
Pod
::
Source
.
search_by_name
(
'BlocksKit'
).
first
,
Pod
::
Source
.
search_by_name
(
'libffi'
).
first
Source
.
search_by_name
(
'A2DynamicDelegate'
).
first
,
Source
.
search_by_name
(
'BlocksKit'
).
first
,
Source
.
search_by_name
(
'libffi'
).
first
].
sort_by
(
&
:name
)
end
...
...
@@ -34,7 +34,7 @@ module Pod
end
it
"raises once any of the dependencies does not match the platform of its podfile target"
do
set
=
Pod
::
Source
.
search_by_name
(
'BlocksKit'
).
first
set
=
Source
.
search_by_name
(
'BlocksKit'
).
first
@resolver
.
cached_sets
[
'BlocksKit'
]
=
set
def
set
.
stub_platform
=
(
platform
);
@stubbed_platform
=
platform
;
end
...
...
@@ -54,7 +54,7 @@ module Pod
end
it
"raises once any of the dependencies does not have a deployment_target compatible with its podfile target"
do
set
=
Pod
::
Source
.
search_by_name
(
'BlocksKit'
).
first
set
=
Source
.
search_by_name
(
'BlocksKit'
).
first
@resolver
.
cached_sets
[
'BlocksKit'
]
=
set
@podfile
.
platform
:ios
,
"4.0"
...
...
@@ -200,7 +200,7 @@ module Pod
pod
'JSONKit'
,
"1.5pre"
end
resolver
=
Resolver
.
new
(
podfile
,
nil
,
stub
(
'sandbox'
))
lambda
{
resolver
.
resolve
}.
should
.
raise
Pod
::
Informative
lambda
{
resolver
.
resolve
}.
should
.
raise
Informative
end
describe
"Concerning Installation mode"
do
...
...
@@ -212,11 +212,11 @@ module Pod
pod
'JSONKit'
end
@specs
=
[
Pod
::
Specification
.
new
do
|
s
|
Specification
.
new
do
|
s
|
s
.
name
=
"BlocksKit"
s
.
version
=
"1.0.0"
end
,
Pod
::
Specification
.
new
do
|
s
|
Specification
.
new
do
|
s
|
s
.
name
=
"JSONKit"
s
.
version
=
"1.4"
end
]
...
...
@@ -300,7 +300,7 @@ module Pod
pod
'JSONKit'
end
config
.
skip_repo_update
=
false
Pod
::
Command
::
Repo
.
any_instance
.
expects
(
:run
).
never
Command
::
Repo
.
any_instance
.
expects
(
:run
).
never
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
resolve
end
...
...
@@ -313,7 +313,7 @@ module Pod
pod
'libPusher'
# New pod
end
config
.
skip_repo_update
=
false
Pod
::
Command
::
Repo
.
any_instance
.
expects
(
:run
).
once
Command
::
Repo
::
Update
.
any_instance
.
expects
(
:run
).
once
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
resolve
end
...
...
@@ -326,7 +326,7 @@ module Pod
pod
'libPusher'
# New pod
end
config
.
skip_repo_update
=
true
Pod
::
Command
::
Repo
.
any_instance
.
expects
(
:run
).
never
Command
::
Repo
::
Update
.
any_instance
.
expects
(
:run
).
never
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
resolve
end
...
...
@@ -338,7 +338,7 @@ module Pod
pod
'JSONKit'
,
:head
#changed to head
end
config
.
skip_repo_update
=
false
Pod
::
Command
::
Repo
.
any_instance
.
expects
(
:run
).
once
Command
::
Repo
::
Update
.
any_instance
.
expects
(
:run
).
once
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
resolve
end
...
...
@@ -354,11 +354,11 @@ module Pod
pod
'libPusher'
end
@specs
=
[
Pod
::
Specification
.
new
do
|
s
|
Specification
.
new
do
|
s
|
s
.
name
=
"libPusher"
s
.
version
=
"1.3"
end
,
Pod
::
Specification
.
new
do
|
s
|
Specification
.
new
do
|
s
|
s
.
name
=
"JSONKit"
s
.
version
=
"1.4"
end
]
...
...
@@ -411,7 +411,7 @@ module Pod
pod
'libPusher'
end
config
.
skip_repo_update
=
false
Pod
::
Command
::
Repo
.
any_instance
.
expects
(
:run
).
once
Command
::
Repo
::
Update
.
any_instance
.
expects
(
:run
).
once
@resolver
=
Resolver
.
new
(
podfile
,
@lockfile
,
stub
(
'sandbox'
))
@resolver
.
update_mode
=
true
@resolver
.
resolve
...
...
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