summaryrefslogtreecommitdiff
path: root/new/bin/server.rb
blob: d1e85ddd6eb76dcb15bd8e777eaa9bec00f287d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# frozen_string_literal: true

require 'launchy'

require_relative '../lib/crys'
require_relative 'mixins/splash'

module Crys
  class ServerRunner
    include Splash

    def initialize(server_class:, root:, section:)
      @root = File.expand_path root
      @server = server_class.new(root: root)
      @section = section
    end

    def serve
      puts ''
      print_splash
      puts "Hello mms to \e[1m#{section}\e[22m"
      puts "Serving from: #{root}"
      puts ''
      server.start
    end

    private

    attr_reader :root, :server, :section
  end
end