Skip to content

DSL - #153

Merged
rickmark merged 18 commits into
mainfrom
dsl
Aug 6, 2026
Merged

DSL#153
rickmark merged 18 commits into
mainfrom
dsl

Conversation

@rickmark

@rickmark rickmark commented Aug 6, 2026

Copy link
Copy Markdown
Member

No description provided.

Copilot AI lite review requested due to automatic review settings August 6, 2026 01:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Introduces a Ruby DSL and Zeitwerk-based loading to define and consume AppleData YAML-backed schemas/models, along with new RSpec coverage and dependency updates.

Changes:

  • Added a DataFile.define DSL (and supporting DSL classes) to declare schema-backed collections.
  • Added schema/model definitions for IMG4, FDR, PKI, and LocalPolicy, plus RSpec specs validating mapping.
  • Updated gem entrypoint/dependencies (Zeitwerk, Shale, ActiveSupport, JsonPath) and normalized associated YAML data shapes.

Reviewed changes

Copilot reviewed 25 out of 34 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
_packages/ruby/spec/spec_helper.rb Adds RSpec configuration and loads the gem for tests.
_packages/ruby/spec/apple_data/data_file_spec.rb Adds a spec that enumerates all data files and validates collections.
_packages/ruby/spec/apple_data/data/img4_spec.rb Adds schema mapping specs for AppleData::Schemas::IMG4.
_packages/ruby/spec/apple_data/data/fdr_spec.rb Adds schema mapping specs for AppleData::Schemas::FactoryDataRestore.
_packages/ruby/ruby.iml Marks spec as a test source and updates IDE gem indexes.
_packages/ruby/lib/apple_data/version.rb Bumps gem version and removes Sorbet type sigil.
_packages/ruby/lib/apple_data/schemas/pki.rb Adds PKI schema definition via the new DSL.
_packages/ruby/lib/apple_data/schemas/local_policy.rb Adds LocalPolicy schema definition via the new DSL.
_packages/ruby/lib/apple_data/schemas/img4.rb Adds IMG4 schema definition via the new DSL.
_packages/ruby/lib/apple_data/schemas/factory_data_restore.rb Adds FDR schema definition via the new DSL.
_packages/ruby/lib/apple_data/schema_base.rb Introduces a common SchemaBase mapper superclass.
_packages/ruby/lib/apple_data/models/metadata.rb Adds a Metadata mapper model.
_packages/ruby/lib/apple_data/models/img4/tag.rb Adds IMG4 Tag model mapper.
_packages/ruby/lib/apple_data/models/img4/property.rb Adds IMG4 Property model mapper.
_packages/ruby/lib/apple_data/models/img4/object.rb Adds IMG4 Object model mapper.
_packages/ruby/lib/apple_data/dsl/data_file_definition.rb Implements the DSL for defining data files and collections.
_packages/ruby/lib/apple_data/dsl/collection_definition.rb Implements runtime collection accessors and mapping logic.
_packages/ruby/lib/apple_data/data_file.rb Moves to DSL-driven definitions; updates file loading & key normalization.
_packages/ruby/lib/apple_data.rb Adds Zeitwerk loader, eager loads schemas, and centralizes requires.
_packages/ruby/lib/apple-data.rb Removes legacy shim require file.
_packages/ruby/bin/console Adds interactive console script (Pry).
_packages/ruby/apple-data.gemspec Declares runtime dependencies introduced by the new loader/DSL.
_packages/ruby/Gemfile.lock Updates lockfile to include new dependencies and tools.
_packages/ruby/Gemfile Switches to gemspec and adds dev/test tooling (pry, rbs-inline, rubocop plugins).
_data/pki.yaml Reshapes PKI certificate_names data to mapped objects.
_data/img4.yaml Fixes IMG4 YAML structure for firmware_name.
_data/fdr.yaml Updates FDR modes and improves property metadata fields.
Gemfile.lock Updates root lockfile for new gem deps and tool versions.
Gemfile Adds rbs-inline to root dev/test dependencies.
Files not reviewed (4)
  • .idea/apple-knowledge.iml: Generated file
  • .idea/jsonSchemas.xml: Generated file
  • .idea/runConfigurations/AppleData_Specs.xml: Generated file
  • .idea/webResources.xml: Generated file
Suppressed comments (1)

_packages/ruby/spec/apple_data/data_file_spec.rb:1

  • The puts klass will add noise to test output and can make failures harder to scan (especially in CI). Remove the puts (or switch to RSpec metadata/logging if you need debug output).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +48 to +53
parts[-1] = "#{parts[-1]}.yaml" unless parts[-1].end_with? '.yaml'
@filename = File.join(AppleData.data_location, File.join(*parts))
@data = {}
@data = YAML.load_file @filename if File.exist? @filename
@data.with_indifferent_access
@data.deep_symbolize_keys!
@data = @data.with_indifferent_access
Comment on lines +18 to +21
@mapped_collections ||= {}
if @mapped_collections[name].nil?
collection_definition = self.class.const_get(:COLLECTIONS)[name]

Comment on lines +1 to +3
AppleData::Schemas::LocalPolicy = AppleData::DataFile.define do
self.default_filename = 'local_policy'
end
Comment on lines +20 to +22
def self.all
@data_files
end
@rickmark
rickmark merged commit ff8a25c into main Aug 6, 2026
12 checks passed
Copilot stopped work on behalf of rickmark due to an error August 6, 2026 03:29
@rickmark
rickmark deleted the dsl branch August 6, 2026 03:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

2 participants