Permalink
Browse files

Added no_upload option.

  • Loading branch information...
1 parent 2732d34 commit 7f769ef8e32fc8caa3adeb4b8dfb445210534337 @treeder treeder committed Apr 25, 2012
Showing with 36 additions and 2 deletions.
  1. +1 −1 lib/iron_worker/config.rb
  2. +4 −0 lib/iron_worker/service.rb
  3. +1 −1 test/test_base.rb
  4. +30 −0 test/test_uploads.rb
View
2 lib/iron_worker/config.rb
@@ -28,7 +28,7 @@ class Config
:unmerged,
:merged_gems,
:unmerged_gems,
- :force_upload,
+ :force_upload, :no_upload,
:beta, # for setting beta feature flags
:skip_auto_dependencies
View
4 lib/iron_worker/service.rb
@@ -38,6 +38,10 @@ def initialize(token, options={})
# - :callback_url
# - :merge => array of files to merge in with this file
def upload(filename, class_name, options={})
+ if self.config.no_upload
+ IronWorker.logger.debug 'NO UPLOAD!'
+ return
+ end
name = options[:name] || class_name
project_id = get_project_id(options)
tmp = Dir.tmpdir()
View
2 test/test_base.rb
@@ -12,7 +12,7 @@
raise ex
end
-#IronWorker.logger.level = Logger::DEBUG
+IronWorker.logger.level = Logger::DEBUG
IronWorker.service=nil
IronWorker.config.merged_gems={}
View
30 test/test_uploads.rb
@@ -0,0 +1,30 @@
+require_relative 'test_base'
+
+class IronWorkerTests < TestBase
+
+ def test_uploads
+ IronWorker.config.force_upload = false
+ IronWorker.config.no_upload = true
+
+ gen_worker
+
+ IronWorker.config.no_upload = nil
+ IronWorker.config.force_upload = true
+
+ gen_worker
+
+ end
+
+ def gen_worker
+ # copy our simplest worker
+ new_file = "one_line_worker_#{Random.rand(100)}.rb"
+ FileUtils.cp('workers/one_line_worker.rb', new_file)
+ load new_file
+
+ w = OneLineWorker.new
+ w.queue
+ end
+
+
+
+end

0 comments on commit 7f769ef

Please sign in to comment.