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
3744f691
Commit
3744f691
authored
Sep 16, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ partial installer spec
parent
1139295f
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
25 deletions
+92
-25
.kick
.kick
+11
-0
cocoa_pods.rb
lib/cocoa_pods.rb
+6
-0
installer.rb
lib/cocoa_pods/installer.rb
+26
-19
specification.rb
lib/cocoa_pods/specification.rb
+7
-3
installer_spec.rb
spec/unit/installer_spec.rb
+42
-3
No files found.
.kick
View file @
3744f691
recipe :ruby
recipe :ruby
Ruby.runner_bin = 'macbacon'
Ruby.runner_bin = 'macbacon'
process do |files|
specs = files.take_and_map do |file|
case file
when %r{lib/cocoa_pods/(.+?)\.rb$}
s = Dir.glob("spec/**/#{$1}_spec.rb")
s unless s.empty?
end
end
Ruby.run_tests(specs)
end
lib/cocoa_pods.rb
View file @
3744f691
...
@@ -21,3 +21,9 @@ module Pod
...
@@ -21,3 +21,9 @@ module Pod
autoload
:Pathname
,
'pathname'
autoload
:Pathname
,
'pathname'
autoload
:Executioner
,
'executioner'
autoload
:Executioner
,
'executioner'
end
end
class
Pathname
def
glob
(
pattern
=
''
)
Dir
.
glob
((
self
+
pattern
).
to_s
).
map
{
|
f
|
Pathname
.
new
(
f
)
}
end
end
lib/cocoa_pods/installer.rb
View file @
3744f691
...
@@ -4,12 +4,31 @@ module Pod
...
@@ -4,12 +4,31 @@ module Pod
class
Installer
class
Installer
include
Config
::
Mixin
include
Config
::
Mixin
def
initialize
(
top_level_
specification
)
def
initialize
(
specification
)
@
top_level_specification
=
top_level_
specification
@
specification
=
specification
end
end
def
dependent_specification_sets
def
dependent_specification_sets
@dependent_specifications_sets
||=
Resolver
.
new
(
@top_level_specification
).
resolve
@dependent_specification_sets
||=
Resolver
.
new
(
@specification
).
resolve
end
def
build_specification_sets
dependent_specification_sets
.
reject
(
&
:only_part_of_other_pod?
)
end
def
source_files
source_files
=
[]
build_specification_sets
.
each
do
|
set
|
spec
=
set
.
specification
spec
.
read
(
:source_files
).
each
do
|
pattern
|
pattern
=
spec
.
pod_destroot
+
pattern
pattern
=
pattern
+
'*.{h,m,mm,c,cpp}'
if
pattern
.
directory?
pattern
.
glob
.
each
do
|
file
|
source_files
<<
file
.
relative_path_from
(
config
.
project_pods_root
)
end
end
end
source_files
end
end
def
xcconfig
def
xcconfig
...
@@ -27,7 +46,7 @@ module Pod
...
@@ -27,7 +46,7 @@ module Pod
def
install!
def
install!
unless
config
.
silent?
unless
config
.
silent?
puts
"Installing dependencies defined in:
#{
@
top_level_
specification
.
defined_in_file
}
"
puts
"Installing dependencies defined in:
#{
@specification
.
defined_in_file
}
"
end
end
install_dependent_specifications!
install_dependent_specifications!
generate_project
generate_project
...
@@ -45,21 +64,9 @@ module Pod
...
@@ -45,21 +64,9 @@ module Pod
def
generate_project
def
generate_project
puts
"==> Creating Pods project files"
unless
config
.
silent?
puts
"==> Creating Pods project files"
unless
config
.
silent?
dependent_specification_sets
.
each
do
|
set
|
source_files
.
each
{
|
file
|
xproj
.
add_source_file
(
file
)
}
# In case the set is only part of other pods we don't need to build
build_specification_sets
.
each
do
|
set
|
# the pod itself.
xcconfig
<<
set
.
specification
.
read
(
:xcconfig
)
next
if
set
.
only_part_of_other_pod?
spec
=
set
.
specification
spec
.
read
(
:source_files
).
each
do
|
pattern
|
pattern
=
spec
.
pod_destroot
+
pattern
pattern
=
pattern
+
'*.{h,m,mm,c,cpp}'
if
pattern
.
directory?
Dir
.
glob
(
pattern
.
to_s
).
each
do
|
file
|
file
=
Pathname
.
new
(
file
)
file
=
file
.
relative_path_from
(
config
.
project_pods_root
)
xproj
.
add_source_file
(
file
)
end
end
xcconfig
<<
spec
.
read
(
:xcconfig
)
end
end
end
end
...
...
lib/cocoa_pods/specification.rb
View file @
3744f691
...
@@ -104,11 +104,15 @@ module Pod
...
@@ -104,11 +104,15 @@ module Pod
@dependencies
.
find
{
|
d
|
d
.
name
==
name
}
@dependencies
.
find
{
|
d
|
d
.
name
==
name
}
end
end
# Returns the specification for the pod that this pod's source is a part of.
def
part_of_specification_set
def
part_of_specification
if
@part_of
if
@part_of
Set
.
by_specification_name
(
@part_of
.
name
).
specification
Set
.
by_specification_name
(
@part_of
.
name
)
end
end
end
# Returns the specification for the pod that this pod's source is a part of.
def
part_of_specification
(
set
=
part_of_specification_set
)
&&
set
.
specification
end
end
def
pod_destroot
def
pod_destroot
...
...
spec/unit/installer_spec.rb
View file @
3744f691
...
@@ -2,14 +2,53 @@ require File.expand_path('../../spec_helper', __FILE__)
...
@@ -2,14 +2,53 @@ require File.expand_path('../../spec_helper', __FILE__)
describe
"Pod::Installer"
do
describe
"Pod::Installer"
do
before
do
before
do
config
.
project_pods_root
=
fixture
(
'integration'
)
fixture
(
'spec-repos/master'
)
# ensure the archive is unpacked
fixture
(
'spec-repos/master'
)
# ensure the archive is unpacked
config
.
repos_dir
=
fixture
(
'spec-repos'
)
config
.
repos_dir
=
fixture
(
'spec-repos'
)
@spec
=
Pod
::
Spec
.
new
do
dependency
'JSONKit'
end
end
end
after
do
after
do
config
.
project_pods_root
=
nil
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
end
end
it
"adds all source files that should be included in the library to the xcode project"
do
[
[
'ASIHTTPRequest'
,
[
'Classes'
],
"{Classes,External/Reachability}/*.{h,m}"
],
[
'Reachability'
,
[
"External/Reachability/*.h"
,
"External/Reachability/*.m"
],
"External/Reachability/*.{h,m}"
],
[
'ASIWebPageRequest'
,
[
'**/ASIWebPageRequest.*'
],
"{Classes,Classes/ASIWebPageRequest,External/Reachability}/*.{h,m}"
],
].
each
do
|
name
,
patterns
,
expected_pattern
|
Pod
::
Source
.
reset!
Pod
::
Spec
::
Set
.
reset!
installer
=
Pod
::
Installer
.
new
(
Pod
::
Spec
.
new
{
dependency
(
name
);
source_files
(
*
patterns
)
})
expected
=
(
stubbed_destroot
(
installer
)
+
expected_pattern
).
glob
.
map
do
|
file
|
file
.
relative_path_from
(
config
.
project_pods_root
)
end
installer
.
source_files
.
size
.
should
==
expected
.
size
installer
.
source_files
.
sort
.
should
==
expected
.
sort
#installer.xproj.source_files.sort.should == expected.sort
end
end
def
stubbed_destroot
(
installer
)
set
=
installer
.
dependent_specification_sets
.
find
{
|
s
|
s
.
name
==
'ASIHTTPRequest'
}
spec
=
set
.
specification
set
.
extend
(
Module
.
new
{
define_method
(
:specification
)
{
spec
}})
def
spec
.
pod_destroot
config
.
project_pods_root
+
'ASIHTTPRequest'
# without name and version
end
spec
.
pod_destroot
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