Class: Pod::Generator::Acknowledgements

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods/generator/acknowledgements.rb

Direct Known Subclasses

Markdown, Plist

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_accessors) ⇒ Acknowledgements

Returns a new instance of Acknowledgements.

Parameters:


19
20
21
# File 'lib/cocoapods/generator/acknowledgements.rb', line 19

def initialize(file_accessors)
  @file_accessors = file_accessors
end

Instance Attribute Details

#file_accessorsArray<Sandbox::FileAccessor> (readonly)

Returns the list of the file accessors for the specs of the target that needs to generate the acknowledgements.

Returns:

  • (Array<Sandbox::FileAccessor>)

    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

.generatorsArray<Class>

Returns The classes of the acknowledgements generator subclasses.

Returns:

  • (Array<Class>)

    The classes of the acknowledgements generator subclasses.


7
8
9
# File 'lib/cocoapods/generator/acknowledgements.rb', line 7

def self.generators
  [Plist, Markdown]
end

Instance Method Details

#footnote_textString

Returns the foot notes.

Returns:

  • (String)

    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_titleString

Returns The title of the foot notes.

Returns:

  • (String)

    The title of the foot notes.


41
42
43
# File 'lib/cocoapods/generator/acknowledgements.rb', line 41

def footnote_title
  ''
end

#header_textString

Returns A text to present before listing the acknowledgements.

Returns:

  • (String)

    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_titleString

Returns The title of the acknowledgements file.

Returns:

  • (String)

    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.

Parameters:

  • spec (Specification)

    the specification for which license is needed.

Returns:

  • (String)

    The text of the license.

  • (Nil)

    If not license text could be found.


72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# 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
  end
  text
end

#specsArray<Specification> (private)

Returns The root specifications for which the acknowledgements should be generated.

Returns:

  • (Array<Specification>)

    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