thredded_resque 0.0.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.
- data/MIT-LICENSE +20 -0
- data/README.mkdn +34 -0
- data/Rakefile +27 -0
- data/config/initializers/can_access_resque.rb +6 -0
- data/config/initializers/resque_mailer.rb +1 -0
- data/config/routes.rb +5 -0
- data/lib/generators/thredded_resque/install/install_generator.rb +13 -0
- data/lib/tasks/resque.rake +12 -0
- data/lib/tasks/thredded_resque_tasks.rake +4 -0
- data/lib/thredded_resque/engine.rb +14 -0
- data/lib/thredded_resque/version.rb +3 -0
- data/lib/thredded_resque.rb +6 -0
- metadata +121 -0
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2013 YOURNAME
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.mkdn
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Thredded + Redis + Resque
|
2
|
+
|
3
|
+
Out of the gate thredded does require anything other than a recent version of
|
4
|
+
ruby, and postgres and it works fine as is. There is a need over time to speed
|
5
|
+
things up with something like a background job processing queue, or a nosql
|
6
|
+
store like redis to help speed things up.
|
7
|
+
|
8
|
+
This gem helps do that. Using [resque] and [resque_mailer] it automatically
|
9
|
+
updates all mailers to push into resque instead of sending immediately. For now
|
10
|
+
that's all it does, but in time it will do more.
|
11
|
+
|
12
|
+
[resque]: https://github.com/defunkt/resque
|
13
|
+
[resque_mailer]: https://github.com/zapnap/resque_mailer
|
14
|
+
|
15
|
+
## Installation
|
16
|
+
|
17
|
+
* Dependencies:
|
18
|
+
1. Redis must be installed. If you're on a mac: `brew install redis` and follow the directions.
|
19
|
+
2. Use [foreman] ([railscast episode]) locally, and have a Procfile set up (there is a default Procfile in the thredded repo). This isn't a hard and fast requirement but it will certainly make things easier.
|
20
|
+
* Add this gem into your thredded app **Gemfile** - `gem 'thredded_resque'`
|
21
|
+
* Install with - `bundle install`
|
22
|
+
* Run the generator - `rails g thredded_resque:install`. This will append a worker to your Procfile.
|
23
|
+
* Start your local server and worker with foreman (`foreman start`) or start both of them
|
24
|
+
individually:
|
25
|
+
|
26
|
+
```
|
27
|
+
bundle exec rails server
|
28
|
+
bundle exec rake environment resque:work QUEUE='*'
|
29
|
+
```
|
30
|
+
|
31
|
+
[foreman]: https://github.com/ddollar/foreman
|
32
|
+
[railscast episode]: http://railscasts.com/episodes/281-foreman
|
33
|
+
|
34
|
+
## Using with heroku
|
data/Rakefile
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
begin
|
3
|
+
require 'bundler/setup'
|
4
|
+
rescue LoadError
|
5
|
+
puts 'You must `gem install bundler` and `bundle install` to run rake tasks'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'rdoc/task'
|
9
|
+
rescue LoadError
|
10
|
+
require 'rdoc/rdoc'
|
11
|
+
require 'rake/rdoctask'
|
12
|
+
RDoc::Task = Rake::RDocTask
|
13
|
+
end
|
14
|
+
|
15
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
16
|
+
rdoc.rdoc_dir = 'rdoc'
|
17
|
+
rdoc.title = 'ThreddedResque'
|
18
|
+
rdoc.options << '--line-numbers'
|
19
|
+
rdoc.rdoc_files.include('README.rdoc')
|
20
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
21
|
+
end
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Bundler::GemHelper.install_tasks
|
27
|
+
|
@@ -0,0 +1 @@
|
|
1
|
+
Resque::Mailer.excluded_environments = [:test, :cucumber]
|
data/config/routes.rb
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
require 'rails/generators/base'
|
2
|
+
|
3
|
+
module ThreddedResque
|
4
|
+
module Generators
|
5
|
+
class InstallGenerator < Rails::Generators::Base
|
6
|
+
include Rails::Generators::Migration
|
7
|
+
|
8
|
+
def add_worker_to_procfile
|
9
|
+
append_file 'Procfile', "worker: bundle exec rake environment resque:work QUEUE='*'"
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'resque/tasks'
|
2
|
+
|
3
|
+
task 'resque:setup' => :environment do
|
4
|
+
ENV['QUEUE'] ||= '*'
|
5
|
+
Resque.before_fork = Proc.new { ActiveRecord::Base.establish_connection }
|
6
|
+
end
|
7
|
+
|
8
|
+
namespace :resque do
|
9
|
+
desc 'let resque workers always load the rails environment'
|
10
|
+
task setup: :environment do
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'resque/server'
|
2
|
+
require 'thredded_resque'
|
3
|
+
require 'rails'
|
4
|
+
|
5
|
+
module ThreddedResque
|
6
|
+
class Engine < Rails::Engine
|
7
|
+
initializer 'thredded_resque.extend_mailers' do |app|
|
8
|
+
app.config.to_prepare do
|
9
|
+
PostMailer.send(:include, Resque::Mailer)
|
10
|
+
TopicMailer.send(:include, Resque::Mailer)
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: thredded_resque
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Joel Oliveira
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-03-18 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: rails
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 3.2.12
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 3.2.12
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: resque
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '0'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: resque_mailer
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: sqlite3
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :development
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
description: thredded_resque adds resque, and resque-mailer support to thredded
|
79
|
+
email:
|
80
|
+
- joel@thredded.com
|
81
|
+
executables: []
|
82
|
+
extensions: []
|
83
|
+
extra_rdoc_files: []
|
84
|
+
files:
|
85
|
+
- config/initializers/can_access_resque.rb
|
86
|
+
- config/initializers/resque_mailer.rb
|
87
|
+
- config/routes.rb
|
88
|
+
- lib/generators/thredded_resque/install/install_generator.rb
|
89
|
+
- lib/tasks/resque.rake
|
90
|
+
- lib/tasks/thredded_resque_tasks.rake
|
91
|
+
- lib/thredded_resque/engine.rb
|
92
|
+
- lib/thredded_resque/version.rb
|
93
|
+
- lib/thredded_resque.rb
|
94
|
+
- MIT-LICENSE
|
95
|
+
- Rakefile
|
96
|
+
- README.mkdn
|
97
|
+
homepage: https://www.thredded.com/meta
|
98
|
+
licenses: []
|
99
|
+
post_install_message:
|
100
|
+
rdoc_options: []
|
101
|
+
require_paths:
|
102
|
+
- lib
|
103
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
104
|
+
none: false
|
105
|
+
requirements:
|
106
|
+
- - ! '>='
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '0'
|
109
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
110
|
+
none: false
|
111
|
+
requirements:
|
112
|
+
- - ! '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
requirements: []
|
116
|
+
rubyforge_project:
|
117
|
+
rubygems_version: 1.8.25
|
118
|
+
signing_key:
|
119
|
+
specification_version: 3
|
120
|
+
summary: thredded_resque adds resque, and resque-mailer support to thredded
|
121
|
+
test_files: []
|