simple_worker 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/api_auth.rb CHANGED
@@ -1,9 +1,10 @@
1
1
  module SimpleWorker
2
+ attr_accessor :host
2
3
  class ApiAuth
3
- def initialize(access_key, secret_key)
4
+ def initialize(access_key, secret_key, options={})
4
5
  @access_key = access_key
5
6
  @secret_key = secret_key
6
- @host = "http://simpleworker.appoxy.com/api/"
7
+ @host = options[:host] || "http://simpleworker.appoxy.com/api/"
7
8
 
8
9
  end
9
10
  end
data/lib/simple_worker.rb CHANGED
@@ -7,8 +7,8 @@ module SimpleWorker
7
7
 
8
8
  include SimpleWorker::HttpEnabled
9
9
 
10
- def initialize(access_key, secret_key)
11
- super(access_key, secret_key)
10
+ def initialize(access_key, secret_key, options={})
11
+ super(access_key, secret_key, options)
12
12
  end
13
13
 
14
14
  # Options:
data/lib/worker.rb ADDED
@@ -0,0 +1,8 @@
1
+ # This is an abstract module that developers creating works can mixin/include to use the SimpleWorker special functions.
2
+ module SimpleWorker
3
+
4
+ module Worker
5
+ def set_progress(hash)
6
+ end
7
+ end
8
+ end
data/test/test_runner.rb CHANGED
@@ -1,6 +1,8 @@
1
+ require 'simple_worker'
1
2
 
2
3
  class TestRunner
3
4
 
5
+ include SimpleWorker::Worker
4
6
 
5
7
  def run(data=nil)
6
8
  puts 'running the runner for leroy '.upcase + ' with data: ' + data.inspect
@@ -8,6 +10,7 @@ class TestRunner
8
10
  @times.times do |i|
9
11
  puts 'running at ' + i.to_s
10
12
  sleep 1
13
+ set_progress(:percent=> (i / @times * 100))
11
14
  end
12
15
  end
13
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simple_worker
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Reeder
@@ -28,6 +28,7 @@ files:
28
28
  - lib/simple_worker.rb
29
29
  - lib/status.rb
30
30
  - lib/uploader.rb
31
+ - lib/worker.rb
31
32
  - README.markdown
32
33
  has_rdoc: true
33
34
  homepage: http://github.com/appoxy/simple_worker