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



4
5
6
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 4

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

Instance Method Details

#footnote_hashObject



52
53
54
55
56
57
58
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 52

def footnote_hash
  {
    :Type => 'PSGroupSpecifier',
    :Title => sanitize_encoding(footnote_title),
    :FooterText => sanitize_encoding(footnote_text),
  }
end

#hash_for_spec(spec) ⇒ Object



34
35
36
37
38
39
40
41
42
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 34

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

#header_hashObject



44
45
46
47
48
49
50
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 44

def header_hash
  {
    :Type => 'PSGroupSpecifier',
    :Title => sanitize_encoding(header_title),
    :FooterText => sanitize_encoding(header_text),
  }
end

#licensesObject



24
25
26
27
28
29
30
31
32
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 24

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



12
13
14
15
16
17
18
# File 'lib/cocoapods/generator/acknowledgements/plist.rb', line 12

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

#plist_titleObject



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

def plist_title
  'Acknowledgements'
end

#save_as(path) ⇒ Object



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

def save_as(path)
  Xcodeproj::PlistHelper.write(plist, path)
end