Class: Voom::Railtie

Inherits:
Rails::Railtie
  • Object
show all
Defined in:
lib/voom/railtie.rb

Constant Summary collapse

BOOT =
-> {
  Voom::Presenters::App.reset!
  Voom::Presenters::Settings.configure do |config|
    config.presenters.root = Rails.root.join('app')
    config.presenters.deep_freeze = false
  end
  Voom::Presenters::App.boot!
}
WATCH =
-> {
  return unless Rails.env.development?
  path = Rails.root.join('app', '**', '*.pom')
  puts "Watching #{path} for changes..."
  filewatcher = Filewatcher.new(path)
  Thread.new(filewatcher) do |fw|
    fw.watch do |f|
      puts "Detected updated POM file: #{f}"
      begin
        BOOT.call
      rescue Exception => exc
        puts exc.backtrace
        puts exc.message
      end
    end
  end
}