forked from lbt/ruote-kit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrails-template.rb
70 lines (58 loc) · 2.17 KB
/
rails-template.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
gem 'ruote', :git => 'https://github.com/jmettraux/ruote.git'
gem 'ruote-kit', :git => 'https://github.com/kennethkalmer/ruote-kit.git'
rakefile 'ruote.rake', <<-CODE
namespace :ruote do
desc 'Run a worker thread for ruote'
task :run_worker => :environment do
RuoteKit.run_worker(RUOTE_STORAGE)
end
end
CODE
initializer 'ruote-kit.rb', <<-CODE
# make changes when needed
#
# you may use another persistent storage for example or include a worker so that
# you don't have to run it in a separate instance
#
# See http://ruote.rubyforge.org/configuration.html for configuration options of
# ruote.
require 'ruote/storage/fs_storage'
RUOTE_STORAGE = Ruote::FsStorage.new("ruote_work_\#{Rails.env}")
RuoteKit.engine = Ruote::Engine.new(Ruote::Worker.new(RUOTE_STORAGE))
# By default, there is a running worker when you start the Rails server. That is
# convenient in development, but may be (or not) a problem in deployment.
#
# Please keep in mind that there should always be a running worker or schedules
# may get triggered to late. Some deployments (like Passenger) won't guarantee
# the Rails server process is running all the time, so that there's no always-on
# worker. Also beware that the Ruote::HashStorage only supports one worker.
#
# If you don't want to start a worker thread within your Rails server process,
# replace the line before this comment with the following:
#
# RuoteKit.engine = Ruote::Engine.new(RUOTE_STORAGE)
#
# To run a worker in its own process, there's a rake task available:
#
# rake ruote:run_worker
#
# Stop the task by pressing Ctrl+C
unless $RAKE_TASK # don't register participants in rake tasks
RuoteKit.engine.register do
# register your own participants using the participant method
#
# Example: participant 'alice', Ruote::StorageParticipant see
# http://ruote.rubyforge.org/participants.html for more info
# register the catchall storage participant named '.+'
catchall
end
end
# when true, the engine will be very noisy (stdout)
#
RuoteKit.engine.context.logger.noisy = false
CODE
route <<-CODE
# routes to RuoteKit
match '/_ruote' => RuoteKit::Application
match '/_ruote/*path' => RuoteKit::Application
CODE