Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.
/ legacy_app Public archive

Example Ruby 1.8.7 and Rails 2.3 project to use as an exercise in upgrading to Ruby 1.9 and Rails 3.2.12

Notifications You must be signed in to change notification settings

paulfioravanti/legacy_app

Repository files navigation

Legacy App

Code Climate Coverage Status

Description

This is my attempt at upgrading the Legacy App by Trike Apps, from Rails 2.3 to 3.2.13, still have all tests pass, and maybe shine it up a bit. Installation and testing instructions for the original Rails 2.3 app can be found here.

Environment Prerequisites

  • ImageMagick
  • MySQL (or access to a MySQL server)
  • Ruby 1.9.3

Installation

Clone this repo, install gem dependencies with Bundle:

$ git clone https://github.com/paulfioravanti/legacy_app.git
$ bundle install

Environment Configuration

$ cp config/application.example.yml config/application.yml

Inside Rails App

Generate a secret token:

$ rake secret

Copy the resulting string into the SECRET_TOKEN entry in config/application.yml, along with your database information:

# App keys
SECRET_TOKEN: # your rake secret generated token

development:
  DB_NAME: # your dev db name here
  DB_USER: # your dev db username here
  DB_PASSWORD: # your dev db password here

test:
  DB_NAME: # your test db name here
  DB_USER: # your test db username here
  DB_PASSWORD: # your test db password here

production:
  DB_NAME: # your prod db name here
  DB_USER: # your prod db username here
  DB_PASSWORD: # your prod db password here

Testing with Travis CI (optional)

If you're using Travis for continuous integration testing, do the following (without the {{ }}):

Create encrypted travis variables for your database values:

$ gem install travis
$ travis encrypt DB_NAME={{YOUR_DB_NAME_UNDER_TEST}} # eg: sample_app_test
$ travis encrypt DB_USER={{YOUR_DB_USER}}
$ travis encrypt DB_PASSWORD={{YOUR_DB_PASSWORD}}

Then add them to .travis.yml

env:
  global:
    - secure: {{YOUR_ENCRYPTED_DB_NAME_UNDER_TEST}}
    - secure: {{YOUR_ENCRYPTED_DB_USER}}
    - secure: {{YOUR_ENCRYPTED_DB_PASSWORD}}

And after all that's done, set up the databases:

$ bundle exec rake db:create
$ bundle exec rake db:migrate
$ bundle exec rake db:test:prepare

Usage

Start local Rails server and navigate to http://localhost:3000:

$ rails s

Testing

Code quality is attempted by using Code Climate for quality metrics, SimpleCov/Coveralls for test coverage, Rails Brakeman for security auditing, and Reek and Rails Best Practices also helped in identifying some quality issues.

Run tests:

$ rspec spec
$ rake spec cucumber

Extras

  • Wrestled with app to gain precious badges
  • HAMLized the views
  • Refactoring of parts of the app
  • Extra specs to boost code coverage

Issues

  • Tests related to an attachment's size fail the first time, and pass subsequent times. I haven't been able to find a solution to this issue, and so have taken out validates_as_attachment from app/models/image.rb and replaced them with the non-size-related validations it references. Given that attachment_fu is not actively maintained, if this app was to move forward, I would suggest switching over to Paperclip or Carrierwave.
  • Travis CI build is quite fragile, and sometimes fails randomly when calling Image.make!.
  • Not 100% sure whether I properly migrated over from Jammit to the Asset Pipeline correctly due to there being a lot of stylesheets that don't seem to be used, or I haven't been able to reference them properly.

Social

profile for Paul Fioravanti at Stack Overflow, Q&A for professional and enthusiast programmers

endorse

Bitdeli Badge

About

Example Ruby 1.8.7 and Rails 2.3 project to use as an exercise in upgrading to Ruby 1.9 and Rails 3.2.12

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published