Compare commits
4 Commits
ca08bb36e8
...
v0.0.1.alp
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
17025f0ed9 | ||
| 451ef97b9f | |||
| b0e8cf8e20 | |||
| de51ff3a45 |
12
.github/workflows/test.yml
vendored
12
.github/workflows/test.yml
vendored
@@ -14,7 +14,7 @@ jobs:
|
|||||||
matrix:
|
matrix:
|
||||||
ruby: ["3.2", "3.3", "3.4"]
|
ruby: ["3.2", "3.3", "3.4"]
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v5
|
||||||
|
|
||||||
- name: Set up Ruby ${{ matrix.ruby }}
|
- name: Set up Ruby ${{ matrix.ruby }}
|
||||||
uses: ruby/setup-ruby@v1
|
uses: ruby/setup-ruby@v1
|
||||||
@@ -29,11 +29,9 @@ jobs:
|
|||||||
run: gem build opencode-rails.gemspec
|
run: gem build opencode-rails.gemspec
|
||||||
|
|
||||||
- name: Verify gem loads after install
|
- name: Verify gem loads after install
|
||||||
# opencode-rails depends on opencode-ruby; until both gems
|
|
||||||
# are on rubygems.org, the install step here will only resolve
|
|
||||||
# if opencode-ruby has been pre-installed or is reachable.
|
|
||||||
# When the gems do publish, the runtime_dependency on
|
|
||||||
# opencode-ruby will Just Work via rubygems.
|
|
||||||
run: |
|
run: |
|
||||||
gem install --local opencode-rails-*.gem --conservative
|
client_dir="$(bundle show opencode-ruby)"
|
||||||
|
(cd "$client_dir" && gem build opencode-ruby.gemspec)
|
||||||
|
gem install "$client_dir"/opencode-ruby-*.gem --no-document
|
||||||
|
gem install opencode-rails-*.gem --no-document
|
||||||
ruby -ropencode-rails -e 'puts Opencode::RAILS_VERSION'
|
ruby -ropencode-rails -e 'puts Opencode::RAILS_VERSION'
|
||||||
|
|||||||
4
Gemfile
4
Gemfile
@@ -1,3 +1,7 @@
|
|||||||
source "https://rubygems.org"
|
source "https://rubygems.org"
|
||||||
|
|
||||||
|
gem "opencode-ruby",
|
||||||
|
git: "https://github.com/ajaynomics/opencode-ruby.git",
|
||||||
|
ref: "b16292723e6385064064fdd61698c9618f6cb156"
|
||||||
|
|
||||||
gemspec
|
gemspec
|
||||||
|
|||||||
@@ -36,23 +36,25 @@ class Opencode::LoadingTest < Minitest::Test
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# We check via path match on both directory ("/opencode-rails/") and
|
# Match the gem's own lib path, not merely any parent directory. GitHub's
|
||||||
# installed-gem name ("/opencode-rails-VERSION/") so the assertion is
|
# checkout layout nests Bundler under /opencode-rails/opencode-rails, so a
|
||||||
# robust to either a sibling-repo dev setup or a bundle-resolved gem
|
# broad directory-name assertion falsely classifies a bundled
|
||||||
# install.
|
# opencode-ruby source path as belonging to this gem.
|
||||||
GEM_PATH_PATTERN = ->(name) { %r{/#{Regexp.escape(name)}[-/]} }
|
GEM_SOURCE_PATTERN = lambda do |name, file|
|
||||||
|
%r{/#{Regexp.escape(name)}(?:-[^/]+)?/lib/opencode/#{Regexp.escape(file)}\.rb\z}
|
||||||
|
end
|
||||||
|
|
||||||
def test_session_constant_points_at_this_gem
|
def test_session_constant_points_at_this_gem
|
||||||
location = Opencode::Session.instance_method(:initialize).source_location.first
|
location = Opencode::Session.instance_method(:initialize).source_location.first
|
||||||
assert_match GEM_PATH_PATTERN.call("opencode-rails"), location,
|
assert_match GEM_SOURCE_PATTERN.call("opencode-rails", "session"), location,
|
||||||
"Expected Opencode::Session to be loaded from opencode-rails, got: #{location}"
|
"Expected Opencode::Session to be loaded from opencode-rails, got: #{location}"
|
||||||
end
|
end
|
||||||
|
|
||||||
def test_client_constant_points_at_opencode_ruby
|
def test_client_constant_points_at_opencode_ruby
|
||||||
location = Opencode::Client.instance_method(:initialize).source_location.first
|
location = Opencode::Client.instance_method(:initialize).source_location.first
|
||||||
assert_match GEM_PATH_PATTERN.call("opencode-ruby"), location,
|
assert_match GEM_SOURCE_PATTERN.call("opencode-ruby", "client"), location,
|
||||||
"Expected Opencode::Client to come from opencode-ruby, got: #{location}"
|
"Expected Opencode::Client to come from opencode-ruby, got: #{location}"
|
||||||
refute_match GEM_PATH_PATTERN.call("opencode-rails"), location,
|
refute_match GEM_SOURCE_PATTERN.call("opencode-rails", "client"), location,
|
||||||
"Opencode::Client must NOT come from opencode-rails (it's an opencode-ruby class)"
|
"Opencode::Client must NOT come from opencode-rails (it's an opencode-ruby class)"
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user