Permalink
Browse files

Improvements for class workers and version bump.

  • Loading branch information...
1 parent fdbfed4 commit 569f4045dde30d98efa5d2cc804eb46443c7dd7b Andrew Kirilenko committed Mar 27, 2012
Showing with 21 additions and 15 deletions.
  1. +0 −2 Rakefile
  2. +1 −1 VERSION
  3. +18 −10 lib/iron_worker_ng/code/ruby.rb
  4. +1 −1 lib/iron_worker_ng/feature/ruby/merge_gem.rb
  5. +1 −1 sample/upload_and_enqueue.rb
View
@@ -1,5 +1,3 @@
-# encoding: utf-8
-
require 'rubygems'
require 'bundler'
View
@@ -1 +1 @@
-0.1.11
+0.1.12
@@ -50,6 +50,18 @@ def log(*args)
@params[key.to_sym] = @params[key]
end
+def payload
+ @payload
+end
+
+def iron_io_token
+ @iron_io_token
+end
+
+def iron_io_project_id
+ @iron_io_project_id
+end
+
def params
@params
end
@@ -66,18 +78,14 @@ def params
unless worker_class.nil?
worker_inst = worker_class.new
- class << worker_inst
- attr_accessor :iron_io_token
- attr_accessor :iron_io_project_id
- attr_accessor :iron_worker_task_id
- attr_accessor :params
+ params.keys.each do |param|
+ if param.class == String
+ if worker_inst.respond_to?(param + '=')
+ worker_inst.send(param + '=', params[param])
+ end
+ end
end
- worker_inst.iron_io_token = @iron_io_token
- worker_inst.iron_io_project_id = @iron_io_project_id
- worker_inst.iron_worker_task_id = @iron_worker_task_id
- worker_inst.params = @params
-
worker_inst.run
end
RUNNER
@@ -50,7 +50,7 @@ def merge_gem_fixate
if @merge_gem_reqs.length > 0
reqs = @merge_gem_reqs.map { |req| Bundler::DepProxy.new(req, Gem::Platform::RUBY) }
- souce = nil
+ source = nil
begin
source = Bundler::Source::Rubygems.new
rescue Bundler::GemfileNotFound
@@ -9,7 +9,7 @@
@config = YAML.load_file(File.join(File.dirname(__FILE__), 'config.yml'))
end
-client = IronWorkerNG::Client.new(@config['iron_worker']['token'], @config['iron_worker']['project_id'])
+client = IronWorkerNG::Client.new(:token => @config['iron_worker']['token'], :project_id => @config['iron_worker']['project_id'])
code = IronWorkerNG::Code::Ruby.new
code.merge_worker 'hello_worker.rb'

0 comments on commit 569f404

Please sign in to comment.