Class: WritersRoom::Commands::Export
- Inherits:
-
Thor
- Object
- Thor
- WritersRoom::Commands::Export
- Defined in:
- lib/writers_room/cli/export.rb
Instance Method Summary collapse
Instance Method Details
#bible ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/writers_room/cli/export.rb', line 36 def bible project = Dir.pwd story_bible = WritersRoom::StoryBible.new(project) story_bible.regenerate lines = ["# Story Bible\n"] lines << "*Generated: #{Time.now}*\n" story_bible.elements_by_type.each do |type, entries| lines << "## #{type.capitalize}\n" entries.each do |entry| lines << "### #{entry['name']}" lines << "- Aliases: #{entry['aliases'].join(', ')}" if entry["aliases"]&.any? lines << "- Status: #{entry['status']}" if entry["status"] lines << "- Path: #{entry['path']}" lines << "" end end File.write([:output], lines.join("\n")) say "Exported story bible to: #{options[:output]}", :green rescue StandardError => e say "Error: #{e.message}", :red exit 1 end |
#manuscript ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/writers_room/cli/export.rb', line 15 def manuscript project = Dir.pwd = WritersRoom::ProjectMetadata.new(project) medium_id = .medium.to_sym formatter = select_formatter(project, medium_id) output = [:output] || "#{sanitize(metadata.name)}_manuscript.md" formatter.export(output) say "Exported manuscript to: #{output}", :green rescue StandardError => e say "Error: #{e.message}", :red exit 1 end |
#references ⇒ Object
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/writers_room/cli/export.rb', line 68 def references project = Dir.pwd xref = WritersRoom::CrossReference.new(project) xref.scan graph = xref.graph lines = ["# Cross References\n"] lines << "*Generated: #{Time.now}*\n" lines << "## Reference Graph\n" if graph[:edges].empty? lines << "No cross-references found." else graph[:edges].each do |edge| lines << "- **#{edge[:from]}** references **#{edge[:to]}**" end end File.write([:output], lines.join("\n")) say "Exported cross-references to: #{options[:output]}", :green rescue StandardError => e say "Error: #{e.message}", :red exit 1 end |