Rename Opencode::Rails::VERSION -> Opencode::RAILS_VERSION
Critical fix: defining Opencode::Rails as a module shadowed ::Rails
under Ruby's constant lookup whenever host code referenced top-level
Rails.something from inside the Opencode:: namespace.
Caught when host code in lib/opencode/containers/container.rb failed
to boot:
/workspaces/app/lib/opencode/containers/container.rb:433:
undefined method 'root' for module Opencode::Rails (NoMethodError)
"notes.md" => Rails.root.join(...)
Ruby resolved 'Rails' to 'Opencode::Rails' first (the gem's version
namespace) before falling back to ::Rails. The fix removes the
intermediate module entirely:
module Opencode
RAILS_VERSION = "0.0.1.alpha1"
end
Added a regression test (test_no_opencode_rails_module) so the
shadowing never sneaks back in. opencode-ruby uses Opencode::VERSION
for its own gem version; we can't double-up on that constant, so this
gem uses RAILS_VERSION as a sibling on the same Opencode module.
This commit is contained in:
@@ -4,7 +4,7 @@ require_relative "lib/opencode/rails/version"
|
||||
|
||||
Gem::Specification.new do |spec|
|
||||
spec.name = "opencode-rails"
|
||||
spec.version = Opencode::Rails::VERSION
|
||||
spec.version = Opencode::RAILS_VERSION
|
||||
spec.authors = ["Ajay Krishnan"]
|
||||
spec.email = ["ajay@krishnan.ca"]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user