Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Pushes new tweets to Twitter as you publish pages from Radiant CMS

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 config
Octocat-spinner-32 db
Octocat-spinner-32 features
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 MIT-LICENSE.md
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 cucumber.yml
Octocat-spinner-32 flapper_extension.rb
Octocat-spinner-32 radiant-flapper-extension.gemspec
README.md

A tweet pusher for Radiant CMS https://github.com/johnmuhl/flapper

Overview

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.

Install

# 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

Setup

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"]    = "you@gmail.com"
config["flapper.google_password"] = "password"

Usage

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.

Notes

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.

MIT License

https://github.com/johnmuhl/flapper/blob/master/MIT-LICENSE.md

Something went wrong with that request. Please try again.