emitter
Base module for Brighter Planet's emitters. See the Brighter Planet developer page 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 decisions that calculate an impact. -
lib/my_emitter/characterization.rb
-module MyEmitter::Characterization
- defines the Characteristics that describe the model's inputs. -
lib/my_emitter/data.rb
-module MyEmitter::Data
- defines the schema definitions for the emitter and DataMiner 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 models. -
lib/my_emitter/summarization.rb
-moduel MyEmitter::Summarization
- defines phrases that describe various attributes (SummaryJudgement descriptors) about an emitter that are displayed on CM1's methodology pages.
Tools
You can use the bp gem to generate the skeleton for a new emitter.
Magic
Emitter, once included, will perform a couple tasks automatically:
- It converts committees into characterizations that are not already characterized.
- It adds
auto_upgrade!
andrun_data_miner_on_parent_associations!
tasks to DataMiner so that a call toMyEmitter.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.