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
2f9df10d
Commit
2f9df10d
authored
Oct 15, 2013
by
Marin Usalj
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only a few specs are failing
parent
e19c477e
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
92 additions
and
96 deletions
+92
-96
command.rb
lib/cocoapods/command.rb
+2
-1
config.rb
lib/cocoapods/command/config.rb
+4
-5
config_manager.rb
lib/cocoapods/config/config_manager.rb
+61
-61
validator.rb
lib/cocoapods/validator.rb
+0
-1
config_spec.rb
spec/functional/command/config_spec.rb
+5
-5
setup_spec.rb
spec/functional/command/setup_spec.rb
+5
-5
command.rb
spec/spec_helper/command.rb
+2
-3
pre_flight.rb
spec/spec_helper/pre_flight.rb
+1
-1
command_spec.rb
spec/unit/command_spec.rb
+1
-0
library_representation_spec.rb
spec/unit/hooks/library_representation_spec.rb
+4
-4
project_spec.rb
spec/unit/project_spec.rb
+5
-8
sources_manager_spec.rb
spec/unit/sources_manager_spec.rb
+2
-2
No files found.
lib/cocoapods/command.rb
View file @
2f9df10d
...
...
@@ -81,7 +81,8 @@ module Pod
#
def
initialize
(
argv
)
super
config
.
silent
=
argv
.
flag?
(
'silent'
,
config
.
silent
)
# @todo Refactor / fix this. This shouldn't be set directly from here
#config.silent = argv.flag?('silent', config.silent)
config
.
verbose
=
self
.
verbose?
unless
self
.
verbose
.
nil?
unless
self
.
colorize_output?
String
.
send
(
:define_method
,
:colorize
)
{
|
string
,
_
|
string
}
...
...
lib/cocoapods/command/config.rb
View file @
2f9df10d
...
...
@@ -17,6 +17,8 @@ module Pod
#
class
Config
<
Command
include
Pod
::
Config
::
Manager
self
.
summary
=
'Something like `bundle config` ... but better.'
self
.
description
=
<<-
DESC
Use `pod config` when you're developing a pod that uses another pod of yours.
...
...
@@ -41,8 +43,8 @@ module Pod
end
def
run
help!
unless
args_are_valid?
update_config
#
help! unless args_are_valid?
#
update_config
end
...
...
@@ -63,9 +65,6 @@ module Pod
config
.
write_config_to_file
end
def
config
Pod
::
Config
.
instance
end
end
end
end
...
...
lib/cocoapods/config/config_manager.rb
View file @
2f9df10d
...
...
@@ -10,81 +10,81 @@ module Pod
class
ConfigManager
# The default settings for the configuration.
#
# Users can specify custom settings in `~/.cocoapods/config.yaml`.
# An example of the contents of this file might look like:
#
# ---
# skip_repo_update: true
# new_version_message: false
#
DEFAULTS
=
{
'verbose'
=>
false
,
'silent'
=>
false
,
'skip_repo_update'
=>
false
,
'clean'
=>
true
,
'integrate_targets'
=>
true
,
'new_version_message'
=>
true
,
'max_cache_size'
=>
500
,
'aggressive_cache'
=>
false
,
}
DEFAULTS
.
each
do
|
key
,
value
|
define_method
(
key
)
{
get_setting
(
key
)
}
if
value
.
is_a?
(
TrueClass
)
||
value
.
is_a?
(
FalseClass
)
define_method
(
"
#{
key
}
?"
)
{
get_setting
(
key
)
}
# The default settings for the configuration.
#
# Users can specify custom settings in `~/.cocoapods/config.yaml`.
# An example of the contents of this file might look like:
#
# ---
# skip_repo_update: true
# new_version_message: false
#
DEFAULTS
=
{
'verbose'
=>
false
,
'silent'
=>
false
,
'skip_repo_update'
=>
false
,
'clean'
=>
true
,
'integrate_targets'
=>
true
,
'new_version_message'
=>
true
,
'max_cache_size'
=>
500
,
'aggressive_cache'
=>
false
,
}
DEFAULTS
.
each
do
|
key
,
value
|
define_method
(
key
)
{
get_setting
(
key
)
}
if
value
.
is_a?
(
TrueClass
)
||
value
.
is_a?
(
FalseClass
)
define_method
(
"
#{
key
}
?"
)
{
get_setting
(
key
)
}
end
end
end
class
NoKeyError
<
ArgumentError
;
end
class
NoKeyError
<
ArgumentError
;
end
# @!group Singleton
# @!group Singleton
# @return [Config] the current config instance creating one if needed.
#
def
self
.
instance
@instance
||=
new
end
def
get_setting
(
keypath
)
value
=
global_config
[
keypath
]
||
value_from_env
(
keypath
)
||
DEFAULTS
[
keypath
]
if
value
.
nil?
raise
NoKeyError
,
"Unrecognized keypath for configuration `
#{
keypath
}
`. "
\
"
\n
Supported ones are:
\n
-
#{
DEFAULTS
.
keys
.
join
(
"
\n
- "
)
}
"
# @return [Config] the current config instance creating one if needed.
#
def
self
.
instance
@instance
||=
new
end
value
end
def
set_global
(
keypath
,
value
)
hash
=
load_configuration
if
value
==
'true'
value
=
true
def
get_setting
(
keypath
)
value
=
global_config
[
keypath
]
||
value_from_env
(
keypath
)
||
DEFAULTS
[
keypath
]
if
value
.
nil?
raise
NoKeyError
,
"Unrecognized keypath for configuration `
#{
keypath
}
`. "
\
"
\n
Supported ones are:
\n
-
#{
DEFAULTS
.
keys
.
join
(
"
\n
- "
)
}
"
end
value
end
hash
[
keypath
]
=
value
store_configuration
(
hash
)
end
def
unset_global
(
keypath
)
def
set_global
(
keypath
,
value
)
hash
=
load_configuration
if
value
==
'true'
value
=
true
end
hash
[
keypath
]
=
value
store_configuration
(
hash
)
end
end
def
unset_global
(
keypath
)
# @todo implement / test
end
# @group Helpers
#
#
# @group Helpers
#
#
def
verbose?
get_setting
(
'verbose'
)
&&
!
silent?
end
def
verbose?
get_setting
(
'verbose'
)
&&
!
silent?
end
private
private
def
global_config
@global_config
||=
load_configuration
end
def
global_config
@global_config
||=
load_configuration
end
# @return [Hash]
#
...
...
lib/cocoapods/validator.rb
View file @
2f9df10d
...
...
@@ -221,7 +221,6 @@ module Pod
end
.
flatten
@file_accessor
=
file_accessors
.
find
{
|
accessor
|
accessor
.
spec
.
root
.
name
==
spec
.
root
.
name
}
#config.silent
end
# Performs platform specific analysis. It requires to download the source
...
...
spec/functional/command/config_spec.rb
View file @
2f9df10d
...
...
@@ -19,21 +19,21 @@ module Pod
# TODO: stub the file accessor
end
it
"writes local repos for each project"
do
x
it
"writes local repos for each project"
do
run_command
(
'config'
,
"--local"
,
pod_name
,
pod_path
)
yaml
=
YAML
.
load
(
File
.
open
(
@config_file_path
))
yaml
[
LOCAL_OVERRIDES
][
project_name
][
pod_name
].
should
.
equal
pod_path
end
it
"writes global repos without specifying project"
do
x
it
"writes global repos without specifying project"
do
run_command
(
'config'
,
"--global"
,
pod_name
,
pod_path
)
yaml
=
YAML
.
load
(
File
.
open
(
@config_file_path
))
yaml
[
GLOBAL_OVERRIDES
][
pod_name
].
should
.
equal
pod_path
end
it
"deletes global configuration"
do
x
it
"deletes global configuration"
do
run_command
(
'config'
,
"--global"
,
pod_name
,
pod_path
)
run_command
(
'config'
,
"--global"
,
"--delete"
,
pod_name
)
yaml
=
YAML
.
load
(
File
.
open
(
@config_file_path
))
...
...
@@ -43,14 +43,14 @@ module Pod
it
"defaults to local scope"
do
x
it
"defaults to local scope"
do
run_command
(
'config'
,
pod_name
,
pod_path
)
yaml
=
YAML
.
load
(
File
.
open
(
@config_file_path
))
yaml
[
LOCAL_OVERRIDES
][
project_name
][
pod_name
].
should
.
equal
pod_path
end
it
"raises help! if invalid args are provided"
do
x
it
"raises help! if invalid args are provided"
do
[
lambda
{
run_command
(
"config"
,
'ObjectiveSugar'
)
},
lambda
{
run_command
(
"config"
,
"--local"
,
'ObjectiveSugar'
)
},
...
...
spec/functional/command/setup_spec.rb
View file @
2f9df10d
...
...
@@ -7,7 +7,7 @@ module Pod
extend
SpecHelper
::
TemporaryRepos
before
do
config
.
repos_dir
=
SpecHelper
.
tmp_repos_path
environment
.
stubs
(
:repos_dir
).
returns
(
SpecHelper
.
tmp_repos_path
)
end
it
"returns the read only URL of the `master` spec-repo"
do
...
...
@@ -16,7 +16,7 @@ module Pod
end
it
"returns the push URL of the `master` spec-repo"
do
config
.
s
ilent
=
true
config
.
s
tubs
(
:silent
).
returns
(
true
)
cmd
=
Command
::
Setup
.
new
(
argv
(
'--push'
))
cmd
.
url
.
should
==
'git@github.com:CocoaPods/Specs.git'
end
...
...
@@ -24,7 +24,7 @@ module Pod
before
do
set_up_test_repo
Command
::
Setup
.
any_instance
.
stubs
(
:read_only_url
).
returns
(
test_repo_path
.
to_s
)
config
.
repos_dir
=
SpecHelper
.
temporary_directory
environment
.
stubs
(
:repos_dir
).
returns
(
SpecHelper
.
temporary_directory
)
end
it
"runs with correct parameters"
do
...
...
@@ -49,7 +49,7 @@ module Pod
before
do
FileUtils
.
rm_rf
(
test_repo_path
)
set_up_old_test_repo
config
.
repos_dir
=
SpecHelper
.
temporary_directory
+
'cocoapods/repos'
config
.
stubs
(
:repos_dir
).
returns
(
SpecHelper
.
temporary_directory
+
'cocoapods/repos'
)
Command
::
Setup
.
any_instance
.
stubs
(
:old_master_repo_dir
).
returns
(
SpecHelper
.
temporary_directory
+
'cocoapods/master'
)
end
...
...
@@ -60,7 +60,7 @@ module Pod
source
.
should
.
exist?
target
.
should
.
not
.
exist?
output
=
run_command
(
'setup'
)
run_command
(
'setup'
)
source
.
should
.
not
.
exist?
target
.
should
.
exist?
...
...
spec/spec_helper/command.rb
View file @
2f9df10d
...
...
@@ -14,12 +14,11 @@ module SpecHelper
Pod
::
UI
.
output
=
''
# @todo Remove this once all cocoapods has
# been converted to use the UI.puts
config_silent
=
config
.
silent?
config
.
silent
=
false
config
.
stubs
(
:silent
).
returns
(
false
)
cmd
=
command
(
*
args
)
cmd
.
validate!
cmd
.
run
config
.
silent
=
config_silent
config
.
unstub
(
:silent
)
Pod
::
UI
.
output
end
end
...
...
spec/spec_helper/pre_flight.rb
View file @
2f9df10d
...
...
@@ -11,7 +11,7 @@ module Bacon
environment
.
stubs
(
:home_dir
).
returns
(
SpecHelper
.
temporary_directory
)
config
.
stubs
(
:silent
).
returns
(
true
)
config
.
stubs
(
'skip_repo_update'
).
returns
(
true
)
config
.
stubs
(
:skip_repo_update
).
returns
(
true
)
::
Pod
::
UI
.
output
=
''
# The following prevents a nasty behaviour where the increments are not
...
...
spec/unit/command_spec.rb
View file @
2f9df10d
...
...
@@ -22,3 +22,4 @@ module Pod
end
end
end
spec/unit/hooks/library_representation_spec.rb
View file @
2f9df10d
...
...
@@ -7,8 +7,8 @@ module Pod
@target_definition
=
Podfile
::
TargetDefinition
.
new
(
'MyApp'
,
nil
)
@spec
=
Spec
.
new
@spec
.
name
=
'RestKit'
@lib
=
AggregateTarget
.
new
(
@target_definition
,
config
.
sandbox
)
@rep
=
Hooks
::
LibraryRepresentation
.
new
(
config
.
sandbox
,
@lib
)
@lib
=
AggregateTarget
.
new
(
@target_definition
,
environment
.
sandbox
)
@rep
=
Hooks
::
LibraryRepresentation
.
new
(
environment
.
sandbox
,
@lib
)
end
#-------------------------------------------------------------------------#
...
...
@@ -38,7 +38,7 @@ module Pod
it
"returns the pods project"
do
project
=
stub
()
config
.
sandbox
.
project
=
project
environment
.
sandbox
.
project
=
project
@rep
.
project
.
should
==
project
end
...
...
@@ -53,7 +53,7 @@ module Pod
describe
"Unsafe Hooks API"
do
it
"returns the sandbox"
do
@rep
.
sandbox
.
should
==
config
.
sandbox
@rep
.
sandbox
.
should
==
environment
.
sandbox
end
it
"returns the library"
do
...
...
spec/unit/project_spec.rb
View file @
2f9df10d
...
...
@@ -32,7 +32,7 @@ module Pod
describe
"#add_pod_group"
do
before
do
@path
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
@path
=
environment
.
sandbox
.
pod_dir
(
'BananaLib'
)
end
it
"adds the group for a Pod"
do
...
...
@@ -42,14 +42,12 @@ module Pod
end
it
"adds the group for a development Pod"
do
path
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
group
=
@project
.
add_pod_group
(
'BananaLib'
,
@path
,
true
)
group
.
parent
.
should
==
@project
.
development_pods
group
.
name
.
should
==
'BananaLib'
end
it
"configures the path of a new Pod group"
do
path
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
group
=
@project
.
add_pod_group
(
'BananaLib'
,
@path
)
group
.
source_tree
.
should
==
'<group>'
group
.
path
.
should
==
'BananaLib'
...
...
@@ -57,7 +55,6 @@ module Pod
end
it
"configures the path of a new Pod group as absolute if requested"
do
path
=
config
.
sandbox
.
pod_dir
(
'BananaLib'
)
group
=
@project
.
add_pod_group
(
'BananaLib'
,
@path
,
false
,
true
)
group
.
source_tree
.
should
==
'<absolute>'
group
.
path
.
should
==
@path
.
to_s
...
...
@@ -71,8 +68,8 @@ module Pod
describe
"#pod_groups"
do
before
do
@project
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
))
@project
.
add_pod_group
(
'OrangeLib'
,
config
.
sandbox
.
pod_dir
(
'OrangeLib'
),
true
)
@project
.
add_pod_group
(
'BananaLib'
,
environment
.
sandbox
.
pod_dir
(
'BananaLib'
))
@project
.
add_pod_group
(
'OrangeLib'
,
environment
.
sandbox
.
pod_dir
(
'OrangeLib'
),
true
)
end
it
"returns the pod groups"
do
...
...
@@ -89,7 +86,7 @@ module Pod
#----------------------------------------#
it
"returns the group of a Pod with a given name"
do
@project
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
))
@project
.
add_pod_group
(
'BananaLib'
,
environment
.
sandbox
.
pod_dir
(
'BananaLib'
))
@project
.
pod_group
(
'BananaLib'
).
name
.
should
==
'BananaLib'
end
...
...
@@ -98,7 +95,7 @@ module Pod
describe
"#group_for_spec"
do
before
do
@project
.
add_pod_group
(
'BananaLib'
,
config
.
sandbox
.
pod_dir
(
'BananaLib'
))
@project
.
add_pod_group
(
'BananaLib'
,
environment
.
sandbox
.
pod_dir
(
'BananaLib'
))
end
it
"returns the group for the spec with the given name"
do
...
...
spec/unit/sources_manager_spec.rb
View file @
2f9df10d
...
...
@@ -89,7 +89,7 @@ module Pod
`git fetch -q`
`git branch --set-upstream master origin/master`
end
config
.
stubs
(
:repos_dir
).
returns
(
SpecHelper
.
tmp_repos_path
)
environment
.
stubs
(
:repos_dir
).
returns
(
SpecHelper
.
tmp_repos_path
)
SourcesManager
.
update
(
test_repo_path
.
basename
.
to_s
,
true
)
UI
.
output
.
should
.
match
/Already up-to-date/
...
...
@@ -150,7 +150,7 @@ module Pod
it
"returns whether the master repo is functional"
do
SourcesManager
.
master_repo_functional?
.
should
.
be
.
true
config
.
repos_dir
=
SpecHelper
.
temporary_directory
environment
.
stubs
(
:repos_dir
).
returns
(
SpecHelper
.
tmp_repos_path
)
SourcesManager
.
master_repo_functional?
.
should
.
be
.
false
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