-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathapp.rb
executable file
·33 lines (28 loc) · 972 Bytes
/
app.rb
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
#!/usr/bin/env ruby
require "bundler/setup"
#load sinatra and add local lib folder to include path
require "haml" #avoid race condition
require "sinatra"
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), "lib"))
Encoding.default_external = "ASCII-8BIT" #irc logs tend to have invalid data
Encoding.default_internal = "UTF-8"
configure do
set :root, File.dirname(__FILE__)
set :public, Proc.new { File.join(root, "public") }
set :views, Proc.new { File.join(root, "templates") }
set :haml, :format => :html5, :ugly => true
#shell commands
set :grep_folder, "/usr/bin/env egrep -r" #folder
set :grep_file, "/usr/bin/env egrep " #file
#absolute path to irc logs
set :irc_logs_path, "/Users/marquis/programming/test_data/irclogs/"
set :show_private_chats, false # TODO: get this working for browse and grep
end
helpers do
include Rack::Utils
def h(text)
escape_html(text)
end
end
load "controllers/grep.rb"
load "controllers/browse.rb"