Sha256: c4f92f9487d510edfe853e153c2b22f0152281b2fa24d1b53811504fe788c46f

Contents?: true

Size: 1.51 KB

Versions: 38

Compression:

Stored size: 1.51 KB

Contents

require_relative '../../lib/config/runlist'
require_relative '../../lib/config/config'
require_relative '../../nutella_lib/framework_core'

# Framework bots can access all the parameters they need directly
# from the configuration file and the runlist,
# to which they have full access to.

# Access the config file like so:
# Nutella.config['broker']

# Access the runs list like so:
# Nutella.runlist.all_runs


# Initialize this bot as framework component
nutella.f.init(Nutella.config['broker'], 'app_runs_list_bot')


# Listen for runs_list requests (done by app components when they connect)
nutella.f.net.handle_requests_on_all_apps('app_runs_list', lambda do |req, app_id, from|
  Nutella.runlist.runs_for_app app_id
end)

# Listen for runs_list requests (done by framework interfaces when they connect)
nutella.f.net.handle_requests('runs_list', lambda do |req, from|
  Nutella.runlist.all_runs
end)

# Listen for runs_list requests at run level (done by Roomcast iPad interface)
nutella.f.net.handle_requests_on_all_runs('runs_list', lambda do |req, app_id, run_id, from|
  Nutella.runlist.all_runs
end)

# Whenever the runs list is updated, fire an updated runlist to all the apps and all framework components
p = Nutella.runlist.all_runs
while sleep 0.25
  n = Nutella.runlist.all_runs
  if p!=n
    Nutella.runlist.all_apps.each do |app_id, _|
      nutella.f.net.publish_to_app(app_id, 'app_runs_list', Nutella.runlist.runs_for_app(app_id))
    end
    nutella.f.net.publish 'runs_list', Nutella.runlist.all_runs
    p = n
  end
end

Version data entries

38 entries across 38 versions & 1 rubygems

Version Path
nutella_framework-0.9.2 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.9.1 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.9.0 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.8.0 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.7.3 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.7.2 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.7.1 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.7.0 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.21 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.20 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.19 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.18 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.17 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.16 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.15 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.13 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.12 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.11 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.10 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.9 framework_components/runs_list_bot/runs_list_bot.rb