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.6.8 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.7 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.6 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.5 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.4 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.3 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.2 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.1 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.6.0 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.5.1 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.5.0 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.32 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.31 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.30 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.29 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.28 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.27 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.26 framework_components/runs_list_bot/runs_list_bot.rb