simple_job 0.8.1 → 0.9.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.rdoc +3 -0
- data/lib/simple_job/test_job_queue.rb +41 -0
- data/lib/simple_job/version.rb +1 -1
- data/lib/simple_job.rb +3 -1
- metadata +2 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: cfe49b0fcf2044d8fff0d799b2e99f1d784fa756
         | 
| 4 | 
            +
              data.tar.gz: 777b33fd448f0a06b2f389b828397ebd77d6bbfb
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 77685007584963ffccfc1be90aee5a237d02d3d27285f7e6b7349f088bf7d2b514bef4a8ff84366fe4a20d253ffd7532e2d2ac824ff019f4e619e3ec59503d96
         | 
| 7 | 
            +
              data.tar.gz: 115f00f7f3d2cc92f8b014120406d22744e180ae9054e026f262eda997e2aaa7516e373c9f59abf524a7e5454e30115c0ff9644174ebe570f36d31ee9ac1cea7
         | 
    
        data/CHANGELOG.rdoc
    CHANGED
    
    
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            module SimpleJob
         | 
| 2 | 
            +
            class TestJobQueue < JobQueue
         | 
| 3 | 
            +
             | 
| 4 | 
            +
              register_job_queue 'test', self
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              def initialize(type)
         | 
| 7 | 
            +
                @type = type
         | 
| 8 | 
            +
                @jobs = []
         | 
| 9 | 
            +
              end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
              def self.default_queue
         | 
| 12 | 
            +
                get_queue('default')
         | 
| 13 | 
            +
              end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
              def self.get_queue(type, options = {})
         | 
| 16 | 
            +
                @queues ||= {}
         | 
| 17 | 
            +
                @queues[type] ||= TestJobQueue.new(type)
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              def enqueue(message, options = {})
         | 
| 21 | 
            +
                hash = JSON.parse(message)
         | 
| 22 | 
            +
                job_type = hash['type']
         | 
| 23 | 
            +
                definition_class = JobDefinition.job_definition_class_for(job_type, hash['version'])
         | 
| 24 | 
            +
                job = definition_class.new.from_json(message)
         | 
| 25 | 
            +
                @jobs << job
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
              def poll(options = {}, &block)
         | 
| 29 | 
            +
                raise NotImplementedError
         | 
| 30 | 
            +
              end
         | 
| 31 | 
            +
             | 
| 32 | 
            +
              def jobs
         | 
| 33 | 
            +
                @jobs.dup
         | 
| 34 | 
            +
              end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
              def self.jobs(type = 'default')
         | 
| 37 | 
            +
                get_queue(type).jobs
         | 
| 38 | 
            +
              end
         | 
| 39 | 
            +
             | 
| 40 | 
            +
            end
         | 
| 41 | 
            +
            end
         | 
    
        data/lib/simple_job/version.rb
    CHANGED
    
    
    
        data/lib/simple_job.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: simple_job
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.9.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - David Dawson
         | 
| @@ -82,6 +82,7 @@ files: | |
| 82 82 | 
             
            - lib/simple_job/job_definition.rb
         | 
| 83 83 | 
             
            - lib/simple_job/job_queue.rb
         | 
| 84 84 | 
             
            - lib/simple_job/sqs_job_queue.rb
         | 
| 85 | 
            +
            - lib/simple_job/test_job_queue.rb
         | 
| 85 86 | 
             
            - lib/simple_job/version.rb
         | 
| 86 87 | 
             
            homepage: https://github.com/daws/simple_job
         | 
| 87 88 | 
             
            licenses: []
         |