Socket
Book a DemoInstallSign in
Socket

graffable

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

graffable

0.0.3
bundlerRubygems
Version published
Maintainers
1
Created
Source

Graffable

Sinatra-based data charting application

Installation

Add this line to your application's Gemfile:

gem 'graffable'

And then execute:

$ bundle

Or install it yourself as:

$ gem install graffable

Usage

Set environment variables:

% export GRAFFABLE_DATABASE_URL=sqlite://path/to/db.sqlite3
% export GRAFFABLE_SEED_FILE=/path/to/seed.rb

Create seed file:

require 'graffable'

DB = Graffable::Database.connect

# Report Groups
[
  [ 'a', 'Service A' ],
  [ 'b', 'Host B',   ]
].each do |tuple|
  DB[:groups].insert name: tuple.first, description: tuple.last
end

# Reports
{
  'a' => {
    'report-a1' => [ 'Name of report', :sum ],
    'report-a2' => [ 'Name of report', :avg ],
  },
  'b' => {
    'report-b1' => [ 'Name of report', :sum ],
    'report-b2' => [ 'Name of report', :avg ],
  }
}.each_pair do |group_name, reports|
  group = DB[:groups][ name: group_name ]
  raise "ERROR: unknown report group '#{ group_name }'" if group.nil?

  reports.each_pair do |name, values|
    DB[:reports].insert group_id: group[:id], name: name, description: values.first, aggregate: values.last.to_s
  end
end

Add tasks to Rakefile:

% cat Rakefile
...
require 'graffable/migration_task'
Graffable::MigrationTask.new

require 'graffable/seed_task'
Graffable::SeedTask.new
...

Migrate database and load seed data:

% rake graffable:migrate:reset graffable:seed

Create config.ru and launch application:

% cat config.ru
require 'graffable'
run Graffable::App
% rackup

Contributing

  • Fork it
  • Create your feature branch (git checkout -b my-new-feature)
  • Commit your changes (git commit -am 'Add some feature')
  • Push to the branch (git push origin my-new-feature)
  • Create new Pull Request

FAQs

Package last updated on 12 Mar 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.