Skip to content

Commit

Permalink
add after_initialize method to cli
Browse files Browse the repository at this point in the history
  • Loading branch information
marcosgz committed Nov 10, 2023
1 parent 7b9bf91 commit 180d6b9
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 14 deletions.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1 @@
ruby 3.2.2
ruby 3.0.3
26 changes: 13 additions & 13 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ GEM
coderay (1.1.3)
crack (0.4.5)
rexml
diff-lcs (1.4.4)
diff-lcs (1.5.0)
dotenv (2.7.5)
hashdiff (1.0.1)
method_source (1.0.0)
Expand All @@ -31,19 +31,19 @@ GEM
rake (12.3.3)
regexp_parser (2.1.1)
rexml (3.2.5)
rspec (3.9.0)
rspec-core (~> 3.9.0)
rspec-expectations (~> 3.9.0)
rspec-mocks (~> 3.9.0)
rspec-core (3.9.2)
rspec-support (~> 3.9.3)
rspec-expectations (3.9.2)
rspec (3.12.0)
rspec-core (~> 3.12.0)
rspec-expectations (~> 3.12.0)
rspec-mocks (~> 3.12.0)
rspec-core (3.12.2)
rspec-support (~> 3.12.0)
rspec-expectations (3.12.3)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-mocks (3.9.1)
rspec-support (~> 3.12.0)
rspec-mocks (3.12.6)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.9.0)
rspec-support (3.9.3)
rspec-support (~> 3.12.0)
rspec-support (3.12.1)
rubocop (1.20.0)
parallel (~> 1.10)
parser (>= 3.0.0.0)
Expand Down Expand Up @@ -82,7 +82,7 @@ DEPENDENCIES
esse!
pry
rake (~> 12.3)
rspec (~> 3.0)
rspec (~> 3.12)
rubocop (~> 1.20)
rubocop-performance (~> 1.11, >= 1.11.5)
rubocop-rspec (~> 2.4)
Expand Down
5 changes: 5 additions & 0 deletions lib/esse/cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class Root < Thor
def initialize(*)
super

after_initialize
load_app_config(options[:require])
setup_listeners if !options[:silent] && Esse.config.cli_event_listeners?
end
Expand Down Expand Up @@ -71,6 +72,10 @@ def install

private

def after_initialize
# esse plugins may override this method
end

def setup_listeners
Esse::Events.__bus__.events.keys.grep(/^elasticsearch/).each do |event_name|
Esse::Events.subscribe(event_name) do |event|
Expand Down

0 comments on commit 180d6b9

Please sign in to comment.