From dec346254cc3b4305c13e0a6b8f789dcd7b2e56f Mon Sep 17 00:00:00 2001 From: mathias234 Date: Tue, 2 Dec 2025 13:21:13 +0100 Subject: [PATCH] Project rename --- CLAUDE.md | 18 ++++++------ README.md | 32 +++++++++++----------- examples/full_demo.rb | 10 +++---- lib/ezdoc.rb | 28 ------------------- lib/notare.rb | 28 +++++++++++++++++++ lib/{ezdoc => notare}/builder.rb | 2 +- lib/{ezdoc => notare}/document.rb | 2 +- lib/{ezdoc => notare}/image_dimensions.rb | 2 +- lib/{ezdoc => notare}/nodes/base.rb | 2 +- lib/{ezdoc => notare}/nodes/image.rb | 2 +- lib/{ezdoc => notare}/nodes/list.rb | 2 +- lib/{ezdoc => notare}/nodes/list_item.rb | 2 +- lib/{ezdoc => notare}/nodes/paragraph.rb | 2 +- lib/{ezdoc => notare}/nodes/run.rb | 2 +- lib/{ezdoc => notare}/nodes/table.rb | 2 +- lib/{ezdoc => notare}/nodes/table_cell.rb | 2 +- lib/{ezdoc => notare}/nodes/table_row.rb | 2 +- lib/{ezdoc => notare}/package.rb | 2 +- lib/{ezdoc => notare}/style.rb | 2 +- lib/{ezdoc => notare}/version.rb | 2 +- lib/{ezdoc => notare}/xml/content_types.rb | 2 +- lib/{ezdoc => notare}/xml/document_xml.rb | 2 +- lib/{ezdoc => notare}/xml/numbering.rb | 2 +- lib/{ezdoc => notare}/xml/relationships.rb | 2 +- lib/{ezdoc => notare}/xml/styles_xml.rb | 2 +- ezdoc.gemspec => notare.gemspec | 12 ++++---- test/document_test.rb | 18 ++++++------ test/formatting_test.rb | 2 +- test/heading_test.rb | 2 +- test/image_test.rb | 12 ++++---- test/integration_test.rb | 2 +- test/list_test.rb | 2 +- test/paragraph_test.rb | 2 +- test/style_test.rb | 10 +++---- test/table_test.rb | 2 +- test/test_helper.rb | 8 +++--- 36 files changed, 114 insertions(+), 114 deletions(-) delete mode 100644 lib/ezdoc.rb create mode 100644 lib/notare.rb rename lib/{ezdoc => notare}/builder.rb (99%) rename lib/{ezdoc => notare}/document.rb (99%) rename lib/{ezdoc => notare}/image_dimensions.rb (99%) rename lib/{ezdoc => notare}/nodes/base.rb (89%) rename lib/{ezdoc => notare}/nodes/image.rb (98%) rename lib/{ezdoc => notare}/nodes/list.rb (95%) rename lib/{ezdoc => notare}/nodes/list_item.rb (96%) rename lib/{ezdoc => notare}/nodes/paragraph.rb (95%) rename lib/{ezdoc => notare}/nodes/run.rb (96%) rename lib/{ezdoc => notare}/nodes/table.rb (94%) rename lib/{ezdoc => notare}/nodes/table_cell.rb (94%) rename lib/{ezdoc => notare}/nodes/table_row.rb (94%) rename lib/{ezdoc => notare}/package.rb (99%) rename lib/{ezdoc => notare}/style.rb (99%) rename lib/{ezdoc => notare}/version.rb (79%) rename lib/{ezdoc => notare}/xml/content_types.rb (99%) rename lib/{ezdoc => notare}/xml/document_xml.rb (99%) rename lib/{ezdoc => notare}/xml/numbering.rb (99%) rename lib/{ezdoc => notare}/xml/relationships.rb (99%) rename lib/{ezdoc => notare}/xml/styles_xml.rb (99%) rename ezdoc.gemspec => notare.gemspec (68%) diff --git a/CLAUDE.md b/CLAUDE.md index 23c7be4..e92e58a 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -19,28 +19,28 @@ bundle exec ruby -Ilib:test test/paragraph_test.rb -n test_paragraph_with_text ## Architecture -Ezdoc is a Ruby gem for creating .docx files using a DSL. The gem generates valid Office Open XML (OOXML) documents. +Notare is a Ruby gem for creating .docx files using a DSL. The gem generates valid Office Open XML (OOXML) documents. ### Core Components -- **Document** (`lib/ezdoc/document.rb`): Entry point via `Document.create`. Includes the Builder module and maintains a collection of nodes. +- **Document** (`lib/notare/document.rb`): Entry point via `Document.create`. Includes the Builder module and maintains a collection of nodes. -- **Builder** (`lib/ezdoc/builder.rb`): DSL methods (`p`, `text`, `h1`-`h6`, `b`, `i`, `u`, `ul`, `ol`, `li`, `table`, `tr`, `td`, `image`). Uses a format stack for nested formatting and target tracking for content placement. +- **Builder** (`lib/notare/builder.rb`): DSL methods (`p`, `text`, `h1`-`h6`, `b`, `i`, `u`, `ul`, `ol`, `li`, `table`, `tr`, `td`, `image`). Uses a format stack for nested formatting and target tracking for content placement. -- **Nodes** (`lib/ezdoc/nodes/`): Document element representations (Paragraph, Run, Image, List, ListItem, Table, TableRow, TableCell). All inherit from `Nodes::Base`. +- **Nodes** (`lib/notare/nodes/`): Document element representations (Paragraph, Run, Image, List, ListItem, Table, TableRow, TableCell). All inherit from `Nodes::Base`. -- **Style** (`lib/ezdoc/style.rb`): Style definitions with text properties (bold, italic, color, size, font) and paragraph properties (align, indent, spacing). +- **Style** (`lib/notare/style.rb`): Style definitions with text properties (bold, italic, color, size, font) and paragraph properties (align, indent, spacing). -- **Package** (`lib/ezdoc/package.rb`): Assembles the docx ZIP structure using rubyzip. Coordinates XML generation. +- **Package** (`lib/notare/package.rb`): Assembles the docx ZIP structure using rubyzip. Coordinates XML generation. -- **XML generators** (`lib/ezdoc/xml/`): Generate OOXML-compliant XML: +- **XML generators** (`lib/notare/xml/`): Generate OOXML-compliant XML: - `DocumentXml`: Main content with paragraphs, lists, tables, images - `StylesXml`: styles.xml with built-in and custom styles - `ContentTypes`: [Content_Types].xml - `Relationships`: .rels files - `Numbering`: numbering.xml for lists -- **ImageDimensions** (`lib/ezdoc/image_dimensions.rb`): Uses fastimage gem to read image dimensions for EMU calculations. +- **ImageDimensions** (`lib/notare/image_dimensions.rb`): Uses fastimage gem to read image dimensions for EMU calculations. ### Data Flow @@ -51,4 +51,4 @@ Ezdoc is a Ruby gem for creating .docx files using a DSL. The gem generates vali ### Testing -Tests use Minitest. `EzdocTestHelpers` module provides helpers that create temp documents and extract XML for assertions. +Tests use Minitest. `NotareTestHelpers` module provides helpers that create temp documents and extract XML for assertions. diff --git a/README.md b/README.md index 91142c2..99eaff5 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Ezdoc +# Notare A Ruby gem for creating docx files with a simple DSL @@ -7,7 +7,7 @@ A Ruby gem for creating docx files with a simple DSL Add this line to your application's Gemfile: ```ruby -gem 'ezdoc' +gem 'notare' ``` And then execute: @@ -16,16 +16,16 @@ And then execute: Or install it yourself as: - $ gem install ezdoc + $ gem install notare ## Usage ### Basic Example ```ruby -require 'ezdoc' +require 'notare' -Ezdoc::Document.create("output.docx") do |doc| +Notare::Document.create("output.docx") do |doc| doc.p "Hello World" end ``` @@ -33,7 +33,7 @@ end ### Paragraphs ```ruby -Ezdoc::Document.create("output.docx") do |doc| +Notare::Document.create("output.docx") do |doc| # Simple paragraph doc.p "This is a paragraph." @@ -50,7 +50,7 @@ end Formatting uses nested blocks. Nesting combines formatting styles. ```ruby -Ezdoc::Document.create("output.docx") do |doc| +Notare::Document.create("output.docx") do |doc| doc.p do doc.text "Normal text " doc.b { doc.text "bold" } @@ -74,7 +74,7 @@ end Use `h1` through `h6` for document headings: ```ruby -Ezdoc::Document.create("output.docx") do |doc| +Notare::Document.create("output.docx") do |doc| doc.h1 "Document Title" doc.h2 "Chapter 1" doc.h3 "Section 1.1" @@ -92,12 +92,12 @@ end ### Styles -Ezdoc includes built-in styles and supports custom style definitions. +Notare includes built-in styles and supports custom style definitions. #### Built-in Styles ```ruby -Ezdoc::Document.create("output.docx") do |doc| +Notare::Document.create("output.docx") do |doc| doc.p "This is a title", style: :title doc.p "A subtitle", style: :subtitle doc.p "A quotation", style: :quote @@ -110,7 +110,7 @@ end Define your own styles with text and paragraph properties: ```ruby -Ezdoc::Document.create("output.docx") do |doc| +Notare::Document.create("output.docx") do |doc| # Define custom styles doc.define_style :warning, bold: true, @@ -161,7 +161,7 @@ end #### Bullet Lists ```ruby -Ezdoc::Document.create("output.docx") do |doc| +Notare::Document.create("output.docx") do |doc| doc.ul do doc.li "First item" doc.li "Second item" @@ -173,7 +173,7 @@ end #### Numbered Lists ```ruby -Ezdoc::Document.create("output.docx") do |doc| +Notare::Document.create("output.docx") do |doc| doc.ol do doc.li "First" doc.li "Second" @@ -185,7 +185,7 @@ end ### Tables ```ruby -Ezdoc::Document.create("output.docx") do |doc| +Notare::Document.create("output.docx") do |doc| doc.table do doc.tr do doc.td "Header 1" @@ -204,7 +204,7 @@ end Images can be added to paragraphs, table cells, and list items. Supports PNG and JPEG formats. ```ruby -Ezdoc::Document.create("output.docx") do |doc| +Notare::Document.create("output.docx") do |doc| # Simple image (uses native dimensions) doc.p do doc.image "photo.png" @@ -249,7 +249,7 @@ end ### Complete Example ```ruby -Ezdoc::Document.create("report.docx") do |doc| +Notare::Document.create("report.docx") do |doc| doc.p "Monthly Report" doc.p do diff --git a/examples/full_demo.rb b/examples/full_demo.rb index dc89e8d..360b4eb 100755 --- a/examples/full_demo.rb +++ b/examples/full_demo.rb @@ -1,15 +1,15 @@ #!/usr/bin/env ruby # frozen_string_literal: true -# Full demo of all Ezdoc features +# Full demo of all Notare features # Run with: bundle exec ruby examples/full_demo.rb -require_relative "../lib/ezdoc" +require_relative "../lib/notare" OUTPUT_FILE = File.expand_path("../example.docx", __dir__) FIXTURES_DIR = File.expand_path("../test/fixtures", __dir__) -Ezdoc::Document.create(OUTPUT_FILE) do |doc| +Notare::Document.create(OUTPUT_FILE) do |doc| # ============================================================================ # Custom Styles # ============================================================================ @@ -20,7 +20,7 @@ Ezdoc::Document.create(OUTPUT_FILE) do |doc| # ============================================================================ # Title and Introduction # ============================================================================ - doc.h1 "Ezdoc Feature Demo" + doc.h1 "Notare Feature Demo" doc.p "A comprehensive example of all supported features", style: :subtitle # ============================================================================ @@ -173,7 +173,7 @@ Ezdoc::Document.create(OUTPUT_FILE) do |doc| doc.i { doc.text "formatting" } doc.text " options with " doc.text "custom styles", style: :highlight - doc.text " to demonstrate the full power of Ezdoc." + doc.text " to demonstrate the full power of Notare." end doc.p "End of demo document.", style: :centered_large diff --git a/lib/ezdoc.rb b/lib/ezdoc.rb deleted file mode 100644 index 5a3874d..0000000 --- a/lib/ezdoc.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -require "nokogiri" - -require_relative "ezdoc/version" -require_relative "ezdoc/nodes/base" -require_relative "ezdoc/nodes/run" -require_relative "ezdoc/nodes/image" -require_relative "ezdoc/nodes/paragraph" -require_relative "ezdoc/nodes/list" -require_relative "ezdoc/nodes/list_item" -require_relative "ezdoc/nodes/table" -require_relative "ezdoc/nodes/table_row" -require_relative "ezdoc/nodes/table_cell" -require_relative "ezdoc/image_dimensions" -require_relative "ezdoc/style" -require_relative "ezdoc/xml/content_types" -require_relative "ezdoc/xml/relationships" -require_relative "ezdoc/xml/document_xml" -require_relative "ezdoc/xml/numbering" -require_relative "ezdoc/xml/styles_xml" -require_relative "ezdoc/builder" -require_relative "ezdoc/package" -require_relative "ezdoc/document" - -module Ezdoc - class Error < StandardError; end -end diff --git a/lib/notare.rb b/lib/notare.rb new file mode 100644 index 0000000..61335f8 --- /dev/null +++ b/lib/notare.rb @@ -0,0 +1,28 @@ +# frozen_string_literal: true + +require "nokogiri" + +require_relative "notare/version" +require_relative "notare/nodes/base" +require_relative "notare/nodes/run" +require_relative "notare/nodes/image" +require_relative "notare/nodes/paragraph" +require_relative "notare/nodes/list" +require_relative "notare/nodes/list_item" +require_relative "notare/nodes/table" +require_relative "notare/nodes/table_row" +require_relative "notare/nodes/table_cell" +require_relative "notare/image_dimensions" +require_relative "notare/style" +require_relative "notare/xml/content_types" +require_relative "notare/xml/relationships" +require_relative "notare/xml/document_xml" +require_relative "notare/xml/numbering" +require_relative "notare/xml/styles_xml" +require_relative "notare/builder" +require_relative "notare/package" +require_relative "notare/document" + +module Notare + class Error < StandardError; end +end diff --git a/lib/ezdoc/builder.rb b/lib/notare/builder.rb similarity index 99% rename from lib/ezdoc/builder.rb rename to lib/notare/builder.rb index 1fcfdc0..68b2b6a 100644 --- a/lib/ezdoc/builder.rb +++ b/lib/notare/builder.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Builder def p(text = nil, style: nil, &block) para = Nodes::Paragraph.new(style: resolve_style(style)) diff --git a/lib/ezdoc/document.rb b/lib/notare/document.rb similarity index 99% rename from lib/ezdoc/document.rb rename to lib/notare/document.rb index da2aaf4..3912f2e 100644 --- a/lib/ezdoc/document.rb +++ b/lib/notare/document.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare class Document include Builder diff --git a/lib/ezdoc/image_dimensions.rb b/lib/notare/image_dimensions.rb similarity index 99% rename from lib/ezdoc/image_dimensions.rb rename to lib/notare/image_dimensions.rb index 42faae7..70059bb 100644 --- a/lib/ezdoc/image_dimensions.rb +++ b/lib/notare/image_dimensions.rb @@ -2,7 +2,7 @@ require "fastimage" -module Ezdoc +module Notare class ImageDimensions EMUS_PER_INCH = 914_400 DEFAULT_DPI = 96 diff --git a/lib/ezdoc/nodes/base.rb b/lib/notare/nodes/base.rb similarity index 89% rename from lib/ezdoc/nodes/base.rb rename to lib/notare/nodes/base.rb index 96e6a5e..26c5473 100644 --- a/lib/ezdoc/nodes/base.rb +++ b/lib/notare/nodes/base.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Nodes class Base # Base class for all document nodes diff --git a/lib/ezdoc/nodes/image.rb b/lib/notare/nodes/image.rb similarity index 98% rename from lib/ezdoc/nodes/image.rb rename to lib/notare/nodes/image.rb index 78ca2e7..15f7a74 100644 --- a/lib/ezdoc/nodes/image.rb +++ b/lib/notare/nodes/image.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Nodes class Image < Base attr_reader :path, :width_emu, :height_emu, :rid, :filename diff --git a/lib/ezdoc/nodes/list.rb b/lib/notare/nodes/list.rb similarity index 95% rename from lib/ezdoc/nodes/list.rb rename to lib/notare/nodes/list.rb index 7b73608..f098753 100644 --- a/lib/ezdoc/nodes/list.rb +++ b/lib/notare/nodes/list.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Nodes class List < Base attr_reader :items, :type, :num_id diff --git a/lib/ezdoc/nodes/list_item.rb b/lib/notare/nodes/list_item.rb similarity index 96% rename from lib/ezdoc/nodes/list_item.rb rename to lib/notare/nodes/list_item.rb index 9f72faf..78d73d9 100644 --- a/lib/ezdoc/nodes/list_item.rb +++ b/lib/notare/nodes/list_item.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Nodes class ListItem < Base attr_reader :runs, :list_type, :num_id diff --git a/lib/ezdoc/nodes/paragraph.rb b/lib/notare/nodes/paragraph.rb similarity index 95% rename from lib/ezdoc/nodes/paragraph.rb rename to lib/notare/nodes/paragraph.rb index ac10acf..ee04f47 100644 --- a/lib/ezdoc/nodes/paragraph.rb +++ b/lib/notare/nodes/paragraph.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Nodes class Paragraph < Base attr_reader :runs, :style diff --git a/lib/ezdoc/nodes/run.rb b/lib/notare/nodes/run.rb similarity index 96% rename from lib/ezdoc/nodes/run.rb rename to lib/notare/nodes/run.rb index 9f4740e..67ad253 100644 --- a/lib/ezdoc/nodes/run.rb +++ b/lib/notare/nodes/run.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Nodes class Run < Base attr_reader :text, :bold, :italic, :underline, :style diff --git a/lib/ezdoc/nodes/table.rb b/lib/notare/nodes/table.rb similarity index 94% rename from lib/ezdoc/nodes/table.rb rename to lib/notare/nodes/table.rb index d89b7e2..8676cf4 100644 --- a/lib/ezdoc/nodes/table.rb +++ b/lib/notare/nodes/table.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Nodes class Table < Base attr_reader :rows diff --git a/lib/ezdoc/nodes/table_cell.rb b/lib/notare/nodes/table_cell.rb similarity index 94% rename from lib/ezdoc/nodes/table_cell.rb rename to lib/notare/nodes/table_cell.rb index 086fcdf..c7e3137 100644 --- a/lib/ezdoc/nodes/table_cell.rb +++ b/lib/notare/nodes/table_cell.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Nodes class TableCell < Base attr_reader :runs diff --git a/lib/ezdoc/nodes/table_row.rb b/lib/notare/nodes/table_row.rb similarity index 94% rename from lib/ezdoc/nodes/table_row.rb rename to lib/notare/nodes/table_row.rb index e112197..e539c77 100644 --- a/lib/ezdoc/nodes/table_row.rb +++ b/lib/notare/nodes/table_row.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Nodes class TableRow < Base attr_reader :cells diff --git a/lib/ezdoc/package.rb b/lib/notare/package.rb similarity index 99% rename from lib/ezdoc/package.rb rename to lib/notare/package.rb index bf99ebe..4538e9b 100644 --- a/lib/ezdoc/package.rb +++ b/lib/notare/package.rb @@ -2,7 +2,7 @@ require "zip" -module Ezdoc +module Notare class Package def initialize(document) @document = document diff --git a/lib/ezdoc/style.rb b/lib/notare/style.rb similarity index 99% rename from lib/ezdoc/style.rb rename to lib/notare/style.rb index 95ec42a..47edee7 100644 --- a/lib/ezdoc/style.rb +++ b/lib/notare/style.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare class Style attr_reader :name, :bold, :italic, :underline, :color, :size, :font, :align, :indent, :spacing_before, :spacing_after diff --git a/lib/ezdoc/version.rb b/lib/notare/version.rb similarity index 79% rename from lib/ezdoc/version.rb rename to lib/notare/version.rb index 8ac1e77..a2e9162 100644 --- a/lib/ezdoc/version.rb +++ b/lib/notare/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true -module Ezdoc +module Notare VERSION = "0.0.1" end diff --git a/lib/ezdoc/xml/content_types.rb b/lib/notare/xml/content_types.rb similarity index 99% rename from lib/ezdoc/xml/content_types.rb rename to lib/notare/xml/content_types.rb index a35611e..10f2cee 100644 --- a/lib/ezdoc/xml/content_types.rb +++ b/lib/notare/xml/content_types.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Xml class ContentTypes NAMESPACE = "http://schemas.openxmlformats.org/package/2006/content-types" diff --git a/lib/ezdoc/xml/document_xml.rb b/lib/notare/xml/document_xml.rb similarity index 99% rename from lib/ezdoc/xml/document_xml.rb rename to lib/notare/xml/document_xml.rb index 4423165..f259b50 100644 --- a/lib/ezdoc/xml/document_xml.rb +++ b/lib/notare/xml/document_xml.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Xml class DocumentXml NAMESPACES = { diff --git a/lib/ezdoc/xml/numbering.rb b/lib/notare/xml/numbering.rb similarity index 99% rename from lib/ezdoc/xml/numbering.rb rename to lib/notare/xml/numbering.rb index 628a736..70498a2 100644 --- a/lib/ezdoc/xml/numbering.rb +++ b/lib/notare/xml/numbering.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Xml class Numbering NAMESPACE = "http://schemas.openxmlformats.org/wordprocessingml/2006/main" diff --git a/lib/ezdoc/xml/relationships.rb b/lib/notare/xml/relationships.rb similarity index 99% rename from lib/ezdoc/xml/relationships.rb rename to lib/notare/xml/relationships.rb index 47a198b..bfa9d59 100644 --- a/lib/ezdoc/xml/relationships.rb +++ b/lib/notare/xml/relationships.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Xml class Relationships NAMESPACE = "http://schemas.openxmlformats.org/package/2006/relationships" diff --git a/lib/ezdoc/xml/styles_xml.rb b/lib/notare/xml/styles_xml.rb similarity index 99% rename from lib/ezdoc/xml/styles_xml.rb rename to lib/notare/xml/styles_xml.rb index a33a3b0..48c4bf0 100644 --- a/lib/ezdoc/xml/styles_xml.rb +++ b/lib/notare/xml/styles_xml.rb @@ -1,6 +1,6 @@ # frozen_string_literal: true -module Ezdoc +module Notare module Xml class StylesXml NAMESPACE = "http://schemas.openxmlformats.org/wordprocessingml/2006/main" diff --git a/ezdoc.gemspec b/notare.gemspec similarity index 68% rename from ezdoc.gemspec rename to notare.gemspec index 77c4f8c..c64665c 100644 --- a/ezdoc.gemspec +++ b/notare.gemspec @@ -1,14 +1,14 @@ # frozen_string_literal: true -require_relative "lib/ezdoc/version" +require_relative "lib/notare/version" Gem::Specification.new do |spec| - spec.name = "ezdoc" - spec.version = Ezdoc::VERSION + spec.name = "notare" + spec.version = Notare::VERSION spec.authors = ["Mathias"] - spec.summary = "A Ruby gem for working with docx files" - spec.description = "Easy document manipulation for docx files in Ruby" - spec.homepage = "https://github.com/mathias/ezdoc" + spec.summary = "A Ruby gem for creating docx files with a simple DSL" + spec.description = "Notare provides a clean DSL for creating Word documents in Ruby" + spec.homepage = "https://github.com/mathias/notare" spec.license = "MIT" spec.required_ruby_version = ">= 3.0.0" diff --git a/test/document_test.rb b/test/document_test.rb index bdd6d60..6661f63 100644 --- a/test/document_test.rb +++ b/test/document_test.rb @@ -3,11 +3,11 @@ require "test_helper" class DocumentTest < Minitest::Test - include EzdocTestHelpers + include NotareTestHelpers def test_creates_valid_docx_structure Tempfile.create(["test", ".docx"]) do |file| - Ezdoc::Document.create(file.path) do |doc| + Notare::Document.create(file.path) do |doc| doc.p "Test" end @@ -33,7 +33,7 @@ class DocumentTest < Minitest::Test def test_empty_document Tempfile.create(["test", ".docx"]) do |file| - Ezdoc::Document.create(file.path) { |_doc| } # rubocop:disable Lint/EmptyBlock + Notare::Document.create(file.path) { |_doc| } # rubocop:disable Lint/EmptyBlock assert File.exist?(file.path) Zip::File.open(file.path) do |zip| @@ -45,30 +45,30 @@ class DocumentTest < Minitest::Test def test_document_create_returns_document result = nil Tempfile.create(["test", ".docx"]) do |file| - result = Ezdoc::Document.create(file.path) do |doc| + result = Notare::Document.create(file.path) do |doc| doc.p "Test" end end - assert_instance_of Ezdoc::Document, result + assert_instance_of Notare::Document, result end def test_document_has_nodes - doc = Ezdoc::Document.new + doc = Notare::Document.new doc.p "Test" assert_equal 1, doc.nodes.count - assert_instance_of Ezdoc::Nodes::Paragraph, doc.nodes.first + assert_instance_of Notare::Nodes::Paragraph, doc.nodes.first end def test_document_lists_helper - doc = Ezdoc::Document.new + doc = Notare::Document.new doc.p "Paragraph" doc.ul { doc.li "Bullet" } doc.ol { doc.li "Number" } doc.table { doc.tr { doc.td "Cell" } } assert_equal 2, doc.lists.count - assert(doc.lists.all? { |l| l.is_a?(Ezdoc::Nodes::List) }) + assert(doc.lists.all? { |l| l.is_a?(Notare::Nodes::List) }) end end diff --git a/test/formatting_test.rb b/test/formatting_test.rb index 2b2f29b..6cd3a72 100644 --- a/test/formatting_test.rb +++ b/test/formatting_test.rb @@ -3,7 +3,7 @@ require "test_helper" class FormattingTest < Minitest::Test - include EzdocTestHelpers + include NotareTestHelpers def test_bold_text xml = create_doc_and_read_xml do |doc| diff --git a/test/heading_test.rb b/test/heading_test.rb index cb47e11..3f42640 100644 --- a/test/heading_test.rb +++ b/test/heading_test.rb @@ -3,7 +3,7 @@ require "test_helper" class HeadingTest < Minitest::Test - include EzdocTestHelpers + include NotareTestHelpers def test_h1 xml = create_doc_and_read_xml { |doc| doc.h1 "Title" } diff --git a/test/image_test.rb b/test/image_test.rb index 9ca7906..693d41a 100644 --- a/test/image_test.rb +++ b/test/image_test.rb @@ -3,7 +3,7 @@ require "test_helper" class ImageTest < Minitest::Test - include EzdocTestHelpers + include NotareTestHelpers def setup @png_path = File.expand_path("fixtures/test.png", __dir__) @@ -80,7 +80,7 @@ class ImageTest < Minitest::Test def test_image_file_embedded_in_docx files = nil Tempfile.create(["test", ".docx"]) do |file| - Ezdoc::Document.create(file.path) do |doc| + Notare::Document.create(file.path) do |doc| doc.p { doc.image @png_path } end Zip::File.open(file.path) do |zip| @@ -124,7 +124,7 @@ class ImageTest < Minitest::Test def test_invalid_image_path_raises_error assert_raises(ArgumentError) do Tempfile.create(["test", ".docx"]) do |file| - Ezdoc::Document.create(file.path) do |doc| + Notare::Document.create(file.path) do |doc| doc.p { doc.image "/nonexistent/image.png" } end end @@ -138,7 +138,7 @@ class ImageTest < Minitest::Test assert_raises(ArgumentError) do Tempfile.create(["test", ".docx"]) do |docx_file| - Ezdoc::Document.create(docx_file.path) do |doc| + Notare::Document.create(docx_file.path) do |doc| doc.p { doc.image gif_file.path } end end @@ -149,7 +149,7 @@ class ImageTest < Minitest::Test def test_same_image_used_multiple_times_deduplication files = nil Tempfile.create(["test", ".docx"]) do |file| - Ezdoc::Document.create(file.path) do |doc| + Notare::Document.create(file.path) do |doc| doc.p { doc.image @png_path } doc.p { doc.image @png_path } doc.p { doc.image @png_path } @@ -166,7 +166,7 @@ class ImageTest < Minitest::Test def test_multiple_different_images files = nil Tempfile.create(["test", ".docx"]) do |file| - Ezdoc::Document.create(file.path) do |doc| + Notare::Document.create(file.path) do |doc| doc.p { doc.image @png_path } doc.p { doc.image @jpeg_path } end diff --git a/test/integration_test.rb b/test/integration_test.rb index f044645..06eb0b6 100644 --- a/test/integration_test.rb +++ b/test/integration_test.rb @@ -3,7 +3,7 @@ require "test_helper" class IntegrationTest < Minitest::Test - include EzdocTestHelpers + include NotareTestHelpers def test_complex_document_with_all_features xml_files = create_doc_and_read_all_xml do |doc| diff --git a/test/list_test.rb b/test/list_test.rb index 87cc8b2..9fc914e 100644 --- a/test/list_test.rb +++ b/test/list_test.rb @@ -3,7 +3,7 @@ require "test_helper" class ListTest < Minitest::Test - include EzdocTestHelpers + include NotareTestHelpers # # Bullet List Tests diff --git a/test/paragraph_test.rb b/test/paragraph_test.rb index a1875f9..5615df2 100644 --- a/test/paragraph_test.rb +++ b/test/paragraph_test.rb @@ -3,7 +3,7 @@ require "test_helper" class ParagraphTest < Minitest::Test - include EzdocTestHelpers + include NotareTestHelpers def test_simple_paragraph xml = create_doc_and_read_xml { |doc| doc.p "Hello World" } diff --git a/test/style_test.rb b/test/style_test.rb index 24c9f57..148a024 100644 --- a/test/style_test.rb +++ b/test/style_test.rb @@ -3,7 +3,7 @@ require "test_helper" class StyleTest < Minitest::Test - include EzdocTestHelpers + include NotareTestHelpers def test_define_custom_style xml_files = create_doc_and_read_all_xml do |doc| @@ -124,7 +124,7 @@ class StyleTest < Minitest::Test def test_unknown_style_raises_error assert_raises(ArgumentError) do Tempfile.create(["test", ".docx"]) do |file| - Ezdoc::Document.create(file.path) do |doc| + Notare::Document.create(file.path) do |doc| doc.p "Test", style: :nonexistent end end @@ -133,18 +133,18 @@ class StyleTest < Minitest::Test def test_invalid_color_raises_error assert_raises(ArgumentError) do - Ezdoc::Style.new(:bad, color: "invalid") + Notare::Style.new(:bad, color: "invalid") end end def test_invalid_alignment_raises_error assert_raises(ArgumentError) do - Ezdoc::Style.new(:bad, align: :invalid) + Notare::Style.new(:bad, align: :invalid) end end def test_color_normalizes_hash - style = Ezdoc::Style.new(:test, color: "#ff0000") + style = Notare::Style.new(:test, color: "#ff0000") assert_equal "FF0000", style.color end diff --git a/test/table_test.rb b/test/table_test.rb index dd13981..e7fdb66 100644 --- a/test/table_test.rb +++ b/test/table_test.rb @@ -3,7 +3,7 @@ require "test_helper" class TableTest < Minitest::Test - include EzdocTestHelpers + include NotareTestHelpers def test_simple_table xml = create_doc_and_read_xml do |doc| diff --git a/test/test_helper.rb b/test/test_helper.rb index ff07b73..c736a2e 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -1,17 +1,17 @@ # frozen_string_literal: true $LOAD_PATH.unshift File.expand_path("../lib", __dir__) -require "ezdoc" +require "notare" require "minitest/autorun" require "tempfile" require "zip" -module EzdocTestHelpers +module NotareTestHelpers # Helper to create a document and return the document.xml content def create_doc_and_read_xml(&block) content = nil Tempfile.create(["test", ".docx"]) do |file| - Ezdoc::Document.create(file.path, &block) + Notare::Document.create(file.path, &block) Zip::File.open(file.path) do |zip| content = zip.read("word/document.xml").force_encoding("UTF-8") end @@ -23,7 +23,7 @@ module EzdocTestHelpers def create_doc_and_read_all_xml(&block) result = {} Tempfile.create(["test", ".docx"]) do |file| - Ezdoc::Document.create(file.path, &block) + Notare::Document.create(file.path, &block) Zip::File.open(file.path) do |zip| zip.each do |entry| if entry.name.end_with?(".xml") || entry.name.end_with?(".rels")