On the last weeks I’ve been playing a bit with Ruby. Until now I’ve to say I’m very comfortable working with this language, it’s amazing very easy to work with data structures and the syntax it’s very simple and clear to understand. I’m a kind of person that thinks if you want to learn one language you’ve to play doing small programs that does useful things. In this case I was thinking about develop a small program to parse rss channels and put in twitter the last updates from the channels and put a hash tag for each rss channel if you want. This client may be useful for me to put the last updates from the Spanish planet http://planetasysadmin.com and put on his twitter account.
So how most of the projects that I’ve, you can get the code from Github: https://github.com/opentodonet/rss2twitter
There a bit use description if you want to use it:
- To use this program you’ve to use a minimum version of Ruby 1.9.3 and install the oauth gem:$ sudo gem install oauth
- Put the project folder under any location on the system. Ex:$ cp -p rss2twitter/ /usr/local/bin/
- You need to register an application with your twitter account and create a consumer key, consumer secret, an access token and access secret. For more information visit: https://dev.twitter.com/apps
- Edit the configuration file rss2twitter/config/config.json and setup your twitter account settings. With this configuration file you can put all the channels that you want to tweet under the array channels and setup a hash tag for each channel to include in all the tweets.
- Create the directory /var/cache/rss2twitter/ and the file /var/log/rss2twitter.log with write permissions for the user that will run the program. Change the location for the file and the directory if you change it on the configuration file.
- Setup a cron task to run the program. The script you’ve to run is $LOCATION/rss2twitter/bin/rss2twitter.rb
And of course you are free to suggest any useful functionality or if you see any bug on the program.