Module: Goat
- Includes:
- Log
- Defined in:
- lib/goat.rb,
lib/goat/html.rb,
lib/goat/common.rb,
lib/goat/static.rb,
lib/goat/state-srv.rb,
lib/goat/net-common.rb,
lib/goat/notifications.rb
Defined Under Namespace
Modules: AppHelpers, DOMTools, FlashHelper, HTMLHelpers, JSONMessages, Log, NotificationCenter, StateSrvClient
Classes: App, BasicApp, Channel, ChannelPusher, Component, ComponentSkeleton, ComponentUpdate, DOMDiff, DOMDistiller, ERBRunner, ExpansionHelper, HTMLString, Halt, IndifferentHash, JustRerenderError, NoStateSrvConnectionError, NotFoundError, Page, PageCanvas, ReqHandler, StateSrvConnection, Static, UpdateDispatcher
Class Method Summary
collapse
Methods included from Log
lockpath, log, log_message, logf, logname, logpath
Class Method Details
.add_component_helpers(modul) ⇒ Object
110
111
112
|
# File 'lib/goat.rb', line 110
def self.add_component_helpers(modul)
Goat::Component.send(:include, modul)
end
|
.announce_launch(svc) ⇒ Object
9
10
11
|
# File 'lib/goat/common.rb', line 9
def self.announce_launch(svc)
$stderr.puts "#{Time.now.to_s} #{svc} #{Goat.version} starting..."
end
|
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# File 'lib/goat.rb', line 114
def self.configure(&blk)
blk.call
load_all('components')
load_all('pages')
Goat.extend_mongo if Goat.setting(:mongo)
if p = Goat.setting(:press)
Goat::Static.press = p
end
if Goat.setting(:debug)
if defined?(Thin)
Thin::Logging.debug = true
end
end
NotificationCenter.configure(Goat.setting(:notifications)) if Goat.setting(:notifications)
end
|
.enable_appsrv(opts = {}) ⇒ Object
84
85
86
|
# File 'lib/goat.rb', line 84
def self.enable_appsrv(opts={})
UpdateDispatcher.enable
end
|
.enable_notifications(opts = {}) ⇒ Object
76
77
78
|
# File 'lib/goat.rb', line 76
def self.enable_notifications(opts={})
NotificationCenter.configure(opts)
end
|
.enable_statesrv(opts = {}) ⇒ Object
80
81
82
|
# File 'lib/goat.rb', line 80
def self.enable_statesrv(opts={})
StateSrvClient.configure(opts)
end
|
.extend_mongo ⇒ Object
72
73
74
|
# File 'lib/goat.rb', line 72
def self.extend_mongo
require goat_path('mongo')
end
|
.goat_path(f) ⇒ Object
70
|
# File 'lib/goat.rb', line 70
def self.goat_path(f); File.join(File.dirname(__FILE__), 'goat', f); end
|
.load_all(dir_fragment) ⇒ Object
88
89
90
91
92
93
|
# File 'lib/goat.rb', line 88
def self.load_all(dir_fragment)
dir = File.join(Goat.setting!(:root), dir_fragment)
if File.directory?(dir)
Dir.entries(dir).select{|f| f =~ /\.rb$/}.each {|f| require(File.join(dir, f))}
end
end
|
.logd(msg) ⇒ Object
4
|
# File 'lib/goat/net-common.rb', line 4
def self.logd(msg); Log.log(:debug, msg); end
|
.loge(msg) ⇒ Object
6
|
# File 'lib/goat/net-common.rb', line 6
def self.loge(msg); Log.log(:error, msg); end
|
.logw(msg) ⇒ Object
5
|
# File 'lib/goat/net-common.rb', line 5
def self.logw(msg); Log.log(:warn, msg); end
|
.rack_builder(app, opts = {}) ⇒ Object
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
|
# File 'lib/goat.rb', line 135
def self.rack_builder(app, opts={})
defaults = {:logger => Rack::CommonLogger}
opts = defaults.merge(opts)
Rack::Builder.new do
if cookies = Goat.setting(:cookies)
use Rack::Session::Cookie, cookies
end
use opts[:logger]
if static = Goat.setting(:static)
use Rack::Static, :urls => static.fetch(:urls), :root => static.fetch(:root)
end
use Rack::Flash if defined?(Rack::Flash)
run app
end
end
|
.rpc_handlers ⇒ Object
686
|
# File 'lib/goat.rb', line 686
def self.rpc_handlers; @rpc_handlers ||= {}; end
|
.setting(opt) ⇒ Object
96
97
98
|
# File 'lib/goat.rb', line 96
def self.setting(opt)
@settings[opt]
end
|
.setting!(opt) ⇒ Object
100
101
102
103
104
105
106
|
# File 'lib/goat.rb', line 100
def self.setting!(opt)
if @settings.include?(opt)
@settings[opt]
else
raise "#{opt} not set"
end
end
|
108
|
# File 'lib/goat.rb', line 108
def self.settings; @settings; end
|
4
5
6
7
|
# File 'lib/goat/common.rb', line 4
def self.version
specpath = File.join(File.dirname(__FILE__), '../../goat.gemspec')
Gem::Specification.load(specpath).version.to_s
end
|