Module: Goat
- Includes:
- Log
- Defined in:
- lib/goat.rb,
lib/goat/dom.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, Config, DOMDistiller, ERBRunner, ExpansionHelper, HTMLString, Halt, IndifferentHash, NoStateSrvConnectionError, NotFoundError, Page, PageCanvas, PageUpdate, ReqHandler, StateSrvConnection, Static, TxnCompleteUpdate, UpdateDispatcher
Class Method Summary
collapse
Methods included from Log
lockpath, log, log_message, logf, logname, logpath, tai64n
Class Method Details
.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
|
121
|
# File 'lib/goat.rb', line 121
def self.config; @config; end
|
.goat_path(f) ⇒ Object
72
|
# File 'lib/goat.rb', line 72
def self.goat_path(f); File.join(File.dirname(__FILE__), 'goat', f); end
|
.load_all(dir_fragment) ⇒ Object
114
115
116
117
118
119
|
# File 'lib/goat.rb', line 114
def self.load_all(dir_fragment)
dir = File.join(Goat.config.get!(: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); Goat::Log.log(:debug, msg); end
|
.loge(msg) ⇒ Object
6
|
# File 'lib/goat/net-common.rb', line 6
def self.loge(msg); Goat::Log.log(:error, msg); end
|
.logw(msg) ⇒ Object
5
|
# File 'lib/goat/net-common.rb', line 5
def self.logw(msg); Goat::Log.log(:warn, msg); end
|
.rack_builder(app, opts = {}) ⇒ Object
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
|
# File 'lib/goat.rb', line 147
def self.rack_builder(app, opts={})
defaults = {:logger => Rack::CommonLogger}
opts = defaults.merge(opts)
Rack::Builder.new do
if cookies = Goat.config[:cookies]
use Rack::Session::Cookie, cookies
end
use opts[:logger]
if static = Goat.config[: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
711
|
# File 'lib/goat.rb', line 711
def self.rpc_handlers; @rpc_handlers ||= {}; end
|
.run_app(app, opts = {}) ⇒ Object
168
169
170
171
|
# File 'lib/goat.rb', line 168
def self.run_app(app, opts={})
builder = rack_builder(app, opts)
Rack::Handler::Thin.run(builder.to_app)
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
|