Sha256: f7efdc24cb26323694fc5a9f3c5dd68ad9f958d7bc7584b3670ecec7a54b05ce

Contents?: true

Size: 532 Bytes

Versions: 16

Compression:

Stored size: 532 Bytes

Contents

require 'listen'

class CodeReloader

  def initialize(path)
    $log.warn("code.reloader", active: true, path: path)
    Listen.to(path) do |m, a, r|
      Thread.name = "Code Reloader (#{path})"
      (m + a).uniq.each do |file|
        reload(file)
      end
    end.start
  end

  def reload(file)
    if file =~ /\.rb$/
      $log.info("code.reloader", reload: file)
      begin
        load(file)
      rescue SyntaxError => e
        $log.exception(e)
      rescue => e
        $log.exception(e)
      end
    end
  end

end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
liquid-ext-3.5.3 lib/liquid/code_reloader.rb
liquid-ext-3.5.2 lib/liquid/code_reloader.rb
liquid-ext-3.5.0 lib/liquid/code_reloader.rb
liquid-ext-3.4.2 lib/liquid/code_reloader.rb
liquid-ext-3.4.1 lib/liquid/code_reloader.rb
liquid-ext-3.4.0 lib/liquid/code_reloader.rb
liquid-ext-3.3.10 lib/liquid/code_reloader.rb
liquid-ext-3.3.9 lib/liquid/code_reloader.rb
liquid-ext-3.3.8 lib/liquid/code_reloader.rb
liquid-ext-3.3.7 lib/liquid/code_reloader.rb
liquid-ext-3.3.6 lib/liquid/code_reloader.rb
liquid-ext-3.3.5 lib/liquid/code_reloader.rb
liquid-ext-3.3.4 lib/liquid/code_reloader.rb
liquid-ext-3.3.3 lib/liquid/code_reloader.rb
liquid-ext-3.3.2 lib/liquid/code_reloader.rb
liquid-ext-3.3.0 lib/liquid/code_reloader.rb