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
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140515211100_create_services.rb
db/migrate/20140515211100_create_services.rb
class CreateServices < ActiveRecord::Migration[4.2] def change create_table :services do |t| t.integer :user_id, null: false t.string :provider, null: false t.string :name, null: false t.text :token, null: false t.text :secret t.text :refresh_token t.datetime :expires_at ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140403043556_add_disabled_to_agent.rb
db/migrate/20140403043556_add_disabled_to_agent.rb
class AddDisabledToAgent < ActiveRecord::Migration[4.2] def change add_column :agents, :disabled, :boolean, :default => false, :null => false end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140509170420_create_scenarios.rb
db/migrate/20140509170420_create_scenarios.rb
class CreateScenarios < ActiveRecord::Migration[4.2] def change create_table :scenarios do |t| t.string :name, :null => false t.integer :user_id, :null => false t.timestamps end add_column :users, :scenario_count, :integer, :null => false, :default => 0 end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140820003139_add_tag_color_to_scenarios.rb
db/migrate/20140820003139_add_tag_color_to_scenarios.rb
class AddTagColorToScenarios < ActiveRecord::Migration[4.2] def change add_column :scenarios, :tag_bg_color, :string add_column :scenarios, :tag_fg_color, :string end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20160302095413_add_deactivated_at_to_users.rb
db/migrate/20160302095413_add_deactivated_at_to_users.rb
class AddDeactivatedAtToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :deactivated_at, :datetime add_index :users, :deactivated_at end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140213053001_add_event_id_at_creation_to_links.rb
db/migrate/20140213053001_add_event_id_at_creation_to_links.rb
class AddEventIdAtCreationToLinks < ActiveRecord::Migration[4.2] class Link < ActiveRecord::Base; end class Event < ActiveRecord::Base; end def up add_column :links, :event_id_at_creation, :integer, :null => false, :default => 0 Link.all.find_each do |link| last_event_id = execute( <<-SQL ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20160807000122_remove_queue_from_email_digest_agent_memory.rb
db/migrate/20160807000122_remove_queue_from_email_digest_agent_memory.rb
class RemoveQueueFromEmailDigestAgentMemory < ActiveRecord::Migration[4.2] def up Agents::EmailDigestAgent.find_each do |agent| agent.memory.delete("queue") agent.save!(validate: false) end end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140809211540_remove_service_index_on_user_id.rb
db/migrate/20140809211540_remove_service_index_on_user_id.rb
class RemoveServiceIndexOnUserId < ActiveRecord::Migration[4.2] def change remove_index :services, :user_id end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20160224120316_add_mode_option_to_ftpsite_agents.rb
db/migrate/20160224120316_add_mode_option_to_ftpsite_agents.rb
class AddModeOptionToFtpsiteAgents < ActiveRecord::Migration[4.2] def up Agents::FtpsiteAgent.find_each do |agent| agent.options['mode'] = 'read' agent.save!(validate: false) end end def down Agents::FtpsiteAgent.find_each do |agent| agent.options.delete 'mode' agent.save!(val...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20130126080736_change_memory_to_long_text.rb
db/migrate/20130126080736_change_memory_to_long_text.rb
# PG allows arbitrarily long text fields but MySQL has default limits. Make those limits larger if we're using MySQL. class ChangeMemoryToLongText < ActiveRecord::Migration[4.2] def up if mysql? change_column :agents, :memory, :text, :limit => 4294967295 change_column :events, :payload, :text, :limit...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20160405072512_post_agent_set_event_header_style.rb
db/migrate/20160405072512_post_agent_set_event_header_style.rb
class PostAgentSetEventHeaderStyle < ActiveRecord::Migration[4.2] def up Agent.of_type("Agents::PostAgent").each do |post_agent| if post_agent.send(:boolify, post_agent.options['emit_events']) && !post_agent.options.key?('event_headers_style') post_agent.options['event_headers_style'] = 'ra...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20131223032112_switch_to_json_serialization.rb
db/migrate/20131223032112_switch_to_json_serialization.rb
class SwitchToJsonSerialization < ActiveRecord::Migration[4.2] FIELDS = { :agents => [:options, :memory], :events => [:payload] } def up if data_exists? puts "This migration will update tables to use UTF-8 encoding and will update Agent and Event storage from YAML to JSON." puts "It shoul...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20241027081918_website_agent_rename_array_to_single_array.rb
db/migrate/20241027081918_website_agent_rename_array_to_single_array.rb
class WebsiteAgentRenameArrayToSingleArray < ActiveRecord::Migration[6.1] def up Agents::WebsiteAgent.find_each do |agent| case extract = agent.options['extract'] when Hash extract.each_value do |details| if details.is_a?(Hash) && details.key?('array') details['single_arr...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20230622140301_delete_empty_keys_and_values_from_key_value_store_agents.rb
db/migrate/20230622140301_delete_empty_keys_and_values_from_key_value_store_agents.rb
class DeleteEmptyKeysAndValuesFromKeyValueStoreAgents < ActiveRecord::Migration[6.1] def up Agents::KeyValueStoreAgent.find_each do |agent| agent.memory.delete_if { |key, value| key.empty? || value.nil? || value.try(:empty?) } agent.save! end end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20161124065838_add_templates_to_resolve_url.rb
db/migrate/20161124065838_add_templates_to_resolve_url.rb
class AddTemplatesToResolveUrl < ActiveRecord::Migration[5.0] def up Agents::WebsiteAgent.find_each do |agent| if agent.event_keys.try!(:include?, 'url') agent.options['template'] = (agent.options['template'] || {}).tap { |template| template['url'] ||= '{{ url | to_uri: _response_.url }}' ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20131227000021_add_cached_dates_to_agent.rb
db/migrate/20131227000021_add_cached_dates_to_agent.rb
class AddCachedDatesToAgent < ActiveRecord::Migration[4.2] def up add_column :agents, :last_event_at, :datetime execute "UPDATE agents SET last_event_at = (SELECT created_at FROM events WHERE events.agent_id = agents.id ORDER BY id DESC LIMIT 1)" add_column :agents, :last_error_log_at, :datetime exec...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20150219213604_add_type_option_attribute_to_pushbullet_agents.rb
db/migrate/20150219213604_add_type_option_attribute_to_pushbullet_agents.rb
class AddTypeOptionAttributeToPushbulletAgents < ActiveRecord::Migration[4.2] def up Agents::PushbulletAgent.find_each do |agent| if agent.options['type'].nil? agent.options['type'] = 'note' agent.save! end end end def down Agents::PushbulletAgent.find_each do |agent| ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140722131220_convert_efa_skip_agent.rb
db/migrate/20140722131220_convert_efa_skip_agent.rb
class ConvertEfaSkipAgent < ActiveRecord::Migration[4.2] def up Agent.where(type: 'Agents::EventFormattingAgent').each do |agent| agent.options_will_change! unless agent.options.delete('skip_agent').to_s == 'true' agent.options['instructions'] = { 'agent' => '{{agent.type}}' ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20160108221620_website_agent_does_not_use_event_url.rb
db/migrate/20160108221620_website_agent_does_not_use_event_url.rb
class WebsiteAgentDoesNotUseEventUrl < ActiveRecord::Migration[4.2] def up # Until this migration, if a WebsiteAgent received Events and did not have a `url_from_event` option set, # it would use the `url` from the Event's payload. If the Event did not have a `url` in its payload, the # WebsiteAgent woul...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20121222074732_create_links.rb
db/migrate/20121222074732_create_links.rb
class CreateLinks < ActiveRecord::Migration[4.2] def change create_table :links do |t| t.integer :source_id t.integer :receiver_id t.timestamps end add_index :links, [:source_id, :receiver_id] end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20120919063304_add_username_to_users.rb
db/migrate/20120919063304_add_username_to_users.rb
class AddUsernameToUsers < ActiveRecord::Migration[4.2] class User < ActiveRecord::Base end def up add_column :users, :username, :string User.find_each do |user| user.update_attribute :username, user.email.gsub(/@.*$/, '') end change_column :users, :username, :string, :null => false a...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140811200922_add_uid_column_to_services.rb
db/migrate/20140811200922_add_uid_column_to_services.rb
class AddUidColumnToServices < ActiveRecord::Migration[4.2] def change add_column :services, :uid, :string add_index :services, :uid add_index :services, :provider end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140121075418_create_user_credentials.rb
db/migrate/20140121075418_create_user_credentials.rb
class CreateUserCredentials < ActiveRecord::Migration[4.2] def change create_table :user_credentials do |t| t.integer :user_id, :null => false t.string :credential_name, :null => false t.text :credential_value, :null => false t.timestamps end add_index :user_credentials...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140509170443_create_scenario_memberships.rb
db/migrate/20140509170443_create_scenario_memberships.rb
class CreateScenarioMemberships < ActiveRecord::Migration[4.2] def change create_table :scenario_memberships do |t| t.integer :agent_id, :null => false t.integer :scenario_id, :null => false t.timestamps end end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20160607055850_change_events_order_to_events_list_order.rb
db/migrate/20160607055850_change_events_order_to_events_list_order.rb
class ChangeEventsOrderToEventsListOrder < ActiveRecord::Migration[4.2] def up Agents::DataOutputAgent.find_each do |agent| if value = agent.options.delete('events_order') agent.options['events_list_order'] = value agent.save!(validate: false) end end end def down Agents::...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140730005210_convert_efa_skip_created_at.rb
db/migrate/20140730005210_convert_efa_skip_created_at.rb
class ConvertEfaSkipCreatedAt < ActiveRecord::Migration[4.2] def up Agent.where(type: 'Agents::EventFormattingAgent').each do |agent| agent.options_will_change! unless agent.options.delete('skip_created_at').to_s == 'true' agent.options['instructions'] = { 'created_at' => '{{created_...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140531232016_add_fields_to_scenarios.rb
db/migrate/20140531232016_add_fields_to_scenarios.rb
class AddFieldsToScenarios < ActiveRecord::Migration[4.2] def change add_column :scenarios, :description, :text add_column :scenarios, :public, :boolean, :default => false, :null => false add_column :scenarios, :guid, :string change_column :scenarios, :guid, :string, :null => false add_column :sce...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20170307190555_add_min_events_option_to_peak_detector_agents.rb
db/migrate/20170307190555_add_min_events_option_to_peak_detector_agents.rb
class AddMinEventsOptionToPeakDetectorAgents < ActiveRecord::Migration[5.0] def up Agents::PeakDetectorAgent.find_each do |agent| if agent.options['min_events'].nil? agent.options['min_events'] = '4' agent.save(validate: false) end end end def down Agents::PeakDetectorAgen...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20130819160603_create_agent_logs.rb
db/migrate/20130819160603_create_agent_logs.rb
class CreateAgentLogs < ActiveRecord::Migration[4.2] def change create_table :agent_logs do |t| t.integer :agent_id, :null => false t.text :message, :null => false t.integer :level, :default => 3, :null => false t.integer :inbound_event_id t.integer :outbound_event_id t.timest...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20170419073748_set_rss_content_type.rb
db/migrate/20170419073748_set_rss_content_type.rb
class SetRssContentType < ActiveRecord::Migration[5.0] def up Agents::DataOutputAgent.find_each do |agent| if agent.options['rss_content_type'].nil? agent.options['rss_content_type'] = 'text/xml' agent.save(validate: false) end end end def down Agents::DataOutputAgent.find...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140525150140_migrate_agents_to_service_authentication.rb
db/migrate/20140525150140_migrate_agents_to_service_authentication.rb
class MigrateAgentsToServiceAuthentication < ActiveRecord::Migration[4.2] def twitter_consumer_key(agent) agent.options['consumer_key'].presence || agent.credential('twitter_consumer_key') end def twitter_consumer_secret(agent) agent.options['consumer_secret'].presence || agent.credential('twitter_consum...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20120728215449_add_admin_to_users.rb
db/migrate/20120728215449_add_admin_to_users.rb
class AddAdminToUsers < ActiveRecord::Migration[4.2] def change add_column :users, :admin, :boolean, :default => false, :null => false end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140603104211_rename_digest_email_to_email_digest.rb
db/migrate/20140603104211_rename_digest_email_to_email_digest.rb
class RenameDigestEmailToEmailDigest < ActiveRecord::Migration[4.2] def up sql = <<-SQL UPDATE #{ActiveRecord::Base.connection.quote_table_name('agents')} SET #{ActiveRecord::Base.connection.quote_column_name('type')} = 'Agents::EmailDigestAgent' WHERE #{ActiveRecord::Base.connection.quote_colum...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20140525150040_add_service_id_to_agents.rb
db/migrate/20140525150040_add_service_id_to_agents.rb
class AddServiceIdToAgents < ActiveRecord::Migration[4.2] def change add_column :agents, :service_id, :integer end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20130124050117_add_indexes.rb
db/migrate/20130124050117_add_indexes.rb
class AddIndexes < ActiveRecord::Migration[4.2] def change add_index :links, [:receiver_id, :source_id] end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/db/migrate/20150507153436_update_keep_events_for_to_be_in_seconds.rb
db/migrate/20150507153436_update_keep_events_for_to_be_in_seconds.rb
class UpdateKeepEventsForToBeInSeconds < ActiveRecord::Migration[4.2] class Agent < ActiveRecord::Base; end SECONDS_IN_DAY = 60 * 60 * 24 def up Agent.update_all ['keep_events_for = keep_events_for * ?', SECONDS_IN_DAY] end def down Agent.update_all ['keep_events_for = keep_events_for / ?', SECONDS...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/bin/twitter_stream.rb
bin/twitter_stream.rb
#!/usr/bin/env ruby # This process is used by TwitterStreamAgents to watch the Twitter stream in real time. It periodically checks for # new or changed TwitterStreamAgents and starts to follow the stream for them. It is typically run by foreman via # the included Procfile. require_relative './pre_runner_boot' Agen...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/bin/threaded.rb
bin/threaded.rb
#!/usr/bin/env ruby require_relative './pre_runner_boot' agent_runner = AgentRunner.new # We need to wait a bit to let delayed_job set it's traps so we can override them Thread.new do sleep 5 agent_runner.set_traps end agent_runner.run
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/bin/agent_runner.rb
bin/agent_runner.rb
#!/usr/bin/env ruby # This process is used to maintain Huginn's upkeep behavior, automatically running scheduled Agents and # periodically propagating and expiring Events. It also running TwitterStreamAgents and Agents that support long running # background jobs. require_relative './pre_runner_boot' AgentRunner.new(...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/bin/pre_runner_boot.rb
bin/pre_runner_boot.rb
unless defined?(Rails) puts puts "Please run me with rails runner, for example:" puts " RAILS_ENV=production bundle exec rails runner bin/#{File.basename($0)}" puts exit 1 end Rails.configuration.cache_classes = true Dotenv.load if ENV['APP_SECRET_TOKEN'].blank?
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/bin/decrypt_backup.rb
bin/decrypt_backup.rb
#!/usr/bin/env ruby # If you're using the backup gem, described on the Huginn wiki and at doc/deployment/backup, then you can use this # utility to decrypt backups. in_file = ARGV.shift out_file = ARGV.shift || "decrypted_backup.tar" puts "About to decrypt #{in_file} and write it to #{out_file}." cmd = "bundle exec...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/bin/schedule.rb
bin/schedule.rb
#!/usr/bin/env ruby # This process is used to maintain Huginn's upkeep behavior, automatically running scheduled Agents and # periodically propagating and expiring Events. It's typically run via foreman and the included Procfile. require_relative './pre_runner_boot' AgentRunner.new(only: HuginnScheduler).run
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/capybara_helper.rb
spec/capybara_helper.rb
require 'rails_helper' require 'capybara/rails' require 'capybara-select-2' CAPYBARA_TIMEOUT = ENV['CI'] == 'true' ? 60 : 5 Capybara.javascript_driver = ENV['USE_HEADED_CHROME'] ? :selenium_chrome : :selenium_chrome_headless Capybara.default_max_wait_time = CAPYBARA_TIMEOUT RSpec.configure do |config| config.inclu...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/rails_helper.rb
spec/rails_helper.rb
ENV['RAILS_ENV'] ||= 'test' if ENV['COVERAGE'] require 'simplecov' SimpleCov.start 'rails' elsif ENV['CI'] == 'true' require 'simplecov' SimpleCov.start 'rails' do require 'simplecov-lcov' SimpleCov::Formatter::LcovFormatter.config do |c| c.report_with_single_file = true c.single_report_pat...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/spec_helper.rb
spec/spec_helper.rb
# This file was generated by the `rails generate rspec:install` command. Conventionally, all # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`. # The generated `.rspec` file contains `--require spec_helper` which will cause # this file to always be loaded, without a need to explicitly require ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/jobs/agent_reemit_job_spec.rb
spec/jobs/agent_reemit_job_spec.rb
require 'rails_helper' describe AgentReemitJob do subject { described_class.new } let(:agent) { agents(:bob_website_agent) } let(:agent_event) { events(:bob_website_agent_event) } it "re-emits all events created by the given Agent" do 2.times { agent_event.dup.save! } expect { subject.perform(a...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/jobs/agent_propagate_job_spec.rb
spec/jobs/agent_propagate_job_spec.rb
require 'rails_helper' describe AgentPropagateJob do it "calls Agent.receive! when run" do expect(Agent).to receive(:receive!) AgentPropagateJob.new.perform end context "#can_enqueue?" do it "is truthy when no propagation job is queued" do expect(AgentPropagateJob.can_enqueue?).to be_truthy ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/alert_confirmer.rb
spec/support/alert_confirmer.rb
module AlertConfirmer def reject_confirm_from &block handle_js_modal 'confirm', false, &block end def accept_confirm_from &block handle_js_modal 'confirm', true, &block end def accept_alert_from &block handle_js_modal 'alert', true, &block end def get_alert_text_from &block handle_js_mo...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/matchers.rb
spec/support/matchers.rb
RSpec::Matchers.define_negated_matcher :not_change, :change
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/spec_helpers.rb
spec/support/spec_helpers.rb
module SpecHelpers def build_events(options = {}) options[:values].map.with_index do |tuple, index| event = Event.new event.agent = agents(:bob_weather_agent) event.payload = (options[:pattern] || {}).dup.merge((options[:keys].zip(tuple)).inject({}) { |memo, (key, value)| memo[key] = value; memo...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/vcr_support.rb
spec/support/vcr_support.rb
require 'vcr' VCR.configure do |c| c.cassette_library_dir = 'spec/cassettes' c.allow_http_connections_when_no_cassette = false c.hook_into :webmock c.default_cassette_options = { record: :new_episodes} c.configure_rspec_metadata! end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/feature_helpers.rb
spec/support/feature_helpers.rb
module FeatureHelpers def select_agent_type(search) agent_name = search[/\A.*?Agent\b/] || search select2(agent_name, search:, from: "Type") # Wait for all parts of the Agent form to load: expect(page).to have_css("div.function_buttons") # Options editor expect(page).to have_css(".well.descriptio...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/fake_mqtt_server.rb
spec/support/fake_mqtt_server.rb
#!/usr/bin/env ruby # # This is a 'fake' MQTT server to help with testing client implementations # # See https://github.com/njh/ruby-mqtt/blob/master/spec/fake_server.rb # # It behaves in the following ways: # * Responses to CONNECT with a successful CONACK # * Responses to PUBLISH by echoing the packet back # * ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/shared_examples/liquid_interpolatable.rb
spec/support/shared_examples/liquid_interpolatable.rb
require 'rails_helper' shared_examples_for LiquidInterpolatable do before(:each) do @valid_params = { "normal" => "just some normal text", "variable" => "{{variable}}", "text" => "Some test with an embedded {{variable}}", "escape" => "This should be {{hello_world | uri_escape}}" } ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/shared_examples/has_guid.rb
spec/support/shared_examples/has_guid.rb
require 'rails_helper' shared_examples_for HasGuid do it "gets created before_save, but only if it's not present" do instance = new_instance expect(instance.guid).to be_nil instance.save! expect(instance.guid).not_to be_nil expect { instance.save! }.not_to change { instance.reload.guid } end e...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/shared_examples/agent_controller_concern.rb
spec/support/shared_examples/agent_controller_concern.rb
require 'rails_helper' shared_examples_for AgentControllerConcern do describe "preconditions" do it "must be satisfied for these shared examples" do expect(agent.user).to eq(users(:bob)) expect(agent.control_action).to eq('run') end end describe "validation" do describe "of action" do ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/shared_examples/web_request_concern.rb
spec/support/shared_examples/web_request_concern.rb
require 'rails_helper' shared_examples_for WebRequestConcern do let(:agent) do _agent = described_class.new(:name => "some agent", :options => @valid_options || {}) _agent.user = users(:jane) _agent end describe "validations" do it "should be valid" do expect(agent).to be_valid end ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/shared_examples/working_helpers.rb
spec/support/shared_examples/working_helpers.rb
require 'rails_helper' shared_examples_for WorkingHelpers do describe "recent_error_logs?" do it "returns true if last_error_log_at is near last_event_at" do agent = described_class.new agent.last_error_log_at = 10.minutes.ago agent.last_event_at = 10.minutes.ago expect(agent.recent_erro...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/shared_examples/file_handling_consumer.rb
spec/support/shared_examples/file_handling_consumer.rb
require 'rails_helper' shared_examples_for 'FileHandlingConsumer' do let(:event) { Event.new(user: @checker.user, payload: {'file_pointer' => {'file' => 'text.txt', 'agent_id' => @checker.id}}) } it 'returns a file pointer' do expect(@checker.get_file_pointer('testfile')).to eq(file_pointer: { file: "testfile...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/support/shared_examples/email_concern.rb
spec/support/shared_examples/email_concern.rb
require 'rails_helper' shared_examples_for EmailConcern do let(:valid_options) { { :subject => "hello!", :expected_receive_period_in_days => "2" } } let(:agent) do _agent = described_class.new(:name => "some email agent", :options => valid_options) _agent.user = users(:jane) _age...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/concerns/dry_runnable_spec.rb
spec/concerns/dry_runnable_spec.rb
require 'rails_helper' describe DryRunnable do class Agents::SandboxedAgent < Agent default_schedule "3pm" can_dry_run! def check perform end def receive(events) events.each do |event| perform(event.payload['prefix']) end end private def perform(prefix =...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/concerns/long_runnable_spec.rb
spec/concerns/long_runnable_spec.rb
require 'rails_helper' class TestWorker < LongRunnable::Worker def stop; end def terminate; end def runl; end end describe LongRunnable do class LongRunnableAgent < Agent include LongRunnable def default_options { test: 'test' } end end before(:each) do @agent = LongRunnableAgent.n...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/concerns/twitter_concern_spec.rb
spec/concerns/twitter_concern_spec.rb
require 'rails_helper' describe TwitterConcern do class TestTwitterAgent < Agent include TwitterConcern end before do allow(TestTwitterAgent).to receive(:valid_type?).with("TestTwitterAgent") { true } @agent = TestTwitterAgent.create(name: "some agent") { |agent| agent.user = users(:bob) ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/concerns/form_configurable_spec.rb
spec/concerns/form_configurable_spec.rb
require 'rails_helper' describe FormConfigurable do class Agent1 include FormConfigurable def validate_test true end def complete_test [{name: 'test', value: 1234}] end end class Agent2 < Agent end before(:all) do @agent1 = Agent1.new @agent2 = Agent2.new end ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/concerns/liquid_interpolatable_spec.rb
spec/concerns/liquid_interpolatable_spec.rb
require 'rails_helper' require 'nokogiri' describe LiquidInterpolatable::Filters do before do @filter = Class.new do include LiquidInterpolatable::Filters end.new end describe 'uri_escape' do it 'should escape a string for use in URI' do expect(@filter.uri_escape('abc:/?=')).to eq('abc%3...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/concerns/inheritance_tracking_spec.rb
spec/concerns/inheritance_tracking_spec.rb
require 'rails_helper' require 'inheritance_tracking' describe InheritanceTracking do class Class1 include InheritanceTracking end class Class2 < Class1; end class Class3 < Class1; end it "tracks subclasses" do expect(Class1.subclasses).to eq([Class2, Class3]) end it "can be temporarily overri...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/concerns/sortable_events_spec.rb
spec/concerns/sortable_events_spec.rb
require 'rails_helper' describe SortableEvents do let(:agent_class) { Class.new(Agent) do include SortableEvents default_schedule 'never' def self.valid_type?(name) true end end } def new_agent(events_order = nil) options = {} options['events_order'] = events_or...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/routing/webhooks_controller_spec.rb
spec/routing/webhooks_controller_spec.rb
require 'rails_helper' describe "routing for web requests", :type => :routing do it "routes to handle_request" do resulting_params = { :user_id => "6", :agent_id => "2", :secret => "foobar" } expect(get("/users/6/web_requests/2/foobar")).to route_to("web_requests#handle_request", resulting_params) expect...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/presenters/form_configurable_agent_presenter_spec.rb
spec/presenters/form_configurable_agent_presenter_spec.rb
require 'rails_helper' describe FormConfigurableAgentPresenter do include RSpecHtmlMatchers class FormConfigurableAgentPresenterAgent < Agent include FormConfigurable form_configurable :string, roles: :validatable form_configurable :number, type: :number, html_options: { min: 0 } form_configurable...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/helpers/markdown_helper_spec.rb
spec/helpers/markdown_helper_spec.rb
require 'rails_helper' describe MarkdownHelper do describe '#markdown' do it 'renders HTML from a markdown text' do expect(markdown('# Header')).to match(/<h1>Header<\/h1>/) expect(markdown('## Header 2')).to match(/<h2>Header 2<\/h2>/) end end end
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/helpers/jobs_helper_spec.rb
spec/helpers/jobs_helper_spec.rb
require 'rails_helper' describe JobsHelper do let(:job) { Delayed::Job.new } describe '#status' do it "works for failed jobs" do job.failed_at = Time.now expect(status(job)).to eq('<span class="label label-danger">failed</span>') end it "works for running jobs" do job.locked_at = Ti...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/helpers/scenario_helper_spec.rb
spec/helpers/scenario_helper_spec.rb
require 'rails_helper' describe ScenarioHelper do let(:scenario) { users(:bob).scenarios.build(name: 'Scene', tag_fg_color: '#AAAAAA', tag_bg_color: '#000000') } describe '#style_colors' do it 'returns a css style-formated version of the scenario foreground and background colors' do expect(style_colors(...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/helpers/dot_helper_spec.rb
spec/helpers/dot_helper_spec.rb
require 'rails_helper' describe DotHelper do describe "with example Agents" do class Agents::DotFoo < Agent default_schedule "2pm" def check create_event :payload => {} end end class Agents::DotBar < Agent cannot_be_scheduled! def check create_event :paylo...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/helpers/application_helper_spec.rb
spec/helpers/application_helper_spec.rb
require 'rails_helper' describe ApplicationHelper do describe '#icon_tag' do it 'returns a Glyphicon icon element' do icon = icon_tag('glyphicon-help') expect(icon).to be_html_safe expect(Nokogiri(icon).at('span.glyphicon.glyphicon-help')).to be_a Nokogiri::XML::Element end it 'returns...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/importers/scenario_import_spec.rb
spec/importers/scenario_import_spec.rb
require 'rails_helper' describe ScenarioImport do let(:user) { users(:bob) } let(:guid) { "somescenarioguid" } let(:tag_fg_color) { "#ffffff" } let(:tag_bg_color) { "#000000" } let(:icon) { 'Star' } let(:description) { "This is a cool Huginn Scenario that does something useful!" } let(:name) { "A useful ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/importers/default_scenario_importer_spec.rb
spec/importers/default_scenario_importer_spec.rb
require 'rails_helper' describe DefaultScenarioImporter do let(:user) { users(:bob) } describe '.import' do it 'imports a set of agents to get the user going when they are first created' do expect(DefaultScenarioImporter).to receive(:seed).with(kind_of(User)) allow(ENV).to receive(:[]) { nil } ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/db/seeds/admin_and_default_scenario_spec.rb
spec/db/seeds/admin_and_default_scenario_spec.rb
require 'rails_helper' require_relative '../../../db/seeds/seeder' describe Seeder do before do stub_puts_to_prevent_spew_in_spec_output end describe '.seed' do before(:each) do User.delete_all expect(User.count).to eq(0) end it 'imports a default scenario' do expect { Seeder....
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/logs_controller_spec.rb
spec/controllers/logs_controller_spec.rb
require 'rails_helper' describe LogsController do describe "GET index" do it "can filter by Agent" do sign_in users(:bob) get :index, params: {:agent_id => agents(:bob_weather_agent).id} expect(assigns(:logs).length).to eq(agents(:bob_weather_agent).logs.length) expect(assigns(:logs).all?...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/web_requests_controller_spec.rb
spec/controllers/web_requests_controller_spec.rb
require 'rails_helper' describe WebRequestsController do class Agents::WebRequestReceiverAgent < Agent cannot_receive_events! cannot_be_scheduled! def receive_web_request(params, method, format) if params.delete(:secret) == options[:secret] memory[:web_request_values] = params memo...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/agents_controller_spec.rb
spec/controllers/agents_controller_spec.rb
require 'rails_helper' describe AgentsController do def valid_attributes(options = {}) { :type => "Agents::WebsiteAgent", :name => "Something", :options => agents(:bob_website_agent).options, :source_ids => [agents(:bob_weather_agent).id, ""] }.merge(options) end describe...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/omniauth_callbacks_controller_spec.rb
spec/controllers/omniauth_callbacks_controller_spec.rb
require 'rails_helper' describe OmniauthCallbacksController do before do sign_in users(:bob) OmniAuth.config.test_mode = true request.env["devise.mapping"] = Devise.mappings[:user] end describe "accepting a callback url" do it "should update the user's credentials" do request.env["omniauth...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/jobs_controller_spec.rb
spec/controllers/jobs_controller_spec.rb
require 'rails_helper' describe JobsController do describe "GET index" do before do async_handler_yaml = "--- !ruby/object:ActiveJob::QueueAdapters::DelayedJobAdapter::JobWrapper\njob_data:\n job_class: AgentCheckJob\n job_id: 123id\n queue_name: default\n arguments:\n - %d\n" Delayed::...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/user_credentials_controller_spec.rb
spec/controllers/user_credentials_controller_spec.rb
require 'rails_helper' describe UserCredentialsController do def valid_attributes(options = {}) { :credential_name => "some_name", :credential_value => "some_value" }.merge(options) end before do sign_in users(:bob) @file = fixture_file_upload('user_credentials.json') end descri...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/events_controller_spec.rb
spec/controllers/events_controller_spec.rb
require 'rails_helper' describe EventsController do before do expect(Event.where(:user_id => users(:bob).id).count).to be > 0 expect(Event.where(:user_id => users(:jane).id).count).to be > 0 end describe "GET index" do it "only returns Events created by Agents of the current user" do sign_in u...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/scenario_imports_controller_spec.rb
spec/controllers/scenario_imports_controller_spec.rb
require 'rails_helper' describe ScenarioImportsController do before do sign_in users(:bob) end describe "GET new" do it "initializes a new ScenarioImport and renders new" do get :new expect(assigns(:scenario_import)).to be_a(ScenarioImport) expect(response).to render_template(:new) ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/services_controller_spec.rb
spec/controllers/services_controller_spec.rb
require 'rails_helper' describe ServicesController do before do sign_in users(:bob) end describe "GET index" do it "only returns sevices of the current user" do get :index expect(assigns(:services).all? {|i| expect(i.user).to eq(users(:bob)) }).to eq(true) end end describe "POST tog...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/scenarios_controller_spec.rb
spec/controllers/scenarios_controller_spec.rb
require 'rails_helper' describe ScenariosController do def valid_attributes(options = {}) { :name => "some_name" }.merge(options) end before do sign_in users(:bob) end describe "GET index" do it "only returns Scenarios for the current user" do get :index expect(assigns(:scenarios).a...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/concerns/sortable_table_spec.rb
spec/controllers/concerns/sortable_table_spec.rb
require 'rails_helper' describe SortableTable do class SortableTestController attr_accessor :params def self.helper(foo) end include SortableTable public :set_table_sort public :table_sort end describe "#set_table_sort" do let(:controller) { SortableTestController.new } let(:d...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/agents/dry_runs_controller_spec.rb
spec/controllers/agents/dry_runs_controller_spec.rb
require 'rails_helper' describe Agents::DryRunsController do def valid_attributes(options = {}) { type: "Agents::WebsiteAgent", name: "Something", options: agents(:bob_website_agent).options, source_ids: [agents(:bob_weather_agent).id, ""] }.merge(options) end before do sign_...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/admin/users_controller_spec.rb
spec/controllers/admin/users_controller_spec.rb
require 'rails_helper' describe Admin::UsersController do describe 'POST #create' do context 'with valid user params' do it 'imports the default scenario for the new user' do expect(DefaultScenarioImporter).to receive(:import).with(kind_of(User)) sign_in users(:jane) post :create, p...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/controllers/users/registrations_controller_spec.rb
spec/controllers/users/registrations_controller_spec.rb
require 'rails_helper' module Users describe RegistrationsController do describe "POST create" do before do @request.env["devise.mapping"] = Devise.mappings[:user] end context 'with valid params' do it "imports the default scenario for the new user" do expect(DefaultS...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/models/agent_log_spec.rb
spec/models/agent_log_spec.rb
# -*- coding: utf-8 -*- require 'rails_helper' describe AgentLog do describe "validations" do before do @log = AgentLog.new(:agent => agents(:jane_website_agent), :message => "The agent did something", :level => 3) expect(@log).to be_valid end it "requires an agent" do @log.agent = nil...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/models/agent_spec.rb
spec/models/agent_spec.rb
require 'rails_helper' describe Agent do it_behaves_like WorkingHelpers describe '.active/inactive' do let(:agent) { agents(:jane_website_agent) } it 'is active per default' do expect(Agent.active).to include(agent) expect(Agent.inactive).not_to include(agent) end it 'is not active w...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
true
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/models/scenario_spec.rb
spec/models/scenario_spec.rb
require 'rails_helper' describe Scenario do let(:new_instance) { users(:bob).scenarios.build(:name => "some scenario") } it_behaves_like HasGuid describe "validations" do before do expect(new_instance).to be_valid end it "validates the presence of name" do new_instance.name = '' ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/models/service_spec.rb
spec/models/service_spec.rb
require 'rails_helper' describe Service do before(:each) do @user = users(:bob) end describe "#toggle_availability!" do it "should toggle the global flag" do @service = services(:generic) expect(@service.global).to eq(false) @service.toggle_availability! expect(@service.global).t...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/models/user_credential_spec.rb
spec/models/user_credential_spec.rb
require 'rails_helper' describe UserCredential do describe "validation" do it { should validate_uniqueness_of(:credential_name).scoped_to(:user_id) } it { should validate_presence_of(:credential_name) } it { should validate_presence_of(:credential_value) } it { should validate_presence_of(:user_id) }...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/models/event_spec.rb
spec/models/event_spec.rb
require 'rails_helper' describe Event do describe ".with_location" do it "selects events with location" do event = events(:bob_website_agent_event) event.lat = 2 event.lng = 3 event.save! expect(Event.with_location.pluck(:id)).to eq([event.id]) event.lat = nil event.sav...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/models/user_spec.rb
spec/models/user_spec.rb
require 'rails_helper' describe User do let(:bob) { users(:bob) } describe "validations" do describe "invitation_code" do context "when configured to use invitation codes" do before do allow(User).to receive(:using_invitation_code?) {true} end it "only accepts ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/models/concerns/oauthable.rb
spec/models/concerns/oauthable.rb
require 'rails_helper' module Agents class OauthableTestAgent < Agent include Oauthable end end shared_examples_for Oauthable do before(:each) do @agent = described_class.new(:name => "somename") @agent.user = users(:jane) end it "should be oauthable" do expect(@agent.oauthable?).to eq(true...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false
huginn/huginn
https://github.com/huginn/huginn/blob/8edec55aab03d4e3f13b205db02d21dc36e34e4f/spec/models/agents/change_detector_agent_spec.rb
spec/models/agents/change_detector_agent_spec.rb
require 'rails_helper' describe Agents::ChangeDetectorAgent do def create_event(output=nil) event = Event.new event.agent = agents(:jane_weather_agent) event.payload = { :command => 'some-command', :output => output } event.save! event end before do @valid_params = { ...
ruby
MIT
8edec55aab03d4e3f13b205db02d21dc36e34e4f
2026-01-04T15:37:27.328445Z
false