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
99819b9f
Commit
99819b9f
authored
Sep 11, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fetch a pod's source with git.
parent
30d8b91e
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
94 additions
and
6 deletions
+94
-6
cocoa_pods.rb
lib/cocoa_pods.rb
+1
-0
install.rb
lib/cocoa_pods/command/install.rb
+5
-2
downloader.rb
lib/cocoa_pods/downloader.rb
+47
-0
resolver.rb
lib/cocoa_pods/resolver.rb
+1
-2
specification.rb
lib/cocoa_pods/specification.rb
+40
-2
No files found.
lib/cocoa_pods.rb
View file @
99819b9f
...
@@ -2,6 +2,7 @@ module Pod
...
@@ -2,6 +2,7 @@ module Pod
autoload
:Command
,
'cocoa_pods/command'
autoload
:Command
,
'cocoa_pods/command'
autoload
:Config
,
'cocoa_pods/config'
autoload
:Config
,
'cocoa_pods/config'
autoload
:Dependency
,
'cocoa_pods/dependency'
autoload
:Dependency
,
'cocoa_pods/dependency'
autoload
:Downloader
,
'cocoa_pods/downloader'
autoload
:Resolver
,
'cocoa_pods/resolver'
autoload
:Resolver
,
'cocoa_pods/resolver'
autoload
:Source
,
'cocoa_pods/source'
autoload
:Source
,
'cocoa_pods/source'
autoload
:Spec
,
'cocoa_pods/specification'
autoload
:Spec
,
'cocoa_pods/specification'
...
...
lib/cocoa_pods/command/install.rb
View file @
99819b9f
...
@@ -3,13 +3,16 @@ module Pod
...
@@ -3,13 +3,16 @@ module Pod
class
Install
<
Command
class
Install
<
Command
def
run
def
run
if
spec
=
Specification
.
from_podfile
(
podfile
)
if
spec
=
Specification
.
from_podfile
(
podfile
)
p
spec
spec
.
install_dependent_specifications!
(
pods_root
)
Resolver
.
new
(
spec
).
resolve
else
else
$stderr
.
puts
"No Podfile found in current working directory."
$stderr
.
puts
"No Podfile found in current working directory."
end
end
end
end
def
pods_root
Pathname
.
new
(
Dir
.
pwd
)
+
'Pods'
end
def
podfile
def
podfile
File
.
join
(
Dir
.
pwd
,
'Podfile'
)
File
.
join
(
Dir
.
pwd
,
'Podfile'
)
end
end
...
...
lib/cocoa_pods/downloader.rb
0 → 100644
View file @
99819b9f
module
Pod
class
Downloader
def
self
.
for_source
(
source
)
options
=
source
.
dup
if
url
=
options
.
delete
(
:git
)
Git
.
new
(
url
,
options
)
else
raise
"Unsupported download strategy `
#{
source
.
inspect
}
'."
end
end
def
initialize
(
url
,
options
)
@url
,
@options
=
url
,
options
end
class
Git
<
Downloader
require
'rubygems'
require
'executioner'
include
Executioner
# TODO make Executioner:
# * not raise when there's output to either stdout/stderr, but check exit status
# * sync output
executable
:git
def
download_to
(
pod_root
)
checkout
=
pod_root
+
'source'
if
tag
=
@options
[
:tag
]
checkout
.
mkdir
Dir
.
chdir
(
checkout
)
do
git
"init"
git
"remote add origin '
#{
@url
}
'"
git
"fetch origin tags/
#{
tag
}
2>&1"
git
"reset --hard FETCH_HEAD"
git
"checkout -b activated-pod-commit 2>&1"
end
elsif
commit
=
@options
[
:commit
]
git
"clone '
#{
@url
}
' '
#{
checkout
}
'"
Dir
.
chdir
(
checkout
)
do
git
"checkout -b activated-pod-commit
#{
commit
}
2>&1"
end
else
raise
"Either a tag or a commit has to be specified."
end
end
end
end
end
lib/cocoa_pods/resolver.rb
View file @
99819b9f
...
@@ -7,8 +7,7 @@ module Pod
...
@@ -7,8 +7,7 @@ module Pod
def
resolve
def
resolve
@sets
=
[]
@sets
=
[]
find_dependency_sets
(
@specification
)
find_dependency_sets
(
@specification
)
specs
=
@sets
.
map
(
&
:podspec
)
@sets
.
map
(
&
:podspec
)
p
specs
end
end
def
find_dependency_sets
(
specification
)
def
find_dependency_sets
(
specification
)
...
...
lib/cocoa_pods/specification.rb
View file @
99819b9f
...
@@ -63,7 +63,7 @@ module Pod
...
@@ -63,7 +63,7 @@ module Pod
def
part_of
(
name
,
*
version_requirements
)
def
part_of
(
name
,
*
version_requirements
)
#@part_of = Dependency.new(name, *version_requirements)
#@part_of = Dependency.new(name, *version_requirements)
dependency
(
name
,
*
version_requirements
)
@part_of
=
dependency
(
name
,
*
version_requirements
)
end
end
def
source_files
(
*
patterns
)
def
source_files
(
*
patterns
)
...
@@ -76,11 +76,49 @@ module Pod
...
@@ -76,11 +76,49 @@ module Pod
attr_reader
:dependencies
attr_reader
:dependencies
def
dependency
(
name
,
*
version_requirements
)
def
dependency
(
name
,
*
version_requirements
)
@dependencies
<<
Dependency
.
new
(
name
,
*
version_requirements
)
dep
=
Dependency
.
new
(
name
,
*
version_requirements
)
@dependencies
<<
dep
dep
end
end
# Not attributes
# Not attributes
def
resolved_dependent_specifications
@resolved_dependent_specifications
||=
Resolver
.
new
(
self
).
resolve
end
def
install_dependent_specifications!
(
root
)
resolved_dependent_specifications
.
each
do
|
spec
|
install_spec
=
spec
if
part_of_spec_dep
=
spec
.
read
(
:part_of
)
install_spec
=
resolved_dependent_specifications
.
find
{
|
s
|
s
.
read
(
:name
)
==
part_of_spec_dep
.
name
}
puts
"-- Installing:
#{
install_spec
}
for
#{
spec
}
"
else
puts
"-- Installing:
#{
install_spec
}
"
end
install_spec
.
install!
(
root
)
end
end
# User can override this for custom installation
def
install!
(
pods_root
)
require
'fileutils'
pods_root
.
mkpath
pod_root
=
pods_root
+
"
#{
@name
}
-
#{
@version
}
"
if
pod_root
.
exist?
puts
" Skipping, the pod already exists:
#{
pod_root
}
"
else
pod_root
.
mkdir
FileUtils
.
cp
(
@defined_in_file
,
pod_root
)
download_to
(
pod_root
)
end
end
# User can override this for custom downloading
def
download_to
(
pod_root
)
Downloader
.
for_source
(
@source
).
download_to
(
pod_root
)
end
def
from_podfile?
def
from_podfile?
@name
.
nil?
&&
@version
.
nil?
@name
.
nil?
&&
@version
.
nil?
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