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
c4702eb0
Commit
c4702eb0
authored
Mar 18, 2012
by
Eloy Duran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move the doc generator into lib/cocoapods/generators/documentation.rb
parent
ad1e8fab
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
120 deletions
+119
-120
cocoapods.rb
lib/cocoapods.rb
+1
-3
docs_generator.rb
lib/cocoapods/docs_generator.rb
+0
-109
documentation.rb
lib/cocoapods/generator/documentation.rb
+112
-0
installer.rb
lib/cocoapods/installer.rb
+1
-2
integration_spec.rb
spec/integration_spec.rb
+1
-1
documentation_spec.rb
spec/unit/generator/documentation_spec.rb
+4
-5
No files found.
lib/cocoapods.rb
View file @
c4702eb0
...
@@ -6,11 +6,9 @@ module Pod
...
@@ -6,11 +6,9 @@ module Pod
class
Informative
<
StandardError
class
Informative
<
StandardError
end
end
autoload
:BridgeSupportGenerator
,
'cocoapods/bridge_support_generator'
autoload
:Command
,
'cocoapods/command'
autoload
:Command
,
'cocoapods/command'
autoload
:Config
,
'cocoapods/config'
autoload
:Config
,
'cocoapods/config'
autoload
:Dependency
,
'cocoapods/dependency'
autoload
:Dependency
,
'cocoapods/dependency'
autoload
:DocsGenerator
,
'cocoapods/docs_generator'
autoload
:Downloader
,
'cocoapods/downloader'
autoload
:Downloader
,
'cocoapods/downloader'
autoload
:Executable
,
'cocoapods/executable'
autoload
:Executable
,
'cocoapods/executable'
autoload
:Installer
,
'cocoapods/installer'
autoload
:Installer
,
'cocoapods/installer'
...
@@ -28,11 +26,11 @@ module Pod
...
@@ -28,11 +26,11 @@ module Pod
autoload
:Pathname
,
'pathname'
autoload
:Pathname
,
'pathname'
autoload
:FileList
,
'cocoapods/file_list'
autoload
:FileList
,
'cocoapods/file_list'
autoload
:Open3
,
'open3'
module
Generator
module
Generator
autoload
:BridgeSupport
,
'cocoapods/generator/bridge_support'
autoload
:BridgeSupport
,
'cocoapods/generator/bridge_support'
autoload
:CopyResourcesScript
,
'cocoapods/generator/copy_resources_script'
autoload
:CopyResourcesScript
,
'cocoapods/generator/copy_resources_script'
autoload
:Documentation
,
'cocoapods/generator/documentation'
end
end
end
end
...
...
lib/cocoapods/docs_generator.rb
deleted
100644 → 0
View file @
ad1e8fab
module
Pod
class
DocsGenerator
def
self
.
appledoc_installed?
!
`which appledoc`
.
strip
.
empty?
end
include
Config
::
Mixin
attr_reader
:pod
,
:specification
,
:target_path
,
:options
def
initialize
(
pod
)
@pod
=
pod
@specification
=
pod
.
specification
@target_path
=
pod
.
sandbox
.
root
+
"Documentation"
+
pod
.
name
@options
=
pod
.
specification
.
documentation
||
{}
end
def
name
@specification
.
to_s
end
def
company
if
@specification
.
authors
@specification
.
authors
.
keys
.
join
(
', '
)
else
'no-company'
end
end
def
copyright
company
end
def
description
@specification
.
description
||
"Generated by CocoaPods."
end
def
docs_id
'org.cocoapods'
end
def
files
@pod
.
absolute_source_files
end
def
index_file
@pod
.
chdir
do
Dir
.
glob
(
"README*"
,
File
::
FNM_CASEFOLD
).
first
end
end
def
spec_appledoc_options
@options
[
:appledoc
]
||
[]
end
def
generate_appledoc_options
options
=
[
'--project-name'
,
name
,
'--docset-desc'
,
description
,
'--project-company'
,
company
,
'--docset-copyright'
,
copyright
,
'--company-id'
,
docs_id
,
'--ignore'
,
'.m'
,
'--keep-undocumented-objects'
,
'--keep-undocumented-members'
]
index
=
index_file
options
+=
[
'--index-desc'
,
index
]
if
index
options
+=
spec_appledoc_options
end
def
generate
(
install
=
false
)
unless
self
.
class
.
appledoc_installed?
puts
"[!] Skipping documentation generation because appledoc can't be found."
if
config
.
verbose?
return
end
options
=
generate_appledoc_options
options
+=
[
'--output'
,
@target_path
.
to_s
]
options
+=
[
'--keep-intermediate-files'
]
options
+=
install
?
[
'-create-docset'
]
:
[
'--no-create-docset'
]
@target_path
.
mkpath
@pod
.
chdir
do
appledoc
(
options
)
end
end
def
appledoc
(
options
)
arguments
=
[]
arguments
+=
options
arguments
+=
[
'--print-settings'
]
if
config
.
verbose?
arguments
+=
files
.
map
(
&
:to_s
)
Open3
.
popen3
(
'appledoc'
,
*
arguments
)
do
|
i
,
o
,
e
|
if
config
.
verbose?
puts
o
.
read
.
chomp
puts
e
.
read
.
chomp
else
# TODO: This is needed otherwise appledoc may not install the doc set
# This is a work around related to poor understanding of the IO class.
#
# I think we can use the non-block version here, which should read
# everything till the end and then return.
o
.
read
e
.
read
end
end
end
end
end
lib/cocoapods/generator/documentation.rb
0 → 100644
View file @
c4702eb0
require
'open3'
module
Pod
module
Generator
class
Documentation
def
self
.
appledoc_installed?
!
`which appledoc`
.
strip
.
empty?
end
include
Config
::
Mixin
attr_reader
:pod
,
:specification
,
:target_path
,
:options
def
initialize
(
pod
)
@pod
=
pod
@specification
=
pod
.
specification
@target_path
=
pod
.
sandbox
.
root
+
"Documentation"
+
pod
.
name
@options
=
pod
.
specification
.
documentation
||
{}
end
def
name
@specification
.
to_s
end
def
company
if
@specification
.
authors
@specification
.
authors
.
keys
.
join
(
', '
)
else
'no-company'
end
end
def
copyright
company
end
def
description
@specification
.
description
||
"Generated by CocoaPods."
end
def
docs_id
'org.cocoapods'
end
def
files
@pod
.
absolute_source_files
end
def
index_file
@pod
.
chdir
do
Dir
.
glob
(
"README*"
,
File
::
FNM_CASEFOLD
).
first
end
end
def
spec_appledoc_options
@options
[
:appledoc
]
||
[]
end
def
generate_appledoc_options
options
=
[
'--project-name'
,
name
,
'--docset-desc'
,
description
,
'--project-company'
,
company
,
'--docset-copyright'
,
copyright
,
'--company-id'
,
docs_id
,
'--ignore'
,
'.m'
,
'--keep-undocumented-objects'
,
'--keep-undocumented-members'
]
index
=
index_file
options
+=
[
'--index-desc'
,
index
]
if
index
options
+=
spec_appledoc_options
end
def
generate
(
install
=
false
)
unless
self
.
class
.
appledoc_installed?
puts
"[!] Skipping documentation generation because appledoc can't be found."
if
config
.
verbose?
return
end
options
=
generate_appledoc_options
options
+=
[
'--output'
,
@target_path
.
to_s
]
options
+=
[
'--keep-intermediate-files'
]
options
+=
install
?
[
'-create-docset'
]
:
[
'--no-create-docset'
]
@target_path
.
mkpath
@pod
.
chdir
do
appledoc
(
options
)
end
end
def
appledoc
(
options
)
arguments
=
[]
arguments
+=
options
arguments
+=
[
'--print-settings'
]
if
config
.
verbose?
arguments
+=
files
.
map
(
&
:to_s
)
Open3
.
popen3
(
'appledoc'
,
*
arguments
)
do
|
i
,
o
,
e
|
if
config
.
verbose?
puts
o
.
read
.
chomp
puts
e
.
read
.
chomp
else
# TODO: This is needed otherwise appledoc may not install the doc set
# This is a work around related to poor understanding of the IO class.
#
# I think we can use the non-block version here, which should read
# everything till the end and then return.
o
.
read
e
.
read
end
end
end
end
end
end
lib/cocoapods/installer.rb
View file @
c4702eb0
...
@@ -59,8 +59,7 @@ module Pod
...
@@ -59,8 +59,7 @@ module Pod
if
config
.
doc?
if
config
.
doc?
puts
"Installing Documentation for
#{
spec
}
"
if
config
.
verbose?
puts
"Installing Documentation for
#{
spec
}
"
if
config
.
verbose?
docs_generator
=
DocsGenerator
.
new
(
pod
)
Generator
::
Documentation
.
new
(
pod
).
generate
(
config
.
doc_install?
)
docs_generator
.
generate
(
config
.
doc_install?
)
end
end
end
end
end
end
...
...
spec/integration_spec.rb
View file @
c4702eb0
...
@@ -134,7 +134,7 @@ else
...
@@ -134,7 +134,7 @@ else
change_log
.
should
.
not
.
include
'1.3'
change_log
.
should
.
not
.
include
'1.3'
end
end
if
Pod
::
DocsGenerator
.
appledoc_installed?
if
Pod
::
Generator
::
Documentation
.
appledoc_installed?
it
"generates documentation of all pods by default"
do
it
"generates documentation of all pods by default"
do
create_config!
create_config!
...
...
spec/unit/
docs_generator
_spec.rb
→
spec/unit/
generator/documentation
_spec.rb
View file @
c4702eb0
require
File
.
expand_path
(
'../../spec_helper'
,
__FILE__
)
require
File
.
expand_path
(
'../../
../
spec_helper'
,
__FILE__
)
describe
Pod
::
Generator
::
Documentation
do
describe
Pod
::
DocsGenerator
do
before
do
before
do
@sandbox
=
temporary_sandbox
@sandbox
=
temporary_sandbox
@pod
=
Pod
::
LocalPod
.
new
(
fixture_spec
(
'banana-lib/BananaLib.podspec'
),
@sandbox
)
@pod
=
Pod
::
LocalPod
.
new
(
fixture_spec
(
'banana-lib/BananaLib.podspec'
),
@sandbox
)
copy_fixture_to_pod
(
'banana-lib'
,
@pod
)
copy_fixture_to_pod
(
'banana-lib'
,
@pod
)
@doc_installer
=
Pod
::
DocsGenerator
.
new
(
@pod
)
@doc_installer
=
Pod
::
Generator
::
Documentation
.
new
(
@pod
)
end
end
it
'returns reads correctly the Pod documentation'
do
it
'returns reads correctly the Pod documentation'
do
...
@@ -44,7 +43,7 @@ describe Pod::DocsGenerator do
...
@@ -44,7 +43,7 @@ describe Pod::DocsGenerator do
]
]
end
end
if
Pod
::
DocsGenerator
.
appledoc_installed?
if
Pod
::
Generator
::
Documentation
.
appledoc_installed?
before
do
before
do
@doc_installer
.
generate
@doc_installer
.
generate
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