Class: Pod::Generator::Acknowledgements
- Inherits:
-
Object
- Object
- Pod::Generator::Acknowledgements
- Defined in:
- lib/cocoapods/generator/acknowledgements.rb
Instance Attribute Summary collapse
-
#file_accessors ⇒ Array<Sandbox::FileAccessor>
readonly
The list of the file accessors for the specs of the target that needs to generate the acknowledgements.
Class Method Summary collapse
-
.generators ⇒ Array<Class>
The classes of the acknowledgements generator subclasses.
Instance Method Summary collapse
-
#footnote_text ⇒ String
The foot notes.
-
#footnote_title ⇒ String
The title of the foot notes.
-
#format_license(text) ⇒ String
private
Convenience method for users to format licenses.
-
#header_text ⇒ String
A text to present before listing the acknowledgements.
-
#header_title ⇒ String
The title of the acknowledgements file.
-
#initialize(file_accessors) ⇒ Acknowledgements
constructor
A new instance of Acknowledgements.
-
#license_text(spec) ⇒ String, Nil
private
Returns the text of the license for the given spec.
-
#specs ⇒ Array<Specification>
private
The root specifications for which the acknowledgements should be generated.
Constructor Details
#initialize(file_accessors) ⇒ Acknowledgements
Returns a new instance of Acknowledgements.
19 20 21 |
# File 'lib/cocoapods/generator/acknowledgements.rb', line 19 def initialize(file_accessors) @file_accessors = file_accessors end |
Instance Attribute Details
#file_accessors ⇒ Array<Sandbox::FileAccessor> (readonly)
Returns the list of the file accessors for the specs of the target that needs to generate the acknowledgements.
15 16 17 |
# File 'lib/cocoapods/generator/acknowledgements.rb', line 15 def file_accessors @file_accessors end |
Class Method Details
Instance Method Details
#footnote_text ⇒ String
Returns the foot notes.
47 48 49 |
# File 'lib/cocoapods/generator/acknowledgements.rb', line 47 def footnote_text 'Generated by CocoaPods - https://cocoapods.org' end |
#footnote_title ⇒ String
Returns The title of the foot notes.
41 42 43 |
# File 'lib/cocoapods/generator/acknowledgements.rb', line 41 def footnote_title '' end |
#format_license(text) ⇒ String (private)
Convenience method for users to format licenses
99 100 101 |
# File 'lib/cocoapods/generator/acknowledgements.rb', line 99 def format_license(text) text end |
#header_text ⇒ String
Returns A text to present before listing the acknowledgements.
35 36 37 |
# File 'lib/cocoapods/generator/acknowledgements.rb', line 35 def header_text 'This application makes use of the following third party libraries:' end |
#header_title ⇒ String
Returns The title of the acknowledgements file.
29 30 31 |
# File 'lib/cocoapods/generator/acknowledgements.rb', line 29 def header_title 'Acknowledgements' end |
#license_text(spec) ⇒ String, Nil (private)
Returns the text of the license for the given spec.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/cocoapods/generator/acknowledgements.rb', line 72 def license_text(spec) return nil unless spec.license text = spec.license[:text] unless text if license_file = spec.license[:file] license_path = file_accessor(spec).root + license_file if File.exist?(license_path) text = IO.read(license_path) else UI.warn "Unable to read the license file `#{license_file}` " \ "for the spec `#{spec}`" end elsif license_file = file_accessor(spec).license text = IO.read(license_file) end text = format_license(text) end text end |
#specs ⇒ Array<Specification> (private)
Returns The root specifications for which the acknowledgements should be generated.
60 61 62 |
# File 'lib/cocoapods/generator/acknowledgements.rb', line 60 def specs file_accessors.map { |accessor| accessor.spec.root }.uniq end |