Module: Sparrow
- Defined in:
- lib/sparrow.rb,
lib/sparrow/queue.rb,
lib/sparrow/utils.rb,
lib/sparrow/runner.rb,
lib/sparrow/server.rb,
lib/sparrow/queues/memory.rb,
lib/sparrow/queues/sqlite.rb
Defined Under Namespace
Modules: Miscel, Queues, Server
Classes: Queue, Runner, SparrowError
Constant Summary
collapse
- VERSION =
'0.4.1'
- @@options =
{}
Class Method Summary
collapse
Class Method Details
.base_dir ⇒ Object
34
35
36
|
# File 'lib/sparrow.rb', line 34
def base_dir
options[:base_dir] || File.join(%w( / var spool sparrow base ))
end
|
.log_path ⇒ Object
38
39
40
|
# File 'lib/sparrow.rb', line 38
def log_path
options[:log_path] || File.join(%w( / var run sparrow.log ))
end
|
.logger ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/sparrow.rb', line 24
def logger
return @@logger if defined?(@@loggger)
FileUtils.mkdir_p(File.dirname(log_path))
@@logger = Logger.new(log_path)
@@logger.level = Logger::INFO if options[:debug] == false
@@logger
rescue
@@logger = Logger.new(STDOUT)
end
|
.options ⇒ Object
16
17
18
|
# File 'lib/sparrow.rb', line 16
def options
@@options
end
|
.options=(val) ⇒ Object
20
21
22
|
# File 'lib/sparrow.rb', line 20
def options=(val)
@@options = val
end
|
.pid_dir ⇒ Object
42
43
44
|
# File 'lib/sparrow.rb', line 42
def pid_dir
options[:pid_dir] || File.join(%w( / var run sparrow pids ))
end
|