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
deb4712c
Commit
deb4712c
authored
Sep 14, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
+ downloader spec
parent
0785edfb
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
70 additions
and
13 deletions
+70
-13
cocoa_pods.rb
lib/cocoa_pods.rb
+5
-2
downloader.rb
lib/cocoa_pods/downloader.rb
+3
-2
specification.rb
lib/cocoa_pods/specification.rb
+1
-1
banana-lib
spec/fixtures/banana-lib
+1
-0
downloader_spec.rb
spec/functional/downloader_spec.rb
+35
-0
spec_helper.rb
spec/spec_helper.rb
+6
-3
fixture.rb
spec/spec_helper/fixture.rb
+2
-2
temporary_directory.rb
spec/spec_helper/temporary_directory.rb
+3
-3
downloader_spec.rb
spec/unit/downloader_spec.rb
+14
-0
No files found.
lib/cocoa_pods.rb
View file @
deb4712c
...
...
@@ -11,7 +11,10 @@ module Pod
autoload
:Version
,
'cocoa_pods/version'
module
Xcode
autoload
:Config
,
'cocoa_pods/xcode/config'
autoload
:Project
,
'cocoa_pods/xcode/project'
autoload
:Config
,
'cocoa_pods/xcode/config'
autoload
:Project
,
'cocoa_pods/xcode/project'
end
autoload
:Pathname
,
'pathname'
autoload
:Executioner
,
'executioner'
end
lib/cocoa_pods/downloader.rb
View file @
deb4712c
module
Pod
class
Downloader
def
self
.
for_source
(
source
,
pod_root
)
def
self
.
for_source
(
pod_root
,
source
)
options
=
source
.
dup
if
url
=
options
.
delete
(
:git
)
Git
.
new
(
pod_root
,
url
,
options
)
...
...
@@ -9,12 +9,13 @@ module Pod
end
end
attr_reader
:pod_root
,
:url
,
:options
def
initialize
(
pod_root
,
url
,
options
)
@pod_root
,
@url
,
@options
=
pod_root
,
url
,
options
end
class
Git
<
Downloader
require
'rubygems'
require
'executioner'
include
Executioner
# TODO make Executioner:
...
...
lib/cocoa_pods/specification.rb
View file @
deb4712c
...
...
@@ -178,7 +178,7 @@ module Pod
# end
# end
def
download!
downloader
=
Downloader
.
for_source
(
@source
,
pod_destroot
)
downloader
=
Downloader
.
for_source
(
pod_destroot
,
@source
)
downloader
.
download
downloader
.
clean
if
config
.
clean
end
...
...
banana-lib
@
f046c1a0
Subproject commit f046c1a0fc673a01cf1ce4607c5d1857ce08b44a
spec/functional/downloader_spec.rb
0 → 100644
View file @
deb4712c
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
describe
"Pod::Downloader"
do
extend
SpecHelper
::
TemporaryDirectory
before
do
@dir
=
temporary_directory
+
'banana-lib'
end
it
"check's out a specific commit"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:git
=>
fixture
(
'banana-lib'
),
:commit
=>
'02467b074d4dc9f6a75b8cd3ab80d9bf37887b01'
)
downloader
.
download
(
@dir
+
'README'
).
read
.
strip
.
should
==
'first commit'
end
it
"check's out a specific tag"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:git
=>
fixture
(
'banana-lib'
),
:tag
=>
'v1.0'
)
downloader
.
download
(
@dir
+
'README'
).
read
.
strip
.
should
==
'v1.0'
end
it
"removes the .git directory"
do
downloader
=
Pod
::
Downloader
.
for_source
(
@dir
,
:git
=>
fixture
(
'banana-lib'
),
:tag
=>
'v1.0'
)
downloader
.
download
downloader
.
clean
(
@dir
+
'.git'
).
should
.
not
.
exist
end
end
spec/spec_helper.rb
View file @
deb4712c
require
'rubygems'
require
'mac_bacon'
ROOT
=
File
.
expand_path
(
'../../'
,
__FILE__
)
require
'pathname'
ROOT
=
Pathname
.
new
(
File
.
expand_path
(
'../../'
,
__FILE__
))
$:
.
unshift
File
.
join
(
ROOT
,
'lib'
)
$:
.
unshift
((
ROOT
+
'lib'
).
to_s
)
require
'cocoa_pods'
$:
.
unshift
File
.
join
(
ROOT
,
'spec'
)
$:
.
unshift
((
ROOT
+
'spec'
).
to_s
)
require
'spec_helper/fixture'
require
'spec_helper/git'
require
'spec_helper/log'
...
...
@@ -17,6 +18,8 @@ require 'spec_helper/temporary_directory'
class
Bacon
::
Context
include
Pod
::
Config
::
Mixin
include
SpecHelper
::
Fixture
end
Pod
::
Config
.
instance
.
repos_dir
=
SpecHelper
.
tmp_repos_path
spec/spec_helper/fixture.rb
View file @
deb4712c
...
...
@@ -4,10 +4,10 @@ module SpecHelper
end
module
Fixture
ROOT
=
File
.
join
(
::
ROOT
,
'spec'
,
'fixtures'
)
ROOT
=
::
ROOT
+
'spec/fixtures'
def
fixture
(
name
)
File
.
join
(
ROOT
,
name
)
ROOT
+
name
end
module_function
:fixture
end
...
...
spec/spec_helper/temporary_directory.rb
View file @
deb4712c
...
...
@@ -7,16 +7,16 @@ module SpecHelper
module
TemporaryDirectory
def
temporary_directory
File
.
join
(
ROOT
,
'tmp'
)
ROOT
+
'tmp'
end
module_function
:temporary_directory
def
setup_temporary_directory
FileUtils
.
mkdir_p
(
temporary_directory
)
temporary_directory
.
mkpath
end
def
teardown_temporary_directory
FileUtils
.
rm_rf
(
temporary_directory
)
temporary_directory
.
rmtree
end
def
self
.
extended
(
base
)
...
...
spec/unit/downloader_spec.rb
0 → 100644
View file @
deb4712c
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
describe
"Pod::Downloader"
do
it
"returns a git downloader"
do
downloader
=
Pod
::
Downloader
.
for_source
(
'/path/to/pod_root'
,
:git
=>
'http://example.local/banana.git'
,
:tag
=>
'v1.0'
,
)
downloader
.
should
.
be
.
instance_of
Pod
::
Downloader
::
Git
downloader
.
pod_root
.
should
==
'/path/to/pod_root'
downloader
.
url
.
should
==
'http://example.local/banana.git'
downloader
.
options
.
should
==
{
:tag
=>
'v1.0'
}
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