Class: Playgroundbook::ContentsManifestGenerator
- Inherits:
-
Object
- Object
- Playgroundbook::ContentsManifestGenerator
- Defined in:
- lib/playgroundbook_renderer/contents_manifest_generator.rb
Instance Method Summary collapse
- #generate!(book_metadata) ⇒ Object
-
#initialize(ui = Cork::Board.new) ⇒ ContentsManifestGenerator
constructor
A new instance of ContentsManifestGenerator.
- #manifest_contents(book_metadata) ⇒ Object
- #write_manifest_file!(book_metadata) ⇒ Object
Constructor Details
#initialize(ui = Cork::Board.new) ⇒ ContentsManifestGenerator
Returns a new instance of ContentsManifestGenerator.
5 6 7 |
# File 'lib/playgroundbook_renderer/contents_manifest_generator.rb', line 5 def initialize(ui = Cork::Board.new) @ui = ui end |
Instance Method Details
#generate!(book_metadata) ⇒ Object
9 10 11 12 13 |
# File 'lib/playgroundbook_renderer/contents_manifest_generator.rb', line 9 def generate!() @ui.puts "Generating main manifest file." write_manifest_file!() @ui.puts "Manifest file generated." end |
#manifest_contents(book_metadata) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/playgroundbook_renderer/contents_manifest_generator.rb', line 21 def manifest_contents() chapters = ['chapters'].map{ |c| "#{c}.playgroundchapter" } manifest_contents = { 'Name' => ['name'], 'ContentIdentifier' => ['identifier'], 'DeploymentTarget' => ['deployment_target'] || 'ios10.0', 'Chapters' => chapters, 'Version' => '1.0', 'ContentVersion' => '1.0', } manifest_contents['ImageReference'] = ['cover'] unless ['cover'].nil? manifest_contents end |
#write_manifest_file!(book_metadata) ⇒ Object
15 16 17 18 19 |
# File 'lib/playgroundbook_renderer/contents_manifest_generator.rb', line 15 def write_manifest_file!() File.open(ManifestFileName, 'w') do |file| file.write(manifest_contents().to_plist) end end |