# File lib/smart_proxy_dynflow.rb, line 69 def after_initialize(&block) after_initialize_blocks << block end
# File lib/smart_proxy_dynflow.rb, line 44 def ensure_initialized return @instance if @instance @instance = Proxy::Dynflow.new after_initialize_blocks.each(&:call) @instance end
# File lib/smart_proxy_dynflow.rb, line 11 def initialize @world = create_world end
# File lib/smart_proxy_dynflow.rb, line 51 def web_console require 'dynflow/web' dynflow_console = ::Dynflow::Web.setup do # we can't use the proxy's after_actionvation hook, as # it happens before the Daemon forks the process (including # closing opened file descriptors) # TODO: extend smart proxy to enable hooks that happen after # the forking Proxy::Dynflow.ensure_initialized set :world, Proxy::Dynflow.world end dynflow_console end
# File lib/smart_proxy_dynflow.rb, line 65 def world instance.world end
# File lib/smart_proxy_dynflow.rb, line 75 def after_initialize_blocks @after_initialize_blocks ||= [] end
# File lib/smart_proxy_dynflow.rb, line 15 def create_world(&block) config = default_world_config(&block) ::Dynflow::World.new(config) end
# File lib/smart_proxy_dynflow.rb, line 28 def default_world_config ::Dynflow::Config.new.tap do |config| config.auto_rescue = true config.logger_adapter = logger_adapter config.persistence_adapter = persistence_adapter yield config if block_given? end end
# File lib/smart_proxy_dynflow.rb, line 37 def logger_adapter ::Dynflow::LoggerAdapters::Simple.new $stderr, 0 end
# File lib/smart_proxy_dynflow.rb, line 24 def persistence_adapter ::Dynflow::PersistenceAdapters::Sequel.new persistence_conn_string end
# File lib/smart_proxy_dynflow.rb, line 20 def persistence_conn_string ENV['DYNFLOW_DB_CONN_STRING'] || 'sqlite:/' end