sucker_punch-backgroundable 0.2.0 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YTljNmMwNGMyOTc0MjlhZGM0NTg3NDRhMmNlODlkYWI3NmFmM2Y4NQ==
4
+ NzY5ZjA2NTA2MTJiOGE0NmM0MTdmYzZkZmRiNzZkY2NlMzUxNjRkMg==
5
5
  data.tar.gz: !binary |-
6
- ODY2NTNhMjNjNDFjYjgwNzQ0ZDY1ZTgyNTkzNWViNTEyNTQwNGJmZQ==
6
+ OTNhNmVlZDkzNjU3NjkzMzM5OWQzMjFmNmYzOWU5OTdhN2JkODkwYw==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NjIxM2QzN2Y2YWY2NzQ5YjM1Mzk1NjZhYjZlODU1MjA4YzBlMzJiYzUyMWQw
10
- ZGY3MWYxNGQwMjIyNzZhMDVhMjcwMWJlOWZkNDZlYTUyZjMzZTUzY2RlNGY5
11
- NDhmNzZkOWM0MmU4OWI3NTVlZmY3Y2RlM2EwNjZhYzBjNzFkYzM=
9
+ N2I1MWRhMjk4MjhlNzcwMjJkNmE3Mjk4ZmIzMDAzMmQxMGNjMWEzYTJhNTY0
10
+ YWNiOGZiYmZiNTRmODMyZWNiMGJmYmIyOGZkYjhiMzQwOGJhNjc0NTEzNmVk
11
+ M2UyNmI5ODAwYTJlMTc2M2NlYzMyNzQ1N2RmYmY1ZmVmNzdhMDQ=
12
12
  data.tar.gz: !binary |-
13
- ODk5OTRkMzZhYmM0MDhlYzVhNjY0ZWM3MTA1ZjkzNzRjMmYzMDNlNzJiNDlm
14
- YWNhMWM1MmZlZjk5YTRlMzQ2MTFkYmNkM2RkNmU1MDFmZGRhMGNkOGU4NTY3
15
- ZmIzODk2NzIzZmVmMDY2YzU2YjQ1NjE1MDU3NjQyODJhYThkODU=
13
+ MDJhZjY0OTNkNzVhMzRkYTU5ZGNkNGFhYzFlN2IxZGY0YTk3MTk4ODYzYWRm
14
+ N2M2OGJlMWJiMTc3NTA3YjAyMjBhNDY0NGY2MWNkNTQzY2UxNGJiZTYxZTdl
15
+ MGQwZWNjMTY5NWQ1YWM3ZWUzODM3NDZhODZjY2UxZjYwOTY2N2E=
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## 0.3.0 (14/2/2015)
2
+
3
+ * Now depend on Sucker Punch 2.0 or higher (due to new Sucker Punch API)
4
+
1
5
  ## 0.2.0 (20/5/2014)
2
6
 
3
7
  * Added 'enabled' configuration option
data/Gemfile CHANGED
@@ -2,7 +2,7 @@ source "http://rubygems.org"
2
2
  # Add dependencies required to use your gem here.
3
3
  # Example:
4
4
  # gem "activesupport", ">= 2.3.5"
5
- gem "sucker_punch", "~> 1.0"
5
+ gem "sucker_punch", "~> 2.0"
6
6
 
7
7
  # Add dependencies to develop your gem here.
8
8
  # Include everything needed to run rake, tests, features, etc.
data/Gemfile.lock CHANGED
@@ -1,42 +1,41 @@
1
1
  GEM
2
2
  remote: http://rubygems.org/
3
3
  specs:
4
- activemodel (4.1.0)
5
- activesupport (= 4.1.0)
4
+ activemodel (4.2.4)
5
+ activesupport (= 4.2.4)
6
6
  builder (~> 3.1)
