In this document you will learn in three easy steps how to use tog in your own applications. Tog is a non-intrusive platform, so you can choose which parts you want to use and which not.
Many plugins are downloaded from Github, who is a service for git repositories, so you will need to install git’s binary for your platform. If you are a Linux or Mac user you are lucky, if not, it can be hard!.
Tog’s gems and plugins, like many others, are hosted in github, so you will need to add github to your list of sources:
gem sources -a http://gems.github.com
Tog uses [Paperclip](http://www.thoughtbot.com/projects/paperclip) which needs [ImageMagick](http://www.imagemagick.org/) for image processing, so you will need to install it. It isn’t always easy, but the features it provides are really necessary for social networks with pages full of scaled photos, so don’t be too lazy and install it. You can install via apt, yum, or port, or the package manager of your choice
Create your webapp with tog’s template. Tog 0.6 supports Rails 2.3.* only. We are working on Rails 3 support for there is no ETA right now.
rails _2.3.8_ hello_tog -m http://tr.im/tog_current
or if you prefer the edge version:
rails _2.3.8_ hello_tog -m http://tr.im/tog_edge
This will create the application with tog and all required gems and plugins installed. It will ask you a couple of questions (for example if you need tog_user or you have your own user management), but nothing difficult.
If you already have an existing application, you have a rake task for modifying an application using a template, so you can also use this template for adding to an existing application. It could be easy, since event tog_user is optional, buy anyway we will improve this template to be more flexible. Contact us if you find some cases for improving it. Run inside your application folder the following command:
rake rails:template LOCATION=http://tr.im/tog_current
rake rails:template LOCATION=http://tr.im/tog_edge
This installs the following tog plugins:
Now configure your database if needed (default to sqllite) and your email server if you want to. And do it like you always do. Just Rails, not magic.
At this point, you should be able to start your server and see tog’s demo application. Check the Customizing tog guide for information about using and customizing it.
There is an issue with rails 2.3 and the way desert handles plugins, so in development environment you will need to reload plugins in the same way that classes aren’t cached. to do that, just add the following line to config/environment.rb or config/environments/development.rb
config.reload_plugins = true if RAILS_ENV == 'development'
You can install more plugins to your brand new social network. For a list of available plugins check http://www.toghq.com/tog_plugins
We are working in a system for painless updating and upgrading of your plugins. Unfortunately it isn’t finished and still have to decide a couple of things (for example deciding to build a gem for every plugin we use), so you’ll need to update/upgrade your installation manually. Just overwritting the given plugin and adding a migrate for each upgraded plugin. It doesn’t hurt, believe me.