h1. Chirp
Chirp is a GemPlugin designed to make it easy to submit tweets to Twitter. You can provide an optional URL that you want to link to in your tweet, which will be shortened automatically and included at the end of your tweet.
h2. Installation
There are a few options for installing Chirp. Please note that Chirp expects to find a configuration file at @/config/chirp.yml@. If you are using Chirp as a GemPlugin, you will need to be sure and create this file. If you are using Chirp as a normal Rails plugin, this file will be created automatically when the plugin is installed.
h3. Install as a Rails plugin:
script/plugin install git://github.com/bgetting/Chirp.git
h3. Install as a Gem:
sudo gem install bgetting-chirp
In your Rails project, put the following lines in your @environment.rb@ file:
config.gem "bgetting-chirp", :lib => 'chirp', :source => "http://gems.github.com"
config.gem "shorturl", :version => '>= 0.8.4'
config.gem "twitter4r", :version => '>= 0.3.1', :lib => 'twitter'
h2. Example
First, edit @config/chirp.yml@ to include your Twitter login and password for each environment. It's probably a good idea to set up a development Twitter account to play around with.
To post a tweet to Twitter:
tweet_to_twitter("This is an example tweet.")
Optionally, you can include a link:
tweet_to_twitter("This is an example tweet.", "http://www.github.com/")
When you include a link with your tweet, Chirp will truncate your tweet to 115 characters to leave room for a short URL at the end of the tweet. When you do not include a link, Chirp will truncate your tweet to the usual 140 characters allowed by Twitter.