repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/hooks.rb | lib/tmuxinator/hooks.rb | # frozen_string_literal: true
module Tmuxinator
module Hooks
module_function
def commands_from(project, hook_name)
hook_config = project.yaml[hook_name]
if hook_config.is_a?(Array)
hook_config.join("; ")
else
hook_config
end
end
end
end
| ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/window.rb | lib/tmuxinator/window.rb | # frozen_string_literal: true
module Tmuxinator
class Window
include Tmuxinator::Util
attr_reader :commands, :index, :name, :project
def initialize(window_yaml, index, project)
first_key = window_yaml.keys.first
@name = first_key.to_s.shellescape unless first_key.nil?
@yaml = window_... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/deprecations.rb | lib/tmuxinator/deprecations.rb | # frozen_string_literal: true
module Tmuxinator
module Deprecations
def rvm?
yaml["rvm"]
end
def rbenv?
yaml["rbenv"]
end
def pre_tab?
yaml["pre_tab"]
end
def cli_args?
yaml["cli_args"]
end
def pre?
yaml["pre"]
end
def post?
yaml["p... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/cli.rb | lib/tmuxinator/cli.rb | # frozen_string_literal: true
require "open3"
module Tmuxinator
class Cli < Thor
# By default, Thor returns exit(0) when an error occurs.
# Please see: https://github.com/tmuxinator/tmuxinator/issues/192
def self.exit_on_failure?
true
end
include Tmuxinator::Util
COMMANDS = {
c... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/config.rb | lib/tmuxinator/config.rb | # frozen_string_literal: true
module Tmuxinator
class Config
LOCAL_DEFAULTS = ["./.tmuxinator.yml", "./.tmuxinator.yaml"].freeze
NO_LOCAL_FILE_MSG = "Project file at ./.tmuxinator.yml doesn't exist."
NO_PROJECT_FOUND_MSG = "Project could not be found."
TMUX_MASTER_VERSION = Float::INFINITY
class... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/wemux_support.rb | lib/tmuxinator/wemux_support.rb | # frozen_string_literal: true
module Tmuxinator
module WemuxSupport
def render
Tmuxinator::Project.render_template(
Tmuxinator::Config.wemux_template,
binding
)
end
%i(name tmux).each do |m|
define_method(m) { "wemux" }
end
end
end
| ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/pane.rb | lib/tmuxinator/pane.rb | # frozen_string_literal: true
module Tmuxinator
class Pane
attr_reader :commands, :project, :index, :tab, :title
def initialize(index, project, tab, *commands, title: nil)
@commands = commands
@index = index
@project = project
@tab = tab
@title = title.to_s.shellescape unless t... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/util.rb | lib/tmuxinator/util.rb | # frozen_string_literal: true
module Tmuxinator
module Util
include Thor::Actions
def exit!(msg)
puts msg
Kernel.exit(1)
end
def yes_no(condition)
condition ? say("Yes", :green) : say("No", :red)
end
def current_session_name
`[[ -n "${TMUX+set}" ]] && tmux display-m... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/tmux_version.rb | lib/tmuxinator/tmux_version.rb | # frozen_string_literal: true
module Tmuxinator
module TmuxVersion
SUPPORTED_TMUX_VERSIONS = [
"3.6a",
3.6,
"3.5a",
3.5,
3.4,
"3.3a",
3.3,
"3.2a",
3.2,
"3.1c",
"3.1b",
"3.1a",
3.1,
"3.0a",
3.0,
"2.9a",
2.9,
... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
tmuxinator/tmuxinator | https://github.com/tmuxinator/tmuxinator/blob/8f8a4687c229b4d0ed725451057b32f14b476ebd/lib/tmuxinator/hooks/project.rb | lib/tmuxinator/hooks/project.rb | # frozen_string_literal: true
module Tmuxinator
module Hooks
module Project
module_function
# Commands specified in this hook run when "tmuxinator start project"
# command is issued
def hook_on_project_start
# this method can only be used from inside Tmuxinator::Project
T... | ruby | MIT | 8f8a4687c229b4d0ed725451057b32f14b476ebd | 2026-01-04T15:37:31.204874Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/jobs/agent_reemit_job.rb | app/jobs/agent_reemit_job.rb | class AgentReemitJob < ActiveJob::Base
# Given an Agent, re-emit all of agent's events up to (and including) `most_recent_event_id`
def perform(agent, most_recent_event_id, delete_old_events = false)
# `find_each` orders by PK, so events get re-created in the same order
agent.events.where("id <= ?", most_re... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/jobs/agent_propagate_job.rb | app/jobs/agent_propagate_job.rb | class AgentPropagateJob < ActiveJob::Base
queue_as :propagation
def perform
Agent.receive!
end
def self.can_enqueue?
case queue_adapter.class.name # not using class since it would load adapter dependent gems
when 'ActiveJob::QueueAdapters::DelayedJobAdapter'
return Delayed::Job.where(failed_... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/jobs/agent_cleanup_expired_job.rb | app/jobs/agent_cleanup_expired_job.rb | class AgentCleanupExpiredJob < ActiveJob::Base
queue_as :default
def perform
Event.cleanup_expired!
end
end
| ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/jobs/agent_run_schedule_job.rb | app/jobs/agent_run_schedule_job.rb | class AgentRunScheduleJob < ActiveJob::Base
queue_as :default
def perform(time)
Agent.run_schedule(time)
end
end
| ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/jobs/agent_check_job.rb | app/jobs/agent_check_job.rb | class AgentCheckJob < ActiveJob::Base
# Given an Agent id, load the Agent, call #check on it, and then save it with an updated `last_check_at` timestamp.
def perform(agent_id)
agent = Agent.find(agent_id)
begin
return if agent.unavailable?
agent.check
agent.last_check_at = Time.now
a... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/jobs/agent_receive_job.rb | app/jobs/agent_receive_job.rb | class AgentReceiveJob < ActiveJob::Base
# Given an Agent id and an array of Event ids, load the Agent, call #receive on it with the Event objects, and then
# save it with an updated `last_receive_at` timestamp.
def perform(agent_id, event_ids)
agent = Agent.find(agent_id)
begin
return if agent.unava... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/markdown_class_attributes.rb | app/concerns/markdown_class_attributes.rb | module MarkdownClassAttributes
extend ActiveSupport::Concern
module ClassMethods
def markdown_class_attributes(*attributes)
attributes.each do |attribute|
class_eval <<-RUBY
def html_#{attribute}
Kramdown::Document.new(#{attribute}, auto_ids: false).to_html.html_safe
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/assignable_types.rb | app/concerns/assignable_types.rb | module AssignableTypes
extend ActiveSupport::Concern
included do
validate :validate_type
end
def short_type
@short_type ||= type.split("::").pop
end
def validate_type
errors.add(:type, "cannot be changed once an instance has been created") if type_changed? && !new_record?
errors.add(:type... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/oauthable.rb | app/concerns/oauthable.rb | module Oauthable
extend ActiveSupport::Concern
included do |base|
@valid_oauth_providers = :all
validate :validate_service
end
def oauthable?
true
end
def validate_service
if !service
errors.add(:service, :blank)
end
end
def valid_services_for(user)
if valid_oauth_provi... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/liquid_interpolatable.rb | app/concerns/liquid_interpolatable.rb | # :markup: markdown
module LiquidInterpolatable
extend ActiveSupport::Concern
included do
validate :validate_interpolation
end
def valid?(context = nil)
super
rescue Liquid::Error
errors.empty?
end
def validate_interpolation
interpolated
rescue Liquid::ZeroDivisionError => e
# Ig... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/json_serialized_field.rb | app/concerns/json_serialized_field.rb | require 'json_with_indifferent_access'
module JsonSerializedField
extend ActiveSupport::Concern
module ClassMethods
def json_serialize(*fields)
fields.each do |field|
class_eval <<-CODE
serialize :#{field}, JsonWithIndifferentAccess
validate :#{field}_has_no_errors
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/has_guid.rb | app/concerns/has_guid.rb | module HasGuid
extend ActiveSupport::Concern
included do
before_save :make_guid
end
protected
def make_guid
self.guid = SecureRandom.hex unless guid.present?
end
end | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/agent_controller_concern.rb | app/concerns/agent_controller_concern.rb | module AgentControllerConcern
extend ActiveSupport::Concern
included do
can_control_other_agents!
validate :validate_control_action
end
def default_options
{
'action' => 'run'
}
end
def control_action
interpolated['action']
end
def validate_control_action
case options[... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/dry_runnable.rb | app/concerns/dry_runnable.rb | module DryRunnable
extend ActiveSupport::Concern
def dry_run!(event = nil)
@dry_run = true
log = StringIO.new
@dry_run_started_at = Time.zone.now
@dry_run_logger = Logger.new(log).tap { |logger|
logger.formatter = proc { |severity, datetime, progname, message|
elapsed_time = '%02d:%0... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/web_request_concern.rb | app/concerns/web_request_concern.rb | require 'faraday'
module WebRequestConcern
module DoNotEncoder
def self.encode(params)
params.map do |key, value|
value.nil? ? "#{key}" : "#{key}=#{value}"
end.join('&')
end
def self.decode(val)
[val]
end
end
class CharacterEncoding < Faraday::Middleware
def initia... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/form_configurable.rb | app/concerns/form_configurable.rb | module FormConfigurable
extend ActiveSupport::Concern
included do
class_attribute :_form_configurable_fields
self._form_configurable_fields = HashWithIndifferentAccess.new { |h, k| h[k] = [] }
end
delegate :form_configurable_attributes, to: :class
delegate :form_configurable_fields, to: :class
de... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/file_handling.rb | app/concerns/file_handling.rb | module FileHandling
extend ActiveSupport::Concern
def get_file_pointer(file)
{ file_pointer: { file: file, agent_id: id } }
end
def has_file_pointer?(event)
event.payload['file_pointer'] &&
event.payload['file_pointer']['file'] &&
event.payload['file_pointer']['agent_id']
end
def get_... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/liquid_droppable.rb | app/concerns/liquid_droppable.rb | # frozen_string_literal: true
module LiquidDroppable
class Drop < Liquid::Drop
def initialize(object)
@object = object
end
def to_s
@object.to_s
end
def each
(public_instance_methods - Drop.public_instance_methods).each { |name|
yield [name, __send__(name)]
}
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/weibo_concern.rb | app/concerns/weibo_concern.rb | module WeiboConcern
extend ActiveSupport::Concern
included do
gem_dependency_check { defined?(WeiboOAuth2) }
self.validate :validate_weibo_options
end
def validate_weibo_options
unless options['app_key'].present? &&
options['app_secret'].present? &&
options['access_token'].present... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/event_headers_concern.rb | app/concerns/event_headers_concern.rb | # frozen_string_literal: true
module EventHeadersConcern
private
def validate_event_headers_options!
event_headers_payload({})
rescue ArgumentError => e
errors.add(:base, e.message)
rescue Liquid::Error => e
errors.add(:base, "has an error with Liquid templating: #{e.message}")
end
def event_... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/working_helpers.rb | app/concerns/working_helpers.rb | module WorkingHelpers
extend ActiveSupport::Concern
def event_created_within?(days)
last_event_at && last_event_at > days.to_i.days.ago
end
def recent_error_logs?
last_event_at && last_error_log_at && last_error_log_at > (last_event_at - 2.minutes)
end
def received_event_without_error?
(last_... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/long_runnable.rb | app/concerns/long_runnable.rb | =begin
Usage Example:
class Agents::ExampleAgent < Agent
include LongRunnable
# Optional
# Override this method if you need to group multiple agents based on an API key,
# or server they connect to.
# Have a look at the TwitterStreamAgent for an example.
def self.setup_worker; end
class Worker < ... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/google_oauth2_concern.rb | app/concerns/google_oauth2_concern.rb | module GoogleOauth2Concern
extend ActiveSupport::Concern
included do
include Oauthable
valid_oauth_providers :google
end
private
def google_oauth2_client_id
(config = Devise.omniauth_configs[:google]) && config.strategy.client_id
end
def google_oauth2_client_secret
(config = Devise.om... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/dropbox_concern.rb | app/concerns/dropbox_concern.rb | module DropboxConcern
extend ActiveSupport::Concern
included do
include Oauthable
valid_oauth_providers :dropbox_oauth2
gem_dependency_check { defined?(Dropbox) && Devise.omniauth_providers.include?(:dropbox) }
end
def dropbox
Dropbox::API::Config.app_key = consumer_key
Dropbox::API::Confi... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/inheritance_tracking.rb | app/concerns/inheritance_tracking.rb | module InheritanceTracking
extend ActiveSupport::Concern
module ClassMethods
def inherited(subclass)
@subclasses ||= []
@subclasses << subclass
@subclasses.uniq!
super
end
def subclasses
@subclasses
end
def with_subclasses(*subclasses)
original_subclasses =... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/twitter_concern.rb | app/concerns/twitter_concern.rb | module TwitterConcern
extend ActiveSupport::Concern
included do
include Oauthable
validate :validate_twitter_options
valid_oauth_providers :twitter
gem_dependency_check {
defined?(Twitter) &&
Devise.omniauth_providers.include?(:twitter) &&
ENV['TWITTER_OAUTH_KEY'].present? &... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/evernote_concern.rb | app/concerns/evernote_concern.rb | module EvernoteConcern
extend ActiveSupport::Concern
included do
include Oauthable
validate :validate_evernote_options
valid_oauth_providers :evernote
gem_dependency_check { defined?(EvernoteOAuth) && Devise.omniauth_providers.include?(:evernote) }
end
def evernote_client
EvernoteOAuth:... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/tumblr_concern.rb | app/concerns/tumblr_concern.rb | module TumblrConcern
extend ActiveSupport::Concern
included do
include Oauthable
valid_oauth_providers :tumblr
end
def tumblr_consumer_key
ENV['TUMBLR_OAUTH_KEY']
end
def tumblr_consumer_secret
ENV['TUMBLR_OAUTH_SECRET']
end
def tumblr_oauth_token
service.token
end
def tumb... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/email_concern.rb | app/concerns/email_concern.rb | module EmailConcern
extend ActiveSupport::Concern
MAIN_KEYS = %w[title message text main value]
included do
self.validate :validate_email_options
end
def validate_email_options
errors.add(
:base,
"subject and expected_receive_period_in_days are required"
) unless options['subject'].... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/concerns/sortable_events.rb | app/concerns/sortable_events.rb | module SortableEvents
extend ActiveSupport::Concern
included do
validate :validate_events_order
end
EVENTS_ORDER_KEY = 'events_order'.freeze
EVENTS_DESCRIPTION = 'events created in each run'.freeze
def description_events_order(*args)
self.class.description_events_order(*args)
end
module Clas... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/presenters/form_configurable_agent_presenter.rb | app/presenters/form_configurable_agent_presenter.rb | require 'delegate'
class Decorator < SimpleDelegator
def class
__getobj__.class
end
end
class FormConfigurableAgentPresenter < Decorator
def initialize(agent, view)
@agent = agent
@view = view
super(agent)
end
def option_field_for(attribute)
data = @agent.form_configurable_fields[attrib... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/helpers/scenario_helper.rb | app/helpers/scenario_helper.rb | module ScenarioHelper
def style_colors(scenario)
{
color: scenario.tag_fg_color || default_scenario_fg_color,
background_color: scenario.tag_bg_color || default_scenario_bg_color
}.map { |key, value| "#{key.to_s.dasherize}:#{value}" }.join(';')
end
def scenario_label(scenario, text = nil)
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/helpers/jobs_helper.rb | app/helpers/jobs_helper.rb | module JobsHelper
def status(job)
case
when job.failed_at
content_tag :span, 'failed', class: 'label label-danger'
when job.locked_at && job.locked_by
content_tag :span, 'running', class: 'label label-info'
else
content_tag :span, 'queued', class: 'label label-warning'
end
end
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/helpers/agent_helper.rb | app/helpers/agent_helper.rb | module AgentHelper
def agent_show_view(agent)
path = File.join('agents', 'agent_views', @agent.short_type.underscore, 'show')
return self.controller.template_exists?(path, [], true) ? path : nil
end
def toggle_disabled_text
if cookies[:huginn_view_only_enabled_agents]
" Show Disabled Agents"
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/helpers/users_helper.rb | app/helpers/users_helper.rb | module UsersHelper
def user_account_state(user)
if !user.active?
content_tag :span, 'inactive', class: 'label label-danger'
elsif user.access_locked?
content_tag :span, 'locked', class: 'label label-danger'
elsif ENV['REQUIRE_CONFIRMED_EMAIL'] == 'true' && !user.confirmed?
content_tag :s... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/helpers/dot_helper.rb | app/helpers/dot_helper.rb | module DotHelper
def render_agents_diagram(agents, layout: nil)
if svg = dot_to_svg(agents_dot(agents, rich: true, layout:))
decorate_svg(svg, agents).html_safe
else
# Google chart request url
faraday = Faraday.new { |builder|
builder.request :url_encoded
builder.adapter Fara... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/helpers/application_helper.rb | app/helpers/application_helper.rb | module ApplicationHelper
def icon_tag(name, options = {})
dom_class = options[:class]
case name
when /\Aglyphicon-/
"<span class='glyphicon #{name}#{' ' if dom_class}#{dom_class}'></span>".html_safe
when /\Afa-/
"<i class='#{'fa-solid ' unless /(?:\A| )fa-(?:solid|brands)(?: |\z)/.match?(... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/helpers/markdown_helper.rb | app/helpers/markdown_helper.rb | module MarkdownHelper
def markdown(text)
Kramdown::Document.new(text, auto_ids: false).to_html.html_safe
end
end
| ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/helpers/logs_helper.rb | app/helpers/logs_helper.rb | module LogsHelper
end
| ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/importers/default_scenario_importer.rb | app/importers/default_scenario_importer.rb | require 'open-uri'
class DefaultScenarioImporter
def self.import(user)
return unless ENV['IMPORT_DEFAULT_SCENARIO_FOR_ALL_USERS'] == 'true'
seed(user)
end
def self.seed(user)
scenario_import = ScenarioImport.new()
scenario_import.set_user(user)
scenario_file = ENV['DEFAULT_SCENARIO_FILE'].pre... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/importers/scenario_import.rb | app/importers/scenario_import.rb | require 'ostruct'
# This is a helper class for managing Scenario imports, used by the ScenarioImportsController. This class behaves much
# like a normal ActiveRecord object, with validations and callbacks. However, it is never persisted to the database.
class ScenarioImport
include ActiveModel::Model
include Act... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/validators/owned_by_validator.rb | app/validators/owned_by_validator.rb | class OwnedByValidator < ActiveModel::EachValidator
def validate_each(record, attribute, association)
return if association.all? {|s| s[options[:with]] == record[options[:with]] }
record.errors.add(attribute, "must be owned by you")
end
end
| ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/diagrams_controller.rb | app/controllers/diagrams_controller.rb | class DiagramsController < ApplicationController
def show
if params[:scenario_id].present?
@scenario = current_user.scenarios.find(params[:scenario_id])
agents = @scenario.agents
else
agents = current_user.agents
end
@disabled_agents = agents.inactive
agents = agents.active if pa... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/scenarios_controller.rb | app/controllers/scenarios_controller.rb | require 'agents_exporter'
class ScenariosController < ApplicationController
include SortableTable
skip_before_action :authenticate_user!, only: :export
def index
set_table_sort sorts: %w[name public], default: { name: :asc }
@scenarios = current_user.scenarios.reorder(table_sort).page(params[:page])
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/jobs_controller.rb | app/controllers/jobs_controller.rb | class JobsController < ApplicationController
before_action :authenticate_admin!
def index
@jobs = Delayed::Job.order(Arel.sql("coalesce(failed_at,'1000-01-01'), run_at asc")).page(params[:page])
respond_to do |format|
format.html { render layout: !request.xhr? }
format.json { render json: @job... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/web_requests_controller.rb | app/controllers/web_requests_controller.rb | # This controller is designed to allow your Agents to receive cross-site Webhooks (POSTs), or to output data streams.
# When a POST or GET is received, your Agent will have #receive_web_request called on itself with the incoming params,
# method, and requested content-type.
#
# Requests are routed as follows:
# http:... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/home_controller.rb | app/controllers/home_controller.rb | class HomeController < ApplicationController
skip_before_action :authenticate_user!
before_action :upgrade_warning, only: :index
def index
end
def about
end
end
| ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/omniauth_callbacks_controller.rb | app/controllers/omniauth_callbacks_controller.rb | class OmniauthCallbacksController < Devise::OmniauthCallbacksController
def action_missing(name)
case name.to_sym
when *Devise.omniauth_providers
service = current_user.services.initialize_or_update_via_omniauth(request.env['omniauth.auth'])
if service && service.save
redirect_to services_... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/logs_controller.rb | app/controllers/logs_controller.rb | class LogsController < ApplicationController
before_action :load_agent
def index
@logs = @agent.logs.all
render :action => :index, :layout => false
end
def clear
@agent.delete_logs!
index
end
protected
def load_agent
@agent = current_user.agents.find(params[:agent_id])
end
end
| ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/user_credentials_controller.rb | app/controllers/user_credentials_controller.rb | class UserCredentialsController < ApplicationController
include SortableTable
def index
set_table_sort sorts: %w[credential_name credential_value], default: { credential_name: :asc }
@user_credentials = current_user.user_credentials.reorder(table_sort).page(params[:page])
respond_to do |format|
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/scenario_imports_controller.rb | app/controllers/scenario_imports_controller.rb | class ScenarioImportsController < ApplicationController
def new
@scenario_import = ScenarioImport.new(:url => params[:url])
end
def create
@scenario_import = ScenarioImport.new(scenario_import_params)
@scenario_import.set_user(current_user)
if @scenario_import.valid? && @scenario_import.import_c... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/events_controller.rb | app/controllers/events_controller.rb | class EventsController < ApplicationController
before_action :load_event, except: [:index, :show]
def index
if params[:agent_id]
@agent = current_user.agents.find(params[:agent_id])
@events = @agent.events.page(params[:page])
else
@events = current_user.events.preload(:agent).page(params[... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/agents_controller.rb | app/controllers/agents_controller.rb | class AgentsController < ApplicationController
include DotHelper
include ActionView::Helpers::TextHelper
include SortableTable
def index
set_table_sort sorts: %w[name created_at last_check_at last_event_at last_receive_at], default: { created_at: :desc }
@agents = current_user.agents.preload(:scenario... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/services_controller.rb | app/controllers/services_controller.rb | class ServicesController < ApplicationController
include SortableTable
before_action :upgrade_warning, only: :index
def index
set_table_sort sorts: %w[provider name global], default: { provider: :asc }
@services = current_user.services.reorder(table_sort).page(params[:page])
respond_to do |format|... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/worker_status_controller.rb | app/controllers/worker_status_controller.rb | class WorkerStatusController < ApplicationController
def show
start = Time.now
events = current_user.events
if params[:since_id].present?
since_id = params[:since_id].to_i
events = events.where('id > ?', since_id)
end
result = events.select('COUNT(id) AS count', 'MIN(id) AS min_id', ... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/application_controller.rb | app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
before_action :authenticate_user!
before_action :configure_permitted_parameters, if: :devise_controller?
helper :all
rescue_from 'ActiveRecord::SubclassNotFound' do
@undefined_agent_types = current_user.undefined_agent_types
render template: 'appli... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/concerns/sortable_table.rb | app/controllers/concerns/sortable_table.rb | require 'active_support/concern'
module SortableTable
extend ActiveSupport::Concern
included do
helper SortableTableHelper
end
protected
def table_sort
raise("You must call set_table_sort in any action using table_sort.") unless @table_sort_info.present?
@table_sort_info[:order]
end
def s... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/agents/dry_runs_controller.rb | app/controllers/agents/dry_runs_controller.rb | module Agents
class DryRunsController < ApplicationController
include ActionView::Helpers::TextHelper
def index
@events = if params[:agent_id]
current_user.agents.find_by(id: params[:agent_id]).received_events.limit(5)
elsif params[:source_ids]
Event.... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/admin/users_controller.rb | app/controllers/admin/users_controller.rb | class Admin::UsersController < ApplicationController
before_action :authenticate_admin!, except: [:switch_back]
before_action :find_user, only: [:edit, :destroy, :update, :deactivate, :activate, :switch_to_user]
helper_method :resource
def index
@users = User.reorder('created_at DESC').page(params[:page]... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/controllers/users/registrations_controller.rb | app/controllers/users/registrations_controller.rb | module Users
class RegistrationsController < Devise::RegistrationsController
after_action :create_default_scenario, only: :create
private
def create_default_scenario
DefaultScenarioImporter.import(@user) if @user.persisted?
end
end
end
| ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agent.rb | app/models/agent.rb | require 'utils'
# Agent is the core class in Huginn, representing a configurable, schedulable, reactive system with memory that can
# be sub-classed for many different purposes. Agents can emit Events, as well as receive them and react in many different ways.
# The basic Agent API is detailed on the Huginn wiki: http... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/event.rb | app/models/event.rb | require 'location'
# Events are how Huginn Agents communicate and log information about the world. Events can be emitted and received by
# Agents. They contain a serialized `payload` of arbitrary JSON data, as well as optional `lat`, `lng`, and `expires_at`
# fields.
class Event < ActiveRecord::Base
include JsonSe... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/scenario.rb | app/models/scenario.rb | class Scenario < ActiveRecord::Base
include HasGuid
belongs_to :user, counter_cache: :scenario_count, inverse_of: :scenarios
has_many :scenario_memberships, dependent: :destroy, inverse_of: :scenario
has_many :agents, through: :scenario_memberships, inverse_of: :scenarios
validates_presence_of :name, :user
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/control_link.rb | app/models/control_link.rb | # A ControlLink connects Agents in a control flow from the `controller` to the `control_target`.
class ControlLink < ActiveRecord::Base
belongs_to :controller, class_name: 'Agent', inverse_of: :control_links_as_controller
belongs_to :control_target, class_name: 'Agent', inverse_of: :control_links_as_control_target
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agent_log.rb | app/models/agent_log.rb | # AgentLogs are temporary records of Agent activity, intended for debugging and error tracking. They can be viewed
# in Agents' detail pages. AgentLogs with a `level` of 4 or greater are considered "errors" and automatically update
# Agents' `last_error_log_at` column. These are often used to determine if an Agent i... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/link.rb | app/models/link.rb | # A Link connects Agents in a directed Event flow from the `source` to the `receiver`.
class Link < ActiveRecord::Base
belongs_to :source, class_name: "Agent", inverse_of: :links_as_source
belongs_to :receiver, class_name: "Agent", inverse_of: :links_as_receiver
before_create :store_event_id_at_creation
def s... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/user_credential.rb | app/models/user_credential.rb | class UserCredential < ActiveRecord::Base
MODES = %w[text java_script]
belongs_to :user
validates :credential_name, presence: true, uniqueness: { case_sensitive: true, scope: :user_id }
validates :credential_value, presence: true
validates :mode, inclusion: { in: MODES }
validates :user_id, presence: true... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/scenario_membership.rb | app/models/scenario_membership.rb | class ScenarioMembership < ActiveRecord::Base
belongs_to :agent, inverse_of: :scenario_memberships
belongs_to :scenario, inverse_of: :scenario_memberships
end
| ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/service.rb | app/models/service.rb | class Service < ActiveRecord::Base
serialize :options, Hash
belongs_to :user, inverse_of: :services
has_many :agents, inverse_of: :service
validates_presence_of :user_id, :provider, :name, :token
before_destroy :disable_agents
scope :available_to_user, lambda { |user| where("services.user_id = ? or serv... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/user.rb | app/models/user.rb | # Huginn is designed to be a multi-User system. Users have many Agents (and Events created by those Agents).
class User < ActiveRecord::Base
devise :database_authenticatable, :registerable,
:recoverable, :rememberable, :trackable,
:validatable, :lockable, :omniauthable,
*(:confirmable if E... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/pushbullet_agent.rb | app/models/agents/pushbullet_agent.rb | module Agents
class PushbulletAgent < Agent
include FormConfigurable
cannot_be_scheduled!
cannot_create_events!
no_bulk_receive!
before_validation :create_device, on: :create
API_BASE = 'https://api.pushbullet.com/v2/'
TYPE_TO_ATTRIBUTES = {
'note' => [:title, :body],
'link'... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/peak_detector_agent.rb | app/models/agents/peak_detector_agent.rb | module Agents
class PeakDetectorAgent < Agent
cannot_be_scheduled!
DEFAULT_SEARCH_URL = 'https://twitter.com/search?q={q}'
description <<~MD
The Peak Detector Agent will watch for peaks in an event stream. When a peak is detected, the resulting Event will have a payload message of `message`. You... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/slack_agent.rb | app/models/agents/slack_agent.rb | module Agents
class SlackAgent < Agent
DEFAULT_USERNAME = 'Huginn'
ALLOWED_PARAMS = ['channel', 'username', 'unfurl_links', 'attachments', 'blocks']
can_dry_run!
cannot_be_scheduled!
cannot_create_events!
no_bulk_receive!
gem_dependency_check { defined?(Slack) }
description <<~MD
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/local_file_agent.rb | app/models/agents/local_file_agent.rb | module Agents
class LocalFileAgent < Agent
include LongRunnable
include FormConfigurable
include FileHandling
emits_file_pointer!
default_schedule 'every_1h'
def self.should_run?
ENV['ENABLE_INSECURE_AGENTS'] == "true"
end
description do
<<~MD
The LocalFileAgent... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/ftpsite_agent.rb | app/models/agents/ftpsite_agent.rb | require 'uri'
require 'time'
module Agents
class FtpsiteAgent < Agent
include FileHandling
default_schedule "every_12h"
gem_dependency_check { defined?(Net::FTP) && defined?(Net::FTP::List) }
emits_file_pointer!
description do
<<~MD
The Ftp Site Agent checks an FTP site and creat... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/http_status_agent.rb | app/models/agents/http_status_agent.rb | require 'time_tracker'
module Agents
class HttpStatusAgent < Agent
include WebRequestConcern
include FormConfigurable
can_dry_run!
can_order_created_events!
default_schedule "every_12h"
form_configurable :url
form_configurable :disable_redirect_follow, type: :boolean
form_configura... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/webhook_agent.rb | app/models/agents/webhook_agent.rb | module Agents
class WebhookAgent < Agent
include EventHeadersConcern
include WebRequestConcern # to make reCAPTCHA verification requests
cannot_be_scheduled!
cannot_receive_events!
description do
<<~MD
The Webhook Agent will create events by receiving webhooks from any source. In ... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/weibo_user_agent.rb | app/models/agents/weibo_user_agent.rb | module Agents
class WeiboUserAgent < Agent
include WeiboConcern
cannot_receive_events!
description <<~MD
The Weibo User Agent follows the timeline of a specified Weibo user. It uses this endpoint: http://open.weibo.com/wiki/2/statuses/user_timeline/en
#{'## Include `weibo_2` in your Gemfile... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/commander_agent.rb | app/models/agents/commander_agent.rb | module Agents
class CommanderAgent < Agent
include AgentControllerConcern
cannot_create_events!
description <<~MD
The Commander Agent is triggered by schedule or an incoming event, and commands other agents ("targets") to run, disable, configure, or enable themselves.
# Action types
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/telegram_agent.rb | app/models/agents/telegram_agent.rb | require 'httmultiparty'
module Agents
class TelegramAgent < Agent
include FormConfigurable
cannot_be_scheduled!
cannot_create_events!
no_bulk_receive!
can_dry_run!
description <<~MD
The Telegram Agent receives and collects events and sends them via [Telegram](https://telegram.org/).
... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/human_task_agent.rb | app/models/agents/human_task_agent.rb | module Agents
class HumanTaskAgent < Agent
default_schedule "every_10m"
gem_dependency_check { defined?(RTurk) }
description <<~MD
The Human Task Agent is used to create Human Intelligence Tasks (HITs) on Mechanical Turk.
#{'## Include `rturk` in your Gemfile to use this Agent!' if dependen... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/google_calendar_publish_agent.rb | app/models/agents/google_calendar_publish_agent.rb | require 'json'
require 'google/apis/calendar_v3'
module Agents
class GoogleCalendarPublishAgent < Agent
cannot_be_scheduled!
no_bulk_receive!
gem_dependency_check { defined?(Google) && defined?(Google::Apis::CalendarV3) }
description <<~MD
The Google Calendar Publish Agent creates events on y... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/key_value_store_agent.rb | app/models/agents/key_value_store_agent.rb | # frozen_string_literal: true
module Agents
class KeyValueStoreAgent < Agent
can_control_other_agents!
cannot_be_scheduled!
cannot_create_events!
description <<~MD
The Key-Value Store Agent is a data storage that keeps an associative array in its memory. It receives events to store values and... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/csv_agent.rb | app/models/agents/csv_agent.rb | module Agents
class CsvAgent < Agent
include FormConfigurable
include FileHandling
cannot_be_scheduled!
consumes_file_pointer!
def default_options
{
'mode' => 'parse',
'separator' => ',',
'use_fields' => '',
'output' => 'event_per_row',
'with_header'... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/twilio_receive_text_agent.rb | app/models/agents/twilio_receive_text_agent.rb | module Agents
class TwilioReceiveTextAgent < Agent
cannot_be_scheduled!
cannot_receive_events!
gem_dependency_check { defined?(Twilio) }
description do
<<~MD
The Twilio Receive Text Agent receives text messages from Twilio and emits them as events.
#{'## Include `twilio-ruby` ... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/post_agent.rb | app/models/agents/post_agent.rb | module Agents
class PostAgent < Agent
include EventHeadersConcern
include WebRequestConcern
include FileHandling
consumes_file_pointer!
MIME_RE = /\A\w+\/.+\z/
can_dry_run!
no_bulk_receive!
default_schedule "never"
description do
<<~MD
A Post Agent receives events... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/pushover_agent.rb | app/models/agents/pushover_agent.rb | module Agents
class PushoverAgent < Agent
can_dry_run!
cannot_be_scheduled!
cannot_create_events!
no_bulk_receive!
API_URL = 'https://api.pushover.net/1/messages.json'
description <<~MD
The Pushover Agent receives and collects events and sends them via push notification to a user/group... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/delay_agent.rb | app/models/agents/delay_agent.rb | module Agents
class DelayAgent < Agent
include FormConfigurable
default_schedule 'every_12h'
description <<~MD
The DelayAgent stores received Events and emits copies of them on a schedule. Use this as a buffer or queue of Events.
`max_events` should be set to the maximum number of events th... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/java_script_agent.rb | app/models/agents/java_script_agent.rb | require 'date'
require 'cgi'
module Agents
class JavaScriptAgent < Agent
include FormConfigurable
can_dry_run!
default_schedule "never"
gem_dependency_check { defined?(MiniRacer) }
description <<~MD
The JavaScript Agent allows you to write code in JavaScript that can create and receive ... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
huginn/huginn | https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/app/models/agents/witai_agent.rb | app/models/agents/witai_agent.rb | module Agents
class WitaiAgent < Agent
cannot_be_scheduled!
no_bulk_receive!
description <<~MD
The `wit.ai` agent receives events, sends a text query to your `wit.ai` instance and generates outcome events.
Fill in `Server Access Token` of your `wit.ai` instance. Use [Liquid](https://github.c... | ruby | MIT | 8edec55aab03d4e3f13b205db02d21dc36e34e4f | 2026-01-04T15:37:27.328445Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.