https://github.com/faradayio/emitter
The umbrella library for all Brighter Planet environmental impact models.
https://github.com/faradayio/emitter
Last synced: 11 months ago
JSON representation
The umbrella library for all Brighter Planet environmental impact models.
- Host: GitHub
- URL: https://github.com/faradayio/emitter
- Owner: faradayio
- License: other
- Created: 2010-08-12T18:14:25.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2012-09-13T15:31:02.000Z (over 13 years ago)
- Last Synced: 2025-06-28T17:09:08.691Z (12 months ago)
- Language: Ruby
- Homepage: http://impact.brighterplanet.com
- Size: 309 KB
- Stars: 6
- Watchers: 4
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.markdown
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
# emitter
Base module for Brighter Planet's emitters. See the [Brighter Planet developer page](http://brighterplanet.github.com) for details on Brighter Planet's development environment.
## Installation
$ gem install emitter
## Usage
# my_emitter.rb
require 'emitter'
class MyEmitter
include BrighterPlanet::Emitter
end
### Required modules
Your emitter must define some modules under `lib/my_emitter/`, they are:
* `lib/my_emitter/impact_model.rb` - `module MyEmitter::ImpactModel` - defines the [Leap](http://rubygems.org/gems/leap) decisions that calculate an impact.
* `lib/my_emitter/characterization.rb` - `module MyEmitter::Characterization` - defines the [Characteristics](http://rubygems.org/gems/charisma) that describe the model's inputs.
* `lib/my_emitter/data.rb` - `module MyEmitter::Data` - defines the [schema](http://rubygems.org/gems/mini\_record) definitions for the emitter and [DataMiner](http://rubygems.org/gems/data\_miner) processes that fetch and store data for the emitter.
* `lib/my_emitter/relationships.rb` - `module MyEmitter::Relationships` - defines the ActiveRecord relationships between the emitter and other [Earth](http://rubygems.org/gems/earth) models.
* `lib/my_emitter/summarization.rb` - `moduel MyEmitter::Summarization` - defines phrases that describe various attributes ([SummaryJudgement descriptors](http://rubygems.org/gems/summary\_judgement)) about an emitter that are displayed on CM1's methodology pages.
## Tools
You can use the [bp gem](http://github.com/brighterplanet/bp) to generate the skeleton for a new emitter.
## Magic
Emitter, once included, will perform a couple tasks automatically:
1. It converts committees into characterizations that are not already characterized.
1. It adds `auto_upgrade!` and `run_data_miner_on_parent_associations!` tasks to DataMiner so that a call to `MyEmitter.run_data_miner!` will update the emitter's schema and run DataMiner tasks on any belongs\_to associations.
## Note on Patches/Pull Requests
* Fork the project.
* Make your feature addition or bug fix.
* Add tests for it. This is important so I don't break it in a
future version unintentionally.
* Commit, do not mess with rakefile, version, or history.
(if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
* Send me a pull request. Bonus points for topic branches.
## Copyright
Copyright 2010, 2011 Brighter Planet, Inc. See LICENSE and LICENSE-PREAMBLE for details.