Skip to content
This repository has been archived by the owner on Oct 2, 2019. It is now read-only.

Commit

Permalink
fix: Prevent error 'logo file not found'
Browse files Browse the repository at this point in the history
By requiring a file to render the Logo, BoJack needed a file to
initialize, adding a dependency.

Closes #47
  • Loading branch information
marceloboeira committed Sep 1, 2016
1 parent 067ced1 commit 80eedd8
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 18 deletions.
8 changes: 0 additions & 8 deletions src/bojack/logo

This file was deleted.

21 changes: 21 additions & 0 deletions src/bojack/logo.cr
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
require "./version"

module BoJack
class Logo
def self.render
logo = <<-'HERE'
_|\ _/|_,
,((\\``-\\\\_
,(()) `))\
,(())) ,_ \
((())' | \
))))) >.__ \
(((' / `-. .c|
/ `-`'
BoJack VERSION
HERE
puts logo.gsub("VERSION", BoJack::VERSION)
end
end
end
12 changes: 2 additions & 10 deletions src/bojack/server.cr
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ require "logger"
require "./logger"
require "./memory"
require "./command"
require "./version"
require "./logo"

module BoJack
class Server
Expand All @@ -19,7 +19,7 @@ module BoJack
server.recv_buffer_size = 4096
memory = BoJack::Memory(String, Array(String)).new

puts BoJack::Logo.build
BoJack::Logo.render

@logger.info("Server started at #{@hostname}:#{@port}")

Expand Down Expand Up @@ -76,12 +76,4 @@ module BoJack
end
end

class Logo
def self.build
logo = String.build do |logo|
logo << File.read(File.join(File.dirname(__FILE__), "logo"))
logo << "BoJack #{BoJack::VERSION}"
end
end
end
end

0 comments on commit 80eedd8

Please sign in to comment.