sucker_punch 1.0.5 → 1.1

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
  SHA1:
3
- metadata.gz: 8ee22c723599005015b1435fdc3c9db086267bb5
4
- data.tar.gz: 459b40ba0f08459ee686719ae3f663fe13c5cf44
3
+ metadata.gz: c06fbb508d46f70a9492afa140eacb67e7520788
4
+ data.tar.gz: 8e4ab9baba4967f6a6f79066573cdeae4dc5150c
5
5
  SHA512:
6
- metadata.gz: e8aa07e9e33a3a780a0eb55eddea62c75a3b4bcd3d963ff263075923010fe59b3182c0e9548e2c0ed019b1740170851bc2cda73fe9e1cf2d5e4063907523d752
7
- data.tar.gz: 9709c31ec001c2141d146c315e667558b38fde89fde8701bb43ebd58c30f92bf3ae0e31c330705ce91d2ebfb9d04bbe7b81f0d703fd1a4fe025931507aaffc8c
6
+ metadata.gz: cf3c3a70ce5520654910b7a0caabed5c38ca61a2c45bd6c52a403808f84dca739180c652e363d212261aff8bebaaf587b0c6a6b7ed3b0c2dc0a0cd135ec11775
7
+ data.tar.gz: 181c24cd4b0991aabf73c985d28a25fe7bf2ef6186b1d953acf37ebcf59f7b392935ee3b1a177faf8ff1b456a2b2abac8952940281726c45154fabda378f1553
data/CHANGES.md CHANGED
@@ -1,3 +1,9 @@
1
+ 1.1
2
+ --------
3
+
4
+ - Delegate to Celluloid's exception handler
5
+
6
+
1
7
  1.0.5
2
8
  --------
3
9
 
@@ -1,3 +1,3 @@
1
1
  module SuckerPunch
2
- VERSION = "1.0.5"
2
+ VERSION = "1.1"
3
3
  end
data/lib/sucker_punch.rb CHANGED
@@ -12,6 +12,10 @@ module SuckerPunch
12
12
  def self.logger=(logger)
13
13
  Celluloid.logger = logger
14
14
  end
15
+
16
+ def self.exception_handler(&block)
17
+ Celluloid.exception_handler(&block)
18
+ end
15
19
  end
16
20
 
17
21
  require 'sucker_punch/railtie' if defined?(::Rails)
@@ -1,6 +1,12 @@
1
1
  class JobsController < ApplicationController
2
2
  def index
3
3
  @store = STORE
4
+ @crashes = CRASHES
5
+ end
6
+
7
+ def crashing
8
+ CrashingJob.new.async.perform
9
+ redirect_to jobs_path
4
10
  end
5
11
 
6
12
  def single
@@ -0,0 +1,9 @@
1
+ class CrashingJob
2
+ include SuckerPunch::Job
3
+ workers 4
4
+
5
+ def perform
6
+ raise 'Oooops, I just crashed'
7
+ end
8
+ end
9
+
@@ -4,6 +4,11 @@
4
4
  <%= submit_tag "Add 1 job to store" %>
5
5
  <% end %>
6
6
 
7
+ <br />
8
+ <%= form_tag crashing_jobs_path do %>
9
+ <%= submit_tag "Add 1 crashing job to store" %>
10
+ <% end %>
11
+
7
12
  <br />
8
13
  <%= form_tag multiple_jobs_path do %>
9
14
  <%= submit_tag "Add 1 job to store every 1 second for 5 seconds" %>
@@ -12,8 +17,24 @@
12
17
 
13
18
  <h2>Store Content</h2>
14
19
  <p>
15
- <% @store.each do |item| %>
16
- <%= item %>
17
- <br />
20
+ <% if @store.any? %>
21
+ <% @store.each do |item| %>
22
+ <%= item %>
23
+ <br />
24
+ <% end %>
25
+ <% else %>
26
+ (nothing)
18
27
  <% end %>
19
28
  </p>
29
+
30
+ <h2>Crashes</h2>
31
+ <p>
32
+ <% if @crashes.any? %>
33
+ <% @crashes.each do |item| %>
34
+ <%= item %>
35
+ <br />
36
+ <% end %>
37
+ <% else %>
38
+ (none)
39
+ <% end %>
40
+ </p>
@@ -1 +1,4 @@
1
1
  STORE = []
2
+ CRASHES = []
3
+
4
+ SuckerPunch.exception_handler { |ex| CRASHES << ex }
@@ -2,6 +2,7 @@ Myapp::Application.routes.draw do
2
2
  root "jobs#index"
3
3
 
4
4
  resources :jobs, only: [:index] do
5
+ post :crashing, on: :collection
5
6
  post :single, on: :collection
6
7
  post :multiple, on: :collection
7
8
  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.0.5
4
+ version: '1.1'
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-05-11 00:00:00.000000000 Z
11
+ date: 2014-06-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -96,6 +96,7 @@ files:
96
96
  - rails_app_example/app/assets/stylesheets/application.css
97
97
  - rails_app_example/app/controllers/application_controller.rb
98
98
  - rails_app_example/app/controllers/jobs_controller.rb
99
+ - rails_app_example/app/jobs/crashing_job.rb
99
100
  - rails_app_example/app/jobs/multiple_job.rb
100
101
  - rails_app_example/app/jobs/single_job.rb
101
102
  - rails_app_example/app/models/.keep