resque-master 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/HISTORY.md +488 -0
- data/LICENSE +20 -0
- data/README.markdown +920 -0
- data/Rakefile +57 -0
- data/bin/resque +81 -0
- data/bin/resque-web +31 -0
- data/lib/resque.rb +578 -0
- data/lib/resque/data_store.rb +326 -0
- data/lib/resque/errors.rb +21 -0
- data/lib/resque/failure.rb +119 -0
- data/lib/resque/failure/airbrake.rb +33 -0
- data/lib/resque/failure/base.rb +73 -0
- data/lib/resque/failure/multiple.rb +68 -0
- data/lib/resque/failure/redis.rb +128 -0
- data/lib/resque/failure/redis_multi_queue.rb +104 -0
- data/lib/resque/helpers.rb +48 -0
- data/lib/resque/job.rb +296 -0
- data/lib/resque/log_formatters/quiet_formatter.rb +7 -0
- data/lib/resque/log_formatters/verbose_formatter.rb +7 -0
- data/lib/resque/log_formatters/very_verbose_formatter.rb +8 -0
- data/lib/resque/logging.rb +18 -0
- data/lib/resque/plugin.rb +78 -0
- data/lib/resque/server.rb +299 -0
- data/lib/resque/server/helpers.rb +64 -0
- data/lib/resque/server/public/favicon.ico +0 -0
- data/lib/resque/server/public/idle.png +0 -0
- data/lib/resque/server/public/jquery-1.12.4.min.js +5 -0
- data/lib/resque/server/public/jquery.relatize_date.js +95 -0
- data/lib/resque/server/public/poll.png +0 -0
- data/lib/resque/server/public/ranger.js +78 -0
- data/lib/resque/server/public/reset.css +44 -0
- data/lib/resque/server/public/style.css +91 -0
- data/lib/resque/server/public/working.png +0 -0
- data/lib/resque/server/test_helper.rb +19 -0
- data/lib/resque/server/views/error.erb +1 -0
- data/lib/resque/server/views/failed.erb +29 -0
- data/lib/resque/server/views/failed_job.erb +50 -0
- data/lib/resque/server/views/failed_queues_overview.erb +24 -0
- data/lib/resque/server/views/key_sets.erb +17 -0
- data/lib/resque/server/views/key_string.erb +11 -0
- data/lib/resque/server/views/layout.erb +44 -0
- data/lib/resque/server/views/next_more.erb +22 -0
- data/lib/resque/server/views/overview.erb +4 -0
- data/lib/resque/server/views/queues.erb +58 -0
- data/lib/resque/server/views/stats.erb +62 -0
- data/lib/resque/server/views/workers.erb +111 -0
- data/lib/resque/server/views/working.erb +72 -0
- data/lib/resque/stat.rb +58 -0
- data/lib/resque/tasks.rb +72 -0
- data/lib/resque/thread_signal.rb +45 -0
- data/lib/resque/vendor/utf8_util.rb +26 -0
- data/lib/resque/vendor/utf8_util/utf8_util_18.rb +91 -0
- data/lib/resque/vendor/utf8_util/utf8_util_19.rb +6 -0
- data/lib/resque/version.rb +5 -0
- data/lib/resque/worker.rb +891 -0
- data/lib/tasks/redis.rake +161 -0
- data/lib/tasks/resque.rake +2 -0
- metadata +177 -0
@@ -0,0 +1,161 @@
|
|
1
|
+
# Inspired by rabbitmq.rake the Redbox project at http://github.com/rick/redbox/tree/master
|
2
|
+
require 'fileutils'
|
3
|
+
require 'open-uri'
|
4
|
+
require 'pathname'
|
5
|
+
|
6
|
+
class RedisRunner
|
7
|
+
def self.redis_dir
|
8
|
+
@redis_dir ||= if ENV['PREFIX']
|
9
|
+
Pathname.new(ENV['PREFIX'])
|
10
|
+
else
|
11
|
+
Pathname.new(`which redis-server`) + '..' + '..'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.bin_dir
|
16
|
+
redis_dir + 'bin'
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.config
|
20
|
+
@config ||= if File.exists?(redis_dir + 'etc/redis.conf')
|
21
|
+
redis_dir + 'etc/redis.conf'
|
22
|
+
else
|
23
|
+
redis_dir + '../etc/redis.conf'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def self.dtach_socket
|
28
|
+
'/tmp/redis.dtach'
|
29
|
+
end
|
30
|
+
|
31
|
+
# Just check for existance of dtach socket
|
32
|
+
def self.running?
|
33
|
+
File.exists? dtach_socket
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.start
|
37
|
+
puts 'Detach with Ctrl+\ Re-attach with rake redis:attach'
|
38
|
+
sleep 1
|
39
|
+
command = "#{bin_dir}/dtach -A #{dtach_socket} #{bin_dir}/redis-server #{config}"
|
40
|
+
sh command
|
41
|
+
end
|
42
|
+
|
43
|
+
def self.attach
|
44
|
+
exec "#{bin_dir}/dtach -a #{dtach_socket}"
|
45
|
+
end
|
46
|
+
|
47
|
+
def self.stop
|
48
|
+
sh 'echo "SHUTDOWN" | nc localhost 6379'
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
INSTALL_DIR = ENV['INSTALL_DIR'] || '/tmp/redis'
|
53
|
+
|
54
|
+
namespace :redis do
|
55
|
+
desc 'About redis'
|
56
|
+
task :about do
|
57
|
+
puts "\nSee http://code.google.com/p/redis/ for information about redis.\n\n"
|
58
|
+
end
|
59
|
+
|
60
|
+
desc 'Start redis'
|
61
|
+
task :start do
|
62
|
+
RedisRunner.start
|
63
|
+
end
|
64
|
+
|
65
|
+
desc 'Stop redis'
|
66
|
+
task :stop do
|
67
|
+
RedisRunner.stop
|
68
|
+
end
|
69
|
+
|
70
|
+
desc 'Restart redis'
|
71
|
+
task :restart do
|
72
|
+
RedisRunner.stop
|
73
|
+
RedisRunner.start
|
74
|
+
end
|
75
|
+
|
76
|
+
desc 'Attach to redis dtach socket'
|
77
|
+
task :attach do
|
78
|
+
RedisRunner.attach
|
79
|
+
end
|
80
|
+
|
81
|
+
desc <<-DOC
|
82
|
+
Install the latest verison of Redis from Github (requires git, duh).
|
83
|
+
Use INSTALL_DIR env var like "rake redis:install INSTALL_DIR=~/tmp"
|
84
|
+
in order to get an alternate location for your install files.
|
85
|
+
DOC
|
86
|
+
|
87
|
+
task :install => [:about, :download, :make] do
|
88
|
+
bin_dir = '/usr/bin'
|
89
|
+
conf_dir = '/etc'
|
90
|
+
|
91
|
+
if ENV['PREFIX']
|
92
|
+
bin_dir = "#{ENV['PREFIX']}/bin"
|
93
|
+
sh "mkdir -p #{bin_dir}" unless File.exists?("#{bin_dir}")
|
94
|
+
|
95
|
+
conf_dir = "#{ENV['PREFIX']}/etc"
|
96
|
+
sh "mkdir -p #{conf_dir}" unless File.exists?("#{conf_dir}")
|
97
|
+
end
|
98
|
+
|
99
|
+
%w(redis-benchmark redis-cli redis-server).each do |bin|
|
100
|
+
sh "cp #{INSTALL_DIR}/src/#{bin} #{bin_dir}"
|
101
|
+
end
|
102
|
+
|
103
|
+
puts "Installed redis-benchmark, redis-cli and redis-server to #{bin_dir}"
|
104
|
+
|
105
|
+
unless File.exists?("#{conf_dir}/redis.conf")
|
106
|
+
sh "cp #{INSTALL_DIR}/redis.conf #{conf_dir}/redis.conf"
|
107
|
+
puts "Installed redis.conf to #{conf_dir} \n You should look at this file!"
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
task :make do
|
112
|
+
sh "cd #{INSTALL_DIR}/src && make clean"
|
113
|
+
sh "cd #{INSTALL_DIR}/src && make"
|
114
|
+
end
|
115
|
+
|
116
|
+
desc "Download package"
|
117
|
+
task :download do
|
118
|
+
sh "rm -rf #{INSTALL_DIR}/" if File.exists?("#{INSTALL_DIR}/.svn")
|
119
|
+
sh "git clone git://github.com/antirez/redis.git #{INSTALL_DIR}" unless File.exists?(INSTALL_DIR)
|
120
|
+
sh "cd #{INSTALL_DIR} && git pull" if File.exists?("#{INSTALL_DIR}/.git")
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
namespace :dtach do
|
125
|
+
desc 'About dtach'
|
126
|
+
task :about do
|
127
|
+
puts "\nSee http://dtach.sourceforge.net/ for information about dtach.\n\n"
|
128
|
+
end
|
129
|
+
|
130
|
+
desc 'Install dtach 0.8 from source'
|
131
|
+
task :install => [:about, :download, :make] do
|
132
|
+
|
133
|
+
bin_dir = "/usr/bin"
|
134
|
+
|
135
|
+
|
136
|
+
if ENV['PREFIX']
|
137
|
+
bin_dir = "#{ENV['PREFIX']}/bin"
|
138
|
+
sh "mkdir -p #{bin_dir}" unless File.exists?("#{bin_dir}")
|
139
|
+
end
|
140
|
+
|
141
|
+
sh "cp #{INSTALL_DIR}/dtach-0.8/dtach #{bin_dir}"
|
142
|
+
end
|
143
|
+
|
144
|
+
task :make do
|
145
|
+
sh "cd #{INSTALL_DIR}/dtach-0.8/ && ./configure && make"
|
146
|
+
end
|
147
|
+
|
148
|
+
desc "Download package"
|
149
|
+
task :download do
|
150
|
+
unless File.exists?("#{INSTALL_DIR}/dtach-0.8.tar.gz")
|
151
|
+
require 'net/http'
|
152
|
+
|
153
|
+
url = 'http://downloads.sourceforge.net/project/dtach/dtach/0.8/dtach-0.8.tar.gz'
|
154
|
+
open("#{INSTALL_DIR}/dtach-0.8.tar.gz", 'wb') do |file| file.write(open(url).read) end
|
155
|
+
end
|
156
|
+
|
157
|
+
unless File.directory?("#{INSTALL_DIR}/dtach-0.8")
|
158
|
+
sh "cd #{INSTALL_DIR} && tar xzf dtach-0.8.tar.gz"
|
159
|
+
end
|
160
|
+
end
|
161
|
+
end
|
metadata
ADDED
@@ -0,0 +1,177 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: resque-master
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.3
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Chris Wanstrath
|
8
|
+
- Steve Klabnik
|
9
|
+
- Terence Lee
|
10
|
+
autorequire:
|
11
|
+
bindir: bin
|
12
|
+
cert_chain: []
|
13
|
+
date: 2016-09-15 00:00:00.000000000 Z
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: redis-namespace
|
17
|
+
requirement: !ruby/object:Gem::Requirement
|
18
|
+
requirements:
|
19
|
+
- - "~>"
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '1.3'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
requirements:
|
26
|
+
- - "~>"
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
version: '1.3'
|
29
|
+
- !ruby/object:Gem::Dependency
|
30
|
+
name: vegas
|
31
|
+
requirement: !ruby/object:Gem::Requirement
|
32
|
+
requirements:
|
33
|
+
- - "~>"
|
34
|
+
- !ruby/object:Gem::Version
|
35
|
+
version: 0.1.2
|
36
|
+
type: :runtime
|
37
|
+
prerelease: false
|
38
|
+
version_requirements: !ruby/object:Gem::Requirement
|
39
|
+
requirements:
|
40
|
+
- - "~>"
|
41
|
+
- !ruby/object:Gem::Version
|
42
|
+
version: 0.1.2
|
43
|
+
- !ruby/object:Gem::Dependency
|
44
|
+
name: sinatra
|
45
|
+
requirement: !ruby/object:Gem::Requirement
|
46
|
+
requirements:
|
47
|
+
- - ">="
|
48
|
+
- !ruby/object:Gem::Version
|
49
|
+
version: 0.9.2
|
50
|
+
type: :runtime
|
51
|
+
prerelease: false
|
52
|
+
version_requirements: !ruby/object:Gem::Requirement
|
53
|
+
requirements:
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: 0.9.2
|
57
|
+
- !ruby/object:Gem::Dependency
|
58
|
+
name: multi_json
|
59
|
+
requirement: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.0'
|
64
|
+
type: :runtime
|
65
|
+
prerelease: false
|
66
|
+
version_requirements: !ruby/object:Gem::Requirement
|
67
|
+
requirements:
|
68
|
+
- - "~>"
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: '1.0'
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: mono_logger
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '1.0'
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - "~>"
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: '1.0'
|
85
|
+
description: Tracks the master branch of resque 1.27.0 at sha a3a66389618b830de0e6acf862b0dc9fde05cf49
|
86
|
+
email: steve@steveklabnik.com
|
87
|
+
executables:
|
88
|
+
- resque
|
89
|
+
- resque-web
|
90
|
+
extensions: []
|
91
|
+
extra_rdoc_files:
|
92
|
+
- LICENSE
|
93
|
+
- README.markdown
|
94
|
+
files:
|
95
|
+
- HISTORY.md
|
96
|
+
- LICENSE
|
97
|
+
- README.markdown
|
98
|
+
- Rakefile
|
99
|
+
- bin/resque
|
100
|
+
- bin/resque-web
|
101
|
+
- lib/resque.rb
|
102
|
+
- lib/resque/data_store.rb
|
103
|
+
- lib/resque/errors.rb
|
104
|
+
- lib/resque/failure.rb
|
105
|
+
- lib/resque/failure/airbrake.rb
|
106
|
+
- lib/resque/failure/base.rb
|
107
|
+
- lib/resque/failure/multiple.rb
|
108
|
+
- lib/resque/failure/redis.rb
|
109
|
+
- lib/resque/failure/redis_multi_queue.rb
|
110
|
+
- lib/resque/helpers.rb
|
111
|
+
- lib/resque/job.rb
|
112
|
+
- lib/resque/log_formatters/quiet_formatter.rb
|
113
|
+
- lib/resque/log_formatters/verbose_formatter.rb
|
114
|
+
- lib/resque/log_formatters/very_verbose_formatter.rb
|
115
|
+
- lib/resque/logging.rb
|
116
|
+
- lib/resque/plugin.rb
|
117
|
+
- lib/resque/server.rb
|
118
|
+
- lib/resque/server/helpers.rb
|
119
|
+
- lib/resque/server/public/favicon.ico
|
120
|
+
- lib/resque/server/public/idle.png
|
121
|
+
- lib/resque/server/public/jquery-1.12.4.min.js
|
122
|
+
- lib/resque/server/public/jquery.relatize_date.js
|
123
|
+
- lib/resque/server/public/poll.png
|
124
|
+
- lib/resque/server/public/ranger.js
|
125
|
+
- lib/resque/server/public/reset.css
|
126
|
+
- lib/resque/server/public/style.css
|
127
|
+
- lib/resque/server/public/working.png
|
128
|
+
- lib/resque/server/test_helper.rb
|
129
|
+
- lib/resque/server/views/error.erb
|
130
|
+
- lib/resque/server/views/failed.erb
|
131
|
+
- lib/resque/server/views/failed_job.erb
|
132
|
+
- lib/resque/server/views/failed_queues_overview.erb
|
133
|
+
- lib/resque/server/views/key_sets.erb
|
134
|
+
- lib/resque/server/views/key_string.erb
|
135
|
+
- lib/resque/server/views/layout.erb
|
136
|
+
- lib/resque/server/views/next_more.erb
|
137
|
+
- lib/resque/server/views/overview.erb
|
138
|
+
- lib/resque/server/views/queues.erb
|
139
|
+
- lib/resque/server/views/stats.erb
|
140
|
+
- lib/resque/server/views/workers.erb
|
141
|
+
- lib/resque/server/views/working.erb
|
142
|
+
- lib/resque/stat.rb
|
143
|
+
- lib/resque/tasks.rb
|
144
|
+
- lib/resque/thread_signal.rb
|
145
|
+
- lib/resque/vendor/utf8_util.rb
|
146
|
+
- lib/resque/vendor/utf8_util/utf8_util_18.rb
|
147
|
+
- lib/resque/vendor/utf8_util/utf8_util_19.rb
|
148
|
+
- lib/resque/version.rb
|
149
|
+
- lib/resque/worker.rb
|
150
|
+
- lib/tasks/redis.rake
|
151
|
+
- lib/tasks/resque.rake
|
152
|
+
homepage: http://resque.github.io/
|
153
|
+
licenses:
|
154
|
+
- MIT
|
155
|
+
metadata: {}
|
156
|
+
post_install_message:
|
157
|
+
rdoc_options:
|
158
|
+
- "--charset=UTF-8"
|
159
|
+
require_paths:
|
160
|
+
- lib
|
161
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
162
|
+
requirements:
|
163
|
+
- - ">="
|
164
|
+
- !ruby/object:Gem::Version
|
165
|
+
version: '0'
|
166
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
167
|
+
requirements:
|
168
|
+
- - ">="
|
169
|
+
- !ruby/object:Gem::Version
|
170
|
+
version: '0'
|
171
|
+
requirements: []
|
172
|
+
rubyforge_project:
|
173
|
+
rubygems_version: 2.5.1
|
174
|
+
signing_key:
|
175
|
+
specification_version: 4
|
176
|
+
summary: Tracks the master branch of resque 1.27.0 at sha a3a66389618b830de0e6acf862b0dc9fde05cf49
|
177
|
+
test_files: []
|