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.8.2'
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
15 16 17 |
# File 'lib/ruote-kit.rb', line 15 def engine @engine end |
.worker ⇒ Object
The instance of our worker, if used
18 19 20 |
# File 'lib/ruote-kit.rb', line 18 def worker @worker end |
Class Method Details
.configuration ⇒ Object
43 44 45 |
# File 'lib/ruote-kit.rb', line 43 def configuration @configuration ||= Configuration.new end |
.configure {|configuration| ... } ⇒ Object Also known as: run!
Yields a RuoteKit::Configuration instance and then immediately starts the engine.
32 33 34 35 36 |
# File 'lib/ruote-kit.rb', line 32 def configure yield configuration if block_given? run_engine! end |
.ensure_engine! ⇒ Object
Ensure the engine is running
48 49 50 |
# File 'lib/ruote-kit.rb', line 48 def ensure_engine! run_engine! if self.engine.nil? end |
.env ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/ruote-kit.rb', line 20 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
105 106 107 |
# File 'lib/ruote-kit.rb', line 105 def reset_configuration! @configuration = nil end |
.run_engine! ⇒ Object
Runs an engine, and starts a threaded workers if #configuration allows it
54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/ruote-kit.rb', line 54 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
69 70 71 72 |
# File 'lib/ruote-kit.rb', line 69 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
39 40 41 |
# File 'lib/ruote-kit.rb', line 39 def shutdown!( purge_engine = false ) shutdown_engine( purge_engine ) end |
.shutdown_engine(purge = false) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/ruote-kit.rb', line 74 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
92 93 94 95 |
# File 'lib/ruote-kit.rb', line 92 def shutdown_worker! self.worker.shutdown if self.worker self.worker = nil end |
.storage_participant ⇒ Object
97 98 99 100 |
# File 'lib/ruote-kit.rb', line 97 def storage_participant return nil if self.engine.nil? @storage_participant ||= Ruote::StorageParticipant.new(self.engine) end |