{"id":24698551,"url":"https://github.com/faradayio/tronprint","last_synced_at":"2026-03-15T01:02:55.252Z","repository":{"id":1252992,"uuid":"1191618","full_name":"faradayio/tronprint","owner":"faradayio","description":"Estimate your Ruby application's carbon footprint","archived":false,"fork":false,"pushed_at":"2012-09-06T15:22:24.000Z","size":3692,"stargazers_count":11,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-01-22T21:47:34.982Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://brighterplanet.github.com/tronprint","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/faradayio.png","metadata":{"files":{"readme":"README.rdoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2010-12-22T23:38:44.000Z","updated_at":"2024-05-16T15:47:32.000Z","dependencies_parsed_at":"2022-07-18T16:28:59.926Z","dependency_job_id":null,"html_url":"https://github.com/faradayio/tronprint","commit_stats":null,"previous_names":["brighterplanet/tronprint"],"tags_count":31,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faradayio%2Ftronprint","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faradayio%2Ftronprint/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faradayio%2Ftronprint/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/faradayio%2Ftronprint/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/faradayio","download_url":"https://codeload.github.com/faradayio/tronprint/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":235801792,"owners_count":19047126,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-27T04:29:18.508Z","updated_at":"2025-10-09T06:30:51.811Z","avatar_url":"https://github.com/faradayio.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= Tronprint\n\n\"The Grid: a digital frontier. I tried to picture clusters of information\nas they moved through the computer. Ships, motorcycles... Were the circuits\nlike freeways? I kept dreaming of a world I'd never see. And then, one day,\nI got in!\"\n\n-Flynn\n\nTronprint helps you visualize the carbon footprint of all of those little \nRuby processes zooming around on your system in their light cycles. You \ncan then show this footprint to the world of the Users via Rails helpers.\n\nThe emission estimates are calculated using {Brighter Planet CM1}[http://impact.brighterplanet.com], the impact estimate web service from {Brighter Planet}[http://brighterplanet.com].\nSpecifically, the {computation emitter}[http://impact.brighterplanet.com/models/computation] \nis used.\n\n{\u003cimg src=\"https://secure.travis-ci.org/brighterplanet/tronprint.png\" /\u003e}[http://travis-ci.org/brighterplanet/tronprint]\n\n== Getting Started\n\nIf you haven't already, go to http://keys.brighterplanet.com and sign up for an\nAPI key. Non-commercial use of CM1 is free, but commercial use is \n{charged}[http://impact.brighterplanet.com/pricing] per-query. Heroku users are \ncharged per-month.\n\n=== Rails\n\nAdd tronprint to your Gemfile:\n\n  gem 'tronprint'\n\nAnd install the gem from the command line:\n\n  bundle update\n\nOnce you start your Rails app, Tronprint will automatically begin collecting \nusage data. If you have multiple Rails processes running, Tronprint will \nkeep track of aggregate statistics for all processes. This is where\nTronprint.application_name comes into play. By default, your application's \ndirectory name is used.\n\nIn order to display your application's footprint, you can use Tronprint's \nbuilt-in view helper: TronprintHelper. Feel free to cache your footprint \nto minimize the number of API requests made to CM1.\n\nIn whichever controller(s) that will use TronprintHelper (or in `ApplicationController`), simply require the helper:\n\n  class FoosController\n    helper TronprintHelper\n  end\n\n==== Helper Methods\n\nTronprintHelper comes with a few helper methods:\n\n* footprint_badge - A badge that displays total footprint and current rate of emissions for your app.\n* cm1_badge - Displays a CM1 badge\n* footprint_methodology - A URL for a live methodology statement reporting how your total footprint was calculated. {Example}[http://impact.brighterplanet.com/computations?duration=128372]\n\n==== Heroku\n\nTronprint is available as a Heroku add-on. Add tronprint to your app, and \nyour app will have an environment variable provided: \n`ENV['TRONPRINT_API_KEY']`.\n\nThe tronprint gem will handle API key setup for you, but you will still \nneed to configure your app to store statistics in a persistent data store. \nBy default, Tronprint will use the yaml storage option, but this won't \nfly on Heroku. The easiest way to get up and running is to add the \nMongoHQ add-on to your app. Once you have MongoHQ set up, configure \ntronprint with a Rails initializer:\n\n1. Open a new file, `config/initializers/tronprint.rb`\n1. In it, write: \n  Tronprint.aggregator_options = {\n    :adapter =\u003e :mongodb,\n    :uri =\u003e ENV['MONGOHQ_URL'],\n    :collection =\u003e 'tronprint'\n  }\n\n==== ActiveRecord\n\nIf you'd like to use your Rails app's existing ActiveRecord datastore for \nstoring Tronprint statistics, simply add the following to a new file, \nconfig/initializers/tronprint.rb:\n\n    Tronprint.aggregator_options = { :adapter =\u003e :active_record }\n\nTronprint automatically creates a storage table, `moneta_store` the next time your app\nis run.\n\nIf you need to create the table manually, add to your Rakefile:\n\n    require 'tronprint/rake_tasks/active_record'\n\nAnd run `rake tronprint:moneta`\n\n=== Other Ruby Apps\n\nTronprint will work with any Ruby app, but you have to do a little self-configuration.\n\nWhen your application has started, all you have to do is make a call to \nTronprint.run. This starts up a thread that collects statistics at a \ncertain interval and stores the results in a key/value store.\n\nTo retrieve the footprint, make a call to Tronprint.statistics.emission_estimate.\n\nYou can also call Tronprint.statistics.impact. This returns a +Hashie::Mash+ per {the carbon gem RDoc}[http://rdoc.info/github/brighterplanet/carbon].\n\n== Configuration\n\nThere are several properties of Tronprint that can be configured. The configuration\nis persisted in `pwd`/config/tronprint.yml. Here is a list of options that\ncan be set:\n\n:zip_code:: The ZIP code where the server or host computer resides.\n:brighter_planet_key:: Your Brighter Planet CM1 key. Get one from {keys.brighterplanet.com}[http://keys.brighterplanet.com].\n:application_name:: The name of your application.\n:aggregator_options:: A hash of options to send to the aggregator. A sub-option of :adapter is required. This corresponds to the name of an adapter supported by {moneta}[http://github.com/dkastner/moneta]. All other sub-options given are passed on to the moneta adapter's initializer.\n\n=== Configuring the aggregator\n\nTronprint needs to write the statistics it collects to a persistent data \nstore. There are two ways to configure this.\n\nThe first way is to edit config/tronprint.yml as mentioned above.\n\nThe second way is to manually set the aggregator options before Tronprint.run is called. \nIn Rails, this can be done with an initializer. Just set Tronprint.aggregator_options to\nthe options you would normally set in config/tronprint.yml.\n\n== Examples\n\nYou can see an example Rails app using tronprint at http://github.com/brighterplanet/yaktrak.\nFiles of note: `config/initializers/tronprint.rb`, `Gemfile`, `app/views/trackings/_form.html.rb`.\nThe live example is at http://yaktrak.org\n\n== Note on Patches/Pull Requests\n\n* Fork the project.\n* Make your feature addition or bug fix.\n* Add tests for it. This is important so I don't break it in a\n  future version unintentionally.\n* Commit, do not mess with rakefile, version, or history.\n  (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)\n* Send me a pull request. Bonus points for topic branches.\n\n== Copyright\n\nCopyright © 2010 Brighter Planet. See LICENSE for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaradayio%2Ftronprint","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffaradayio%2Ftronprint","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffaradayio%2Ftronprint/lists"}