Skip to content
Case Study For Distribusion
Branch: master
Clone or download
Latest commit b2511e5 Apr 9, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin
lib
spec
.gitignore
.reek.yml
.rspec
.rubocop.yml
.travis.yml
Gemfile
README.md
Rakefile
leo.gemspec

README.md

Build Status Maintainability Test Coverage

Requirements

ruby >= 2.3

Installation

  • $ git clone git@github.com:zeitnot/leo.git
  • $ bundle install
  • $ rake

Usage

Type $ bin/console on your terminal. To list routes type:

# Without any parameter, it lists all routes by defaul.
Leo.list_routes #=> 

{
  :sentinels => [{
      :start_node => "alpha",
      :end_node => "beta",
      :start_time => "2030-12-31T13:00:01",
      :end_time => "2030-12-31T13:00:02"
    },
    {
      :start_node => "beta",
      :end_node => "gamma",
      :start_time => "2030-12-31T13:00:02",
      :end_time => "2030-12-31T13:00:03"
    },
    {
      :start_node => "delta",
      :end_node => "beta",
      :start_time => "2030-12-31T13:00:02",
      :end_time => "2030-12-31T13:00:03"
    },
    {
      :start_node => "beta",
      :end_node => "gamma",
      :start_time => "2030-12-31T13:00:03",
      :end_time => "2030-12-31T13:00:04"
    }
  ],:sniffers => [{
      :start_node => "lambda",
      :end_node => "tau",
      :start_time => "2030-12-31T13:00:06",
      :end_time => "2030-12-31T13:00:07"
    },
    {
      :start_node => "tau",
      :end_node => "psi",
      :start_time => "2030-12-31T13:00:06",
      :end_time => "2030-12-31T13:00:07"
    },
    {
      :start_node => "psi",
      :end_node => "omega",
      :start_time => "2030-12-31T13:00:06",
      :end_time => "2030-12-31T13:00:07"
    },
    {
      :start_node => "lambda",
      :end_node => "psi",
      :start_time => "2030-12-31T13:00:07",
      :end_time => "2030-12-31T13:00:08"
    },
    {
      :start_node => "psi",
      :end_node => "omega",
      :start_time => "2030-12-31T13:00:07",
      :end_time => "2030-12-31T13:00:08"
    }
  ],:loopholes => [{
      :start_node => "gamma",
      :end_node => "theta",
      :start_time => "2030-12-31T13:00:04",
      :end_time => "2030-12-31T13:00:05"
    },
    {
      :start_node => "theta",
      :end_node => "lambda",
      :start_time => "2030-12-31T13:00:05",
      :end_time => "2030-12-31T13:00:06"
    },
    {
      :start_node => "beta",
      :end_node => "theta",
      :start_time => "2030-12-31T13:00:05",
      :end_time => "2030-12-31T13:00:06"
    },
    {
      :start_node => "theta",
      :end_node => "lambda",
      :start_time => "2030-12-31T13:00:06",
      :end_time => "2030-12-31T13:00:07"
    }
  ]
}


# Or to narrow the list it accepts parameters of source names 
  

Leo.list_routes :sentinels, :loopholes #=>

{
  :sentinels => [{
      :start_node => "alpha",
      :end_node => "beta",
      :start_time => "2030-12-31T13:00:01",
      :end_time => "2030-12-31T13:00:02"
    },
    {
      :start_node => "beta",
      :end_node => "gamma",
      :start_time => "2030-12-31T13:00:02",
      :end_time => "2030-12-31T13:00:03"
    },
    {
      :start_node => "delta",
      :end_node => "beta",
      :start_time => "2030-12-31T13:00:02",
      :end_time => "2030-12-31T13:00:03"
    },
    {
      :start_node => "beta",
      :end_node => "gamma",
      :start_time => "2030-12-31T13:00:03",
      :end_time => "2030-12-31T13:00:04"
    }
  ],:loopholes => [{
      :start_node => "gamma",
      :end_node => "theta",
      :start_time => "2030-12-31T13:00:04",
      :end_time => "2030-12-31T13:00:05"
    },
    {
      :start_node => "theta",
      :end_node => "lambda",
      :start_time => "2030-12-31T13:00:05",
      :end_time => "2030-12-31T13:00:06"
    },
    {
      :start_node => "beta",
      :end_node => "theta",
      :start_time => "2030-12-31T13:00:05",
      :end_time => "2030-12-31T13:00:06"
    },
    {
      :start_node => "theta",
      :end_node => "lambda",
      :start_time => "2030-12-31T13:00:06",
      :end_time => "2030-12-31T13:00:07"
    }
  ]
}

In order to post routes jus type on your console:

Leo.post_routes #=> {} Empty hash means all routes are posted to server.
Leo.post_routes #=> 
{
  [:sentinels, 'alpha', 'beta']=>false,
  [:loopholes, 'beta', 'theta']=>false
} 

# The preceding example show that from sentinels source; alpha to beta route,
# and from loopholes source; beta to theta route are not posted. 
You can’t perform that action at this time.