1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Use frozen-string-literal in ActiveJob

This commit is contained in:
Kir Shatrov 2017-07-09 20:49:52 +03:00
parent 0b6309d6bc
commit 14ece5e429
102 changed files with 102 additions and 0 deletions

View file

@ -82,6 +82,7 @@ Style/FrozenStringLiteralComment:
EnforcedStyle: always
Include:
- 'activesupport/**/*'
- 'activejob/**/*'
# Use `foo {}` not `foo{}`.
Layout/SpaceBeforeBlockBraces:

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rake/testtask"
#TODO: add qu back to the list after it support Rails 5.1

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
version = File.read(File.expand_path("../RAILS_VERSION", __dir__)).strip
Gem::Specification.new do |s|

View file

@ -1,4 +1,5 @@
#!/usr/bin/env ruby
# frozen_string_literal: true
COMPONENT_ROOT = File.expand_path("..", __dir__)
require_relative "../../tools/test"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
#--
# Copyright (c) 2014-2017 David Heinemeier Hansson
#

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "active_support/core_ext/hash"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "core"
require_relative "queue_adapter"
require_relative "queue_name"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "active_support/callbacks"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module ActiveJob
class ConfiguredJob #:nodoc:
def initialize(job_class, options = {})

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module ActiveJob
# Provides general behavior that will be included into every Active Job
# object that inherits from ActiveJob::Base.

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "arguments"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "active_support/core_ext/numeric/time"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "active_support/rescuable"
require_relative "arguments"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module ActiveJob
# Returns the version of the currently loaded Active Job as a <tt>Gem::Version</tt>
def self.gem_version

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "active_support/core_ext/hash/transform_values"
require "active_support/core_ext/string/filters"
require "active_support/tagged_logging"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "active_support/core_ext/string/inflections"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module ActiveJob
# == Active Job adapters
#

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "securerandom"
require "concurrent/scheduled_task"
require "concurrent/executor/thread_pool_executor"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "backburner"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "delayed_job"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module ActiveJob
module QueueAdapters
# == Active Job Inline adapter

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "qu"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "que"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "queue_classic"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "resque"
require "active_support/core_ext/enumerable"
require "active_support/core_ext/array/access"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "sidekiq"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "sneakers"
require "monitor"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "sucker_punch"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module ActiveJob
module QueueAdapters
# == Test adapter for Active Job

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module ActiveJob
module QueueName
extend ActiveSupport::Concern

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module ActiveJob
module QueuePriority
extend ActiveSupport::Concern

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "global_id/railtie"
require "active_job"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "active_support/test_case"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "active_support/core_ext/class/subclasses"
require "active_support/core_ext/hash/keys"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module ActiveJob
module Translation #:nodoc:
extend ActiveSupport::Concern

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "gem_version"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "rails/generators/named_base"
module Rails # :nodoc:

View file

@ -1,2 +1,3 @@
# frozen_string_literal: true
ActiveJob::Base.queue_adapter = :async
ActiveJob::Base.queue_adapter.immediate = true

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "support/backburner/inline"
ActiveJob::Base.queue_adapter = :backburner

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
ActiveJob::Base.queue_adapter = :delayed_job
$LOAD_PATH << File.expand_path("../support/delayed_job", __dir__)

View file

@ -1 +1,2 @@
# frozen_string_literal: true
ActiveJob::Base.queue_adapter = :inline

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "qu-immediate"
ActiveJob::Base.queue_adapter = :qu

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "support/que/inline"
ActiveJob::Base.queue_adapter = :que

View file

@ -1,2 +1,3 @@
# frozen_string_literal: true
require "support/queue_classic/inline"
ActiveJob::Base.queue_adapter = :queue_classic

View file

@ -1,2 +1,3 @@
# frozen_string_literal: true
ActiveJob::Base.queue_adapter = :resque
Resque.inline = true

View file

@ -1,2 +1,3 @@
# frozen_string_literal: true
require "sidekiq/testing/inline"
ActiveJob::Base.queue_adapter = :sidekiq

View file

@ -1,2 +1,3 @@
# frozen_string_literal: true
require "support/sneakers/inline"
ActiveJob::Base.queue_adapter = :sneakers

View file

