Project

suricate

0.0
No commit activity in last 3 years
No release in over 3 years
Suricate aims to be an application template for building dashboards.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 5.0
~> 0.6.3
~> 10.4
~> 3.3
~> 0.10.0

Runtime

~> 1.4
 Project Readme

Build Status Code Climate Test Coverage

Suricate (work in progress)

This README file is the goal, it does not reflect the current state of Suricate.

Suricate aims to be an application template for building dashboards.

How it works

Architecture

A suricate application is composed of pages.
A page is composed of widgets.
A widget exists both in frontend (Javascript) and backend (Ruby) :

  • on the backend a widget act as a controller to send back some data to display
  • on the frontend it controls and keeps updated a portion of the page

A widget is associated to a collector. Collectors provides data to widgets.
This way, depending on the interface implemented by a collector you can use the same collector with multiple widgets.

Installation

As any other gem you can install it with :

gem install suricate

New application

To generate a new Suricate application, run :

suricate new my_application

Where "my_application" is the folder that will contain the application template.

Configuration

Configuration is done with Suricate::build method, which helps generating the configuration.

Suricate.build do |config|
  # Global configuration
  config.default_page        = 'index'  # defines the default page displayed when hiting '/'
  config.public_directory    = 'public' # defines the location of the directory accessible from the web
  config.templates_directory = 'templates' # defines the location the directory containing the templates
  
  # Widgets configuration
  config.widgets do |widgets|
    widgets.counter :id, ErrorsCollector.new  # defines a new widget of type counter, and data will be collected by the ErrorsCollector instance
  end
end

When adding a new widget you can pass a Hash of options :

  • template will sets your widget's view template, if no template option is provided, Suricate will look in the /widgets directory within the templates_directory, for a file called as the widget's id or its type

Any other options passed will be directly passed to the frontend widgets.

Running the application

Like any other Rack application, running rackup config.ru will start your application.

Sample application

A sample application is available in the example folder

Building your own widget

There are two steps to follow :

  • build the backend widget
  • build the frontend widget

Backend

Frontend

Licence

Suricate is released under the MIT License (MIT)