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
b72322f3
Commit
b72322f3
authored
Apr 25, 2012
by
Will Pragnell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fist pass at plist acknowledgements class
parent
a6a86b85
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
115 additions
and
0 deletions
+115
-0
cocoapods.rb
lib/cocoapods.rb
+1
-0
acknowledgements.rb
lib/cocoapods/generator/acknowledgements.rb
+74
-0
acknowledgements_spec.rb
spec/unit/generator/acknowledgements_spec.rb
+40
-0
No files found.
lib/cocoapods.rb
View file @
b72322f3
...
...
@@ -30,6 +30,7 @@ module Pod
autoload
:BridgeSupport
,
'cocoapods/generator/bridge_support'
autoload
:CopyResourcesScript
,
'cocoapods/generator/copy_resources_script'
autoload
:Documentation
,
'cocoapods/generator/documentation'
autoload
:Acknowledgements
,
'cocoapods/generator/acknowledgements'
end
end
...
...
lib/cocoapods/generator/acknowledgements.rb
0 → 100644
View file @
b72322f3
module
Pod
module
Generator
class
Acknowledgements
require
'xcodeproj/xcodeproj_ext'
def
initialize
(
target_definition
,
pods
)
@target_definition
,
@pods
=
target_definition
,
pods
end
def
save_as
(
pathname
)
Xcodeproj
.
write_plist
(
plist
,
pathname
)
end
def
plist
{
:Title
=>
'Acknowledgements'
,
:StringsTable
=>
'Acknowledgements'
,
:PreferenceSpecifiers
=>
licenses
}
end
def
licenses
licences_array
=
[
header
]
@pods
.
each
{
|
pod
|
licences_array
<<
hash_for_pod
(
pod
)
}
licences_array
<<
footnote
end
def
hash_for_pod
(
pod
)
if
(
license
=
pod
.
license
)
license_hash
=
{
:Type
=>
'PSGroupSpecifier'
,
:Title
=>
pod
.
name
,
:FooterText
=>
license
[
:text
]
}
else
puts
'[!] No licence for #{pod.name}'
end
end
def
header
{
:Type
=>
'PSGroupSpecifier'
,
:Title
=>
header_title
,
:FooterText
=>
header_text
}
end
def
footnote
{
:Type
=>
'PSGroupSpecifier'
,
:Title
=>
footnote_title
,
:FooterText
=>
footnote_text
}
end
def
header_title
'Acknowledgements'
end
def
header_text
'This application uses the following third party software:'
end
def
footnote_title
''
end
def
footnote_text
'Generated by CocoaPods'
end
end
end
end
spec/unit/generator/acknowledgements_spec.rb
0 → 100644
View file @
b72322f3
require
File
.
expand_path
(
'../../../spec_helper'
,
__FILE__
)
describe
Pod
::
Generator
::
Acknowledgements
do
before
do
@podfile
=
Pod
::
Podfile
.
new
do
platform
:ios
xcodeproj
'dummy'
end
@target_definition
=
@podfile
.
target_definitions
[
:default
]
@sandbox
=
temporary_sandbox
@pods
=
[
Pod
::
LocalPod
.
new
(
fixture_spec
(
'banana-lib/BananaLib.podspec'
),
@sandbox
,
Pod
::
Platform
.
ios
)]
copy_fixture_to_pod
(
'banana-lib'
,
@pods
[
0
])
@acknowledgements
=
Pod
::
Generator
::
Acknowledgements
.
new
(
@target_definition
,
@pods
)
end
it
'returns the corrent number of licenses (including headera and footnote)'
do
@acknowledgements
.
licenses
.
count
.
should
==
3
end
it
'returns a correctly formed license hash for each pod'
do
@acknowledgements
.
hash_for_pod
(
@pods
[
0
]).
should
==
{
:Type
=>
'PSGroupSpecifier'
,
:Title
=>
'BananaLib'
,
:FooterText
=>
'Permission is hereby granted ...'
}
end
it
'returns a plist containg the licenses'
do
@acknowledgements
.
plist
.
should
==
{
:Title
=>
'Acknowledgements'
,
:StringsTable
=>
'Acknowledgements'
,
:PreferenceSpecifiers
=>
@acknowledgements
.
licenses
}
end
it
'writes a plist to disk'
do
@acknowledgements
.
save_as
(
@sandbox
.
root
+
'test.plist'
).
should
.
be
.
true
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