Class: Pod::Generator::Plist

Inherits:
Acknowledgements show all
Defined in:
lib/cocoapods/generator/acknowledgements/plist.rb

Instance Attribute Summary

Attributes inherited from Acknowledgements

#file_accessors

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Acknowledgements

#footnote_text, #footnote_title, generators, #header_text, #header_title, #initialize

Constructor Details

This class inherits a constructor from Pod::Generator::Acknowledgements

Class Method Details

.path_from_basepath(path) ⇒ Object



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

def self.path_from_basepath(path)
  Pathname.new(path.dirname + "#{path.basename.to_s}.plist")
end

Instance Method Details

#footnote_hashObject



55
56
57
58
59
60
61
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 55

def footnote_hash
  {
    :Type => "PSGroupSpecifier",
    :Title => footnote_title,
    :FooterText => footnote_text
  }
end

#hash_for_spec(spec) ⇒ Object



37
38
39
40
41
42
43
44
45
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 37

def hash_for_spec(spec)
  if (license = license_text(spec))
    {
      :Type => "PSGroupSpecifier",
      :Title => spec.name,
      :FooterText => license
    }
  end
end

#header_hashObject



47
48
49
50
51
52
53
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 47

def header_hash
  {
    :Type => "PSGroupSpecifier",
    :Title => header_title,
    :FooterText => header_text
  }
end

#licensesObject



27
28
29
30
31
32
33
34
35
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 27

def licenses
  licences_array = [header_hash]
  specs.each do |spec|
    if (hash = hash_for_spec(spec))
      licences_array << hash
    end
  end
  licences_array << footnote_hash
end

#plistObject



15
16
17
18
19
20
21
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 15

def plist
  {
    :Title => plist_title,
    :StringsTable => plist_title,
    :PreferenceSpecifiers => licenses
  }
end

#plist_titleObject



23
24
25
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 23

def plist_title
  "Acknowledgements"
end

#save_as(path) ⇒ Object



11
12
13
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 11

def save_as(path)
  Xcodeproj.write_plist(plist, path)
end