Module: RuoteKit
- Defined in:
- lib/ruote-kit/version.rb,
lib/ruote-kit.rb,
lib/ruote-kit/helpers.rb,
lib/ruote-kit/application.rb,
lib/ruote-kit/configuration.rb,
lib/ruote-kit/spec/ruote_helpers.rb,
lib/ruote-kit/helpers/form_helpers.rb,
lib/ruote-kit/helpers/engine_helpers.rb,
lib/ruote-kit/helpers/render_helpers.rb,
lib/ruote-kit/helpers/launch_item_parser.rb,
lib/ruote-kit/helpers/navigation_helpers.rb
Overview
lib/ruote-kit/version.rb
so that the Rakefile doesn’t have to load all the deps when running “rake gemspec”
Defined Under Namespace
Modules: Helpers, Spec Classes: Application, Configuration
Constant Summary collapse
- VERSION =
'2.1.10'
Class Attribute Summary collapse
-
.engine ⇒ Object
The instance of ruote.
-
.worker ⇒ Object
The instance of our worker, if used.
Class Method Summary collapse
- .configuration ⇒ Object
-
.configure {|configuration| ... } ⇒ Object
(also: run!)
Yields a RuoteKit::Configuration instance and then immediately starts the engine.
-
.ensure_engine! ⇒ Object
Ensure the engine is running.
- .env ⇒ Object
-
.reset_configuration! ⇒ Object
resets the configuration.
-
.run_engine! ⇒ Object
Runs an engine, and starts a threaded workers if #configuration allows it.
-
.run_worker!(run_in_thread = false) ⇒ Object
Run a single worker.
- .shutdown!(purge_engine = false) ⇒ Object
- .shutdown_engine(purge = false) ⇒ Object
- .shutdown_worker! ⇒ Object
- .storage_participant ⇒ Object
Class Attribute Details
.engine ⇒ Object
The instance of ruote
14 15 16 |
# File 'lib/ruote-kit.rb', line 14 def engine @engine end |
.worker ⇒ Object
The instance of our worker, if used
17 18 19 |
# File 'lib/ruote-kit.rb', line 17 def worker @worker end |
Class Method Details
.configuration ⇒ Object
42 43 44 |
# File 'lib/ruote-kit.rb', line 42 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object Also known as: run!
Yields a RuoteKit::Configuration instance and then immediately starts the engine.
31 32 33 34 35 |
# File 'lib/ruote-kit.rb', line 31 def configure yield configuration if block_given? run_engine! end |
.ensure_engine! ⇒ Object
Ensure the engine is running
47 48 49 |
# File 'lib/ruote-kit.rb', line 47 def ensure_engine! run_engine! if self.engine.nil? end |
.env ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'lib/ruote-kit.rb', line 19 def env @env ||= ( if defined?( Rails ) Rails.env else ENV['RACK_ENV'] || 'development' end ) end |
.reset_configuration! ⇒ Object
resets the configuration
mainly used in tests
104 105 106 |
# File 'lib/ruote-kit.rb', line 104 def reset_configuration! @configuration = nil end |
.run_engine! ⇒ Object
Runs an engine, and starts a threaded workers if #configuration allows it
53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/ruote-kit.rb', line 53 def run_engine! return unless configuration.run_engine storage = configuration.storage_instance self.engine = Ruote::Engine.new( configuration.run_worker ? self.worker = Ruote::Worker.new(storage) : storage ) configuration.do_participant_registration @storage_participant = nil end |
.run_worker!(run_in_thread = false) ⇒ Object
Run a single worker. By default this method will block indefinitely, unless run_in_thread
is set to true
68 69 70 71 |
# File 'lib/ruote-kit.rb', line 68 def run_worker!( run_in_thread = false ) self.worker = Ruote::Worker.new( configuration.storage_instance ) run_in_thread ? self.worker.run_in_thread : self.worker.run end |
.shutdown!(purge_engine = false) ⇒ Object
38 39 40 |
# File 'lib/ruote-kit.rb', line 38 def shutdown!( purge_engine = false ) shutdown_engine( purge_engine ) end |
.shutdown_engine(purge = false) ⇒ Object
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/ruote-kit.rb', line 73 def shutdown_engine( purge = false ) return if self.engine.nil? self.engine.shutdown if purge self.engine.context.keys.each do |k| s = self.engine.context[k] s.purge if s.respond_to?(:purge) end end self.engine = nil shutdown_worker! if configuration.run_worker end |
.shutdown_worker! ⇒ Object
91 92 93 94 |
# File 'lib/ruote-kit.rb', line 91 def shutdown_worker! self.worker.shutdown if self.worker self.worker = nil end |
.storage_participant ⇒ Object
96 97 98 99 |
# File 'lib/ruote-kit.rb', line 96 def storage_participant return nil if self.engine.nil? @storage_participant ||= Ruote::StorageParticipant.new(self.engine) end |