Sha256: 8ef4411c177bd18e38f23c8fe4f0d15e3637080f318d87867ec673430f07c718

Contents?: true

Size: 782 Bytes

Versions: 1

Compression:

Stored size: 782 Bytes

Contents

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

require "stats_lite"

arg = ARGV[0]
return print "StatsLite V#{StatsLite::VERSION}\n" if arg == "-v"
require "rack/handler/puma"
require "filewatcher"


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

config = arg || "./config.rb"

load_config = -> do
  if File.exist?(config)
    print StatsLite::Log.green "\nFound config file #{config}\n"
    load config
  else
    print StatsLite::Log.red "\nNo config found #{config}\n"
  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.2 exe/stats-lite