labor 0.1 → 0.1.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/README.md +4 -0
- data/Rakefile +10 -23
- data/lib/labor/version.rb +1 -1
- data/lib/labor/worker.rb +2 -10
- data/spec/labor_spec.rb +18 -0
- metadata +41 -58
- data/labor.gemspec +0 -61
data/README.md
CHANGED
data/Rakefile
CHANGED
@@ -1,28 +1,15 @@
|
|
1
|
-
|
2
|
-
require "jeweler"
|
3
|
-
|
4
|
-
Jeweler::Tasks.new do |gem|
|
5
|
-
gem.name = "labor"
|
6
|
-
gem.version = "0.1"
|
7
|
-
gem.summary = "More portable jobs for Gearman workers."
|
8
|
-
gem.description = <<-desc
|
9
|
-
Wrapper for gearman-ruby that provides a different, and more portable, way of defining jobs.
|
10
|
-
desc
|
11
|
-
gem.email = "brett@intraspirit.net"
|
12
|
-
gem.homepage = "http://github.com/brettbuddin/labor"
|
13
|
-
gem.date = Time.now.strftime('%Y-%m-%d')
|
14
|
-
gem.authors = ["Brett Buddin"]
|
15
|
-
gem.files = %w( README.md Rakefile LICENSE )
|
16
|
-
gem.files += Dir["*", "{lib}/**/*"]
|
17
|
-
gem.add_dependency "gearman-ruby"
|
18
|
-
gem.add_dependency "json"
|
1
|
+
$LOAD_PATH.unshift 'lib'
|
19
2
|
|
20
|
-
|
21
|
-
|
3
|
+
desc "Stamp a new version and push it to Rubygems.org"
|
4
|
+
task :stamp_version do
|
5
|
+
require 'labor/version'
|
22
6
|
|
23
|
-
|
24
|
-
|
25
|
-
|
7
|
+
sh "gem build labor.gemspec"
|
8
|
+
sh "gem push labor-#{Labor::Version}.gem"
|
9
|
+
sh "git tag v#{Labor::Version}"
|
10
|
+
sh "git push origin v#{Labor::Version}"
|
11
|
+
sh "git push origin master"
|
12
|
+
sh "git clean -fd"
|
26
13
|
end
|
27
14
|
|
28
15
|
begin
|
data/lib/labor/version.rb
CHANGED
data/lib/labor/worker.rb
CHANGED
@@ -3,7 +3,7 @@ module Labor
|
|
3
3
|
include Helpers
|
4
4
|
|
5
5
|
def initialize(*abilities)
|
6
|
-
@worker = Gearman::Worker.new
|
6
|
+
@worker = Gearman::Worker.new
|
7
7
|
add_abilities(abilities)
|
8
8
|
end
|
9
9
|
|
@@ -11,6 +11,7 @@ module Labor
|
|
11
11
|
#
|
12
12
|
# Returns nothing.
|
13
13
|
def work
|
14
|
+
@worker.job_servers = Labor.servers
|
14
15
|
register_signals
|
15
16
|
loop { @worker.work or break }
|
16
17
|
end
|
@@ -50,15 +51,6 @@ module Labor
|
|
50
51
|
end
|
51
52
|
end
|
52
53
|
|
53
|
-
# Sets the procline of the program. You can observe it via `top`.
|
54
|
-
#
|
55
|
-
# str - The String to be assigned to the procline.
|
56
|
-
#
|
57
|
-
# Returns the String assigned to the procline.
|
58
|
-
def procline=(str)
|
59
|
-
$0 = "labor: #{str}"
|
60
|
-
end
|
61
|
-
|
62
54
|
# Registers trapping signals with the worker.
|
63
55
|
#
|
64
56
|
# Returns nothing.
|
data/spec/labor_spec.rb
CHANGED
@@ -12,4 +12,22 @@ describe Labor do
|
|
12
12
|
Labor.servers.should == ["10.0.0.1:4370", "10.0.0.2:4370"]
|
13
13
|
end
|
14
14
|
end
|
15
|
+
|
16
|
+
describe :configuration do
|
17
|
+
before(:each) do
|
18
|
+
Labor.config = File.join(File.dirname(__FILE__), 'files', 'sample_config.rb')
|
19
|
+
end
|
20
|
+
|
21
|
+
after(:each) do
|
22
|
+
Labor.instance_variable_set(:@config, nil)
|
23
|
+
end
|
24
|
+
|
25
|
+
it "can instantiate the config object" do
|
26
|
+
Labor.config.should be_instance_of(Labor::Config)
|
27
|
+
end
|
28
|
+
|
29
|
+
it "can retreive a key from the loaded config file" do
|
30
|
+
Labor.config.foo.should == "bar"
|
31
|
+
end
|
32
|
+
end
|
15
33
|
end
|
metadata
CHANGED
@@ -1,68 +1,58 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: labor
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 1
|
8
|
-
version: "0.1"
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
5
|
+
prerelease:
|
9
6
|
platform: ruby
|
10
|
-
authors:
|
7
|
+
authors:
|
11
8
|
- Brett Buddin
|
12
9
|
autorequire:
|
13
10
|
bindir: bin
|
14
11
|
cert_chain: []
|
15
|
-
|
16
|
-
date: 2011-02-19 00:00:00 -05:00
|
12
|
+
date: 2011-02-20 00:00:00.000000000 -05:00
|
17
13
|
default_executable:
|
18
|
-
dependencies:
|
19
|
-
- !ruby/object:Gem::Dependency
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
20
16
|
name: gearman-ruby
|
21
|
-
|
22
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
17
|
+
requirement: &2157813680 !ruby/object:Gem::Requirement
|
23
18
|
none: false
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
- 0
|
29
|
-
version: "0"
|
19
|
+
requirements:
|
20
|
+
- - ! '>='
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
30
23
|
type: :runtime
|
31
|
-
version_requirements: *id001
|
32
|
-
- !ruby/object:Gem::Dependency
|
33
|
-
name: json
|
34
24
|
prerelease: false
|
35
|
-
|
25
|
+
version_requirements: *2157813680
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: json
|
28
|
+
requirement: &2157813100 !ruby/object:Gem::Requirement
|
36
29
|
none: false
|
37
|
-
requirements:
|
38
|
-
- -
|
39
|
-
- !ruby/object:Gem::Version
|
40
|
-
|
41
|
-
- 0
|
42
|
-
version: "0"
|
30
|
+
requirements:
|
31
|
+
- - ! '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
43
34
|
type: :runtime
|
44
|
-
|
45
|
-
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2157813100
|
37
|
+
description: Wrapper for gearman-ruby that provides a different, and more portable,
|
38
|
+
way of defining jobs.
|
46
39
|
email: brett@intraspirit.net
|
47
40
|
executables: []
|
48
|
-
|
49
41
|
extensions: []
|
50
|
-
|
51
|
-
extra_rdoc_files:
|
42
|
+
extra_rdoc_files:
|
52
43
|
- LICENSE
|
53
44
|
- README.md
|
54
|
-
files:
|
45
|
+
files:
|
55
46
|
- LICENSE
|
56
47
|
- README.md
|
57
48
|
- Rakefile
|
58
|
-
- labor.gemspec
|
59
|
-
- lib/labor.rb
|
60
49
|
- lib/labor/config.rb
|
61
50
|
- lib/labor/core_ext.rb
|
62
51
|
- lib/labor/helpers.rb
|
63
52
|
- lib/labor/tasks.rb
|
64
53
|
- lib/labor/version.rb
|
65
54
|
- lib/labor/worker.rb
|
55
|
+
- lib/labor.rb
|
66
56
|
- spec/config_spec.rb
|
67
57
|
- spec/files/sample_config.rb
|
68
58
|
- spec/labor_spec.rb
|
@@ -71,36 +61,29 @@ files:
|
|
71
61
|
has_rdoc: true
|
72
62
|
homepage: http://github.com/brettbuddin/labor
|
73
63
|
licenses: []
|
74
|
-
|
75
64
|
post_install_message:
|
76
65
|
rdoc_options: []
|
77
|
-
|
78
|
-
require_paths:
|
66
|
+
require_paths:
|
79
67
|
- lib
|
80
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
81
69
|
none: false
|
82
|
-
requirements:
|
83
|
-
- -
|
84
|
-
- !ruby/object:Gem::Version
|
85
|
-
|
86
|
-
|
87
|
-
version: "0"
|
88
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - ! '>='
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '0'
|
74
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
89
75
|
none: false
|
90
|
-
requirements:
|
91
|
-
- -
|
92
|
-
- !ruby/object:Gem::Version
|
93
|
-
|
94
|
-
- 0
|
95
|
-
version: "0"
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
96
80
|
requirements: []
|
97
|
-
|
98
81
|
rubyforge_project:
|
99
|
-
rubygems_version: 1.
|
82
|
+
rubygems_version: 1.5.2
|
100
83
|
signing_key:
|
101
84
|
specification_version: 3
|
102
85
|
summary: More portable jobs for Gearman workers.
|
103
|
-
test_files:
|
86
|
+
test_files:
|
104
87
|
- spec/config_spec.rb
|
105
88
|
- spec/files/sample_config.rb
|
106
89
|
- spec/labor_spec.rb
|
data/labor.gemspec
DELETED
@@ -1,61 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{labor}
|
8
|
-
s.version = "0.1"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Brett Buddin"]
|
12
|
-
s.date = %q{2011-02-19}
|
13
|
-
s.description = %q{ Wrapper for gearman-ruby that provides a different, and more portable, way of defining jobs.
|
14
|
-
}
|
15
|
-
s.email = %q{brett@intraspirit.net}
|
16
|
-
s.extra_rdoc_files = [
|
17
|
-
"LICENSE",
|
18
|
-
"README.md"
|
19
|
-
]
|
20
|
-
s.files = [
|
21
|
-
"LICENSE",
|
22
|
-
"README.md",
|
23
|
-
"Rakefile",
|
24
|
-
"labor.gemspec",
|
25
|
-
"lib/labor.rb",
|
26
|
-
"lib/labor/config.rb",
|
27
|
-
"lib/labor/core_ext.rb",
|
28
|
-
"lib/labor/helpers.rb",
|
29
|
-
"lib/labor/tasks.rb",
|
30
|
-
"lib/labor/version.rb",
|
31
|
-
"lib/labor/worker.rb"
|
32
|
-
]
|
33
|
-
s.homepage = %q{http://github.com/brettbuddin/labor}
|
34
|
-
s.require_paths = ["lib"]
|
35
|
-
s.rubygems_version = %q{1.3.7}
|
36
|
-
s.summary = %q{More portable jobs for Gearman workers.}
|
37
|
-
s.test_files = [
|
38
|
-
"spec/config_spec.rb",
|
39
|
-
"spec/files/sample_config.rb",
|
40
|
-
"spec/labor_spec.rb",
|
41
|
-
"spec/spec_helper.rb",
|
42
|
-
"spec/worker_spec.rb"
|
43
|
-
]
|
44
|
-
|
45
|
-
if s.respond_to? :specification_version then
|
46
|
-
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
47
|
-
s.specification_version = 3
|
48
|
-
|
49
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
50
|
-
s.add_runtime_dependency(%q<gearman-ruby>, [">= 0"])
|
51
|
-
s.add_runtime_dependency(%q<json>, [">= 0"])
|
52
|
-
else
|
53
|
-
s.add_dependency(%q<gearman-ruby>, [">= 0"])
|
54
|
-
s.add_dependency(%q<json>, [">= 0"])
|
55
|
-
end
|
56
|
-
else
|
57
|
-
s.add_dependency(%q<gearman-ruby>, [">= 0"])
|
58
|
-
s.add_dependency(%q<json>, [">= 0"])
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|