source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/ftpsite_agent_spec.rb
Ruby
mit
49,192
master
10,447
require 'rails_helper' require 'time' describe Agents::FtpsiteAgent do describe "checking anonymous FTP" do before do @site = { 'expected_update_period_in_days' => 1, 'url' => "ftp://ftp.example.org/pub/releases/", 'patterns' => ["example*.tar.gz"], 'mode' => 'read', ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/http_status_agent_spec.rb
Ruby
mit
49,192
master
11,500
require 'rails_helper' describe 'HttpStatusAgent' do before do stub_request(:get, 'http://google.com/') end let(:default_url) { 'http://google.com/' } let(:agent_options) do { url: "{{ url | default: '#{default_url}' }}", headers_to_save: '{{ headers_to_save }}', } end let(:agent...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/twitter_search_agent_spec.rb
Ruby
mit
49,192
master
1,391
require 'rails_helper' describe Agents::TwitterSearchAgent do before do # intercept the twitter API request stub_request(:any, /freebandnames.*[?&]tweet_mode=extended/). to_return(body: File.read(Rails.root.join("spec/data_fixtures/search_tweets.json")), headers: { 'Content-Type': 'appl...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/weather_agent_spec.rb
Ruby
mit
49,192
master
2,782
require 'rails_helper' describe Agents::WeatherAgent do let(:agent) do Agents::WeatherAgent.create( name: 'weather', options: { :location => "37.77550,-122.41292", :api_key => 'test', :which_day => 1, } ).tap do |agent| agent.user = users(:bob) agent.sa...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/adioso_agent_spec.rb
Ruby
mit
49,192
master
1,347
require 'rails_helper' describe Agents::AdiosoAgent do before do stub_request(:get, /parse/).to_return(:body => File.read(Rails.root.join("spec/data_fixtures/adioso_parse.json")), :status => 200, :headers => {"Content-Type" => "text/json"}) stub_request(:get, /fares/).to_return(:body => File.read(Rails.root.join(...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/jabber_agent_spec.rb
Ruby
mit
49,192
master
4,991
require 'rails_helper' describe Agents::JabberAgent do let(:sent) { [] } let(:config) { { jabber_server: '127.0.0.1', jabber_port: '5222', jabber_sender: 'foo@localhost', jabber_receiver: 'bar@localhost', jabber_password: 'password', message: 'Warning! {{title}} - {{url}}', ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/post_agent_spec.rb
Ruby
mit
49,192
master
17,942
require 'rails_helper' require 'ostruct' describe Agents::PostAgent do let(:mocked_response) do { status: 200, body: "<html>a webpage!</html>", headers: { 'Content-type' => 'text/html', 'X-Foo-Bar' => 'baz', } } end before do @valid_options = { 'post_url...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/openai_video_generation_agent_spec.rb
Ruby
mit
49,192
master
10,380
require 'rails_helper' describe Agents::OpenaiVideoGenerationAgent do before do @valid_submit_options = { 'api_key' => 'test-api-key', 'model' => 'sora', 'mode' => 'submit', 'prompt' => 'A cat playing piano in a jazz club', 'size' => '1920x1080', 'n' => '1', 'endpoint_pa...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/telegram_agent_spec.rb
Ruby
mit
49,192
master
9,174
require 'rails_helper' describe Agents::TelegramAgent do before do default_options = { auth_token: 'xxxxxxxxx:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx', chat_id: 'xxxxxxxx', caption: '{{ caption }}', disable_web_page_preview: '{{ disable_web_page_preview }}', disable_notification: '{{ si...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/event_formatting_agent_spec.rb
Ruby
mit
49,192
master
6,822
require 'rails_helper' describe Agents::EventFormattingAgent do before do @valid_params = { :name => "somename", :options => { :instructions => { :message => "Received {{content.text}} from {{content.name}} .", :subject => "Weather looks like {{conditio...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/key_value_store_agent_spec.rb
Ruby
mit
49,192
master
4,654
require "rails_helper" describe Agents::KeyValueStoreAgent do let(:value_template) { "{{ _event_ | as_object }}" } let(:agent) do Agents::KeyValueStoreAgent.create!( name: "somename", options: { key: "{{ id }}", value: value_template, variable: "kvs", max_keys: 3, ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/threads_user_agent_spec.rb
Ruby
mit
49,192
master
3,884
require "rails_helper" describe Agents::ThreadsUserAgent do before do @agent = Agents::ThreadsUserAgent.new( name: "Threads watcher", options: { user_id: "me", limit: "25", expected_update_period_in_days: "2", starting_at: "Jan 01 00:00:01 +0000 2020", }, ) ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/de_duplication_agent_spec.rb
Ruby
mit
49,192
master
4,669
require 'rails_helper' describe Agents::DeDuplicationAgent do def create_event(output=nil) event = Event.new event.agent = agents(:jane_weather_agent) event.payload = { :output => output } event.save! event end before do @valid_params = { :property => "{{output}}", ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/twitter_favorites_spec.rb
Ruby
mit
49,192
master
1,966
require 'rails_helper' describe Agents::TwitterFavorites do before do stub_request(:any, /tectonic.*[?&]tweet_mode=extended/) .to_return(body: File.read(Rails.root.join("spec/data_fixtures/user_fav_tweets.json")), headers: { 'Content-Type': 'application/json;charset=utf-8' }, ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/agents/sentiment_agent_spec.rb
Ruby
mit
49,192
master
2,414
require 'rails_helper' describe Agents::SentimentAgent do before do @valid_params = { :name => "somename", :options => { :content => "$.message", :expected_receive_period_in_days => 1 } } @checker = Agents::SentimentAgent....
github
huginn/huginn
https://github.com/huginn/huginn
spec/models/concerns/oauthable.rb
Ruby
mit
49,192
master
871
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...
github
huginn/huginn
https://github.com/huginn/huginn
spec/concerns/sortable_events_spec.rb
Ruby
mit
49,192
master
11,447
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...
github
huginn/huginn
https://github.com/huginn/huginn
spec/concerns/long_runnable_spec.rb
Ruby
mit
49,192
master
4,529
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...
github
huginn/huginn
https://github.com/huginn/huginn
spec/concerns/dry_runnable_spec.rb
Ruby
mit
49,192
master
3,281
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 =...
github
huginn/huginn
https://github.com/huginn/huginn
spec/concerns/form_configurable_spec.rb
Ruby
mit
49,192
master
1,472
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 ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/concerns/liquid_interpolatable_spec.rb
Ruby
mit
49,192
master
19,469
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...
github
huginn/huginn
https://github.com/huginn/huginn
spec/concerns/inheritance_tracking_spec.rb
Ruby
mit
49,192
master
424
require 'rails_helper' 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 overridden with #with_subclasses" do ...
github
huginn/huginn
https://github.com/huginn/huginn
spec/concerns/twitter_concern_spec.rb
Ruby
mit
49,192
master
3,373
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) ...
github
huginn/huginn
https://github.com/huginn/huginn
config/application.rb
Ruby
mit
49,192
master
3,667
require_relative 'boot' require 'rails' require 'securerandom' require 'active_model/railtie' require 'active_job/railtie' require 'active_record/railtie' # require "active_storage/engine" require 'action_controller/railtie' require 'action_mailer/railtie' require 'action_view/railtie' # require "action_cable/engine"...
github
huginn/huginn
https://github.com/huginn/huginn
config/boot.rb
Ruby
mit
49,192
master
235
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../Gemfile', __dir__) require "bundler/setup" # Set up gems listed in the Gemfile. require "bootsnap/setup" # Speed up boot time by caching expensive operations. autoload :Logger, "logger"
github
huginn/huginn
https://github.com/huginn/huginn
config/routes.rb
Ruby
mit
49,192
master
2,613
Rails.application.routes.draw do resources :agents do member do post :run post :handle_details_post put :leave_scenario post :reemit_events delete :remove_events delete :memory, action: :destroy_memory end collection do put :toggle_visibility post :propagat...
github
huginn/huginn
https://github.com/huginn/huginn
config/puma.rb
Ruby
mit
49,192
master
1,563
require "active_support/core_ext/object/blank" require "fileutils" app_dir = File.expand_path("..", __dir__) environment_name = ENV.fetch("RAILS_ENV", "development") socket_path = File.join(app_dir, "tmp/sockets/puma.sock") FileUtils.mkdir_p([ File.join(app_dir, "tmp/pids"), File.join(app_dir, "tmp/sockets") ]) ...
github
huginn/huginn
https://github.com/huginn/huginn
config/deploy.rb
Ruby
mit
49,192
master
1,570
require 'dotenv' Dotenv.load # config valid only for current version of Capistrano lock '3.11.0' set :application, 'huginn' set :repo_url, ENV['CAPISTRANO_DEPLOY_REPO_URL'] || 'https://github.com/huginn/huginn.git' # Default branch is :master set :branch, ENV['CAPISTRANO_DEPLOY_BRANCH'] || ENV['BRANCH'] || 'master' ...
github
huginn/huginn
https://github.com/huginn/huginn
config/environments/production.rb
Ruby
mit
49,192
master
6,471
require "active_support/core_ext/integer/time" Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. # Code is not reloaded between requests. config.enable_reloading = false # Eager load code on boot. This eager loads most of Rails and # your app...
github
huginn/huginn
https://github.com/huginn/huginn
config/environments/test.rb
Ruby
mit
49,192
master
2,765
require 'active_support/core_ext/integer/time' # The test environment is used exclusively to run your application's # test suite. You never need to work with it otherwise. Remember that # your test database is "scratch space" for the test suite and is wiped # and recreated between test runs. Don't rely on the data the...
github
huginn/huginn
https://github.com/huginn/huginn
config/environments/development.rb
Ruby
mit
49,192
master
3,172
require "active_support/core_ext/integer/time" $stdout.sync = true Rails.application.configure do # Settings specified here will take precedence over those in config/application.rb. config.hosts << ENV['DOMAIN'] # In the development environment your application's code is reloaded any time # it changes. This ...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/content_security_policy.rb
Ruby
mit
49,192
master
1,222
# Be sure to restart your server when you modify this file. # Define an application-wide content security policy # For further information see the following documentation # https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Content-Security-Policy # Rails.application.config.content_security_policy do |policy| ...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/multi_xml_patch.rb
Ruby
mit
49,192
master
4,399
# Same vulnerability as CVE-2013-0156 # https://groups.google.com/forum/#!topic/rubyonrails-security/61bkgvnSGTQ/discussion # Code has been submitted back to the project: # https://github.com/sferik/multi_xml/pull/34 # Until the fix is released, use this monkey-patch. require "multi_xml" module MultiXml class...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/mail_encoding_patch.rb
Ruby
mit
49,192
master
393
require 'mail' module Mail module Utilities class ImprovedEncoder < BestEffortCharsetEncoder def pick_encoding(charset) case charset when /\Aiso-2022-jp\z/i Encoding::CP50220 when /\Ashift_jis\z/i Encoding::Windows_31J else super end ...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/permissions_policy.rb
Ruby
mit
49,192
master
384
# Define an application-wide HTTP permissions policy. For further # information see https://developers.google.com/web/updates/2018/06/feature-policy # # Rails.application.config.permissions_policy do |f| # f.camera :none # f.gyroscope :none # f.microphone :none # f.usb :none # f.fullscreen :s...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/liquid.rb
Ruby
mit
49,192
master
1,601
module Liquid # https://github.com/Shopify/liquid/pull/2063 # # The Liquid tokenizer does not handle closing braces inside quoted # strings. A `}` in a quoted filter argument (e.g. a regex # quantifier like `{2,}`) prematurely terminates the `{{ }}` # variable token. # # Override Tokenizer#next_variabl...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/devise.rb
Ruby
mit
49,192
master
15,596
# frozen_string_literal: true require 'utils' require Rails.root.join("lib/omniauth/strategies/tumblr").to_s require Rails.root.join("lib/omniauth/strategies/threads").to_s # Use this hook to configure devise mailer, warden hooks and so forth. # Many of these configuration options can be set straight in your model. De...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/filter_parameter_logging.rb
Ruby
mit
49,192
master
260
# Be sure to restart your server when you modify this file. # Configure sensitive parameters which will be filtered from the log file. Rails.application.config.filter_parameters += [ :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn ]
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/faraday_patch.rb
Ruby
mit
49,192
master
318
# Monkey patch https://github.com/lostisland/faraday/pull/513 # Fixes encoding issue when passing an URL with non UTF-8 characters module Faraday module Utils def unescape(s) string = s.to_s string.force_encoding(Encoding::BINARY) if RUBY_VERSION >= '1.9' CGI.unescape string end end end
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/delayed_job.rb
Ruby
mit
49,192
master
926
Delayed::Worker.destroy_failed_jobs = false Delayed::Worker.max_attempts = 5 Delayed::Worker.max_run_time = (ENV['DELAYED_JOB_MAX_RUNTIME'].presence || 2).to_i.minutes Delayed::Worker.read_ahead = 5 Delayed::Worker.default_priority = 10 Delayed::Worker.delay_jobs = !Rails.env.test? Delayed::Worker.sleep_delay = (ENV['D...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/backtrace_silencers.rb
Ruby
mit
49,192
master
540
# Be sure to restart your server when you modify this file. # You can add backtrace silencers for libraries that you're using but don't wish to see in your backtraces. # Rails.backtrace_cleaner.add_silencer { |line| /my_noisy_library/.match?(line) } # You can also remove all the silencers if you're trying to debug a ...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/wrap_parameters.rb
Ruby
mit
49,192
master
485
# Be sure to restart your server when you modify this file. # This file contains settings for ActionController::ParamsWrapper which # is enabled by default. # Enable parameter wrapping for JSON. You can disable this by setting :format to an empty array. ActiveSupport.on_load(:action_controller) do wrap_parameters f...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/assets.rb
Ruby
mit
49,192
master
944
# Be sure to restart your server when you modify this file. Rails.application.config.assets.enabled = true Rails.application.config.assets.initialize_on_precompile = false # Version of your assets, change this if you want to expire all your assets. Rails.application.config.assets.version = '1.0' # Add additional ass...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/inflections.rb
Ruby
mit
49,192
master
647
# Be sure to restart your server when you modify this file. # Add new inflection rules using the following format. Inflections # are locale specific, and you may define rules for as many different # locales as you wish. All of these examples are active by default: # ActiveSupport::Inflector.inflections(:en) do |inflec...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/action_mailer.rb
Ruby
mit
49,192
master
1,041
ActionMailer::Base.smtp_settings = {}.tap { |config| config[:address] = ENV['SMTP_SERVER'] || 'smtp.gmail.com' config[:port] = ENV['SMTP_PORT']&.to_i || 587 config[:domain] = ENV['SMTP_DOMAIN'] authentication = ENV['SMTP_AUTHENTICATION'].presence || 'plain' user_name = ENV['SMTP_USER_NAME'].presence || 'none...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/application_controller_renderer.rb
Ruby
mit
49,192
master
216
# Be sure to restart your server when you modify this file. # ActiveSupport::Reloader.to_prepare do # ApplicationController.renderer.defaults.merge!( # http_host: 'example.org', # https: false # ) # end
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/cookies_serializer.rb
Ruby
mit
49,192
master
244
# Be sure to restart your server when you modify this file. # Specify a serializer for the signed and encrypted cookie jars. # Valid options are :json, :marshal, and :hybrid. Rails.application.config.action_dispatch.cookies_serializer = :json
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/mysqlpls.rb
Ruby
mit
49,192
master
595
# see https://github.com/rails/rails/issues/9855#issuecomment-28874587 # circumvents the default InnoDB limitation for index prefix bytes maximum when using proper 4byte UTF8 (utf8mb4) # (for server-side workaround see http://dev.mysql.com/doc/refman/5.7/en/innodb-parameters.html#sysvar_innodb_large_prefix) if ENV['ON_...
github
huginn/huginn
https://github.com/huginn/huginn
config/initializers/silence_worker_status_logger.rb
Ruby
mit
49,192
master
232
module SilencedLogger def call(env) return super(env) if env['PATH_INFO'] !~ %r{^/worker_status} Rails.logger.silence(Logger::ERROR) do super(env) end end end Rails::Rack::Logger.send(:prepend, SilencedLogger)
github
huginn/huginn
https://github.com/huginn/huginn
lib/rdbms_functions.rb
Ruby
mit
49,192
master
433
module RdbmsFunctions def rdbms_date_add(source, unit, amount) adapter_type = ActiveRecord::Base.connection.adapter_name.downcase.to_sym case adapter_type when :mysql, :mysql2 "DATE_ADD(`#{source}`, INTERVAL #{amount} #{unit})" when :postgresql "(#{source} + INTERVAL '#{amount} #{u...
github
huginn/huginn
https://github.com/huginn/huginn
lib/huginn_scheduler.rb
Ruby
mit
49,192
master
5,243
require 'rufus/scheduler' class Rufus::Scheduler SCHEDULER_AGENT_TAG = Agents::SchedulerAgent.name class Job # Store an ID of SchedulerAgent in this job. def scheduler_agent_id=(id) self[:scheduler_agent_id] = id end # Extract an ID of SchedulerAgent if any. def scheduler_agent_id ...
github
huginn/huginn
https://github.com/huginn/huginn
lib/agent_runner.rb
Ruby
mit
49,192
master
2,915
require 'cgi' require 'json' require 'rufus-scheduler' require 'pp' require 'twitter' class AgentRunner @@agents = [] def initialize(options = {}) @workers = {} @signal_queue = [] @options = options @options[:only] = [@options[:only]].flatten if @options[:only] @options[:except] = [@options[:e...
github
huginn/huginn
https://github.com/huginn/huginn
lib/gemfile_helper.rb
Ruby
mit
49,192
master
2,386
class GemfileHelper class << self def rails_env ENV['RAILS_ENV'] || case File.basename($0) when 'rspec' 'test' when 'rake' 'test' if ARGV.any?(/\Aspec(?:\z|:)/) end || 'development' end def load_dotenv root = Pathname.new(__dir__).parent ...
github
huginn/huginn
https://github.com/huginn/huginn
lib/weibo_api_client.rb
Ruby
mit
49,192
master
2,372
require "faraday" require "faraday/multipart" require "hashie/mash" class WeiboApiClient API_ROOT = "https://api.weibo.com/2" def initialize(access_token:) @access_token = access_token end def statuses @statuses ||= Statuses.new( form_connection:, multipart_connection: ) end priv...
github
huginn/huginn
https://github.com/huginn/huginn
lib/tumblr_api_client.rb
Ruby
mit
49,192
master
5,972
# frozen_string_literal: true require "faraday" require "simple_oauth" # Minimal Tumblr v2 client covering the endpoints Huginn uses. # rubocop:disable Metrics/ClassLength class TumblrApiClient API_ROOT = "https://api.tumblr.com/" USER_AGENT = "Huginn/TumblrApiClient" STANDARD_POST_OPTIONS = %i[state tags tweet...
github
huginn/huginn
https://github.com/huginn/huginn
lib/liquid_migrator.rb
Ruby
mit
49,192
master
2,652
module LiquidMigrator def self.convert_all_agent_options(agent) agent.options = self.convert_hash(agent.options, {:merge_path_attributes => true, :leading_dollarsign_is_jsonpath => true}) agent.save! end def self.convert_hash(hash, options={}) options = {:merge_path_attributes => false, :leading_doll...
github
huginn/huginn
https://github.com/huginn/huginn
lib/time_tracker.rb
Ruby
mit
49,192
master
516
class TimeTracker attr_accessor :elapsed_time, :result def self.track start = Process.clock_gettime(Process::CLOCK_MONOTONIC) result = yield new(Process.clock_gettime(Process::CLOCK_MONOTONIC) - start, result) end def initialize(elapsed_time, result) @elapsed_time = elapsed_time @result = ...
github
huginn/huginn
https://github.com/huginn/huginn
lib/threads_api_client.rb
Ruby
mit
49,192
master
3,067
require "faraday" class ThreadsApiClient API_ROOT = "https://graph.threads.net/" def initialize(access_token_provider:) @access_token_provider = access_token_provider end def account(fields:) connection.get("/v1.0/me", { fields: }.compact).body end def posts(user_id:, fields:, limit:, since: nil...
github
huginn/huginn
https://github.com/huginn/huginn
lib/json_with_indifferent_access.rb
Ruby
mit
49,192
master
364
class JsonWithIndifferentAccess def self.load(json) ActiveSupport::HashWithIndifferentAccess.new(JSON.parse(json || '{}')) rescue JSON::ParserError Rails.logger.error "Unparsable JSON in JsonWithIndifferentAccess: #{json}" { 'error' => 'unparsable json detected during de-serialization' } end def se...
github
huginn/huginn
https://github.com/huginn/huginn
lib/dropbox_api_client.rb
Ruby
mit
49,192
master
2,656
require "faraday" class DropboxApiClient API_ROOT = "https://api.dropboxapi.com/2" def initialize(access_token:) @access_token = access_token end def ls(path) response = connection.post("files/list_folder", path: normalize_path(path)).body entries = response[:entries] || [] while response[:h...
github
huginn/huginn
https://github.com/huginn/huginn
lib/delayed_job_worker.rb
Ruby
mit
49,192
master
228
class DelayedJobWorker < LongRunnable::Worker include LongRunnable def run @dj = Delayed::Worker.new @dj.start end def stop @dj.stop if @dj end def self.setup_worker [new(id: self.to_s)] end end
github
huginn/huginn
https://github.com/huginn/huginn
lib/location.rb
Ruby
mit
49,192
master
2,085
require 'liquid' Location = Struct.new(:lat, :lng, :radius, :speed, :course) class Location include LiquidDroppable protected :[]= def initialize(data = {}) super() case data when Array raise ArgumentError, 'unsupported location data' unless data.size == 2 self.lat, self.lng = data ...
github
huginn/huginn
https://github.com/huginn/huginn
lib/feedjira_extension.rb
Ruby
mit
49,192
master
7,177
require 'feedjira' require 'digest' require 'mail' module FeedjiraExtension AUTHOR_ATTRS = %i[name email uri] LINK_ATTRS = %i[href rel type hreflang title length] ENCLOSURE_ATTRS = %i[url type length] class Author < Struct.new(*AUTHOR_ATTRS) def empty? all?(&:nil?) end def to_json(options =...
github
huginn/huginn
https://github.com/huginn/huginn
lib/utils.rb
Ruby
mit
49,192
master
5,221
require 'jsonpath' require 'cgi' require 'uri' require 'addressable/uri' module Utils def self.unindent(s) s = s.gsub(/\t/, ' ').chomp min = ((s.split("\n").find {|l| l !~ /^\s*$/ })[/^\s+/, 0] || "").length if min > 0 s.gsub(/^#{" " * min}/, "") else s end end def self.pretty_p...
github
huginn/huginn
https://github.com/huginn/huginn
lib/agents_exporter.rb
Ruby
mit
49,192
master
2,172
class AgentsExporter attr_accessor :options def initialize(options) self.options = options end # Filename should have no commas or special characters to support Content-Disposition on older browsers. def filename ((options[:name] || '').downcase.gsub(/[^a-z0-9_-]/, '-').gsub(/-+/, '-').gsub(/^-|-$/,...
github
huginn/huginn
https://github.com/huginn/huginn
lib/google_calendar.rb
Ruby
mit
49,192
master
2,362
require 'googleauth' require 'google/apis/calendar_v3' class GoogleCalendar def initialize(config, logger) @config = config if @config['google']['key'].present? # https://github.com/google/google-auth-library-ruby/issues/65 # https://github.com/google/google-api-ruby-client/issues/370 ENV[...
github
huginn/huginn
https://github.com/huginn/huginn
lib/setup_tools.rb
Ruby
mit
49,192
master
2,782
require 'open3' require 'io/console' require 'securerandom' require 'shellwords' require 'active_support/core_ext/object/blank' module SetupTools def capture(cmd, opts = {}) if opts.delete(:no_stderr) o, s = Open3.capture2(cmd, opts) else o, s = Open3.capture2e(cmd, opts) end o.strip en...
github
huginn/huginn
https://github.com/huginn/huginn
lib/omniauth/strategies/threads.rb
Ruby
mit
49,192
master
1,267
require "omniauth-oauth2" module OmniAuth module Strategies # OmniAuth strategy for Meta Threads. class Threads < OmniAuth::Strategies::OAuth2 option :name, "threads" option :client_options, { site: "https://graph.threads.net", authorize_url: "https://threads.net/oauth/authorize"...
github
huginn/huginn
https://github.com/huginn/huginn
lib/omniauth/strategies/tumblr.rb
Ruby
mit
49,192
master
1,755
# frozen_string_literal: true require "json" require "omniauth-oauth" require "uri" module OmniAuth module Strategies # OmniAuth strategy for Tumblr. class Tumblr < OmniAuth::Strategies::OAuth option :name, "tumblr" option :client_options, { site: "https://www.tumblr.com", reques...
github
huginn/huginn
https://github.com/huginn/huginn
lib/capistrano/sync.rb
Ruby
mit
49,192
master
5,953
require 'yaml' require 'pathname' require 'dotenv' # Edited by Andrew Cantino. Based on: https://gist.github.com/339471 # Original info: # # Capistrano sync.rb task for syncing databases and directories between the # local development environment and different multi_stage environments. You # cannot sync directly bet...
github
huginn/huginn
https://github.com/huginn/huginn
lib/utils/html_transformer.rb
Ruby
mit
49,192
master
2,991
module Utils module HtmlTransformer SINGLE = 1 MULTIPLE = 2 COMMA_SEPARATED = 3 SRCSET = 4 URI_ATTRIBUTES = { 'a' => { 'href' => SINGLE }, 'applet' => { 'archive' => COMMA_SEPARATED, 'codebase' => SINGLE }, 'area' => { 'href' => SINGLE }, 'audio' => { 'src' => SINGLE }, ...
github
huginn/huginn
https://github.com/huginn/huginn
lib/tasks/icon.rake
Ruby
mit
49,192
master
2,234
ICONS_DIR = 'public' ORIGINAL_IMAGE = 'media/huginn-icon-square.svg' desc "Generate site icons from #{ORIGINAL_IMAGE}" task :icons => 'icon:all' namespace :icon do # iOS task :all => :ios [ 57, 114, 60, 120, 180, 72, 144, 76, 152, ].each do |width| sizes = '%1$dx%1$d' % width fil...
github
huginn/huginn
https://github.com/huginn/huginn
lib/tasks/database_test.rake
Ruby
mit
49,192
master
233
namespace :database_test do desc "Ping the database" task :ping do require 'active_record' require 'mysql2' require 'pg' ActiveRecord::Base.establish_connection ActiveRecord::Base.connection.verify! end end
github
huginn/huginn
https://github.com/huginn/huginn
lib/tasks/rspec.rake
Ruby
mit
49,192
master
280
if defined? RSpec namespace :spec do desc 'Run all specs in spec directory (exluding feature specs)' RSpec::Core::RakeTask.new(:nofeatures) do |task| ENV['RSPEC_TASK'] = 'spec:nofeatures' task.exclude_pattern = "spec/features/**/*_spec.rb" end end end
github
huginn/huginn
https://github.com/huginn/huginn
lib/tasks/production.rake
Ruby
mit
49,192
master
2,304
def failed; "[ \033[31mFAIL\033[0m ]"; end def ok; "[ \033[32mOK\033[0m ]"; end def run_as_root return true if ENV['USER'] == 'root' puts "#{failed} Please run this command as root or with sudo\n\n" exit -1 end def runit_installed return true unless `which sv` && $?.to_i != 0 puts "#{failed} Please in...
github
huginn/huginn
https://github.com/huginn/huginn
lib/tasks/vendor.rake
Ruby
mit
49,192
master
1,672
require_relative "../gemfile_helper" require "bundler" require "pathname" namespace :vendor do desc "Update the vendored dotenv gem from RubyGems" task :update_dotenv, [:version] do |_task, args| require "fileutils" root = Pathname.new(__dir__).join("../..").expand_path vendor_root = root.join("vendor...
github
huginn/huginn
https://github.com/huginn/huginn
db/seeds.rb
Ruby
mit
49,192
master
247
# This file should contain all the record creation needed to seed the database with its default values. # The data can then be loaded with the rake db:seed (or created alongside the db with db:setup). require_relative 'seeds/seeder' Seeder.seed
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20160423163416_add_xml_namespace_option_to_data_output_agents.rb
Ruby
mit
49,192
master
458
class AddXmlNamespaceOptionToDataOutputAgents < ActiveRecord::Migration[4.2] def up Agents::DataOutputAgent.find_each do |agent| agent.options['ns_media'] = 'true' agent.options['ns_itunes'] = 'true' agent.save!(validate: false) end end def down Agents::DataOutputAgent.find_each do ...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20170307190555_add_min_events_option_to_peak_detector_agents.rb
Ruby
mit
49,192
master
495
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...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20121223203701_create_delayed_jobs.rb
Ruby
mit
49,192
master
1,265
class CreateDelayedJobs < ActiveRecord::Migration[4.2] def self.up create_table :delayed_jobs, :force => true do |table| table.integer :priority, :default => 0 # Allows some jobs to jump to the front of the queue table.integer :attempts, :default => 0 # Provides for retries, but still fail...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20120919061122_enable_lockable_strategy_for_devise.rb
Ruby
mit
49,192
master
436
class EnableLockableStrategyForDevise < ActiveRecord::Migration[4.2] def up add_column :users, :failed_attempts, :integer, :default => 0 add_column :users, :unlock_token, :string add_column :users, :locked_at, :datetime add_index :users, :unlock_token, :unique => true end def down remove_col...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20160823151303_set_emit_error_event_for_twitter_action_agents.rb
Ruby
mit
49,192
master
402
class SetEmitErrorEventForTwitterActionAgents < ActiveRecord::Migration[4.2] def up Agents::TwitterActionAgent.find_each do |agent| agent.options['emit_error_events'] = 'true' agent.save!(validate: false) end end def down Agents::TwitterActionAgent.find_each do |agent| agent.options...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20230622140301_delete_empty_keys_and_values_from_key_value_store_agents.rb
Ruby
mit
49,192
master
275
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
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20120728210244_devise_create_users.rb
Ruby
mit
49,192
master
1,487
class DeviseCreateUsers < ActiveRecord::Migration[4.2] def change create_table(:users) do |t| ## Database authenticatable t.string :email, :null => false, :default => "" t.string :encrypted_password, :null => false, :default => "" ## Recoverable t.string :reset_passwo...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20260329000000_retire_coffeescript_from_javascript_agents.rb
Ruby
mit
49,192
master
2,743
require "open3" class RetireCoffeescriptFromJavascriptAgents < ActiveRecord::Migration[8.1] def up converted_credentials = {} ActiveRecord::Base.transaction do each_legacy_coffeescript_agent do |agent| credential_name = credential_referenced_by_code(agent.options["code"]) if credential...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20140605032822_add_guid_to_agents.rb
Ruby
mit
49,192
master
325
class AddGuidToAgents < ActiveRecord::Migration[4.2] class Agent < ActiveRecord::Base; end def change add_column :agents, :guid, :string Agent.find_each do |agent| agent.update_attribute :guid, SecureRandom.hex end change_column_null :agents, :guid, false add_index :agents, :guid end...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20161124061256_convert_website_agent_template_for_merge.rb
Ruby
mit
49,192
master
1,040
class ConvertWebsiteAgentTemplateForMerge < ActiveRecord::Migration[5.0] def up Agents::WebsiteAgent.find_each do |agent| extract = agent.options['extract'].presence template = agent.options['template'].presence next unless extract.is_a?(Hash) && template.is_a?(Hash) (extract.keys - templ...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20140602014917_add_indices_to_scenarios.rb
Ruby
mit
49,192
master
240
class AddIndicesToScenarios < ActiveRecord::Migration[4.2] def change add_index :scenarios, [:user_id, :guid], :unique => true add_index :scenario_memberships, :agent_id add_index :scenario_memberships, :scenario_id end end
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20160301113717_add_confirmable_attributes_to_users.rb
Ruby
mit
49,192
master
564
class AddConfirmableAttributesToUsers < ActiveRecord::Migration[4.2] def change change_table(:users) do |t| ## Confirmable t.string :confirmation_token t.datetime :confirmed_at t.datetime :confirmation_sent_at t.string :unconfirmed_email # Only if using reconfirmable end ...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20121216025930_create_events.rb
Ruby
mit
49,192
master
408
class CreateEvents < ActiveRecord::Migration[4.2] def change create_table :events do |t| t.integer :user_id t.integer :agent_id t.decimal :lat, :precision => 15, :scale => 10 t.decimal :lng, :precision => 15, :scale => 10 t.text :payload t.timestamps end add_index :ev...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20140408150825_rename_webhook_to_web_request.rb
Ruby
mit
49,192
master
232
class RenameWebhookToWebRequest < ActiveRecord::Migration[4.2] def up rename_column :agents, :last_webhook_at, :last_web_request_at end def down rename_column :agents, :last_web_request_at, :last_webhook_at end end
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20160607055850_change_events_order_to_events_list_order.rb
Ruby
mit
49,192
master
758
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::...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20150219213604_add_type_option_attribute_to_pushbullet_agents.rb
Ruby
mit
49,192
master
456
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| ...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20121222074732_create_links.rb
Ruby
mit
49,192
master
237
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
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20140722131220_convert_efa_skip_agent.rb
Ruby
mit
49,192
master
662
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}}' ...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20140505201716_migrate_agents_to_liquid_templating.rb
Ruby
mit
49,192
master
1,998
require 'liquid_migrator' class MigrateAgentsToLiquidTemplating < ActiveRecord::Migration[4.2] def up Agent.where(:type => 'Agents::HipchatAgent').each do |agent| LiquidMigrator.convert_all_agent_options(agent) end Agent.where(:type => 'Agents::EventFormattingAgent').each do |agent| agent.opt...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20120919063304_add_username_to_users.rb
Ruby
mit
49,192
master
428
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...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20160224120316_add_mode_option_to_ftpsite_agents.rb
Ruby
mit
49,192
master
352
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...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20260402000000_convert_service_options_to_json_serialization.rb
Ruby
mit
49,192
master
1,693
# Converts legacy YAML-serialized service options into JSON strings. class ConvertServiceOptionsToJsonSerialization < ActiveRecord::Migration[8.1] def up return if native_json_column? each_service_option do |id, raw_options| update_service_options(id, JSON.dump(parse_yaml_or_json(raw_options))) end...
github
huginn/huginn
https://github.com/huginn/huginn
db/migrate/20140509170443_create_scenario_memberships.rb
Ruby
mit
49,192
master
247
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