one_off 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cc793a7ba8fa8c0f6a59bf94feda1a7e1c90a7902dc68fe3a641e608db9ecf8
4
- data.tar.gz: 88fd5c273f09d626cf41ed28060695d86da63f8daf984aa1979eaad547230c21
3
+ metadata.gz: bde4be08a52dae7536b56e60deca097042376ffd49eb576a747c705cbd0f8143
4
+ data.tar.gz: 25acfbbae0600bb36fb7e9fab6082353b9e07374446bdb61dc84bbc5ef4ff5af
5
5
  SHA512:
6
- metadata.gz: a1e15673ac6fd993c35375bdfb8efee813c757d5ae8898f2dac672c13cab3b822a234ce8c670f2981b6ed4daceaa36a38f672f8be8573a909762690cdb4ef8bd
7
- data.tar.gz: 2b6ef33ec59955e18e64cf2089df84a31e2e4248f51ae5e4c378bf6c6772d476d7b2cd98cecd6a5a84bc1c54e99049829b157edd6217222d2a15e4bb17679ca8
6
+ metadata.gz: 9ad69e724464077e399150996d7d1cd83fd8354c20eb706d2fb42b56e5694bff4d0076b1c2d4ed2106530809f3f445cd5d86d86c96f0e7bc6e401c22c4cbcd98
7
+ data.tar.gz: 4e10be2b45d060b0a3f72fb567206f42507459f27ebf443b38dca92d8e04fd536ed7ef34e2b6dcf22efb1e962387dc096f2914d765c2883789424872f9407282
@@ -2,6 +2,9 @@
2
2
 
3
3
  module OneOff
4
4
  class ExecutorJob < ApplicationJob
5
+ queue_as OneOff.config.executor_queue if OneOff.config.executor_queue
6
+ rescue_from StandardError, with: OneOff.config.executor_rescue_handler if OneOff.config.executor_rescue_handler
7
+
5
8
  def perform(file)
6
9
  require "#{Rails.root}/db/one_off/#{file.filename}"
7
10
  Rails.logger.info "=== Starting one_off task #{file.task_name}"
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module OneOff
4
+ class Configuration
5
+ attr_accessor :executor_queue, :executor_rescue_handler
6
+ end
7
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OneOff
4
- VERSION = '1.0.0'
4
+ VERSION = '1.1.0'
5
5
  end
data/lib/one_off.rb CHANGED
@@ -1,8 +1,19 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  require 'one_off/engine'
4
+ require 'one_off/configuration'
4
5
  require 'one_off/file'
5
6
 
6
7
  module OneOff
7
- # Your code goes here...
8
+ class << self
9
+ def configuration
10
+ @configuration ||= OneOff::Configuration.new
11
+ end
12
+
13
+ alias config configuration
14
+
15
+ def configure
16
+ yield configuration
17
+ end
18
+ end
8
19
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: one_off
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hamed Asghari
@@ -91,6 +91,7 @@ files:
91
91
  - lib/generators/one_off/USAGE
92
92
  - lib/generators/one_off/one_off_generator.rb
93
93
  - lib/one_off.rb
94
+ - lib/one_off/configuration.rb
94
95
  - lib/one_off/engine.rb
95
96
  - lib/one_off/environments.rb
96
97
  - lib/one_off/file.rb