class Pod::Generator::Markdown

Public Class Methods

path_from_basepath(path) click to toggle source
# File lib/cocoapods/generator/acknowledgements/markdown.rb, line 4
def self.path_from_basepath(path)
  Pathname.new(path.dirname + "#{path.basename}.markdown")
end

Public Instance Methods

generate() click to toggle source

@return [String] The contents of the acknowledgements in Markdown format.

# File lib/cocoapods/generator/acknowledgements/markdown.rb, line 16
def generate
  licenses
end
licenses() click to toggle source
# File lib/cocoapods/generator/acknowledgements/markdown.rb, line 32
def licenses
  licenses_string = "#{title_from_string(header_title, 1)}\n#{header_text}\n"
  specs.each do |spec|
    if (license = string_for_spec(spec))
      license = license.force_encoding('UTF-8') if license.respond_to?(:force_encoding)
      licenses_string += license
    end
  end
  licenses_string += "#{title_from_string(footnote_title, 2)}#{footnote_text}\n"
end
save_as(path) click to toggle source
# File lib/cocoapods/generator/acknowledgements/markdown.rb, line 8
def save_as(path)
  file = File.new(path, 'w')
  file.write(licenses)
  file.close
end
string_for_spec(spec) click to toggle source
# File lib/cocoapods/generator/acknowledgements/markdown.rb, line 26
def string_for_spec(spec)
  if (license_text = license_text(spec))
    "\n" << title_from_string(spec.name, 2) << "\n\n" << license_text << "\n"
  end
end
title_from_string(string, level) click to toggle source
# File lib/cocoapods/generator/acknowledgements/markdown.rb, line 20
def title_from_string(string, level)
  unless string.empty?
    '#' * level << " #{string}"
  end
end