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
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
lib/generators/active_admin/devise/devise_generator.rb
Ruby
mit
9,684
master
2,525
# frozen_string_literal: true require_relative "../../../active_admin/error" require_relative "../../../active_admin/dependency" module ActiveAdmin module Generators class DeviseGenerator < Rails::Generators::NamedBase desc "Creates an admin user and uses Devise for authentication" argument :name, ty...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
lib/generators/active_admin/page/page_generator.rb
Ruby
mit
9,684
master
310
# frozen_string_literal: true module ActiveAdmin module Generators class PageGenerator < Rails::Generators::NamedBase source_root File.expand_path("templates", __dir__) def generate_config_file template "page.rb", "app/admin/#{file_path.tr('/', '_')}.rb" end end end end
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
lib/generators/active_admin/resource/resource_generator.rb
Ruby
mit
9,684
master
1,517
# frozen_string_literal: true module ActiveAdmin module Generators class ResourceGenerator < Rails::Generators::NamedBase desc "Registers resources with Active Admin" source_root File.expand_path("templates", __dir__) def generate_config_file template "resource.rb.erb", "app/admin/#{fi...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
lib/generators/active_admin/install/install_generator.rb
Ruby
mit
9,684
master
1,807
# frozen_string_literal: true require "rails/generators/active_record" module ActiveAdmin module Generators class InstallGenerator < ActiveRecord::Generators::Base desc "Installs Active Admin and generates the necessary migrations" argument :name, type: :string, default: "AdminUser" hook_for :...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
lib/generators/active_admin/install/templates/dashboard.rb
Ruby
mit
9,684
master
744
# frozen_string_literal: true ActiveAdmin.register_page "Dashboard" do menu priority: 1, label: proc { I18n.t("active_admin.dashboard") } content title: proc { I18n.t("active_admin.dashboard") } do div class: "px-4 py-16 md:py-32 text-center m-auto max-w-3xl" do h2 "Welcome to ActiveAdmin", class: "text-...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
tasks/local.rake
Ruby
mit
9,684
master
954
# frozen_string_literal: true desc "Run a command against the local sample application" task :local do require_relative "test_application" test_application = ActiveAdmin::TestApplication.new( rails_env: "development", template: "rails_template_with_data" ) test_application.soft_generate # Discard t...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
tasks/dependencies.rake
Ruby
mit
9,684
master
726
# frozen_string_literal: true namespace :dependencies do desc "Copy package.json dependencies into vendor/javascript" task :vendor do node_modules = File.expand_path("../node_modules", __dir__) vendor = File.expand_path("../vendor/javascript", __dir__) # Copy flowbite to vendor FileUtils.cp( ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
tasks/test.rake
Ruby
mit
9,684
master
2,148
# frozen_string_literal: true desc "Run the full suite using parallel_tests to run on multiple cores" task test: [:setup, :spec, :cucumber] desc "Create a test rails app for the parallel specs to run against if it doesn't exist already" task setup: :"setup:create" namespace :setup do desc "Forcefully create a test ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
tasks/test_application.rb
Ruby
mit
9,684
master
2,575
# frozen_string_literal: true require "fileutils" module ActiveAdmin class TestApplication attr_reader :rails_env, :template def initialize(opts = {}) @rails_env = opts[:rails_env] || "test" @template = opts[:template] || "rails_template" end def soft_generate if File.exist? app_d...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
tasks/release.rake
Ruby
mit
9,684
master
368
# frozen_string_literal: true require "open3" namespace :release do desc "Publish npm package" task :npm_push do npm_version, _error, _status = Open3.capture3("npm pkg get version") npm_tag = npm_version.include?("-") ? "pre" : "latest" system "npm", "publish", "--tag", npm_tag, exception: true end e...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
tasks/bug_report_template.rb
Ruby
mit
9,684
master
3,144
# frozen_string_literal: true require "bundler/inline" gemfile(true) do source "https://rubygems.org" # Use `ACTIVE_ADMIN_PATH=. ruby tasks/bug_report_template.rb` to run # locally, otherwise run against the default branch. if ENV["ACTIVE_ADMIN_PATH"] gem "activeadmin", path: ENV["ACTIVE_ADMIN_PATH"], req...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/breadcrumb_steps.rb
Ruby
mit
9,684
master
381
# frozen_string_literal: true Around "@breadcrumb" do |scenario, block| previous_breadcrumb = ActiveAdmin.application.breadcrumb begin block.call ensure ActiveAdmin.application.breadcrumb = previous_breadcrumb end end Then(/^I should see a link to "([^"]*)" in the breadcrumb$/) do |text| expect(page...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/action_link_steps.rb
Ruby
mit
9,684
master
490
# frozen_string_literal: true Then(/^I should see a member link to "([^"]*)"$/) do |name| expect(page).to have_css(".data-table-resource-actions > a", text: name) end Then(/^I should not see a member link to "([^"]*)"$/) do |name| %{Then I should not see "#{name}" within ".data-table-resource-actions > a"} end Th...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/web_steps.rb
Ruby
mit
9,684
master
3,543
# frozen_string_literal: true require "uri" require File.expand_path(File.join(__dir__, "..", "support", "paths")) module WithinHelpers def with_scope(locator) locator ? within(*selector_for(locator)) { yield } : yield end private def selector_for(locator) case locator # Add more mappings here. ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/configuration_steps.rb
Ruby
mit
9,684
master
1,721
# frozen_string_literal: true module ActiveAdminReloading def load_aa_config(config_content) ActiveSupport::Notifications.instrument ActiveAdmin::Application::BeforeLoadEvent, { active_admin_application: ActiveAdmin.application } eval(config_content) ActiveSupport::Notifications.instrument ActiveAdmin::Ap...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/additional_web_steps.rb
Ruby
mit
9,684
master
2,521
# frozen_string_literal: true Then(/^I should see a table header with "([^"]*)"$/) do |content| expect(page).to have_xpath "//th", text: content end Then(/^I should not see a table header with "([^"]*)"$/) do |content| expect(page).to have_no_xpath "//th", text: content end Then(/^I should see a sortable table he...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/factory_steps.rb
Ruby
mit
9,684
master
1,688
# frozen_string_literal: true def create_user(name, type = "User") first_name, last_name = name.split(" ") type.camelize.constantize.where(first_name: first_name, last_name: last_name).first_or_create(username: name.tr(" ", "").underscore) end Given(/^(a|\d+)( published)?( unstarred|starred)? posts?(?: with the ti...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/format_steps.rb
Ruby
mit
9,684
master
2,468
# frozen_string_literal: true require "csv" Around "@csv" do |scenario, block| default_csv_options = ActiveAdmin.application.csv_options default_disable_streaming_in = ActiveAdmin.application.disable_streaming_in begin block.call ensure ActiveAdmin.application.disable_streaming_in = default_disable_st...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/index_scope_steps.rb
Ruby
mit
9,684
master
1,475
# frozen_string_literal: true Then(/^I should( not)? see the scope "([^"]*)"( selected)?$/) do |negate, name, selected| should = "I should#{' not' if negate}" scope = ".scopes#{' .index-button-selected' if selected}" step %{#{should} see "#{name}" within "#{scope}"} end Then(/^I should see the scope "([^"]*)" no...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/pagination_steps.rb
Ruby
mit
9,684
master
526
# frozen_string_literal: true Then(/^I should not see pagination$/) do expect(page).to have_no_css "[data-test-pagination]" end Then(/^I should see pagination page (\d+) link$/) do |num| expect(page).to have_css "[data-test-pagination] a", text: num, count: 1 end Then(/^I should see the pagination "Next" link/) d...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/root_steps.rb
Ruby
mit
9,684
master
211
# frozen_string_literal: true Around "@root" do |scenario, block| previous_root = ActiveAdmin.application.root_to begin block.call ensure ActiveAdmin.application.root_to = previous_root end end
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/comment_steps.rb
Ruby
mit
9,684
master
1,061
# frozen_string_literal: true Then(/^I should see a comment by "([^"]*)"$/) do |name| step %{I should see "#{name}" within "[data-test-comment-container]"} end Then(/^I should( not)? be able to add a comment$/) do |negate| should = negate ? :not_to : :to expect(page).send should, have_button("Add Comment") end ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/filter_steps.rb
Ruby
mit
9,684
master
2,038
# frozen_string_literal: true Around "@filters" do |scenario, block| previous_current_filters = ActiveAdmin.application.current_filters begin block.call ensure ActiveAdmin.application.current_filters = previous_current_filters end end Then(/^I should see a select filter for "([^"]*)"$/) do |label| e...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/batch_action_steps.rb
Ruby
mit
9,684
master
2,004
# frozen_string_literal: true Then(/^I (should|should not) see the batch action :([^\s]*) "([^"]*)"$/) do |maybe, sym, title| selector = "[data-batch-action-item]" selector += "[href='#'][data-action='#{sym}']" if maybe == "should" verb = maybe == "should" ? :to : :to_not expect(page).send verb, have_css(selec...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/table_steps.rb
Ruby
mit
9,684
master
3,156
# frozen_string_literal: true Then(/^I should see (\d+) ([\w]*) in the table$/) do |count, resource_type| expect(page).to have_css(".data-table tr > td:first-child", count: count.to_i) end Then("I should see {string} in the table") do |string| expect(page).to have_css(".data-table tr > td", text: string) end Then...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/filesystem_steps.rb
Ruby
mit
9,684
master
1,637
# frozen_string_literal: true module ActiveAdminContentsRollback def files @files ||= {} end # Records the contents of a file the first time we are # about to change it def record(filename) contents = File.read(filename) rescue nil files[filename] = contents unless files.has_key? filename end ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/action_item_steps.rb
Ruby
mit
9,684
master
320
# frozen_string_literal: true Then(/^I should see an action item link to "([^"]*)"$/) do |link| expect(page).to have_css("[data-test-action-items] > a", text: link) end Then(/^I should not see an action item link to "([^"]*)"$/) do |link| expect(page).to have_no_css("[data-test-action-items] > a", text: link) end
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/user_steps.rb
Ruby
mit
9,684
master
1,495
# frozen_string_literal: true def ensure_user_created(email) AdminUser.create_with(password: "password", password_confirmation: "password").find_or_create_by!(email: email) end Given(/^(?:I am logged|log) out$/) do click_on "Sign out" if page.all(:css, "a", text: "Sign out").any? end Given(/^I am logged in$/) do ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/site_title_steps.rb
Ruby
mit
9,684
master
364
# frozen_string_literal: true Around "@site_title" do |scenario, block| previous_site_title = ActiveAdmin.application.site_title begin block.call ensure ActiveAdmin.application.site_title = previous_site_title end end Then(/^I should see the site title "([^"]*)"$/) do |title| expect(page).to have_cs...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/menu_steps.rb
Ruby
mit
9,684
master
816
# frozen_string_literal: true Then(/^I should see a menu item for "([^"]*)"$/) do |name| expect(page).to have_css "#main-menu li a", text: name end Then(/^I should not see a menu item for "([^"]*)"$/) do |name| expect(page).to have_no_css "#main-menu li a", text: name end Then(/^the "([^"]*)" menu item should be ...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/step_definitions/attribute_steps.rb
Ruby
mit
9,684
master
712
# frozen_string_literal: true Then(/^I should( not)? see the attribute "([^"]*)" with "([^"]*)"$/) do |negate, title, value| elems = all ".attributes-table th:contains('#{title}') ~ td:contains('#{value}')" if negate expect(elems.first).to eq(nil), "attribute missing" else expect(elems.first).to_not eq(n...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/support/rails.rb
Ruby
mit
9,684
master
265
# frozen_string_literal: true require "cucumber/rails/application" require "cucumber/rails/action_dispatch" require "cucumber/rails/world" require "cucumber/rails/hooks" require "cucumber/rails/capybara" require "cucumber/rails/database" MultiTest.disable_autorun
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/support/env.rb
Ruby
mit
9,684
master
2,733
# frozen_string_literal: true ENV["RAILS_ENV"] = "test" require "simplecov" if ENV["COVERAGE"] == "true" Dir["#{File.expand_path('../step_definitions', __dir__)}/*.rb"].each do |f| require f end require_relative "../../tasks/test_application" require "#{ActiveAdmin::TestApplication.new.full_app_dir}/config/enviro...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
features/support/paths.rb
Ruby
mit
9,684
master
2,062
# frozen_string_literal: true module NavigationHelpers # Maps a name to a path. Used by the # # When /^I go to (.+)$/ do |page_name| # # step definition in web_steps.rb # def path_to(page_name) case page_name when /the dashboard/ "/admin" when /the new post page/ "/admin/posts/n...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
gemfiles/rails_72/Gemfile
Ruby
mit
9,684
master
855
# frozen_string_literal: true source "https://rubygems.org" group :development, :test do gem "rake" gem "cancancan" gem "pundit" gem "draper" gem "devise" gem "rails", "~> 7.2.0" gem "sprockets-rails" gem "ransack", ">= 4.2.0" gem "formtastic", ">= 6.0.0" gem "cssbundling-rails" gem "importm...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
gemfiles/rails_80/Gemfile
Ruby
mit
9,684
master
855
# frozen_string_literal: true source "https://rubygems.org" group :development, :test do gem "rake" gem "cancancan" gem "pundit" gem "draper" gem "devise" gem "rails", "~> 8.0.0" gem "sprockets-rails" gem "ransack", ">= 4.2.0" gem "formtastic", ">= 6.0.0" gem "cssbundling-rails" gem "importm...
github
activeadmin/activeadmin
https://github.com/activeadmin/activeadmin
config/importmap.rb
Ruby
mit
9,684
master
438
# frozen_string_literal: true pin "flowbite", preload: true # downloaded from https://cdn.jsdelivr.net/npm/flowbite@3.1.2/dist/flowbite.min.js pin "@rails/ujs", to: "rails_ujs_esm.js", preload: true # downloaded from https://cdn.jsdelivr.net/npm/@rails/ujs@7.1.501/+esm pin "active_admin", to: "active_admin.js", preload...
github
resque/resque
https://github.com/resque/resque
config.ru
Ruby
mit
9,468
master
427
#!/usr/bin/env ruby require 'logger' $LOAD_PATH.unshift ::File.expand_path(::File.dirname(__FILE__) + '/lib') require 'resque/server' # Set the RESQUECONFIG env variable if you've a `resque.rb` or similar # config file you want loaded on boot. if ENV['RESQUECONFIG'] && ::File.exist?(::File.expand_path(ENV['RESQUECONF...
github
resque/resque
https://github.com/resque/resque
resque.gemspec
Ruby
mit
9,468
master
2,106
$LOAD_PATH.unshift 'lib' require 'resque/version' Gem::Specification.new do |s| s.name = "resque" s.version = Resque::VERSION s.summary = "Resque is a Redis-backed queueing system." s.homepage = "https://github.com/resque/resque" s.email = "steve@stevekla...
github
resque/resque
https://github.com/resque/resque
Gemfile
Ruby
mit
9,468
master
489
source "https://rubygems.org" gemspec case redis_version = ENV.fetch('REDIS_VERSION', 'latest') when 'latest' gem 'redis', '~> 5.0' else gem 'redis', "~> #{redis_version}.0" end rack_version = ENV.fetch('RACK_VERSION', '3') gem "rack", "~> #{rack_version}.0" if rack_version.to_i >= 3 gem "rackup" end gem "ben...
github
resque/resque
https://github.com/resque/resque
Rakefile
Ruby
mit
9,468
master
1,531
# # Setup # load 'lib/tasks/redis.rake' $LOAD_PATH.unshift 'lib' require 'resque/tasks' def command?(command) system("type #{command} > /dev/null 2>&1") end require 'rubygems' require 'bundler/setup' require 'bundler/gem_tasks' # # Tests # require 'rake/testtask' task :default => :test Rake::TestTask.new do ...
github
resque/resque
https://github.com/resque/resque
test/plugin_test.rb
Ruby
mit
9,468
master
3,476
require 'test_helper' describe "Resque::Plugin finding hooks" do module SimplePlugin extend self def before_perform1; end def before_perform; end def before_perform2; end def after_perform1; end def after_perform; end def after_perform2; end def perform; end def around_perform1; e...
github
resque/resque
https://github.com/resque/resque
test/stat_test.rb
Ruby
mit
9,468
master
1,855
require 'test_helper' describe "Resque::Stat" do class DummyStatStore def initialize @stat = Hash.new(0) end def stat(stat) @stat[stat] end def increment_stat(stat, by = 1, redis: nil) @stat[stat] += by end def decrement_stat(stat, by) @stat[stat] -= by end ...
github
resque/resque
https://github.com/resque/resque
test/test_helper.rb
Ruby
mit
9,468
master
5,810
require 'rubygems' require 'bundler/setup' require 'minitest/autorun' require 'redis/namespace' require 'mocha/minitest' require 'tempfile' $dir = File.dirname(File.expand_path(__FILE__)) $LOAD_PATH.unshift $dir + '/../lib' ENV['TERM_CHILD'] = "1" require 'resque' $TEST_PID=Process.pid begin require 'leftright' res...
github
resque/resque
https://github.com/resque/resque
test/logging_test.rb
Ruby
mit
9,468
master
574
require 'test_helper' require 'minitest/mock' describe "Resque::Logging" do it "sets and receives the active logger" do my_logger = Object.new Resque.logger = my_logger assert_equal my_logger, Resque.logger end %w(debug info error fatal).each do |severity| it "logs #{severity} messages" do ...
github
resque/resque
https://github.com/resque/resque
test/resque_test.rb
Ruby
mit
9,468
master
11,389
require 'test_helper' describe "Resque" do before do @original_redis = Resque.redis @original_stat_data_store = Resque.stat_data_store end after do Resque.redis = @original_redis Resque.stat_data_store = @original_stat_data_store end it "can push an item that depends on redis for encoding" ...
github
resque/resque
https://github.com/resque/resque
test/job_plugins_test.rb
Ruby
mit
9,468
master
5,834
require 'test_helper' describe "Multiple plugins with multiple hooks" do include PerformJob module Plugin1 def before_perform_record_history1(history) history << :before1 end def after_perform_record_history1(history) history << :after1 end end module Plugin2 def before_perfor...
github
resque/resque
https://github.com/resque/resque
test/resque_hook_test.rb
Ruby
mit
9,468
master
4,408
require 'test_helper' require 'tempfile' describe "Resque Hooks" do class CallNotifyJob def self.perform $called = true end end before do $called = false @worker = Resque::Worker.new(:jobs) end it 'retrieving hooks if none have been set' do assert_equal [], Resque.before_first_for...
github
resque/resque
https://github.com/resque/resque
test/child_killing_test.rb
Ruby
mit
9,468
master
5,043
require 'test_helper' require 'tmpdir' describe "Resque::Worker" do class LongRunningJob @queue = :long_running_job def self.perform( sleep_time, rescue_time=nil ) Resque.redis.disconnect! # get its own connection Resque.redis.rpush( 'sigterm-test:start', Process.pid ) sleep sleep_time ...
github
resque/resque
https://github.com/resque/resque
test/resque_failure_redis_test.rb
Ruby
mit
9,468
master
3,340
require 'test_helper' require 'resque/failure/redis' describe "Resque::Failure::Redis" do let(:bad_string) { [39, 52, 127, 86, 93, 95, 39].map { |c| c.chr }.join } let(:exception) { StandardError.exception(bad_string) } let(:worker) { Resque::Worker.new(:test) } let(:queue) { "queue" } let(:payload...
github
resque/resque
https://github.com/resque/resque
test/server_helper_test.rb
Ruby
mit
9,468
master
3,289
require 'test_helper' require 'resque/server_helper' describe 'Resque::ServerHelper' do include Resque::ServerHelper def exists?(key) if Gem::Version.new(Redis::VERSION) >= Gem::Version.new('4.2.0') Resque.redis.exists?(key) else Resque.redis.exists(key) end end describe 'redis_get_si...
github
resque/resque
https://github.com/resque/resque
test/worker_test.rb
Ruby
mit
9,468
master
45,427
require 'test_helper' require 'tmpdir' describe "Resque::Worker" do class DummyLogger def initialize @rd, @wr = IO.pipe end def info(message); @wr << message << "\0"; end alias_method :debug, :info alias_method :warn, :info alias_method :error, :info alias_method :fatal, :info ...
github
resque/resque
https://github.com/resque/resque
test/resque-web_runner_test.rb
Ruby
mit
9,468
master
5,741
require 'test_helper' require 'rack/test' require 'resque/server' require 'resque/web_runner' describe 'Resque::WebRunner' do def get_rackup_or_rack_handler Resque::WebRunner.get_rackup_or_rack_handler end def web_runner(*args) Resque::WebRunner.any_instance.stubs(:daemonize!).once rack_server = Re...
github
resque/resque
https://github.com/resque/resque
test/resque-web_test.rb
Ruby
mit
9,468
master
3,778
require 'test_helper' require 'rack/test' require 'resque/server' describe "Resque web" do include Rack::Test::Methods def app Resque::Server.new end def default_host 'localhost' end # Root path test describe "on GET to /" do before { get "/" } it "redirect to overview" do follo...
github
resque/resque
https://github.com/resque/resque
test/failure_base_test.rb
Ruby
mit
9,468
master
301
require 'test_helper' require 'minitest/mock' require 'resque/failure/base' class TestFailure < Resque::Failure::Base end describe "Base failure class" do it "allows calling all without throwing" do with_failure_backend TestFailure do assert_empty Resque::Failure.all end end end
github
resque/resque
https://github.com/resque/resque
test/rake_test.rb
Ruby
mit
9,468
master
2,315
require "rake" require "test_helper" require "mocha" describe "rake tasks" do before do Rake.application.rake_require "tasks/resque" end after do ENV['QUEUES'] = nil ENV['VVERBOSE'] = nil ENV['VERBOSE'] = nil end describe 'resque:work' do it "requires QUEUE environment variable" do ...
github
resque/resque
https://github.com/resque/resque
test/airbrake_test.rb
Ruby
mit
9,468
master
820
require 'test_helper' begin require 'airbrake' rescue LoadError warn "Install airbrake gem to run Airbrake tests." end if defined? Airbrake::AIRBRAKE_VERSION require 'resque/failure/airbrake' describe "Airbrake" do it "should be notified of an error" do exception = StandardError.new("BOOM") wo...
github
resque/resque
https://github.com/resque/resque
test/resque_failure_multi_queue_test.rb
Ruby
mit
9,468
master
6,153
require 'test_helper' require 'resque/failure/redis_multi_queue' describe "Resque::Failure::RedisMultiQueue" do let(:bad_string) { [39, 52, 127, 86, 93, 95, 39].map { |c| c.chr }.join } let(:exception) { StandardError.exception(bad_string) } let(:worker) { Resque::Worker.new(:test) } let(:queue) { 'q...
github
resque/resque
https://github.com/resque/resque
test/resque_failure_multiple_test.rb
Ruby
mit
9,468
master
1,414
require 'test_helper' require 'resque/failure/multiple' describe 'Resque::Failure::Multiple' do it 'requeue_all and does not raise an exception' do with_failure_backend(Resque::Failure::Multiple) do Resque::Failure::Multiple.classes = [Resque::Failure::Redis] exception = StandardError.exception('some...
github
resque/resque
https://github.com/resque/resque
test/job_hooks_test.rb
Ruby
mit
9,468
master
12,609
require 'test_helper' describe "Resque::Job before_perform" do include PerformJob class ::BeforePerformJob def self.before_perform_record_history(history) history << :before_perform end def self.perform(history) history << :perform end end it "it runs before_perform before perfor...
github
resque/resque
https://github.com/resque/resque
test/active_job/helper.rb
Ruby
mit
9,468
master
625
# frozen_string_literal: true require "active_job" require_relative "support/job_buffer" GlobalID.app = "aj" @adapter = ENV["AJ_ADAPTER"] ||= "resque" puts "Using #{@adapter}" if ENV["AJ_INTEGRATION_TESTS"] require "support/integration/helper" else ActiveJob::Base.logger = Logger.new(nil) require "active_job/...
github
resque/resque
https://github.com/resque/resque
test/active_job/integration/queuing_test.rb
Ruby
mit
9,468
master
2,834
# frozen_string_literal: true require "helper" require "jobs/hello_job" require "active_support/core_ext/numeric/time" class QueuingTest < ActiveSupport::TestCase test "should run jobs enqueued on a listening queue" do TestJob.perform_later @id wait_for_jobs_to_finish_for(5.seconds) assert_job_executed ...
github
resque/resque
https://github.com/resque/resque
test/active_job/cases/adapter_test.rb
Ruby
mit
9,468
master
293
# frozen_string_literal: true require_relative "../helper" class AdapterTest < ActiveSupport::TestCase test "should load #{ENV['AJ_ADAPTER']} adapter" do assert_equal "active_job/queue_adapters/#{ENV['AJ_ADAPTER']}_adapter".classify, ActiveJob::Base.queue_adapter.class.name end end
github
resque/resque
https://github.com/resque/resque
test/active_job/support/job_buffer.rb
Ruby
mit
9,468
master
331
# frozen_string_literal: true module JobBuffer class << self def clear values.clear end def add(value) values << value end def values @values ||= [] end def last_value values.last end end end class ActiveSupport::TestCase teardown do JobBuffer.clear...
github
resque/resque
https://github.com/resque/resque
test/active_job/support/stubs/strong_parameters.rb
Ruby
mit
9,468
master
217
# frozen_string_literal: true class Parameters def initialize(parameters = {}) @parameters = parameters.with_indifferent_access end def permitted? true end def to_h @parameters.to_h end end
github
resque/resque
https://github.com/resque/resque
test/active_job/support/integration/jobs_manager.rb
Ruby
mit
9,468
master
503
# frozen_string_literal: true class JobsManager @@managers = {} attr :adapter_name def self.current_manager @@managers[ENV["AJ_ADAPTER"]] ||= new(ENV["AJ_ADAPTER"]) end def initialize(adapter_name) @adapter_name = adapter_name require_relative "adapters/#{adapter_name}" extend "#{adapter_na...
github
resque/resque
https://github.com/resque/resque
test/active_job/support/integration/helper.rb
Ruby
mit
9,468
master
1,061
# frozen_string_literal: true ENV["RAILS_ENV"] = "test" ActiveJob::Base.queue_name_prefix = nil require "rails/generators/rails/app/app_generator" require "tmpdir" dummy_app_path = Dir.mktmpdir + "/dummy" dummy_app_template = File.expand_path("dummy_app_template.rb", __dir__) args = Rails::Generators::ARGVScrub...
github
resque/resque
https://github.com/resque/resque
test/active_job/support/integration/test_case_helpers.rb
Ruby
mit
9,468
master
1,100
# frozen_string_literal: true require "support/integration/jobs_manager" module TestCaseHelpers extend ActiveSupport::Concern included do self.use_transactional_tests = false setup do clear_jobs @id = "AJ-#{SecureRandom.uuid}" end teardown do clear_jobs end end privat...
github
resque/resque
https://github.com/resque/resque
test/active_job/support/integration/dummy_app_template.rb
Ruby
mit
9,468
master
785
# frozen_string_literal: true if ENV["AJ_ADAPTER"] == "delayed_job" generate "delayed_job:active_record", "--quiet" end initializer "activejob.rb", <<-CODE require "#{File.expand_path("jobs_manager.rb", __dir__)}" JobsManager.current_manager.setup CODE initializer "i18n.rb", <<-CODE I18n.available_locales = [:en,...
github
resque/resque
https://github.com/resque/resque
test/active_job/support/integration/adapters/resque.rb
Ruby
mit
9,468
master
1,339
# frozen_string_literal: true module ResqueJobsManager def setup ActiveJob::Base.queue_adapter = :resque Resque.redis = Redis::Namespace.new "active_jobs_int_test", redis: Redis.new(url: ENV["REDIS_URL"] || "redis://127.0.0.1:6379/12") Resque.logger = Rails.logger unless can_run? puts "Cannot r...
github
resque/resque
https://github.com/resque/resque
lib/resque.rb
Ruby
mit
9,468
master
18,976
require 'mono_logger' require 'redis/namespace' require 'forwardable' require 'resque/version' require 'resque/errors' require 'resque/failure' require 'resque/failure/base' require 'resque/helpers' require 'resque/stat' require 'resque/logging' require 'resque/log_formatters/quiet_formatter' require 'resque/log_fo...
github
resque/resque
https://github.com/resque/resque
lib/tasks/redis.rake
Ruby
mit
9,468
master
4,055
# Inspired by rabbitmq.rake the Redbox project at http://github.com/rick/redbox/tree/master require 'fileutils' require 'open-uri' require 'pathname' class RedisRunner def self.redis_dir @redis_dir ||= if ENV['PREFIX'] Pathname.new(ENV['PREFIX']) else ...
github
resque/resque
https://github.com/resque/resque
lib/resque/data_store.rb
Ruby
mit
9,468
master
10,066
module Resque # An interface between Resque's persistence and the actual # implementation. class DataStore extend Forwardable HEARTBEAT_KEY = "workers:heartbeat" def initialize(redis) @redis = redis @queue_access = QueueAccess.new(@redis) @failed_queue_access...
github
resque/resque
https://github.com/resque/resque
lib/resque/thread_signal.rb
Ruby
mit
9,468
master
399
class Resque::ThreadSignal def initialize @mutex = Mutex.new @signaled = false @received = ConditionVariable.new end def signal @mutex.synchronize do @signaled = true @received.signal end end def wait_for_signal(timeout) @mutex.synchronize do unless @signaled ...
github
resque/resque
https://github.com/resque/resque
lib/resque/job.rb
Ruby
mit
9,468
master
8,546
module Resque # A Resque::Job represents a unit of work. Each job lives on a # single queue and has an associated payload object. The payload # is a hash with two attributes: `class` and `args`. The `class` is # the name of the Ruby class which should be used to run the # job. The `args` are an array of argum...
github
resque/resque
https://github.com/resque/resque
lib/resque/web_runner.rb
Ruby
mit
9,468
master
11,838
require 'open-uri' require 'logger' require 'optparse' require 'fileutils' require 'rack' begin require 'rackup' rescue LoadError end require 'resque/server' # only used with `bin/resque-web` # https://github.com/resque/resque/pull/1780 module Resque WINDOWS = !!(RUBY_PLATFORM =~ /(mingw|bccwin|wince|mswin32)/i) ...
github
resque/resque
https://github.com/resque/resque
lib/resque/worker.rb
Ruby
mit
9,468
master
30,233
require 'time' require 'set' require 'redis/distributed' module Resque # A Resque Worker processes jobs. On platforms that support fork(2), # the worker will fork off a child to process each job. This ensures # a clean slate when beginning the next job and cuts down on gradual # memory growth as well as low le...
github
resque/resque
https://github.com/resque/resque
lib/resque/server_helper.rb
Ruby
mit
9,468
master
4,302
require 'rack/utils' module Resque module ServerHelper include Rack::Utils alias_method :h, :escape_html def current_section url_path request.path_info.sub('/','').split('/')[0].downcase end def current_page url_path request.path_info.sub('/','') end def url_path(*path_part...
github
resque/resque
https://github.com/resque/resque
lib/resque/railtie.rb
Ruby
mit
9,468
master
364
module Resque class Railtie < Rails::Railtie rake_tasks do require 'resque/tasks' # redefine ths task to load the rails env task "resque:setup" => :environment end initializer "resque.active_job" do ActiveSupport.on_load(:active_job) do require "active_job/queue_adapters/...
github
resque/resque
https://github.com/resque/resque
lib/resque/failure.rb
Ruby
mit
9,468
master
3,712
module Resque # The Failure module provides an interface for working with different # failure backends. # # You can use it to query the failure backend without knowing which specific # backend is being used. For instance, the Resque web app uses it to display # stats and other information. module Failure ...
github
resque/resque
https://github.com/resque/resque
lib/resque/helpers.rb
Ruby
mit
9,468
master
1,465
require 'multi_json' # OkJson won't work because it doesn't serialize symbols # in the same way yajl and json do. if MultiJson.respond_to?(:adapter) raise "Please install the yajl-ruby or json gem" if MultiJson.adapter.to_s == 'MultiJson::Adapters::OkJson' elsif MultiJson.respond_to?(:engine) raise "Please install...
github
resque/resque
https://github.com/resque/resque
lib/resque/errors.rb
Ruby
mit
9,468
master
802
module Resque # Raised whenever we need a queue but none is provided. class NoQueueError < RuntimeError; end # Raised when trying to create a job without a class class NoClassError < RuntimeError; end # Raised when a worker was killed while processing a job. class DirtyExit < RuntimeError attr_reader ...
github
resque/resque
https://github.com/resque/resque
lib/resque/tasks.rb
Ruby
mit
9,468
master
1,882
# require 'resque/tasks' # will give you the resque tasks namespace :resque do task :setup desc "Start a Resque worker" task :work => [ :preload, :setup ] do require 'resque' begin worker = Resque::Worker.new rescue Resque::NoQueueError abort "set QUEUE env var, e.g. $ QUEUE=critical,h...
github
resque/resque
https://github.com/resque/resque
lib/resque/logging.rb
Ruby
mit
9,468
master
611
module Resque # Include this module in classes you wish to have logging facilities module Logging module_function # Thunk to the logger's own log method (if configured) def self.log(severity, message) Resque.logger.__send__(severity, message) if Resque.logger end # Log level aliases ...
github
resque/resque
https://github.com/resque/resque
lib/resque/stat.rb
Ruby
mit
9,468
master
1,510
module Resque # The stat subsystem. Used to keep track of integer counts. # # Get a stat: Stat[name] # Incr a stat: Stat.incr(name) # Decr a stat: Stat.decr(name) # Kill a stat: Stat.clear(name) module Stat extend self def redis warn '[Resque] [Deprecation] Resque::Stat #redis meth...
github
resque/resque
https://github.com/resque/resque
lib/resque/plugin.rb
Ruby
mit
9,468
master
2,270
module Resque module Plugin extend self LintError = Class.new(RuntimeError) # Ensure that your plugin conforms to good hook naming conventions. # # Resque::Plugin.lint(MyResquePlugin) def lint(plugin) hooks = before_hooks(plugin) + around_hooks(plugin) + after_hooks(plugin) ho...
github
resque/resque
https://github.com/resque/resque
lib/resque/server.rb
Ruby
mit
9,468
master
4,405
require 'sinatra/base' require 'tilt/erb' require 'resque' require 'resque/server_helper' require 'resque/version' require 'time' require 'yaml' if defined?(Encoding) && Encoding.default_external != Encoding::UTF_8 Encoding.default_external = Encoding::UTF_8 end module Resque class Server < Sinatra::Base dir ...
github
resque/resque
https://github.com/resque/resque
lib/resque/failure/airbrake.rb
Ruby
mit
9,468
master
1,161
begin require 'airbrake' rescue LoadError raise "Can't find 'airbrake' gem. Please add it to your Gemfile or install it." end module Resque module Failure class Airbrake < Base def self.configure(&block) Resque.logger.warn "This actually sets global Airbrake configuration, " \ "which ...
github
resque/resque
https://github.com/resque/resque
lib/resque/failure/base.rb
Ruby
mit
9,468
master
1,709
module Resque module Failure # All Failure classes are expected to subclass Base. # # When a job fails, a new instance of your Failure backend is created # and #save is called. class Base # The exception object raised by the failed job attr_accessor :exception # The worker objec...
github
resque/resque
https://github.com/resque/resque
lib/resque/failure/redis_multi_queue.rb
Ruby
mit
9,468
master
3,248
module Resque module Failure # A Failure backend that stores exceptions in Redis. Very simple but # works out of the box, along with support in the Resque web app. class RedisMultiQueue < Base def data_store Resque.data_store end def self.data_store Resque.data_store ...
github
resque/resque
https://github.com/resque/resque
lib/resque/failure/multiple.rb
Ruby
mit
9,468
master
1,557
module Resque module Failure # A Failure backend that uses multiple backends # delegates all queries to the first backend class Multiple < Base class << self attr_accessor :classes end def self.configure yield self Resque::Failure.backend = self end ...
github
resque/resque
https://github.com/resque/resque
lib/resque/failure/redis.rb
Ruby
mit
9,468
master
3,528
module Resque module Failure # A Failure backend that stores exceptions in Redis. Very simple but # works out of the box, along with support in the Resque web app. class Redis < Base def data_store Resque.data_store end def self.data_store Resque.data_store end ...
github
resque/resque
https://github.com/resque/resque
lib/active_job/queue_adapters/resque_adapter.rb
Ruby
mit
9,468
master
1,632
# frozen_string_literal: true require "active_support/core_ext/enumerable" require "active_support/core_ext/array/access" begin require "resque-scheduler" rescue LoadError begin require "resque_scheduler" rescue LoadError false end end module ActiveJob module QueueAdapters remove_const(:ResqueA...
github
resque/resque
https://github.com/resque/resque
examples/simple.rb
Ruby
mit
9,468
master
641
# This is a simple Resque job. class Archive @queue = :file_serve def self.perform(repo_id, branch = 'master') repo = Repository.find(repo_id) repo.create_archive(branch) end end # This is in our app code class Repository < Model # ... stuff ... def async_create_archive(branch) Resque.enqueue(A...
github
resque/resque
https://github.com/resque/resque
examples/async_helper.rb
Ruby
mit
9,468
master
848
# If you want to just call a method on an object in the background, # we can easily add that functionality to Resque. # # This is similar to DelayedJob's `send_later`. # # Keep in mind that, unlike DelayedJob, only simple Ruby objects # can be persisted. # # If it can be represented in JSON, it can be stored in a job. ...
github
resque/resque
https://github.com/resque/resque
examples/demo/job.rb
Ruby
mit
9,468
master
319
require 'resque' module Demo module Job @queue = :default def self.perform(params) sleep 1 puts "Processed a job!" end end module FailingJob @queue = :failing def self.perform(params) sleep 1 raise 'not processable!' puts "Processed a job!" end end end
github
resque/resque
https://github.com/resque/resque
examples/demo/app.rb
Ruby
mit
9,468
master
1,003
require 'sinatra/base' require 'resque' require 'job' module Demo class App < Sinatra::Base get '/' do info = Resque.info out = "<html><head><title>Resque Demo</title></head><body>" out << "<p>" out << "There are #{info[:pending]} pending and " out << "#{info[:processed]} processed ...
github
resque/resque
https://github.com/resque/resque
examples/demo/Rakefile
Ruby
mit
9,468
master
270
$LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib' $LOAD_PATH.unshift File.dirname(__FILE__) unless $LOAD_PATH.include?(File.dirname(__FILE__)) require 'resque/tasks' require 'job' desc "Start the demo using `rackup`" task :start do exec "rackup config.ru" end
github
resque/resque
https://github.com/resque/resque
examples/demo/config.ru
Ruby
mit
9,468
master
563
#!/usr/bin/env ruby require 'logger' $LOAD_PATH.unshift File.dirname(__FILE__) + '/../../lib' $LOAD_PATH.unshift File.dirname(__FILE__) unless $LOAD_PATH.include?(File.dirname(__FILE__)) require 'app' require 'resque/server' use Rack::ShowExceptions # Set the AUTH env variable to your basic auth password to protect R...
github
antiwork/gumroad
https://github.com/antiwork/gumroad
Gemfile
Ruby
mit
8,966
main
6,120
# frozen_string_literal: true source "https://rubygems.org" ruby file: ".ruby-version" gem "rails", "7.1.6" gem "rake", "13.2.1" gem "sentry-ruby" gem "sentry-rails" install_if -> { ENV["BUNDLE_GEMS__CONTRIBSYS__COM"] } do source "https://gems.contribsys.com/" do gem "sidekiq-pro", "~> 7.2" end end group :...