65 lines
1.7 KiB
Markdown
65 lines
1.7 KiB
Markdown
|
+++
|
||
|
date = "2010-04-13"
|
||
|
title = "Get ready for Firefly 0.3!"
|
||
|
tags = []
|
||
|
slug = "get-ready-for-firefly-03"
|
||
|
+++
|
||
|
Hot off the press is Firefly 0.3! Firefly is a simple URL shortener application intended for personal use. It's core features are:
|
||
|
|
||
|
* Very light-weight - based on Sinatra
|
||
|
* Shorten URLs using 62-Base encoding
|
||
|
* Offers an easy to use API
|
||
|
* Keeps track of URL clicks
|
||
|
* Supports most popular database backends, including MySQL and Sqlite3
|
||
|
* Includes a ready-to-use Bookmarklet
|
||
|
* Works with any Rack capable web server
|
||
|
|
||
|
Interested? Give it a go! Here's how in ht
|
||
|
~
|
||
|
|
||
|
### 1. Install Firefly
|
||
|
|
||
|
gem install firefly
|
||
|
|
||
|
### 2. Ready?
|
||
|
|
||
|
Create a new directory and place the following `config.ru` file in it:
|
||
|
|
||
|
require 'rubygems'
|
||
|
require 'firefly'
|
||
|
|
||
|
disable :run
|
||
|
|
||
|
app = Firefly::Server.new do
|
||
|
set :hostname, "localhost:3000"
|
||
|
set :api_key, "test"
|
||
|
set :database, "sqlite3://#{Dir.pwd}/firefly.sqlite3"
|
||
|
end
|
||
|
|
||
|
run app
|
||
|
|
||
|
### 3. Go!
|
||
|
|
||
|
Start your engines! In this case I use `thin`:
|
||
|
|
||
|
thin start -R config.ru
|
||
|
|
||
|
Now, when you visit `http://localhost:3000/` you'll be asked for your API key to login. Then, start shortening!
|
||
|
|
||
|
### Updating
|
||
|
|
||
|
If you were already running Firefly 0.2, upgrading is easy. Simple update the Firefly gem to 0.3 and restart your server.
|
||
|
|
||
|
When you update from 0.2 you'll notice your click stats are all indicating `0`. Don't worry, no data was lost! The solution is quite simple.
|
||
|
|
||
|
1. Remove the `clicks` field from `firefly_urls`
|
||
|
|
||
|
ALTER TABLE `firefly_urls` DROP `clicks`;
|
||
|
|
||
|
2. Rename the `visits` field to `clicks`
|
||
|
|
||
|
ALTER TABLE `firefly_urls` CHANGE `visits` `clicks` int;
|
||
|
|
||
|
All done! No restart required.
|
||
|
|