localjob 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +4 -0
- data/README.md +1 -1
- data/lib/localjob/cli.rb +2 -34
- data/lib/localjob/version.rb +1 -1
- data/lib/localjob/worker.rb +1 -0
- data/lib/localjob.rb +0 -3
- data/localjob.gemspec +0 -1
- data/test/integration.rb +12 -0
- metadata +5 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0917b722ab080a63864457aa154296a191d095ec
|
4
|
+
data.tar.gz: f15b71a3239ae2fd38cba2861c02d61b33b4c019
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 094f2204527babf51a1da02a0482826305c1510dac6c14e2ca75b7ad7417c8b00c60acb0242783edc24e866a4165ce3425ae909a6127623666aebfc71504ac95
|
7
|
+
data.tar.gz: fb2f04ea2bd0c6510d9e3ce9d3f3cb6feb8b62cb99d132dff6976ff18871adf07ca67c9ac41e5e5b132281dc50e189867a72b800ffe9544b7efe89569563557e
|
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Localjob
|
1
|
+
# Localjob [![Build Status](https://travis-ci.org/Sirupsen/localjob.png?branch=master)](https://travis-ci.org/Sirupsen/localjob) [![Code Climate](https://codeclimate.com/github/Sirupsen/localjob.png)](https://codeclimate.com/github/Sirupsen/localjob)
|
2
2
|
|
3
3
|
Localjob is a simple, self-contained background queue built on top of [System V
|
4
4
|
message queues][sysv] (SysV Message Queue => SysV MQ for short). Workers and the
|
data/lib/localjob/cli.rb
CHANGED
@@ -2,43 +2,14 @@ require 'thor'
|
|
2
2
|
|
3
3
|
class Localjob
|
4
4
|
class CLI < Thor
|
5
|
-
option :
|
5
|
+
option :queue, aliases: ["-q"], type: :string, default: "0x10CA110B"
|
6
6
|
option :require, aliases: ["-r"], type: :string, default: "."
|
7
7
|
option :pid_file, aliases: ["-p"], type: :string
|
8
8
|
option :daemon, aliases: ["-d"], type: :boolean
|
9
9
|
desc "work", "Start worker to process jobs"
|
10
10
|
def work
|
11
11
|
load_environment options[:require]
|
12
|
-
|
13
|
-
queues = options[:queues].split(",")
|
14
|
-
Localjob::Worker.new(queues, options.slice(:daemon, :pid_file)).work
|
15
|
-
end
|
16
|
-
|
17
|
-
desc "size", "Outputs the size of queues"
|
18
|
-
option :queues, aliases: ["-q"], type: :string, default: "localjob"
|
19
|
-
def size
|
20
|
-
queues = options[:queues].split(",")
|
21
|
-
queues.each do |queue|
|
22
|
-
puts "Size of /#{queue}: #{Localjob.new(queue).size}/#{msg_max}"
|
23
|
-
end
|
24
|
-
end
|
25
|
-
|
26
|
-
desc "destroy", "Destroys all queues passed"
|
27
|
-
option :queues, aliases: ["-q"], type: :string, default: "localjob"
|
28
|
-
def destroy
|
29
|
-
options[:queues].split(",").each do |queue|
|
30
|
-
Localjob.new(queue).destroy
|
31
|
-
end
|
32
|
-
end
|
33
|
-
|
34
|
-
desc "list", "Lists all queues"
|
35
|
-
def list
|
36
|
-
unless File.exists?("/dev/mqueue")
|
37
|
-
system "mkdir /dev/mqueue"
|
38
|
-
system "mount -t mqueue none /dev/mqueue"
|
39
|
-
end
|
40
|
-
|
41
|
-
system "ls -l /dev/mqueue"
|
12
|
+
Localjob::Worker.new(options[:queue].to_i(16), *options.slice(:daemon, :pid_file)).work
|
42
13
|
end
|
43
14
|
|
44
15
|
private
|
@@ -49,9 +20,6 @@ class Localjob
|
|
49
20
|
::Rails.application.eager_load!
|
50
21
|
elsif File.file?(file)
|
51
22
|
require File.expand_path(file)
|
52
|
-
else
|
53
|
-
puts "No require path passed, requires -r if not in Rails"
|
54
|
-
exit
|
55
23
|
end
|
56
24
|
end
|
57
25
|
|
data/lib/localjob/version.rb
CHANGED
data/lib/localjob/worker.rb
CHANGED
data/lib/localjob.rb
CHANGED
data/localjob.gemspec
CHANGED
data/test/integration.rb
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: localjob
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Simon Eskildsen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-03-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|
@@ -80,20 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: stackprof
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :development
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
83
|
description: Simple, self-contained background queue built on top of POSIX message
|
98
84
|
queues.
|
99
85
|
email:
|
@@ -104,6 +90,7 @@ extensions: []
|
|
104
90
|
extra_rdoc_files: []
|
105
91
|
files:
|
106
92
|
- ".gitignore"
|
93
|
+
- ".travis.yml"
|
107
94
|
- Gemfile
|
108
95
|
- LICENSE.txt
|
109
96
|
- README.md
|
@@ -116,6 +103,7 @@ files:
|
|
116
103
|
- lib/localjob/version.rb
|
117
104
|
- lib/localjob/worker.rb
|
118
105
|
- localjob.gemspec
|
106
|
+
- test/integration.rb
|
119
107
|
- test/jobs.rb
|
120
108
|
- test/localjob_test.rb
|
121
109
|
- test/mock_adapter.rb
|
@@ -148,6 +136,7 @@ specification_version: 4
|
|
148
136
|
summary: Simple, self-contained background queue built on top of POSIX message queues.
|
149
137
|
It only works on Linux.
|
150
138
|
test_files:
|
139
|
+
- test/integration.rb
|
151
140
|
- test/jobs.rb
|
152
141
|
- test/localjob_test.rb
|
153
142
|
- test/mock_adapter.rb
|