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
7d9479c1
Commit
7d9479c1
authored
Nov 15, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow the use of the Rake FileList class for source_files, clean_paths, and resources. Fixes #65.
parent
ece1c9fd
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
50 additions
and
53 deletions
+50
-53
Rakefile
Rakefile
+1
-0
cocoapods.rb
lib/cocoapods.rb
+1
-0
file_list.rb
lib/cocoapods/file_list.rb
+34
-0
specification.rb
lib/cocoapods/specification.rb
+11
-46
master
spec/fixtures/spec-repos/master
+1
-1
command_spec.rb
spec/functional/command_spec.rb
+0
-4
downloader_spec.rb
spec/functional/downloader_spec.rb
+1
-1
specification_spec.rb
spec/unit/specification_spec.rb
+1
-1
No files found.
Rakefile
View file @
7d9479c1
...
...
@@ -81,6 +81,7 @@ namespace :examples do
require
'pathname'
result
=
[]
examples
=
Pathname
.
new
(
File
.
expand_path
(
'../examples'
,
__FILE__
))
return
[
examples
+
ENV
[
'example'
]]
if
ENV
[
'example'
]
examples
.
entries
.
each
do
|
example
|
next
if
%w{ . .. }
.
include?
(
example
.
basename
.
to_s
)
example
=
examples
+
example
...
...
lib/cocoapods.rb
View file @
7d9479c1
...
...
@@ -19,6 +19,7 @@ module Pod
autoload
:Version
,
'cocoapods/version'
autoload
:Pathname
,
'pathname'
autoload
:FileList
,
'cocoapods/file_list'
end
module
Xcodeproj
...
...
lib/cocoapods/file_list.rb
0 → 100644
View file @
7d9479c1
require
'rake'
# This makes Rake::FileList usable with the Specification attributes
# source_files, clean_paths, and resources.
module
Rake
class
FileList
def
prepend_patterns
(
pathname
)
@pending_add
.
map!
{
|
pattern
|
(
pathname
+
pattern
).
to_s
}
end
def
directory?
false
end
def
glob
to_a
.
map
{
|
path
|
Pathname
.
new
(
path
)
}
end
end
end
class
Pathname
alias_method
:_original_sum
,
:
+
def
+
(
other
)
if
other
.
is_a?
(
Rake
::
FileList
)
other
.
prepend_patterns
(
self
)
other
else
_original_sum
(
other
)
end
end
end
lib/cocoapods/specification.rb
View file @
7d9479c1
require
'rake'
module
Rake
class
FileList
def
prepend_patterns
(
pathname
)
@pending_add
.
map!
{
|
pattern
|
(
pathname
+
pattern
).
to_s
}
end
# This makes Rake::FileList usable with source_files and clean_paths.
def
directory?
false
end
def
glob
to_a
.
map
{
|
path
|
Pathname
.
new
(
path
)
}
end
end
end
class
Pathname
alias_method
:_original_sum
,
:
+
def
+
(
other
)
if
other
.
is_a?
(
Rake
::
FileList
)
other
.
prepend_patterns
(
self
)
other
else
_original_sum
(
other
)
end
end
end
module
Pod
extend
Config
::
Mixin
...
...
@@ -99,30 +68,18 @@ module Pod
end
def
source_files
=
(
patterns
)
if
!
patterns
.
is_a?
(
Rake
::
FileList
)
&&
patterns
.
is_a?
(
Array
)
@source_files
=
patterns
else
@source_files
=
[
patterns
]
end
@source_files
=
pattern_list
(
patterns
)
end
attr_reader
:source_files
def
resources
=
(
patterns
)
if
!
patterns
.
is_a?
(
Rake
::
FileList
)
&&
patterns
.
is_a?
(
Array
)
@resources
=
patterns
else
@resources
=
[
patterns
]
end
@resources
=
pattern_list
(
patterns
)
end
attr_reader
:resources
alias_method
:resource
=
,
:resources
=
def
clean_paths
=
(
patterns
)
if
!
patterns
.
is_a?
(
Rake
::
FileList
)
&&
patterns
.
is_a?
(
Array
)
@clean_paths
=
patterns
else
@clean_paths
=
[
patterns
]
end
@clean_paths
=
pattern_list
(
patterns
)
end
attr_reader
:clean_paths
alias_method
:clean_path
=
,
:clean_paths
=
...
...
@@ -222,6 +179,14 @@ module Pod
false
end
def
pattern_list
(
patterns
)
if
patterns
.
is_a?
(
Array
)
&&
(
!
defined?
(
Rake
)
||
!
patterns
.
is_a?
(
Rake
::
FileList
))
patterns
else
[
patterns
]
end
end
# Returns all resource files of this pod, but relative to the
# project pods root.
def
expanded_resources
...
...
master
@
56c5f468
Subproject commit
39e348b0bfd268fe0a8606e71a07a0f9071cf7e
b
Subproject commit
56c5f468351fe0e195ee95a78160f4c18eaec40
b
spec/functional/command_spec.rb
View file @
7d9479c1
...
...
@@ -4,10 +4,6 @@ describe "Pod::Command" do
extend
SpecHelper
::
Git
extend
SpecHelper
::
TemporaryDirectory
before
do
fixture
(
'spec-repos/master'
)
# ensure the archive is unpacked
end
it
"creates the local spec-repos directory and creates a clone of the `master' repo"
do
command
=
Pod
::
Command
.
parse
(
'setup'
,
'--silent'
)
def
command
.
master_repo_url
;
SpecHelper
.
fixture
(
'spec-repos/master'
);
end
...
...
spec/functional/downloader_spec.rb
View file @
7d9479c1
...
...
@@ -37,7 +37,7 @@ describe "Pod::Downloader" do
:git
=>
fixture
(
'banana-lib'
),
:tag
=>
'v1.0'
)
downloader
.
download
downloader
.
clean
([
'README'
])
downloader
.
clean
([
@dir
+
'README'
])
(
@dir
+
'README'
).
should
.
not
.
exist
end
end
...
...
spec/unit/specification_spec.rb
View file @
7d9479c1
...
...
@@ -273,7 +273,7 @@ describe "A Pod::Specification, in general," do
end
it
"takes any object for clean_paths as long as it responds to #glob (we provide this for Rake::FileList)"
do
require
'rake'
Pod
::
FileList
# autoload
@spec
.
clean_paths
=
FileList
[
'*'
].
exclude
(
'Rakefile'
)
list
=
ROOT
+
@spec
.
clean_paths
.
first
list
.
glob
.
should
==
FileList
[(
ROOT
+
'*'
).
to_s
].
exclude
(
'Rakefile'
).
map
{
|
path
|
Pathname
.
new
(
path
)
}
...
...
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