insque 0.3.0 → 0.3.1

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.
Files changed (4) hide show
  1. data/README.md +10 -7
  2. data/lib/insque/version.rb +1 -1
  3. data/lib/insque.rb +13 -13
  4. metadata +2 -2
data/README.md CHANGED
@@ -6,20 +6,20 @@ Instant queue. Background processing and message driven communication tool. Fast
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'insque', :git => 'https://github.com/Gropher/Insque.git'
9
+ gem 'insque'
10
10
 
11
11
  And then execute:
12
12
 
13
13
  $ bundle
14
14
 
15
- Or install it yourself as:
15
+ Or install it manually:
16
16
 
17
17
  $ gem install insque
18
18
 
19
19
  ## Usage
20
20
 
21
21
  At first you need to generate initializer and redis config file. Pass your sender name as parameter.
22
- Sender name is the unique identifier of your instance of insque. You can use several instances of insque to create message driven communication system
22
+ Sender name is the unique identifier of your instance of insque. You can use several instances of insque to create message driven communication system.
23
23
 
24
24
  $ rails g insque:initializer somesender
25
25
 
@@ -63,10 +63,13 @@ Insque.janitor
63
63
 
64
64
  ### Daemonizing
65
65
 
66
- If you want to run insque listener as a daemon consider using [foreman](https://github.com/ddollar/foreman) for this.
66
+ If you want to run insque listener as a daemon consider using [foreman](https://github.com/ddollar/foreman) for this.
67
+
68
+ If you deploy with capistrano you may want to try a version of foreman with build in capistrano support.
67
69
 
68
70
  Add foreman to your `Gemfile`:
69
71
 
72
+ gem 'foreman' # OR
70
73
  gem 'foreman-capistrano'
71
74
 
72
75
  Install it:
@@ -85,11 +88,11 @@ Run foreman from your console:
85
88
  For production use modify your capistrano deploy script somewhat like this:
86
89
 
87
90
  set :default_environment, {'PATH' => "/sbin:$PATH"} # Optional. Useful if you get errors because start or restart command not found
88
- set :foreman_concurrency, "\"listener=4,janitor=2\"" # How many processes of each type do you want
91
+ set :foreman_concurrency, "\"listener=2,janitor=1\"" # How many processes of each type do you want
89
92
  require 'foreman/capistrano'
90
93
 
91
- after "deploy", "foreman:export" # Export Procfile as a set of upstart jobs
92
- after "deploy", "foreman:restart" # You will need upstart installed on your server for this to work.
94
+ after "deploy", "foreman:export" # Export Procfile as a set of upstart jobs
95
+ after "deploy", "foreman:restart" # You will need upstart installed on your server for this to work.
93
96
 
94
97
  ## Contributing
95
98
 
@@ -1,3 +1,3 @@
1
1
  module Insque
2
- VERSION = "0.3.0"
2
+ VERSION = "0.3.1"
3
3
  end
data/lib/insque.rb CHANGED
@@ -102,21 +102,21 @@ module Insque
102
102
  end
103
103
  end
104
104
 
105
- class ActiveRecord::Base
106
- def send_later(method, *args)
107
- Insque.broadcast :send_later, {:class => self.class.name, :id => id, :method => method, :args => args }, :self
108
- end
109
-
110
- def self.acts_as_insque_crud(*args)
111
- options = args.extract_options!
112
- excluded = (options[:exclude] || []).map(&:to_s)
105
+ if defined?(ActiveRecord::Base)
106
+ class ActiveRecord::Base
107
+ def send_later(method, *args)
108
+ Insque.broadcast :send_later, {:class => self.class.name, :id => id, :method => method, :args => args }, :self
109
+ end
110
+ def self.acts_as_insque_crud(*args)
111
+ options = args.extract_options!
112
+ excluded = (options[:exclude] || []).map(&:to_s)
113
113
 
114
- [:update, :create, :destroy].each do |action|
115
- set_callback action, :after do
116
- params = self.serializable_hash(options).delete_if {|key| (['created_at', 'updated_at'] + excluded).include? key}
117
- Insque.broadcast :"#{self.class.to_s.underscore}_#{action}", params
114
+ [:update, :create, :destroy].each do |action|
115
+ set_callback action, :after do
116
+ params = self.serializable_hash(options).delete_if {|key| (['created_at', 'updated_at'] + excluded).include? key}
117
+ Insque.broadcast :"#{self.class.to_s.underscore}_#{action}", params
118
+ end
118
119
  end
119
120
  end
120
121
  end
121
-
122
122
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: insque
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-04 00:00:00.000000000 Z
12
+ date: 2012-11-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: redis