Sha256: 948af5c7f628582effe5cb88f6d10f90e5c48c8a39867a025adbdf334cc17dd3

Contents?: true

Size: 1.31 KB

Versions: 16

Compression:

Stored size: 1.31 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)


# 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

16 entries across 16 versions & 1 rubygems

Version Path
nutella_framework-0.4.25 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.24 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.23 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.22 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.21 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.20 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.19 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.18 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.17 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.16 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.13 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.12 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.11 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.10 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.9 framework_components/runs_list_bot/runs_list_bot.rb
nutella_framework-0.4.8 framework_components/runs_list_bot/runs_list_bot.rb