Class: Proxy::Dynflow

Inherits:
Object
  • Object
show all
Defined in:
lib/smart_proxy_dynflow/api.rb,
lib/smart_proxy_dynflow/plugin.rb,
lib/smart_proxy_dynflow/helpers.rb,
lib/smart_proxy_dynflow/testing.rb,
lib/smart_proxy_dynflow/version.rb,
lib/smart_proxy_dynflow/callback.rb,
lib/smart_proxy_dynflow.rb

Defined Under Namespace

Modules: Callback, Helpers, Testing Classes: Api, Plugin

Constant Summary collapse

VERSION =
'0.0.1'

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDynflow

Returns a new instance of Dynflow.



12
13
14
# File 'lib/smart_proxy_dynflow.rb', line 12

def initialize
  @world = create_world
end

Class Attribute Details

.instanceObject (readonly)

Returns the value of attribute instance.



52
53
54
# File 'lib/smart_proxy_dynflow.rb', line 52

def instance
  @instance
end

Instance Attribute Details

#worldObject

Returns the value of attribute world.



10
11
12
# File 'lib/smart_proxy_dynflow.rb', line 10

def world
  @world
end

Class Method Details

.initializeObject



54
55
56
# File 'lib/smart_proxy_dynflow.rb', line 54

def initialize
  @instance = Proxy::Dynflow.new
end

.worldObject



58
59
60
# File 'lib/smart_proxy_dynflow.rb', line 58

def world
  instance.world
end

Instance Method Details

#create_world(&block) ⇒ Object



16
17
18
19
# File 'lib/smart_proxy_dynflow.rb', line 16

def create_world(&block)
  config = default_world_config(&block)
  ::Dynflow::World.new(config)
end

#default_world_configObject



29
30
31
32
33
34
35
36
# File 'lib/smart_proxy_dynflow.rb', line 29

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_adapterObject



38
39
40
# File 'lib/smart_proxy_dynflow.rb', line 38

def logger_adapter
  ::Dynflow::LoggerAdapters::Simple.new $stderr, 0
end

#persistence_adapterObject



25
26
27
# File 'lib/smart_proxy_dynflow.rb', line 25

def persistence_adapter
  ::Dynflow::PersistenceAdapters::Sequel.new persistence_conn_string
end

#persistence_conn_stringObject



21
22
23
# File 'lib/smart_proxy_dynflow.rb', line 21

def persistence_conn_string
  ENV['DYNFLOW_DB_CONN_STRING'] || 'sqlite:/'
end

#web_consoleObject



42
43
44
45
46
47
48
49
# File 'lib/smart_proxy_dynflow.rb', line 42

def web_console
  require 'dynflow/web'
  world = @world
  dynflow_console = ::Dynflow::Web.setup do
    set :world, world
  end
  dynflow_console
end