项目作者: md-farhan-memon

项目描述 :
Sorting the inter-dependent job queue using Graph and topological sorting - Ruby
高级语言: Ruby
项目地址: git://github.com/md-farhan-memon/dependent-job-queue-sort-ruby.git


Assumptions:

Ruby version:

I Have assumed that the system has stable/supported ruby version installed as per ruby-lang which is 2.4.6 and so locked it inside the Gemfile for consistency to must have version above or equal to this version.

  1. # functional_spec/Gemfile
  2. .
  3. ruby '>= 2.4.6'
  4. .
  5. .

Setup

bin/setup should install dependencies and then run test suite. if valid ruby version is found, e.g.

  1. dependent-job-queue-sort-ruby $ bin/setup
  2. Using rake 10.5.0
  3. Using bundler 1.16.3
  4. Using diff-lcs 1.3
  5. Using rspec-support 3.8.2
  6. Using rspec-core 3.8.1
  7. Using rspec-expectations 3.8.4
  8. Using rspec-mocks 3.8.1
  9. Using rspec 3.8.0
  10. Bundle complete! 3 Gemfile dependencies, 8 gems now installed.
  11. ...
  12. ...
  13. ..................
  14. Finished in 5.64 seconds (files took 0.16212 seconds to load)
  15. 18 examples, 0 failures
  16. dependent-job-queue-sort-ruby $

RSpec Testing

To run full test suite, you can use the rake task as

  1. dependent-job-queue-sort-ruby/functional_spec $ bundle exec rake spec:functional

To run unit test cases only as in

  1. dependent-job-queue-sort-ruby/functional_spec $ bundle exec rake spec:unit

Execution

Through interactive command line shell:
  1. dependent-job-queue-sort-ruby $ ruby bin/execute.rb
  2. a =>
  3. b => c
  4. c => f
  5. d => a
  6. e => b
  7. f =>
  8. f, c, b, e, a, d
  9. a =>
  10. b => b
  11. Error: Jobs can't depend on themselves.
  12. exit
  13. dependent-job-queue-sort-ruby $