Module: Syntropy
- Defined in:
- lib/syntropy.rb,
lib/syntropy/app.rb,
lib/syntropy/errors.rb,
lib/syntropy/module.rb,
lib/syntropy/rpc_api.rb,
lib/syntropy/version.rb,
lib/syntropy/side_run.rb,
lib/syntropy/file_watch.rb,
lib/syntropy/connection_pool.rb,
lib/syntropy/request_extensions.rb
Defined Under Namespace
Modules: RequestExtensions, SideRun Classes: App, ConnectionPool, Error, Module, ModuleLoader, RPCAPI, ValidationError
Constant Summary collapse
- Status =
Qeweney::Status
- GREEN =
"\e[32m"- CLEAR =
"\e[0m"- YELLOW =
"\e[33m"- BANNER =
( "\n"\ " #{GREEN}\n"\ " #{GREEN} ooo\n"\ " #{GREEN}ooooo\n"\ " #{GREEN} ooo vvv #{CLEAR}Syntropy - a web framework for Ruby\n"\ " #{GREEN} o vvvvv #{CLEAR}--------------------------------------\n"\ " #{GREEN} #{YELLOW}|#{GREEN} vvv o #{CLEAR}https://github.com/noteflakes/syntropy\n"\ " #{GREEN} :#{YELLOW}|#{GREEN}:::#{YELLOW}|#{GREEN}::#{YELLOW}|#{GREEN}:\n"\ "#{YELLOW}+++++++++++++++++++++++++++++++++++++++++++++++++++++++++\e[0m\n\n" )
- VERSION =
'0.4'
Class Attribute Summary collapse
-
.machine ⇒ Object
Returns the value of attribute machine.
Class Method Summary collapse
Instance Method Summary collapse
Class Attribute Details
.machine ⇒ Object
Returns the value of attribute machine.
19 20 21 |
# File 'lib/syntropy.rb', line 19 def machine @machine end |
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
28 29 30 |
# File 'lib/syntropy.rb', line 28 def colorize(color_code) "\e[#{color_code}m#{self}\e[0m" end |