Repository navigation
Bind the pure-Go rails meta-gem: top-level Rails.* accessors + rails/all - #193
Closed
tannevaled wants to merge 1 commit into
Closed
tannevaled wants to merge 1 commit into
tannevaled wants to merge 1 commit into
Conversation
Layer github.com/go-ruby-rails/rails onto the railties binding already in place. The `rails` gem ships almost no code of its own: it ties the framework components together and vends the top-level Rails module. This extends the Rails module registerRailties created (never recreating it) with: - The singleton accessors: Rails.application / application=, env / env=, root, public_path, configuration, autoloaders, logger / logger=, cache / cache=, groups, version / gem_version, backtrace_cleaner, error. - Rails::VERSION (STRING/MAJOR/MINOR/TINY/PRE; targets 8.1.3) and Rails::EnvironmentInquirer (< Rails::StringInquirer) so Rails.env.production? and Rails.env.local? read naturally. - require "rails/all", wired as a feature hook that triggers a require of every shipped (Available) catalog component whose feature the VM provides. Application state (root/public_path/configuration/autoloaders/cache) delegates to the meta-gem, which resolves it against the bound railties Application through its App seam, bridged by railsAppAdapter. Rails.application keeps returning the Ruby Application wrapper (*RailsAppVal) Ruby registered. RailsEnvVal is added to classOf and to hasCustomEq (so `Rails.env == "production"` dispatches the wrapper's == rather than pointer identity). "rails/all" is added to providedFeatures; "rails" stays owned by railties. 100% coverage of the new files; full internal/vm + internal/object suites green; gofmt/vet clean; builds on all six 64-bit Linux arches. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
Author
|
Superseded by the wave-2 consolidation PR (single merge onto main; shared builtins/require/object_model/vm/arith/digest_bind). Work preserved verbatim; branch kept for reference. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Layers the pure-Go
railsmeta-gem (github.com/go-ruby-rails/rails, pinned at5ddb406) onto the railties binding already merged (Wave 1). Therailsgem ships almost no code of its own; it ties the framework components together and vends the top-levelRailsmodule. This binding extends theRailsmoduleregisterRailties()created — it does not recreate it or re-register the"rails"feature.Ruby surface added
Rails.*singleton accessors:application/application=,env/env=,root,public_path,configuration,autoloaders,logger/logger=,cache/cache=,groups,version/gem_version,backtrace_cleaner,error.Rails::VERSIONmodule (STRING/MAJOR/MINOR/TINY/PRE; targets 8.1.3).Rails::EnvironmentInquirer(< Rails::StringInquirer): theRails.envtype, with the dynamicname?predicate and the environment-specificlocal?(development/test).require "rails/all": added toprovidedFeaturesand wired as a feature hook that triggers arequireof every shipped (Available) catalog component whose feature the VM already provides (active_support/active_model/active_job/active_storage/action_cable; components without a provided feature yet are skipped, so the aggregate tracks the catalog as bindings land).How railties is extended, not duplicated
registerRails()runs immediately afterregisterRailties()and grabs the existingRailsmodule (vm.consts["Rails"].(*RClass)), adding the singleton methods,Rails::VERSIONandRails::EnvironmentInquireronto it. The Railtie/Engine/Application/StringInquirer classes and the"rails"/"rails/railtie"/… features stay owned by railties.App-seam wiring
Application state (
root/public_path/configuration/autoloaders/cache) delegates to the meta-gem, which resolves it against the bound railtiesApplicationthrough itsAppinterface — bridged here byrailsAppAdapter(Root/Config/Autoloaders/PublicPath/Cache).Rails.application=records the Ruby wrapper on the VM and threads the underlying railties*Applicationintorails.SetApplication;Rails.applicationreturns the Ruby*RailsAppValRuby set.RailsEnvValis added toclassOfand tohasCustomEqsoRails.env == "production"dispatches the wrapper's==rather than pointer identity.Verification (all exit 0)
go build ./internal/vm/— OK; orphan scan clean.rails_meta.go,rails_meta_bind.go) via-covermode=count.go test ./internal/vm/ ./internal/object/ -count=1— bothok(railties tests still green).gofmt -lempty;go vet ./internal/vm/clean.GOOS=linux GOARCH={amd64,arm64,riscv64,loong64,ppc64le,s390x}— all build.🤖 Generated with Claude Code