summaryrefslogtreecommitdiff
path: root/new/bin/server.rb
diff options
context:
space:
mode:
Diffstat (limited to 'new/bin/server.rb')
-rwxr-xr-xnew/bin/server.rb37
1 files changed, 37 insertions, 0 deletions
diff --git a/new/bin/server.rb b/new/bin/server.rb
new file mode 100755
index 0000000..61f7c22
--- /dev/null
+++ b/new/bin/server.rb
@@ -0,0 +1,37 @@
+require_relative "../lib/crys"
+
+module Crys
+ class ServerRunner
+ SPLASH = [
+ <<-HEREDOC
+ ▄████▄ ██▀███ ▓██ ██▓ ██████ ██████ ██▓▄▄▄█████▓▓█████
+▒██▀ ▀█ ▓██ ▒ ██▒ ▒██ ██▒▒██ ▒ ▒██ ▒ ▓██▒▓ ██▒ ▓▒▓█ ▀
+▒▓█ ▄ ▓██ ░▄█ ▒ ▒██ ██░░ ▓██▄ ░ ▓██▄ ▒██▒▒ ▓██░ ▒░▒███
+▒▓▓▄ ▄██▒▒██▀▀█▄ ░ ▐██▓░ ▒ ██▒ ▒ ██▒░██░░ ▓██▓ ░ ▒▓█ ▄
+▒ ▓███▀ ░░██▓ ▒██▒ ░ ██▒▓░▒██████▒▒▒██████▒▒░██░ ▒██▒ ░ ░▒████▒
+░ ░▒ ▒ ░░ ▒▓ ░▒▓░ ██▒▒▒ ▒ ▒▓▒ ▒ ░▒ ▒▓▒ ▒ ░░▓ ▒ ░░ ░░ ▒░ ░
+ ░ ▒ ░▒ ░ ▒░ ▓██ ░▒░ ░ ░▒ ░ ░░ ░▒ ░ ░ ▒ ░ ░ ░ ░ ░
+░ ░░ ░ ▒ ▒ ░░ ░ ░ ░ ░ ░ ░ ▒ ░ ░ ░
+░ ░ ░ ░ ░ ░ ░ ░ ░ ░
+░ ░ ░
+HEREDOC
+ ]
+
+ def initialize(server_class:, root: )
+ @root = File.expand_path root
+ @server = server_class.new(root: root)
+ end
+
+ def serve
+ puts ""
+ puts SPLASH.sample
+ puts "Serving from: " + root
+ puts ""
+ server.start
+ end
+
+ private
+
+ attr_reader :root, :server
+ end
+end