mirror of
https://github.com/plashchynski/crono.git
synced 2026-04-21 08:21:36 +02:00
Remove rails extension
This commit is contained in:
@@ -5,5 +5,5 @@
|
|||||||
# Actually you can use any class. The only requirement is that
|
# Actually you can use any class. The only requirement is that
|
||||||
# the class should implement a method `perform` without arguments.
|
# the class should implement a method `perform` without arguments.
|
||||||
#
|
#
|
||||||
# TestJob.perform_every 2.days, at: "15:30"
|
# Periodicity.perform(TestJob).every 2.days, at: "15:30"
|
||||||
#
|
#
|
||||||
|
|||||||
@@ -5,5 +5,3 @@ require "active_support/all"
|
|||||||
require "periodicity/version.rb"
|
require "periodicity/version.rb"
|
||||||
require "periodicity/period.rb"
|
require "periodicity/period.rb"
|
||||||
require "periodicity/config.rb"
|
require "periodicity/config.rb"
|
||||||
require 'periodicity/extensions/active_job'
|
|
||||||
require "periodicity/rails.rb" if defined?(::Rails::Engine)
|
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
module Periodicity
|
|
||||||
module Extensions
|
|
||||||
module ActiveJob
|
|
||||||
def perform_every(period, *args)
|
|
||||||
Config.instance.schedule += [self, Period.new(period, *args)]
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
module Periodicity
|
|
||||||
def self.hook_rails!
|
|
||||||
ActiveSupport.on_load(:active_job) do
|
|
||||||
extend Periodicity::Extensions::ActiveJob
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
class Rails < ::Rails::Engine
|
|
||||||
initializer 'periodicity' do
|
|
||||||
Periodicity.hook_rails!
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
require "spec_helper"
|
|
||||||
|
|
||||||
class TestJob < ActiveJob::Base
|
|
||||||
def perform;end
|
|
||||||
end
|
|
||||||
|
|
||||||
TestJob.extend(Periodicity::Extensions::ActiveJob)
|
|
||||||
|
|
||||||
describe Periodicity::Extensions::ActiveJob do
|
|
||||||
describe "#perform_every" do
|
|
||||||
it "should add job and period to schedule" do
|
|
||||||
TestJob.perform_every(1.second)
|
|
||||||
expect(Periodicity::Config.instance.schedule).to_not be_empty
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
Reference in New Issue
Block a user