Commit 1ed10b71 authored by Will Pragnell's avatar Will Pragnell

Simplify Acknowledgement file saving

parent 20419920
...@@ -8,17 +8,8 @@ module Pod ...@@ -8,17 +8,8 @@ module Pod
@target_definition, @pods = target_definition, pods @target_definition, @pods = target_definition, pods
end end
def save_in_directory(pathname) def save_as(path)
Xcodeproj.write_plist(plist, pathname + filename) Xcodeproj.write_plist(plist, path)
end
def filename
result = "#{@target_definition.label}-Acknowledgements.plist"
if result.start_with?"Pods-"
result
else
"Pods-" + result
end
end end
def plist def plist
...@@ -41,7 +32,7 @@ module Pod ...@@ -41,7 +32,7 @@ module Pod
def hash_for_pod(pod) def hash_for_pod(pod)
if (license = pod.license) if (license = pod.license)
license_hash = { {
:Type => "PSGroupSpecifier", :Type => "PSGroupSpecifier",
:Title => pod.name, :Title => pod.name,
:FooterText => license[:text] :FooterText => license[:text]
......
...@@ -80,7 +80,10 @@ module Pod ...@@ -80,7 +80,10 @@ module Pod
target_installers.each do |target_installer| target_installers.each do |target_installer|
pods_for_target = activated_pods_by_target[target_installer.target_definition] pods_for_target = activated_pods_by_target[target_installer.target_definition]
target_installer.install!(pods_for_target, @sandbox) target_installer.install!(pods_for_target, @sandbox)
Generator::Acknowledgements.new(target_installer.target_definition, pods_for_target).save_in_directory(config.project_pods_root) acknowledgements_path = config.project_pods_root +
"#{target_installer.target_definition.label}-Acknowledgements.plist"
Generator::Acknowledgements.new(target_installer.target_definition,
pods_for_target).save_as(acknowledgements_path)
end end
generate_lock_file!(pods) generate_lock_file!(pods)
......
...@@ -35,13 +35,8 @@ describe Pod::Generator::Acknowledgements do ...@@ -35,13 +35,8 @@ describe Pod::Generator::Acknowledgements do
} }
end end
# TODO Test with a target_definition whose label isn't "Pods"
it "adds \"Pods-\" to the beginning of the filename only if necessary" do
(@acknowledgements.filename.start_with?"Pods-").should.be.true
(@acknowledgements.filename.start_with?"Pods-Pods-").should.be.false
end
it "writes a plist to disk" do it "writes a plist to disk" do
@acknowledgements.save_in_directory(@sandbox.root).should.be.true path = @sandbox.root + "#{@target_definition.label}-Acknowledgements.plist"
@acknowledgements.save_as(path).should.be.true
end end
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