-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRakefile
63 lines (48 loc) · 1.25 KB
/
Rakefile
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
$LOAD_PATH << "."
require 'jabber_the_hutt'
require 'irb'
desc 'starts an irb'
task :console do
ARGV.clear
IRB.start
end
task :c => :console
task :test_server do
require 'webrick'
dir = File.dirname(__FILE__)
root = File.expand_path(File.join(dir, 'tmp'))
server = WEBrick::HTTPServer.new(
:BindAddress => 'localhost',
:Port => 13337,
:DocumentRoot => root
)
server.mount "/", WEBrick::HTTPServlet::FileHandler, dir
server.start
end
task :all_in_one do
require File.expand_path('../jabber_the_hutt', __FILE__)
EM.run do
EM.add_periodic_timer(10) do
File.open('tmp/visitors.json', 'w') do |file|
file << JabberTheHutt::Visitors.get_identities.to_json
end
system "scp tmp/visitors.json hacksaar-spaceboard:/data/visitors.json"
end
EM::Xmpp::Connection.start(
JabberTheHutt.config.jabber[:jabber_id],
JabberTheHutt.config.jabber[:password],
JabberTheHutt::ChatBot
)
JabberTheHutt::Daemon.refetch_timer
end
end
namespace :export do
desc 'generates a visitors.json into tmp/, mat_daemon must watch eth device!'
task :json do
File.open('tmp/visitors.json', 'w') do |f|
f.write(
JabberTheHutt::Visitors.get_identities.to_json
)
end
end
end