Skip to content

mvz/turl

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

73 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TinyURL Ramaze Application
===========================

Fork of zh/turl. This is not a drop-in replacement, since it uses base-62
encoding instead of base-36. Do not use this fork without converting your
turls somehow, or fork this and change back to base-36.

Required gems
--------------

sqlite3-ruby, sequel, validatable, ramaze, thin


Features
---------

- everything in one file - model, view, controller
- auto create the database if missing
- unique urls in the database 
- url hits counting
- API for command-line access - can shorten urls and restore the original urls

Additional Features of this Fork
--------------------------------

- Use base-62 encoding for extra small URLs.
- Adding new URLs is password protected, making this a *private* URL
  shortener.

Plans/TODO
----------

*Very* tentative.

- Make private/public shortening configurable.
- Perhaps make base used for turls configurable.

Usage
------

 $ curl -O turl.rb "http://github.com/mvz/turl/tree/master%2Fturl.rb?raw=true"
 $ ruby turl.rb
 # browse http://localhost:7000/
 # shorten url (turl)
 $ curl http://admin:secret@localhost:7000/_api?turl=http://github.com/zh/turl/
 # restore the original url
 $ curl http://admin:secret@localhost:7000/_api?url=abc
 # number of hints for given turl
 $ curl http://admin:secret@localhost:7000/_api?hits=abc

Do not forget to change the BASE_URL and LOGINS values. By default the database 
file (sqlite3) will be created in the same directory with turl.rb. If this is not 
acceptable, change the DB_FILE line.

About

TinyURL service in Ramaze

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Ruby 100.0%