Skip to content

Commit

Permalink
feat: add esse extensions to the extension loader
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosgz committed Jul 15, 2024
1 parent e2bb3c3 commit d910be5
Show file tree
Hide file tree
Showing 13 changed files with 75 additions and 41 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
esse (0.3.3)
esse (0.3.4)
multi_json
thor (>= 0.19)

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.elasticsearch-1.x.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
esse (0.3.3)
esse (0.3.4)
multi_json
thor (>= 0.19)

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.elasticsearch-2.x.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
esse (0.3.3)
esse (0.3.4)
multi_json
thor (>= 0.19)

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.elasticsearch-5.x.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
esse (0.3.3)
esse (0.3.4)
multi_json
thor (>= 0.19)

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.elasticsearch-6.x.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
esse (0.3.3)
esse (0.3.4)
multi_json
thor (>= 0.19)

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.elasticsearch-7.x.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
esse (0.3.3)
esse (0.3.4)
multi_json
thor (>= 0.19)

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.elasticsearch-8.x.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
esse (0.3.3)
esse (0.3.4)
multi_json
thor (>= 0.19)

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.opensearch-1.x.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
esse (0.3.3)
esse (0.3.4)
multi_json
thor (>= 0.19)

Expand Down
2 changes: 1 addition & 1 deletion gemfiles/Gemfile.opensearch-2.x.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: ..
specs:
esse (0.3.3)
esse (0.3.4)
multi_json
thor (>= 0.19)

Expand Down
7 changes: 6 additions & 1 deletion lib/esse/cli/extensions_loader.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,16 @@ class ExtensionsLoader
esse-active_record
esse-sequel
esse-kaminari
esse-pagy
esse-will_paginate
esse-jbuilder
esse-redis_storage
esse-async_indexing
].freeze

def self.load!
GEMS.each do |gem_name|
require gem_name
Kernel.require(gem_name)
rescue LoadError
# do nothing
end
Expand Down
2 changes: 1 addition & 1 deletion lib/esse/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module Esse
VERSION = '0.3.3'
VERSION = '0.3.4'
end
30 changes: 0 additions & 30 deletions spec/esse/cli/extensions_loader.rb

This file was deleted.

59 changes: 59 additions & 0 deletions spec/esse/cli/extensions_loader_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
# frozen_string_literal: true

require 'spec_helper'
require 'esse/cli/extensions_loader'

RSpec.describe Esse::CLI::ExtensionsLoader do
describe '.load!' do
subject(:load) { described_class.load! }

before do
allow(Kernel).to receive(:require)
end

it 'requires esse-rails' do
expect(Kernel).to receive(:require).with('esse-rails').and_raise(LoadError) # rubocop:disable RSpec/StubbedMock
expect { load }.not_to raise_error(LoadError)
end

it 'requires esse-active_record' do
expect(Kernel).to receive(:require).with('esse-active_record').and_raise(LoadError) # rubocop:disable RSpec/StubbedMock
expect { load }.not_to raise_error(LoadError)
end

it 'requires esse-sequel' do
expect(Kernel).to receive(:require).with('esse-sequel').and_raise(LoadError) # rubocop:disable RSpec/StubbedMock
expect { load }.not_to raise_error(LoadError)
end

it 'requires esse-kaminari' do
expect(Kernel).to receive(:require).with('esse-kaminari').and_raise(LoadError) # rubocop:disable RSpec/StubbedMock
expect { load }.not_to raise_error(LoadError)
end

it 'requires esse-pagy' do
expect(Kernel).to receive(:require).with('esse-pagy').and_raise(LoadError) # rubocop:disable RSpec/StubbedMock
expect { load }.not_to raise_error(LoadError)
end

it 'requires esse-will_paginate' do
expect(Kernel).to receive(:require).with('esse-will_paginate').and_raise(LoadError) # rubocop:disable RSpec/StubbedMock
expect { load }.not_to raise_error(LoadError)
end

it 'requires esse-jbuilder' do
expect(Kernel).to receive(:require).with('esse-jbuilder').and_raise(LoadError) # rubocop:disable RSpec/StubbedMock
expect { load }.not_to raise_error(LoadError)
end

it 'requires esse-redis_storage' do
expect(Kernel).to receive(:require).with('esse-redis_storage').and_raise(LoadError) # rubocop:disable RSpec/StubbedMock
expect { load }.not_to raise_error(LoadError)
end

it 'requires esse-async_indexing' do
expect(Kernel).to receive(:require).with('esse-async_indexing').and_raise(LoadError) # rubocop:disable RSpec/StubbedMock
expect { load }.not_to raise_error(LoadError)
end
end
end

0 comments on commit d910be5

Please sign in to comment.