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
646c3e63
Commit
646c3e63
authored
Sep 06, 2011
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add a global config.
parent
4c8530b1
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
58 additions
and
14 deletions
+58
-14
cocoa_pods.rb
lib/cocoa_pods.rb
+1
-0
command.rb
lib/cocoa_pods/command.rb
+2
-4
repo.rb
lib/cocoa_pods/command/repo.rb
+5
-5
config.rb
lib/cocoa_pods/config.rb
+23
-0
spec_helper.rb
spec/spec_helper.rb
+6
-0
command_spec.rb
spec/unit/command_spec.rb
+1
-5
config_spec.rb
spec/unit/config_spec.rb
+20
-0
No files found.
lib/cocoa_pods.rb
View file @
646c3e63
module
Pod
autoload
:Command
,
'cocoa_pods/command'
autoload
:Config
,
'cocoa_pods/config'
end
lib/cocoa_pods/command.rb
View file @
646c3e63
module
Pod
class
Command
include
Config
::
Mixin
autoload
:Help
,
'cocoa_pods/command/help'
autoload
:Setup
,
'cocoa_pods/command/setup'
autoload
:Spec
,
'cocoa_pods/command/spec'
...
...
@@ -19,9 +21,5 @@ module Pod
def
initialize
(
*
argv
)
raise
ArgumentError
,
"unknown argument(s):
#{
argv
.
join
(
', '
)
}
"
unless
argv
.
empty?
end
def
repos_dir
File
.
expand_path
(
'~/.cocoa-pods'
)
end
end
end
lib/cocoa_pods/command/repo.rb
View file @
646c3e63
...
...
@@ -25,7 +25,7 @@ module Pod
end
def
dir
File
.
join
(
repos_dir
,
@name
)
File
.
join
(
config
.
repos_dir
,
@name
)
end
def
run
...
...
@@ -33,14 +33,14 @@ module Pod
end
def
add
FileUtils
.
mkdir_p
(
repos_dir
)
Dir
.
chdir
(
repos_dir
)
{
git
(
"clone
#{
@url
}
#{
@name
}
"
)
}
FileUtils
.
mkdir_p
(
config
.
repos_dir
)
Dir
.
chdir
(
config
.
repos_dir
)
{
git
(
"clone
#{
@url
}
#{
@name
}
"
)
}
end
def
update
names
=
@name
?
[
@name
]
:
Dir
.
entries
(
repos_dir
)[
2
..-
1
]
names
=
@name
?
[
@name
]
:
Dir
.
entries
(
config
.
repos_dir
)[
2
..-
1
]
names
.
each
do
|
name
|
Dir
.
chdir
(
File
.
join
(
repos_dir
,
name
))
{
git
(
"pull"
)
}
Dir
.
chdir
(
File
.
join
(
config
.
repos_dir
,
name
))
{
git
(
"pull"
)
}
end
end
end
...
...
lib/cocoa_pods/config.rb
0 → 100644
View file @
646c3e63
module
Pod
class
Config
def
self
.
instance
@instance
||=
new
end
def
self
.
instance
=
(
instance
)
@instance
=
instance
end
attr_accessor
:repos_dir
def
initialize
@repos_dir
=
File
.
expand_path
(
"~/.cocoa-pods"
)
end
module
Mixin
def
config
Config
.
instance
end
end
end
end
spec/spec_helper.rb
View file @
646c3e63
...
...
@@ -14,3 +14,9 @@ require 'spec_helper/temporary_directory'
#TMP_DIR = SpecHelper::TemporaryDirectory.temporary_directory
#TMP_COCOA_PODS_DIR = File.join(TMP_DIR, 'cocoa-pods')
class
Bacon
::
Context
include
Pod
::
Config
::
Mixin
end
Pod
::
Config
.
instance
.
repos_dir
=
SpecHelper
.
tmp_repos_path
spec/unit/command_spec.rb
View file @
646c3e63
...
...
@@ -21,10 +21,6 @@ describe "Pod::Command::Setup" do
it
"returns the URL of the `master' spec-repo"
do
@command
.
master_repo_url
.
should
==
'git://github.com/alloy/cocoa-pod-specs.git'
end
it
"returns the path of the directory where the local spec-repos will be stored"
do
@command
.
repos_dir
.
should
==
File
.
expand_path
(
"~/.cocoa-pods"
)
end
end
describe
"Pod::Command::Repo"
do
...
...
@@ -34,6 +30,6 @@ describe "Pod::Command::Repo" do
it
"returns the path of the spec-repo directory"
do
repo
=
Pod
::
Command
::
Repo
.
new
(
'cd'
,
'private'
)
repo
.
dir
.
should
==
File
.
expand_path
(
"~/.cocoa-pods/private"
)
repo
.
dir
.
should
==
File
.
join
(
config
.
repos_dir
,
'private'
)
end
end
spec/unit/config_spec.rb
0 → 100644
View file @
646c3e63
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
describe
"Pod::Config"
do
before
do
@original_config
=
config
Pod
::
Config
.
instance
=
nil
end
after
do
Pod
::
Config
.
instance
=
@original_config
end
it
"returns the singleton config instance"
do
config
.
should
.
be
.
instance_of
Pod
::
Config
end
it
"returns the path to the spec-repos dir"
do
config
.
repos_dir
.
should
==
File
.
expand_path
(
"~/.cocoa-pods"
)
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