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
adb89ec5
Commit
adb89ec5
authored
Apr 13, 2012
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cleanup and make specs green.
parent
23626caa
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
96 deletions
+27
-96
set_present.rb
lib/cocoapods/command/set_present.rb
+0
-77
config.rb
lib/cocoapods/config.rb
+5
-1
documentation.rb
lib/cocoapods/generator/documentation.rb
+1
-5
specification.rb
lib/cocoapods/specification.rb
+12
-5
list_spec.rb
spec/functional/command/list_spec.rb
+8
-7
integration_spec.rb
spec/integration_spec.rb
+1
-1
No files found.
lib/cocoapods/command/set_present.rb
deleted
100644 → 0
View file @
23626caa
require
'net/http'
module
Pod
class
Command
module
SetPresent
def
self
.
options
[
[
"--name-only"
,
"Show only the names of the pods"
],
[
"--stats"
,
"Show additional stats (like GitHub watchers and forks)"
],
]
end
def
list
@list
end
def
parse_set_options
(
argv
)
@stats
=
argv
.
option
(
'--stats'
)
@list
=
argv
.
option
(
'--name-only'
)
end
def
present_sets
(
array
)
array
.
each
do
|
set
|
present_set
(
set
)
end
end
def
present_set
(
set
)
if
@list
puts
set
.
name
else
puts
"-->
#{
set
.
name
}
(
#{
set
.
versions
.
reverse
.
join
(
", "
)
}
)"
.
green
puts_wrapped_text
(
set
.
specification
.
summary
)
spec
=
set
.
specification
.
part_of_other_pod?
?
set
.
specification
.
part_of_specification
:
set
.
specification
source
=
spec
.
source
.
reject
{
|
k
,
_
|
k
==
:commit
||
k
==
:tag
}.
values
.
first
puts_detail
(
'Homepage'
,
spec
.
homepage
)
puts_detail
(
'Source'
,
source
)
if
@stats
stats
=
stats
(
source
)
puts_detail
(
'Watchers'
,
stats
[
:watchers
])
puts_detail
(
'Forks'
,
stats
[
:forks
])
end
puts
end
end
# adapted from http://blog.macromates.com/2006/wrapping-text-with-regular-expressions/
def
puts_wrapped_text
(
txt
,
col
=
80
,
indentation
=
4
)
indent
=
' '
*
indentation
puts
txt
.
strip
.
gsub
(
/(.{1,
#{
col
}
})( +|$)\n?|(.{
#{
col
}
})/
,
indent
+
"
\\
1
\\
3
\n
"
)
end
def
puts_detail
(
title
,
string
)
return
if
!
string
# 8 is the length of homepage
number_of_spaces
=
((
8
-
title
.
length
)
>
0
)
?
(
8
-
title
.
length
)
:
0
spaces
=
' '
*
number_of_spaces
puts
" -
#{
title
}
:
#{
spaces
+
string
}
"
end
def
stats
(
url
)
original_url
,
username
,
reponame
=
*
(
url
.
match
(
/[:\/]([\w\-]+)\/([\w\-]+)\.git/
).
to_a
)
result
=
{}
if
original_url
gh_response
=
Net
::
HTTP
.
get
(
'github.com'
,
"/api/v2/json/repos/show/
#{
username
}
/
#{
reponame
}
"
)
result
[
:watchers
]
=
gh_response
.
match
(
/\"watchers\"\W*:\W*([0-9]+)/
).
to_a
[
1
]
result
[
:forks
]
=
gh_response
.
match
(
/\"forks\"\W*:\W*([0-9]+)/
).
to_a
[
1
]
end
result
end
end
end
end
lib/cocoapods/config.rb
View file @
adb89ec5
...
...
@@ -10,7 +10,11 @@ module Pod
@instance
=
instance
end
attr_accessor
:repos_dir
,
:project_root
,
:project_pods_root
,
:clean
,
:verbose
,
:silent
,
:doc
,
:doc_install
,
:force_doc
,
:integrate_targets
attr_accessor
:repos_dir
,
:project_root
,
:project_pods_root
attr_accessor
:clean
,
:verbose
,
:silent
attr_accessor
:doc
,
:doc_install
,
:force_doc
attr_accessor
:integrate_targets
alias_method
:clean?
,
:clean
alias_method
:verbose?
,
:verbose
alias_method
:silent?
,
:silent
...
...
lib/cocoapods/generator/documentation.rb
View file @
adb89ec5
...
...
@@ -87,12 +87,8 @@ module Pod
raise
"Appledoc encountered an error (exitstatus:
#{
$?
.
exitstatus
}
)."
end
rescue
Exception
=>
e
if
e
.
is_a?
(
Informative
)
rescue
Informative
puts
"[!] Skipping documentation generation because appledoc can't be found."
if
config
.
verbose?
else
throw
e
end
end
end
end
...
...
lib/cocoapods/specification.rb
View file @
adb89ec5
...
...
@@ -32,11 +32,9 @@ module Pod
# TODO This is just to work around a MacRuby bug
def
post_initialize
@define_for_platforms
=
[
:osx
,
:ios
]
#@dependencies, @source_files, @resources, @clean_paths, @subspecs = [], [], [], [], []
@clean_paths
,
@subspecs
=
[],
[]
@dependencies
,
@source_files
,
@resources
=
{
:ios
=>
[],
:osx
=>
[]
},
{
:ios
=>
[],
:osx
=>
[]
},
{
:ios
=>
[],
:osx
=>
[]
}
@platform
=
Platform
.
new
(
nil
)
#@xcconfig = Xcodeproj::Config.new
@xcconfig
=
{
:ios
=>
Xcodeproj
::
Config
.
new
,
:osx
=>
Xcodeproj
::
Config
.
new
}
@compiler_flags
=
{
:ios
=>
''
,
:osx
=>
''
}
end
...
...
@@ -332,10 +330,19 @@ module Pod
allowed
=
[
nil
,
:ios
,
:osx
]
incorrect
<<
"platform - accepted values are (no value, :ios, :osx)"
unless
allowed
.
include?
(
platform
.
name
)
[
:source_files
,
:resources
,
:clean_paths
].
each
do
|
m
|
incorrect
<<
"
#{
m
}
- paths cannot start with a slash"
unless
self
.
send
(
m
)
&&
self
.
send
(
m
).
reject
{
|
f
|
!
f
.
start_with?
(
"/"
)}.
empty?
{
:source_files
=>
source_files
.
values
,
:resources
=>
resources
.
values
,
:clean_paths
=>
clean_paths
}.
each
do
|
name
,
paths
|
if
paths
.
flatten
.
any?
{
|
path
|
path
.
start_with?
(
"/"
)
}
incorrect
<<
"
#{
name
}
- paths cannot start with a slash"
end
end
if
source
&&
source
[
:local
]
&&
source
[
:local
].
start_with?
(
"/"
)
incorrect
<<
"source[:local] - paths cannot start with a slash"
end
incorrect
<<
"source[:local] - paths cannot start with a slash"
if
source
&&
source
[
:local
]
&&
source
[
:local
].
start_with?
(
"/"
)
no_errors_found
=
missing
.
empty?
&&
incorrect
.
empty?
...
...
spec/functional/command/list_spec.rb
View file @
adb89ec5
...
...
@@ -28,13 +28,14 @@ describe "Pod::Command::List" do
it
"presents the known pods"
do
list
=
command
()
list
.
run
[
'ZBarSDK'
,
'TouchJSON'
,
'SDURLCache'
,
'MagicalRecord'
,
'A2DynamicDelegate'
,
'75 pods were found'
].
each
{
|
s
|
list
.
output
.
should
.
include
s
}
[
/ZBarSDK/
,
/TouchJSON/
,
/SDURLCache/
,
/MagicalRecord/
,
/A2DynamicDelegate/
,
/\d+ pods were found/
].
each
{
|
regex
|
list
.
output
.
should
=~
regex
}
end
it
"returns the new pods"
do
...
...
spec/integration_spec.rb
View file @
adb89ec5
...
...
@@ -173,7 +173,7 @@ else
should_xcodebuild
(
podfile
.
target_definitions
[
:osx_target
])
end
if
Pod
::
Generator
::
Documentation
.
appledoc_installed
?
unless
`which appledoc`
.
strip
.
empty
?
it
"generates documentation of all pods by default"
do
create_config!
...
...
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