Sha256: 6e85de2df134941374ab38e488346ad2214905667c0728ff9c0f65661d84bc59

Contents?: true

Size: 711 Bytes

Versions: 1

Compression:

Stored size: 711 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require "stats_lite"

arg = ARGV[0]
if arg == "-v"
  return print "StatsLite V#{StatsLite::VERSION}\n"
end

require "rack/handler/puma"
require "filewatcher"


print StatsLite::Log.yellow("\nStarting stats-lite\n")

config = "./config.rb" || ARGV[0]

load_config = -> do
  if File.exist?(config)
    print StatsLite::Log.red "\nFound config.rb\n"
    load config
  end
end

load_config.call
Thread.new do
  Filewatcher.new(StatsLite.configure.watch).watch do |filename, event|
    load_config.call
  end
end

app = Rack::Builder.new do
  use StatsLite::App
  run lambda { |env| [404, {}, []] }
end

Rack::Handler::Puma.run(app, Port: StatsLite.configure.port)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stats_lite-0.6.1 exe/stats-lite