Commit bcfb3240 authored by Will Pragnell's avatar Will Pragnell

WIP: Added Markdown Acknowledgements subclass

parent cdad6fe4
......@@ -32,6 +32,7 @@ module Pod
autoload :Documentation, 'cocoapods/generator/documentation'
autoload :Acknowledgements, 'cocoapods/generator/acknowledgements'
autoload :Plist, 'cocoapods/generator/acknowledgements/plist'
autoload :Markdown, 'cocoapods/generator/acknowledgements/markdown'
end
end
......
module Pod
module Generator
class Markdown < Acknowledgements
def title_from_string(string)
if string != ""
"#{string}\n" + '-' * string.length + "\n"
end
end
def string_for_pod(pod)
if (license_text = pod.license_text)
title_from_string(pod.name) + license_text + "\n"
end
end
def licenses
licenses_string = "#{title_from_string(header_title)}#{header_text}\n"
@pods.each do |pod|
licenses_string += string_for_pod(pod)
end
licenses_string += "#{title_from_string(footnote_title)}#{footnote_text}\n"
end
end
end
end
require File.expand_path("../../../../spec_helper", __FILE__)
describe Pod::Generator::Markdown do
before do
@podfile = Pod::Podfile.new do
platform :ios
xcodeproj "dummy"
end
@target_definition = @podfile.target_definitions[:default]
@sandbox = temporary_sandbox
@pods = [Pod::LocalPod.new(fixture_spec("banana-lib/BananaLib.podspec"), @sandbox, Pod::Platform.ios)]
copy_fixture_to_pod("banana-lib", @pods[0])
@markdown = Pod::Generator::Markdown.new(@target_definition, @pods)
end
it "returns a correctly formatted title string" do
@markdown.title_from_string("A Title").should.equal "A Title\n-------\n"
end
it "returns a correctly formatted license string for each pod" do
@markdown.string_for_pod(@pods[0]).should.equal "BananaLib\n---------\nPermission is hereby granted ...\n"
end
it "returns a correctly formatted markdown string for the target" do
@markdown.licenses.should.equal "Acknowledgements\n----------------\nThis application makes use of the following third party libraries:\nBananaLib\n---------\nPermission is hereby granted ...\nGenerated by CocoaPods - http://cocoapods.org\n"
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment