This repository was archived by the owner on Apr 28, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.rb
More file actions
76 lines (62 loc) · 1.68 KB
/
Copy pathmain.rb
File metadata and controls
76 lines (62 loc) · 1.68 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
require 'rubygems' if RUBY_VERSION < "1.9"
require 'bundler/setup'
$: << File.expand_path(File.dirname(__FILE__) + "/")
# Connector files
require 'client/connector'
require 'client/client'
require 'client/persistence'
# Server Files
require 'server/server'
# Load our Gemfile and require all needed gems
Bundler.require
class Mindware
# Connector is the local Thinkgear Connector
$CONNECTOR_ADDRESS = "127.0.0.1"
$CONNECTOR_PORT = 13854
$SERVER_ADDRESS = "0.0.0.0"
$SERVER_PORT = "8080"
$SERVER_IP = "127.0.0.1"
def initialize(options = {})
options = defaults.merge(options)
grab_logo
# Link to connector
puts "Starting Multi-threading:"
connector_thread = Thread.new {
$connector = Connector.new($CONNECTOR_ADDRESS, $CONNECTOR_PORT)
}
websocket_thread = Thread.new {
$ws = Server.new($SERVER_ADDRESS, $SERVER_PORT)
}
if options.fetch(:persistence)
persistence_thread = Thread.new {
$db = Persistence.new
}
end
while true
sleep 1
end
end
def defaults
{ persistence: false }
end
def grab_logo
File.open("etc/logo", "r") do |file|
while line = file.gets
puts line
end
end
puts "\nBy: Andres Colon Perez\n"+
"Github: http://github.com/mindware/mindware\n"
puts "For: HackPR Mayaguez! March 2 2013"
puts "\tShoutouts:\n"+
"\t----------\n"+
"\tGiancarlos Gonzalez (Government CIO)\n"+
"\tRoberto Rosario, Ramphis Castro, Oscar\n"+
"\tStartups of PR, TiG Team @ Rama Ejecutiva!\n"+
"\n"+
"\tSpecial thanks to the Hackathon Sponsors!\n"
puts "\t-----------\n"
end
end
# To save session to database: Mindware.new(persistence: true)
Mindware.new