class Proxy::Dynflow

Constants

VERSION

Attributes

instance[R]
world[RW]

Public Class Methods

after_initialize(&block) click to toggle source
# File lib/smart_proxy_dynflow.rb, line 69
def after_initialize(&block)
  after_initialize_blocks << block
end
ensure_initialized() click to toggle source
# 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
new() click to toggle source
# File lib/smart_proxy_dynflow.rb, line 11
def initialize
  @world = create_world
end
web_console() click to toggle source
# 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
world() click to toggle source
# File lib/smart_proxy_dynflow.rb, line 65
def world
  instance.world
end

Private Class Methods

after_initialize_blocks() click to toggle source
# File lib/smart_proxy_dynflow.rb, line 75
def after_initialize_blocks
  @after_initialize_blocks ||= []
end

Public Instance Methods

create_world(&block) click to toggle source
# File lib/smart_proxy_dynflow.rb, line 15
def create_world(&block)
  config = default_world_config(&block)
  ::Dynflow::World.new(config)
end
default_world_config() { |config| ... } click to toggle source
# 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
logger_adapter() click to toggle source
# File lib/smart_proxy_dynflow.rb, line 37
def logger_adapter
  ::Dynflow::LoggerAdapters::Simple.new $stderr, 0
end
persistence_adapter() click to toggle source
# File lib/smart_proxy_dynflow.rb, line 24
def persistence_adapter
  ::Dynflow::PersistenceAdapters::Sequel.new persistence_conn_string
end
persistence_conn_string() click to toggle source
# File lib/smart_proxy_dynflow.rb, line 20
def persistence_conn_string
  ENV['DYNFLOW_DB_CONN_STRING'] || 'sqlite:/'
end