Code Monkey home page Code Monkey logo

chameleon's Introduction

Chameleon

DESCRIPTION:

This is a Rails engine designed to make it super easy to expose data from your application as widgets for use with Geckoboard (geckoboard.com).

This only works for Rails 3 apps.

FEATURES:

This provides a generator to build widgets using a basic DSL syntax to describe the data to be exposed, and the settings for it to be exposed under, and also includes the controller/routing necessary to provide an endpoint for Geckoboard to retrieve the data to display on your dashboard.

Currently it supports the “number and optional secondary stat” (with optional display text), “line”, “pie”, “geckometer”, “rag” and “text” widget types.

SYNOPSIS:

Simply add to your Gemfile as follows:

gem 'chameleon'

Then run “bundle install” and once installed, you can run:

rails g chameleon:widget NAME TYPE

to generate a widget within “app/widgets”. For example, if you want to generate a widget that exposes the amount of users you have in your app currently:

rails g chameleon:widget users number_and_secondary

This will generate something similar to the following in “app/widgets/users_widget.rb”:

widget :users do
  key "3638c90ec12d5a59061ad7b78afcbd050e50b621"
  type "number_and_secondary"
  data do
  end
end

To implement your widget, you simply need to alter it to return the required data - for a “number_and_secondary” type of widget, it requires a hash containing a :value, and optionally, a :previous value to compare it to (such as user count as of yesterday, for example):

widget :users do
  key "3618c90ec02d5a57061ad7b78afcbb050e50b608"
  type "number_and_secondary"
  data do
    {
      :value => User.count,
      :previous => User.count(:conditions => "created_at < '#{1.day.ago.to_s(:db)}'")
    }
  end
end

You can then point Geckoboard at your widget, myapp/widgets/users?key=3618c90ec02d5a57061ad7b78afcbb050e50b608, and Geckoboard will then show the current user count, as well as the percentage difference compared to a day ago.

More documentation on the settings available for the widgets, as well as the different types of widgets, is available on the wiki (github.com/ejdraper/chameleon/wiki).

REQUIREMENTS:

A Rails 3 application.

INSTALL:

It’s best to add it to the Gemfile for your Rails 3 app, but if needed you can install the gem manually:

gem install chameleon

CONTRIBUTORS:

Elliott Draper Tim Blair

LICENSE:

Copyright 2011 Elliott Draper <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

chameleon's People

Contributors

ejdraper avatar lenidot avatar

Stargazers

Andreas Zecher avatar

Watchers

Andreas Zecher avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.