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
b929d99b
Commit
b929d99b
authored
Feb 16, 2013
by
Fabio Pelosin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor fixes
parent
4157fa39
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
44 additions
and
93 deletions
+44
-93
library_data.rb
lib/cocoapods/hooks/library_data.rb
+0
-1
pod_data.rb
lib/cocoapods/hooks/pod_data.rb
+6
-3
installer_data_spec.rb
spec/unit/hooks/installer_data_spec.rb
+0
-89
pod_data_spec.rb
spec/unit/hooks/pod_data_spec.rb
+38
-0
No files found.
lib/cocoapods/hooks/library_data.rb
View file @
b929d99b
...
...
@@ -11,7 +11,6 @@ module Pod
[]
end
end
end
end
...
...
lib/cocoapods/hooks/pod_data.rb
View file @
b929d99b
module
Pod
module
Hooks
class
Specification
class
Specification
def
config
UI
.
warn
"Specification#config is deprecated. The config is accessible from "
\
"the parameter passed to the hooks"
include
Config
::
Mixin
Config
.
instance
end
end
module
Hooks
# Stores the information of the Installer for the hooks
#
...
...
spec/unit/hooks/installer_data_spec.rb
deleted
100644 → 0
View file @
4157fa39
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
# Stubs an object ensuring that it responds to the given method
#
def
safe_stub
(
object
,
method
,
return_value
)
object
.
should
.
respond_to?
(
method
)
object
.
stubs
(
method
).
returns
(
return_value
)
end
module
Pod
describe
Hooks
::
InstallerData
do
before
do
target_definition_1
=
Podfile
::
TargetDefinition
.
new
(
'target_1'
,
nil
,
nil
)
target_definition_2
=
Podfile
::
TargetDefinition
.
new
(
'target_2'
,
nil
,
nil
)
lib_1
=
Library
.
new
(
target_definition_1
)
lib_2
=
Library
.
new
(
target_definition_2
)
spec_1
=
Spec
.
new
(
nil
,
'Spec_1'
)
spec_2
=
Spec
.
new
(
nil
,
'Spec_2'
)
lib_1
.
specs
=
[
spec_1
]
lib_2
.
specs
=
[
spec_2
]
pods_project
=
Pod
::
Project
.
new
(
config
.
sandbox
.
project_path
)
@installer
=
Installer
.
new
(
config
.
sandbox
,
nil
,
nil
)
safe_stub
(
@installer
,
:pods_project
,
pods_project
)
safe_stub
(
@installer
,
:libraries
,
[
lib_1
,
lib_2
])
@installer_data
=
Hooks
::
InstallerData
.
new
(
@installer
)
end
#-------------------------------------------------------------------------#
describe
"Public Hooks API"
do
it
"returns the sandbox root"
do
@installer_data
.
sandbox
.
root
.
should
==
temporary_directory
+
'Pods'
end
it
"returns the pods project"
do
@installer_data
.
project
.
class
.
should
==
Pod
::
Project
end
it
"returns the pods data"
do
@installer_data
.
pods
.
map
(
&
:name
).
should
==
[
"Spec_1"
,
"Spec_2"
]
end
it
"returns the target installers data"
do
names
=
@installer_data
.
target_installers
.
map
{
|
ti_data
|
ti_data
.
target_definition
.
name
}
names
.
should
==
[
"target_1"
,
"target_2"
]
end
it
"returns the specs by target"
do
specs_by_target
=
@installer_data
.
specs_by_target
names
=
{}
specs_by_target
.
each
do
|
target
,
specs
|
names
[
target
.
name
]
=
specs
.
map
(
&
:name
)
end
names
.
should
==
{
"target_1"
=>
[
"Spec_1"
],
"target_2"
=>
[
"Spec_2"
]}
end
it
"returns the pods data grouped by target definition data"
do
pods_by_target
=
@installer_data
.
pods_by_target
names
=
{}
pods_by_target
.
each
do
|
target
,
pods_data
|
names
[
target
.
name
]
=
pods_data
.
map
(
&
:name
)
end
names
.
should
==
{
"target_1"
=>
[
"Spec_1"
],
"target_2"
=>
[
"Spec_2"
]}
end
end
#-------------------------------------------------------------------------#
describe
"Unsafe Hooks API"
do
it
"returns the sandbox"
do
@installer_data
.
sandbox
.
should
==
config
.
sandbox
end
it
"returns the config"
do
@installer_data
.
config
.
should
==
Config
.
instance
end
end
#-------------------------------------------------------------------------#
end
end
spec/unit/hooks/pod_data_spec.rb
0 → 100644
View file @
b929d99b
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
# Stubs an object ensuring that it responds to the given method
#
def
safe_stub
(
object
,
method
,
return_value
)
object
.
should
.
respond_to?
(
method
)
object
.
stubs
(
method
).
returns
(
return_value
)
end
module
Pod
describe
Hooks
::
PodData
do
before
do
end
#-------------------------------------------------------------------------#
describe
"Public Hooks API"
do
end
#-------------------------------------------------------------------------#
describe
"Unsafe Hooks API"
do
it
"provides the config to the specification"
do
spec
=
Spec
.
new
(
nil
,
'Name'
)
spec
.
config
.
should
==
config
end
end
#-------------------------------------------------------------------------#
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