7
- activerecord (4.1.0)
8
- activemodel (= 4.1.0)
9
- activesupport (= 4.1.0)
10
- arel (~> 5.0.0)
11
- activesupport (4.1.0)
12
- i18n (~> 0.6, >= 0.6.9)
7
+ activerecord (4.2.4)
8
+ activemodel (= 4.2.4)
9
+ activesupport (= 4.2.4)
10
+ arel (~> 6.0)
11
+ activesupport (4.2.4)
12
+ i18n (~> 0.7)
13
13
  json (~> 1.7, >= 1.7.7)
14
14
  minitest (~> 5.1)
15
- thread_safe (~> 0.1)
15
+ thread_safe (~> 0.3, >= 0.3.4)
16
16
  tzinfo (~> 1.1)
17
- addressable (2.3.6)
18
- arel (5.0.1.20140414130214)
17
+ addressable (2.3.8)
18
+ arel (6.0.3)
19
19
  builder (3.2.2)
20
- celluloid (0.15.2)
21
- timers (~> 1.1.0)
20
+ concurrent-ruby (1.0.0)
22
21
  descendants_tracker (0.0.4)
23
22
  thread_safe (~> 0.3, >= 0.3.1)
24
23
  diff-lcs (1.1.3)
25
- docile (1.1.3)
26
- faraday (0.9.0)
24
+ docile (1.1.5)
25
+ faraday (0.9.2)
27
26
  multipart-post (>= 1.2, < 3)
28
- git (1.2.6)
29
- github_api (0.11.3)
27
+ git (1.2.9.1)
28
+ github_api (0.12.4)
30
29
  addressable (~> 2.3)
31
- descendants_tracker (~> 0.0.1)
30
+ descendants_tracker (~> 0.0.4)
32
31
  faraday (~> 0.8, < 0.10)
33
- hashie (>= 1.2)
32
+ hashie (>= 3.4)
34
33
  multi_json (>= 1.7.5, < 2.0)
35
- nokogiri (~> 1.6.0)
34
+ nokogiri (~> 1.6.6)
36
35
  oauth2
37
- hashie (2.1.1)
38
- highline (1.6.21)
39
- i18n (0.6.9)
36
+ hashie (3.4.3)
37
+ highline (1.7.8)
38
+ i18n (0.7.0)
40
39
  jeweler (2.0.1)
41
40
  builder
42
41
  bundler (>= 1.0)
@@ -46,24 +45,23 @@ GEM
46
45
  nokogiri (>= 1.5.10)
47
46
  rake
48
47
  rdoc
49
- json (1.8.1)
50
- jwt (0.1.13)
51
- multi_json (>= 1.5)
52
- mini_portile (0.6.0)
53
- minitest (5.3.4)
54
- multi_json (1.10.0)
48
+ json (1.8.3)
49
+ jwt (1.5.2)
50
+ mini_portile (0.6.2)
51
+ minitest (5.8.2)
52
+ multi_json (1.11.2)
55
53
  multi_xml (0.5.5)
56
54
  multipart-post (2.0.0)
57
- nokogiri (1.6.2.1)
58
- mini_portile (= 0.6.0)
59
- oauth2 (0.9.3)
55
+ nokogiri (1.6.6.2)
56
+ mini_portile (~> 0.6.0)
57
+ oauth2 (1.0.0)
60
58
  faraday (>= 0.8, < 0.10)
61
- jwt (~> 0.1.8)
59
+ jwt (~> 1.0)
62
60
  multi_json (~> 1.3)
63
61
  multi_xml (~> 0.5)
64
62
  rack (~> 1.2)
65
- rack (1.5.2)
66
- rake (10.3.2)
63
+ rack (1.6.4)
64
+ rake (10.4.2)
67
65
  rdoc (3.12.2)
68
66
  json (~> 1.4)
69
67
  rspec (2.8.0)
@@ -74,17 +72,16 @@ GEM
74
72
  rspec-expectations (2.8.0)
75
73
  diff-lcs (~> 1.1.2)
76
74
  rspec-mocks (2.8.0)
77
- simplecov (0.8.2)
75
+ simplecov (0.10.0)
78
76
  docile (~> 1.1.0)
79
- multi_json
80
- simplecov-html (~> 0.8.0)
81
- simplecov-html (0.8.0)
82
- sqlite3 (1.3.9)
83
- sucker_punch (1.0.5)
84
- celluloid (~> 0.15.2)
85
- thread_safe (0.3.3)
86
- timers (1.1.0)
87
- tzinfo (1.1.0)
77
+ json (~> 1.8)
78
+ simplecov-html (~> 0.10.0)
79
+ simplecov-html (0.10.0)
80
+ sqlite3 (1.3.11)
81
+ sucker_punch (2.0.0)
82
+ concurrent-ruby (~> 1.0.0)
83
+ thread_safe (0.3.5)
84
+ tzinfo (1.2.2)
88
85
  thread_safe (~> 0.1)
89
86
 
90
87
  PLATFORMS
@@ -98,4 +95,4 @@ DEPENDENCIES
98
95
  rspec (~> 2.8.0)
99
96
  simplecov
100
97
  sqlite3
101
- sucker_punch (~> 1.0)
98
+ sucker_punch (~> 2.0)
data/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # sucker_punch-backgroundable
2
2
  [![Build Status](https://travis-ci.org/mvdamme/sucker_punch-backgroundable.png)](https://travis-ci.org/mvdamme/sucker_punch-backgroundable)
3
3
 
4
- This gem allows you to background any method call with [SuckerPunch](https://github.com/brandonhilkert/sucker_punch) without
4
+ This gem allows you to background any method call with [Sucker Punch](https://github.com/brandonhilkert/sucker_punch) without
5
5
  having to write a special job class.
6
6
  It provides the same API as the Backgroundable module from [TorqueBox](http://torquebox.org/), and a large part of the code
7
7
  comes directly from the TorqueBox project.
@@ -20,14 +20,18 @@ And then execute:
20
20
  bundle install
21
21
  ```
22
22
 
23
+ ## Versions
24
+
25
+ The Sucker Punch API changed when Sucker Punch 2.0 was released. This gem uses the new API and requires Sucker Punch 2.0 (or higher). If for some reason you have to use an older version of Sucker Punch, please use version 0.2.0 of this gem.
26
+
23
27
  ## Usage
24
28
 
25
29
  Include the `SuckerPunch::Backgroundable` module in your class. Then you can use `always_background :method1, :method2, ...` to
26
- cause the supplied methods to run asynchronously (in the background). Example:
30
+ cause the supplied methods to run asynchronously in the background ("fire and forget"). Example:
27
31
 
28
32
  ```ruby
29
33
  class MyClass
30
- SuckerPunch::Backgroundable
34
+ include SuckerPunch::Backgroundable
31
35
 
32
36
  always_background :send_email
33
37
  def send_email
@@ -54,7 +58,7 @@ Methods that have not been marked with `always_background` can also be backgroun
54
58
 
55
59
  ```ruby
56
60
  class MyClass
57
- SuckerPunch::Backgroundable
61
+ include SuckerPunch::Backgroundable
58
62
 
59
63
  def notify
60
64
  # ...
@@ -67,7 +71,7 @@ obj = MyClass.new
67
71
  obj.background.notify
68
72
 
69
73
  # This will run the method normally (synchronously, returning after the method is finished)
70
- obj.background.notify
74
+ obj.notify
71
75
  ```
72
76
 
73
77
  It is also possible to specify a delay in seconds:
@@ -88,7 +92,7 @@ threading issues. The gem can do this automatically, although currently only Act
88
92
 
89
93
  ```ruby
90
94
  class MyModel < ActiveRecord::Base
91
- SuckerPunch::Backgroundable
95
+ include SuckerPunch::Backgroundable
92
96
 
93
97
  always_background :send_email, :reload => true
94
98
  def send_email
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.0
1
+ 0.3.0
@@ -37,10 +37,6 @@ module SuckerPunch
37
37
  receiver = load(receiver) if instantiate?(options)
38
38
  call(receiver, method, *args)
39
39
  end
40
-
41
- def later(sec, *args)
42
- after(sec) { perform(*args) }
43
- end
44
40
  end
45
41
 
46
42
  class JobRunner
@@ -54,9 +50,9 @@ module SuckerPunch
54
50
  if SuckerPunch::Backgroundable.configuration.enabled
55
51
  # run as SuckerPunch Job
56
52
  if seconds > 0
57
- Job.new.async.later(seconds, @receiver, @method, @args, @options)
53
+ Job.perform_in(seconds, @receiver, @method, @args, @options)
58
54
  else
59
- Job.new.async.perform(@receiver, @method, @args, @options)
55
+ Job.perform_async(@receiver, @method, @args, @options)
60
56
  end
61
57
  else
62
58
  # run without SuckerPunch or Celluloid
@@ -8,7 +8,7 @@ ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: db_file
8
8
 
9
9
  ActiveRecord::Migration.create_table :test_models do |t|
10
10
  t.integer :value
11
- t.timestamps
11
+ t.timestamps :null => false
12
12
  end
13
13
 
14
14
  module ActiveModel::Validations
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: sucker_punch-backgroundable 0.2.0 ruby lib
5
+ # stub: sucker_punch-backgroundable 0.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "sucker_punch-backgroundable"
9
- s.version = "0.2.0"
9
+ s.version = "0.3.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
13
13
  s.authors = ["Micha\u{eb}l Van Damme"]
14
- s.date = "2014-05-20"
14
+ s.date = "2016-02-14"
15
15
  s.description = "This gem allows you to background any method call without having to write a special job class. Heavily inspired by the Backgroundable module in TorqueBox."
16
16
  s.email = "michael.vandamme@vub.ac.be"
17
17
  s.extra_rdoc_files = [
@@ -50,7 +50,7 @@ Gem::Specification.new do |s|
50
50
  s.specification_version = 4
51
51
 
52
52
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
53
- s.add_runtime_dependency(%q<sucker_punch>, ["~> 1.0"])
53
+ s.add_runtime_dependency(%q<sucker_punch>, ["~> 2.0"])
54
54
  s.add_development_dependency(%q<rspec>, ["~> 2.8.0"])
55
55
  s.add_development_dependency(%q<rdoc>, ["~> 3.12"])
56
56
  s.add_development_dependency(%q<bundler>, ["~> 1.0"])
@@ -59,7 +59,7 @@ Gem::Specification.new do |s|
59
59
  s.add_development_dependency(%q<activerecord>, [">= 0"])
60
60
  s.add_development_dependency(%q<sqlite3>, [">= 0"])
61
61
  else
62
- s.add_dependency(%q<sucker_punch>, ["~> 1.0"])
62
+ s.add_dependency(%q<sucker_punch>, ["~> 2.0"])
63
63
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
64
64
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
65
65
  s.add_dependency(%q<bundler>, ["~> 1.0"])
@@ -69,7 +69,7 @@ Gem::Specification.new do |s|
69
69
  s.add_dependency(%q<sqlite3>, [">= 0"])
70
70
  end
71
71
  else
72
- s.add_dependency(%q<sucker_punch>, ["~> 1.0"])
72
+ s.add_dependency(%q<sucker_punch>, ["~> 2.0"])
73
73
  s.add_dependency(%q<rspec>, ["~> 2.8.0"])
74
74
  s.add_dependency(%q<rdoc>, ["~> 3.12"])
75
75
  s.add_dependency(%q<bundler>, ["~> 1.0"])
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sucker_punch-backgroundable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michaël Van Damme
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-05-20 00:00:00.000000000 Z
11
+ date: 2016-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sucker_punch
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ~>
18
18
  - !ruby/object:Gem::Version
19
- version: '1.0'
19
+ version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ~>
25
25
  - !ruby/object:Gem::Version
26
- version: '1.0'
26
+ version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rspec
29
29
  requirement: !ruby/object:Gem::Requirement