Module: Syntropy
- Defined in:
- lib/syntropy/app.rb,
lib/syntropy/errors.rb,
lib/syntropy/module.rb,
lib/syntropy/rpc_api.rb,
lib/syntropy/version.rb,
lib/syntropy/file_watch.rb,
lib/syntropy/connection_pool.rb,
lib/syntropy.rb
Defined Under Namespace
Classes: App, ConnectionPool, Error, Module, ModuleLoader, RPCAPI, ValidationError
Constant Summary
collapse
- VERSION =
'0.2'
- GREEN =
"\e[32m"
- WHITE =
"\e[0m"
- YELLOW =
"\e[33m"
- BANNER =
(
"\n"\
" #{GREEN}\n"\
" #{GREEN} ooo\n"\
" #{GREEN}ooooo\n"\
" #{GREEN} ooo vvv #{WHITE}Syntropy - a web framework for Ruby\n"\
" #{GREEN} o vvvvv #{WHITE}--------------------------------------\n"\
" #{GREEN} #{YELLOW}|#{GREEN} vvv o #{WHITE}https://github.com/noteflakes/syntropy\n"\
" #{GREEN} :#{YELLOW}|#{GREEN}:::#{YELLOW}|#{GREEN}::#{YELLOW}|#{GREEN}:\n"\
" #{YELLOW}++++++++++++\e[0m\n\n"
)
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.file_watch(machine, *roots, period: 0.1, &block) ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/syntropy/file_watch.rb', line 4
def self.file_watch(machine, *roots, period: 0.1, &block)
raise 'Missing root paths' if roots.empty?
require 'listen'
queue = Thread::Queue.new
listener = Listen.to(*roots) do |modified, added, removed|
fns = (modified + added + removed).uniq
fns.each { queue.push(it) }
end
listener.start
loop do
machine.sleep(period) while queue.empty?
fn = queue.shift
block.call(fn)
end
rescue StandardError => e
p e
p e.backtrace
ensure
listener.stop
end
|
Instance Method Details
#colorize(color_code) ⇒ Object
63
64
65
|
# File 'lib/syntropy.rb', line 63
def colorize(color_code)
"\e[#{color_code}m#{self}\e[0m"
end
|