Skip to content

Add draw DSL loader to Purple::Client and spec for example usage - #29

Merged
kalashnikovisme merged 3 commits into
drawfrom
codex/implement-draw-method-functionality
Feb 18, 2026
Merged

Add draw DSL loader to Purple::Client and spec for example usage#29
kalashnikovisme merged 3 commits into
drawfrom
codex/implement-draw-method-functionality

Conversation

@kalashnikovisme

Copy link
Copy Markdown
Member

Motivation

  • Enable wrapper clients to load and evaluate external DSL files relative to the caller so example/partial client definitions can be split into separate files (e.g. draw 'clients/v1').

Description

  • Implement Purple::Client.draw(file_path) to resolve a path relative to the calling file, accept extensionless paths by appending .rb, and class_eval the file contents in the client class context.
  • The loader uses caller_locations(1, 1).first.absolute_path to compute the caller directory and File.expand_path to build the full file path before evaluation.
  • Added spec/purple/draw_spec.rb which asserts the example spec/examples/time_magic/clients/v1.rb declarations are loaded and produce the expected nested api, api/v1, and api/v1/status paths.

Testing

  • Ran ruby -c lib/purple/client.rb which returned syntax OK.
  • Ran ruby -c spec/purple/draw_spec.rb which returned syntax OK.
  • Attempted bundle exec rspec spec/purple/draw_spec.rb, but the rspec executable could not be run because bundle install failed in this environment due to Rubygems returning 403 Forbidden, so the full RSpec run could not be executed.

Codex Task

@kalashnikovisme
kalashnikovisme merged commit cf9640b into draw Feb 18, 2026
1 check passed
@kalashnikovisme
kalashnikovisme deleted the codex/implement-draw-method-functionality branch February 18, 2026 15:27
kalashnikovisme added a commit that referenced this pull request Feb 18, 2026
* Add draw using example

* Fix

* Add `draw` DSL loader to `Purple::Client` and spec for example usage (#29)

* Add draw DSL loader and specs for example usage

* Fix draw spec root path expectation type

* Fix draw spec to avoid executing leaf path request

* Document `draw` usage in README and AGENTS guide (#30)

* Document draw usage in README and AGENTS guide

* Update AGENTS.md

* Update AGENTS.md with `draw` paths clarification

Clarify usage of `draw` paths and content rules for drawn files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant