sucker_punch 1.3.2 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 4a0ceca855b6c2b2f1c6805c41c6cc2aed155124
4
- data.tar.gz: 4056269dfa7f9f038fedfc1284747b3ae4f3db64
3
+ metadata.gz: 063fd2167ea7931708d817864a566519fed44bc4
4
+ data.tar.gz: 90c335d21c42d04a3b83ff4c58aa336dbdcff216
5
5
  SHA512:
6
- metadata.gz: 32210d326e0fcfe3ca9c71332845a9be81b9b925fb2bdf2884ab8595d3471dc8af2a6ff9cec8d4819102c1ed9229bdfa2d6df39f5daf5ea5d6855f653b4e4624
7
- data.tar.gz: 51e927141ac7442ee675ba72352d3105755175a7175044e64816cd134b8c98d53d6e28b4f5e578889f83f508f925ba7649481964e2e7dda53f77994d586ffada
6
+ metadata.gz: bdedb891160c8569ee0e022d4f4dbd501306cdc2e6f27dba368ca027a86fc13a147834438c392a1ab60b7f34716effb0c6fd8dfe548953f46e3dc239a62bccb0
7
+ data.tar.gz: 999af4061d5ec40a10bcc6efd65effacfea1565c17fcf8b736638af5504e0c234e686dd9ad3e81b4f7e9470afdbf83d2416fd5e741fe092f3def99e7d960c094
data/CHANGES.md CHANGED
@@ -1,3 +1,8 @@
1
+ 1.4.0
2
+ --------
3
+
4
+ - Added Rails generate task to create a job from the command line
5
+
1
6
  1.3.2
2
7
  --------
3
8
 
data/README.md CHANGED
@@ -7,6 +7,17 @@ Sucker Punch is a single-process Ruby asynchronous processing library. It's [gir
7
7
 
8
8
  Sucker Punch is perfect for asynchronous processes like emailing, data crunching, or social platform manipulation. No reason to hold up a user when you can do these things in the background within the same process as your web application...
9
9
 
10
+ Sucker Punch is built on top of [Celluloid
11
+ Pools](https://github.com/celluloid/celluloid/wiki/Pools). Each job is setup as
12
+ a pool, which equates to its own queue with individual workers working against
13
+ the jobs. Unlike most other background processing libraries, Sucker
14
+ Punch's jobs are stored in memory. The benefit to this is there is no
15
+ additional infrastructure requirement (ie. database, redis, etc.). The downside
16
+ is that if the web processes is restarted and there are jobs that haven't yet
17
+ been processed, they will be lost. For this reason, Sucker Punch is generally
18
+ recommended for jobs that are fast and non-mission critical (ie. logs, emails,
19
+ etc.).
20
+
10
21
  ## Installation
11
22
 
12
23
  Add this line to your application's Gemfile:
@@ -147,9 +158,20 @@ require 'sucker_punch/testing/inline'
147
158
  Log.new.async.perform("login") # => Will be synchronous and block until job is finished
148
159
  ```
149
160
 
161
+ ## Rails
162
+
163
+ If you're using Sucker Punch with Rails, there's a built-in generator task:
164
+
165
+ ```ruby
166
+ $ rails g sucker_punch:job logger
167
+ ```
168
+
169
+ would create the file `app/jobs/logger_job.rb` with a unimplemented `#perform`
170
+ method.
171
+
150
172
  ## Active Job
151
173
 
152
- Sucker Punch has been added as an Active job adapter in the upcoming Rails 4.2 release.
174
+ Sucker Punch has been added as an Active Job adapter in Rails 4.2.
153
175
  See the [guide](http://edgeguides.rubyonrails.org/active_job_basics.html) for
154
176
  configuration and implementation.
155
177
 
@@ -162,7 +184,11 @@ gem 'sucker_punch'
162
184
  And then configure the backend to use Sucker Punch:
163
185
 
164
186
  ```Ruby
165
- Rails.application.config.active_job.queue_adapter = :sucker_punch
187
+ # config/initializers/sucker_punch.rb
188
+ Rails.application.configure do
189
+ config.active_job.queue_adapter = :sucker_punch
190
+ end
191
+
166
192
  ```
167
193
 
168
194
  ## Troubleshooting
@@ -0,0 +1,16 @@
1
+ module SuckerPunch
2
+ module Generators
3
+ class JobGenerator < Rails::Generators::NamedBase
4
+ source_root File.expand_path("../templates", __FILE__)
5
+
6
+ desc <<desc
7
+ description:
8
+ create job in app/jobs directory
9
+ desc
10
+
11
+ def create_job_file
12
+ template 'job.rb', File.join('app/jobs', class_path, "#{file_name}_job.rb")
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,7 @@
1
+ class <%= class_name %>Job
2
+ include SuckerPunch::Job
3
+
4
+ def perform
5
+ raise NotImplementedError
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module SuckerPunch
2
- VERSION = "1.3.2"
2
+ VERSION = "1.4.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sucker_punch
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.2
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brandon Hilkert
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-28 00:00:00.000000000 Z
11
+ date: 2015-03-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -80,6 +80,8 @@ files:
80
80
  - LICENSE.txt
81
81
  - README.md
82
82
  - Rakefile
83
+ - lib/generators/sucker_punch/job_generator.rb
84
+ - lib/generators/sucker_punch/templates/job.rb
83
85
  - lib/sucker_punch.rb
84
86
  - lib/sucker_punch/core_ext.rb
85
87
  - lib/sucker_punch/job.rb
@@ -160,7 +162,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
162
  version: '0'
161
163
  requirements: []
162
164
  rubyforge_project:
163
- rubygems_version: 2.2.2
165
+ rubygems_version: 2.4.5
164
166
  signing_key:
165
167
  specification_version: 4
166
168
  summary: Sucker Punch is a Ruby asynchronous processing using Celluloid, heavily influenced
@@ -172,3 +174,4 @@ test_files:
172
174
  - spec/sucker_punch/queue_spec.rb
173
175
  - spec/sucker_punch/testing/inline_spec.rb
174
176
  - spec/sucker_punch_spec.rb
177
+ has_rdoc: