Skip to content

Commit

Permalink
move site and collections console commands to locals (#853)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpace965 authored Mar 15, 2024
1 parent c7738e4 commit c8ab4a1
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions bridgetown-core/lib/bridgetown-core/commands/console.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@

module Bridgetown
module ConsoleMethods
def site
Bridgetown::Current.site
end

def collections
site.collections
end

def reload!
Bridgetown.logger.info "Reloading site..."

site = Bridgetown::Current.site

I18n.reload! # make sure any locale files get read again
Bridgetown::Hooks.trigger :site, :pre_reload, site
Bridgetown::Hooks.clear_reloadable_hooks
Expand Down Expand Up @@ -98,7 +92,14 @@ def console # rubocop:disable Metrics

IRB::ExtendCommandBundle.include ConsoleMethods
IRB.setup(nil)
workspace = IRB::WorkSpace.new
workspace = IRB::WorkSpace.new(
begin
site = Bridgetown::Current.site
collections = site.collections

binding
end
)
irb = IRB::Irb.new(workspace)
IRB.conf[:IRB_RC]&.call(irb.context)
IRB.conf[:MAIN_CONTEXT] = irb.context
Expand Down

0 comments on commit c8ab4a1

Please sign in to comment.