yawl 0.1.1 → 0.2.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.
- data/lib/yawl/process.rb +8 -0
- data/lib/yawl/setup.rb +2 -1
- data/lib/yawl/version.rb +1 -1
- data/spec/lib/process_spec.rb +22 -0
- metadata +6 -4
    
        data/lib/yawl/process.rb
    CHANGED
    
    | @@ -54,7 +54,15 @@ module Yawl | |
| 54 54 | 
             
                  !%w[completed failed].include?(state)
         | 
| 55 55 | 
             
                end
         | 
| 56 56 |  | 
| 57 | 
            +
                def object
         | 
| 58 | 
            +
                  return unless values[:object_id] && object_type
         | 
| 59 | 
            +
             | 
| 60 | 
            +
                  klass = Object.const_get(object_type)
         | 
| 61 | 
            +
                  klass[ values[:object_id] ]
         | 
| 62 | 
            +
                end
         | 
| 63 | 
            +
             | 
| 57 64 | 
             
                def current?
         | 
| 65 | 
            +
                  self.id == self.class.filter(:object_type => object_type, :object_id => values[:object_id]).order(:id).reverse.get(:id)
         | 
| 58 66 | 
             
                end
         | 
| 59 67 |  | 
| 60 68 | 
             
                def start_first_unfinished_step_or_complete
         | 
    
        data/lib/yawl/setup.rb
    CHANGED
    
    
    
        data/lib/yawl/version.rb
    CHANGED
    
    
| @@ -0,0 +1,22 @@ | |
| 1 | 
            +
            require "spec_helper"
         | 
| 2 | 
            +
             | 
| 3 | 
            +
            class FakeObject
         | 
| 4 | 
            +
              def self.[](value)
         | 
| 5 | 
            +
              end
         | 
| 6 | 
            +
            end
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            describe Yawl::Process do
         | 
| 9 | 
            +
              before(:each) do
         | 
| 10 | 
            +
                Yawl::ProcessDefinitions.add :tested do |process|
         | 
| 11 | 
            +
                  process.add_step(:name => "testing")
         | 
| 12 | 
            +
                end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                @process = Yawl::Process.create(:object_type => "FakeObject", :object_id => 123, :desired_state => "tested")
         | 
| 15 | 
            +
                @fake_object = FakeObject.new
         | 
| 16 | 
            +
                FakeObject.stub(:[]).with(123) { @fake_object }
         | 
| 17 | 
            +
              end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
              it "loads object" do
         | 
| 20 | 
            +
                @process.object.should == @fake_object
         | 
| 21 | 
            +
              end
         | 
| 22 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: yawl
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.2.0
         | 
| 5 5 | 
             
              prerelease: 
         | 
| 6 6 | 
             
            platform: ruby
         | 
| 7 7 | 
             
            authors:
         | 
| @@ -9,7 +9,7 @@ authors: | |
| 9 9 | 
             
            autorequire: 
         | 
| 10 10 | 
             
            bindir: bin
         | 
| 11 11 | 
             
            cert_chain: []
         | 
| 12 | 
            -
            date: 2014-02- | 
| 12 | 
            +
            date: 2014-02-24 00:00:00.000000000 Z
         | 
| 13 13 | 
             
            dependencies:
         | 
| 14 14 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 15 15 | 
             
              name: sequel
         | 
| @@ -153,6 +153,7 @@ files: | |
| 153 153 | 
             
            - lib/yawl/worker.rb
         | 
| 154 154 | 
             
            - migrations/01_setup_tables.rb
         | 
| 155 155 | 
             
            - migrations/02_setup_queue_classic.rb
         | 
| 156 | 
            +
            - spec/lib/process_spec.rb
         | 
| 156 157 | 
             
            - spec/lib/step_spec.rb
         | 
| 157 158 | 
             
            - spec/spec_helper.rb
         | 
| 158 159 | 
             
            - yawl.gemspec
         | 
| @@ -171,7 +172,7 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 171 172 | 
             
                  version: '0'
         | 
| 172 173 | 
             
                  segments:
         | 
| 173 174 | 
             
                  - 0
         | 
| 174 | 
            -
                  hash:  | 
| 175 | 
            +
                  hash: 2215781660990008421
         | 
| 175 176 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 176 177 | 
             
              none: false
         | 
| 177 178 | 
             
              requirements:
         | 
| @@ -180,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement | |
| 180 181 | 
             
                  version: '0'
         | 
| 181 182 | 
             
                  segments:
         | 
| 182 183 | 
             
                  - 0
         | 
| 183 | 
            -
                  hash:  | 
| 184 | 
            +
                  hash: 2215781660990008421
         | 
| 184 185 | 
             
            requirements: []
         | 
| 185 186 | 
             
            rubyforge_project: 
         | 
| 186 187 | 
             
            rubygems_version: 1.8.23
         | 
| @@ -188,5 +189,6 @@ signing_key: | |
| 188 189 | 
             
            specification_version: 3
         | 
| 189 190 | 
             
            summary: Yet Another Workflow Library for Ruby
         | 
| 190 191 | 
             
            test_files:
         | 
| 192 | 
            +
            - spec/lib/process_spec.rb
         | 
| 191 193 | 
             
            - spec/lib/step_spec.rb
         | 
| 192 194 | 
             
            - spec/spec_helper.rb
         |