Skip to content

Commit 0400187

Browse files
fidelmostlyobvious
andcommitted
Fix RES Browser being unusable
Two problems contributed to the issue: * two–digit number appeared in the version number (2.11.0) * version number itself contained only two sections instead of three (2.10) Testing with current RubyEvenStore::VERSION contributes to preventing such issues in the future. #1647 Co-authored-by: Paweł Pacana <[email protected]>
1 parent 10ce88e commit 0400187

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

ruby_event_store-browser/lib/ruby_event_store/browser/gem_source.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ def initialize(load_path)
99
@path =
1010
load_path
1111
.select { |entry| String === entry }
12-
.find { |entry| entry.match? %r{ruby_event_store-browser(?:-\d\.\d\.\d)?/lib\z} }
12+
.find { |entry| entry.match? %r{ruby_event_store-browser(?:-\d+\.\d+\.\d+)?/lib\z} }
1313
end
1414

1515
def version
@@ -21,7 +21,7 @@ def version
2121
end
2222

2323
def from_rubygems?
24-
path.match? %r{/gems/ruby_event_store-browser-\d\.\d\.\d/lib\z}
24+
path.match? %r{/gems/ruby_event_store-browser-\d+\.\d+\.\d+/lib\z}
2525
end
2626

2727
def from_git?

ruby_event_store-browser/spec/gem_source_spec.rb

+8
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@ module Browser
3737
expect(source).to be_from_git
3838
end
3939

40+
specify "don't crash on two–digit number in version string" do
41+
path = "/Users/mostlyobvious/.rubies/ruby-3.1.2/lib/ruby/gems/3.1.0/gems/ruby_event_store-browser-#{RubyEventStore::VERSION}/lib"
42+
source = GemSource.new([random_unrelated_path, path])
43+
44+
expect(source.version).to eq(RubyEventStore::VERSION)
45+
expect(source).not_to be_from_git
46+
end
47+
4048
def random_unrelated_path
4149
"/kaka/dudu"
4250
end

0 commit comments

Comments
 (0)