A tweet pusher for Radiant CMS https://github.com/johnmuhl/flapper
Flapper adds a checkbox to enable Twitter notifications for a page's children; to the children of that page it adds a "Tweet" page field. Anything in the Tweet page field plus a Google shortened URL (of the current page) will be posted to Twitter upon page publication. The message is automatically trimmed to fit in 140 characters; i.e. some of the content of the Tweet page field may be removed to make room for the URL.
# gem install (preferred) gem install radiant-flapper-extension $EDITOR config/environment.rb # add config.gem "radiant-flapper-extension" rake db:migrate:extensions # manual install gem install googl -v "~> 0.5.0" gem install twitter -v "~> 1.5.0" script/extension install flapper # otherwise curl -LO https://github.com/johnmuhl/flapper/zipball/master unzip master ; rm master mv johnmuhl-flapper-* vendor/extensions/flapper gem install googl -v "~> 0.5.0" gem install twitter -v "~> 1.5.0" rake db:migrate:extensions
Register a new app. Make sure you set the Default Access type to Read & Write - none of the other settings effect this extension. From the app page grab the OAuth Consumer & Consumer Secret keys. Click the "My Access Token" button and get your Access Token & Access Token Secret.
Edit (or create)
config/initializers/radiant_config.rb to include your Twitter access credentials.
flapper.username is your Twitter username.
flapper.domain is used to build a full URL to the page being tweeted.
config["flapper.username"] = "username" config["flapper.domain"] = "www.example.com" config["flapper.consumer_key"] = "consumer_key" config["flapper.consumer_secret"] = "consumer_secret" config["flapper.oauth_token"] = "oauth_token" config["flapper.oauth_token_secret"] = "oauth_token_secret"
Add your Google Account if you want to track your short URLs with Google URL Shortener.
config["flapper.google_email"] = "email@example.com" config["flapper.google_password"] = "password"
From the Radiant admin find the page whose children you want to tweet and check the "Publish children to Twitter?" box (it's hidden under "More"). When you create a new child enter the page content as usual and fill in the Tweet field (again, under "More") with a short message you'd like to accompany the URL to the page. The Tweet field has a 130 character limit to leave room for the
... and shortened URL; if the URL ever needs more space characters will be dropped from the Tweet field to make room.
Much code (and db schema) lifted from the original Twitter extension by Sean Cribbs. As a result you should be able to drop Flapper in as a replacement when you decided to upgrade to Radiant 1.x (assuming you only need to push).
Written in a fit so no tests and probably many subtle (and not so subtle) bugs not to mention all the code is just stuffed in
#activate. May not work with Radiant < master.
Issues & pull requests are welcome.