Slinky Web Application

Download .zip   Download .tar.gz   View on GitHub

Slinky is a URL Shortener web application written using Ruby 2.0 and Rails 3.2.13.

The application can be used and seen at http://slnky.me/. The following is a screen capture of the application's homepage in it's current state.

alt text

Dependencies

This application uses the following system dependencies: * Ruby 2.0.0 (possibly 1.9.3, but not tested) * Rails 3.2.13 * PostgreSQL for production (not needed for development or testing) * Other gems listed in Gemfile

Using the Application

If you'd like to run the application locally or contribute to the application, begin by cloning the application and installing necessary dependencies:

git clone http://github.com/caseyscarborough/slinky.git
cd slinky
bundle install

Afterwards, create and migrate the database and fire up the rails development server.

rake db:migrate
rails server

Afterwards, navigate to http://localhost:3000 in your web browser to see the application in action.

Configuring the Application

If you'd like to generate sample data for a user, you can do so by editing the lib/tasks/sample_data.rake file.

# Generate first user, typically the one you'll use.
User.create(
  first_name: 'Casey', 
  last_name: 'Scarborough',
  email: '[email protected]',
  password: 'password',
  password_confirmation: 'password'
)

# Create links for each user in the system.
puts 'Generating links...'
User.all.each do |user|     
  15.times do |n|
    user.links.create!(
      short_url: Link.generate_short_link, 
      long_url: "http://" + Faker::Internet.domain_name, 
      total_clicks: rand(0..15),
      last_visited: rand(0..365).days.ago
    )
  end
end

Afterwards, you can add the sample data to the database by running the following command:

rake db:populate

Running the Test Suite

The tests are built using the RSpec testing framework and can be run by issuing the following commands from the project root:

# Prepare the database for testing
rake db:test:prepare

# Run the tests
rspec spec/

To-Do

  • Upgrade project to Rails 4.0.
  • Add link editing.
  • Create logo.
  • Add more features.

Contributing

Please feel free to contribute to the application by following the steps below:

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request