@ -1,2 +1,3 @@
# frozen_string_literal: true
require "sucker_punch/testing/inline"
ActiveJob::Base.queue_adapter = :sucker_punch

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
ActiveJob::Base.queue_adapter = :test
ActiveJob::Base.queue_adapter.perform_enqueued_jobs = true
ActiveJob::Base.queue_adapter.perform_enqueued_at_jobs = true

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
class AdapterTest < ActiveSupport::TestCase

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "active_job/arguments"
require "models/person"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "jobs/callback_job"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "jobs/retry_job"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "jobs/gid_job"
require "jobs/hello_job"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "active_support/log_subscriber/test_helper"
require "active_support/core_ext/numeric/time"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
module ActiveJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "jobs/hello_job"
require "jobs/logging_job"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "jobs/hello_job"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "jobs/hello_job"
require "active_support/core_ext/numeric/time"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "jobs/rescue_job"
require "models/person"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "jobs/hello_job"
require "jobs/logging_job"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "active_support/core_ext/time"
require "active_support/core_ext/date"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "jobs/translated_hello_job"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "active_job"
require "support/job_buffer"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "helper"
require "jobs/logging_job"
require "jobs/hello_job"

View file

@ -1,2 +1,3 @@
# frozen_string_literal: true
class ApplicationJob < ActiveJob::Base
end

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
class CallbackJob < ActiveJob::Base
before_perform ->(job) { job.history << "CallbackJob ran before_perform" }
after_perform ->(job) { job.history << "CallbackJob ran after_perform" }

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "../support/job_buffer"
class GidJob < ActiveJob::Base

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "../support/job_buffer"
class HelloJob < ActiveJob::Base

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "application_job"
class InheritedJob < ApplicationJob

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "../support/job_buffer"
class KwargsJob < ActiveJob::Base

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
class LoggingJob < ActiveJob::Base
def perform(dummy)
logger.info "Dummy, here is it: #{dummy}"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
class NestedJob < ActiveJob::Base
def perform
LoggingJob.perform_later "NestedJob"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
class OverriddenLoggingJob < ActiveJob::Base
def perform(dummy)
logger.info "Dummy, here is it: #{dummy}"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "../support/job_buffer"
class ProviderJidJob < ActiveJob::Base

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
class QueueAdapterJob < ActiveJob::Base
self.queue_adapter = :inline
end

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "../support/job_buffer"
class QueueAsJob < ActiveJob::Base

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "../support/job_buffer"
class RescueJob < ActiveJob::Base

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "../support/job_buffer"
require "active_support/core_ext/integer/inflections"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require_relative "../support/job_buffer"
class TranslatedHelloJob < ActiveJob::Base

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
class Person
class RecordNotFound < StandardError; end

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "backburner"
Backburner::Worker.class_eval do

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
#copied from https://github.com/collectiveidea/delayed_job/blob/master/spec/delayed/backend/test.rb
require "ostruct"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module AsyncJobsManager
def setup
ActiveJob::Base.queue_adapter = :async

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module BackburnerJobsManager
def setup
ActiveJob::Base.queue_adapter = :backburner

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "delayed_job"
require "delayed_job_active_record"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module InlineJobsManager
def setup
ActiveJob::Base.queue_adapter = :inline

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module QuJobsManager
def setup
require "qu-rails"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module QueJobsManager
def setup
require "sequel"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module QueueClassicJobsManager
def setup
ENV["QC_DATABASE_URL"] ||= "postgres:///active_jobs_qc_int_test"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module ResqueJobsManager
def setup
ActiveJob::Base.queue_adapter = :resque

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "sidekiq/api"
require "sidekiq/testing"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "sneakers/runner"
require "sneakers/publisher"
require "timeout"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module SuckerPunchJobsManager
def setup
ActiveJob::Base.queue_adapter = :sucker_punch

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
if ENV["AJ_ADAPTER"] == "delayed_job"
generate "delayed_job:active_record", "--quiet"
end

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
puts "\n\n*** rake aj:integration:#{ENV['AJ_ADAPTER']} ***\n"
ENV["RAILS_ENV"] = "test"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
class JobsManager
@@managers = {}
attr :adapter_name

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "active_support/core_ext/string/inflections"
require "support/integration/jobs_manager"

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
module JobBuffer
class << self
def clear

View file

@ -1,3 +1,4 @@
# frozen_string_literal: true
require "que"
Que::Job.class_eval do

Some files were not shown because too many files have changed in this diff Show more