A small project that prints baseball statistics.
Though uncharacteristic of a Ruby on Rails app, this project does not run from a browser. In accordance with the requirements, output should be sent to STDOUT instead. Therefore, all user processes are implemented as rake tasks and run from the command line.
This application was developed and tested with:
- Ruby 2.1.1
- Rails 4.1.6
Learn more about Installing Rails.
This application uses SQLite with ActiveRecord.
- Go to your top level development directory
- rvm install ruby-2.1.1 # This will install 2.1.1
NOTE: A great doc for installing ruby and rails is at
http://railsapps.github.io/installrubyonrails-ubuntu.html
- Go to your top level development directory
- git clone git@github.com:/dsadaka/stats.git # Clone this repository
- cd stats # Clone command put source in stats subdir. The gemset stats will get created if not already
- bundle install # if you get any "could not find..." errors, just rm Gemfile.lock and try again
- rake db:migrate # build tables
rake stats:import_master # Empties Master and Imports Master-small.csv (for non-default usage, see below)
rake stats:import_batting # Empties Batting and Imports Batting-07-12.csv (for non-default usage, see below)
- cp db/development.sqlite3 db/test.sqlite3 # Just use copy of development data since read-only
- rake test test/models/master_test.rb
- rake test test/models/batting_test.rb
rake stats:print
You can import csv files of other names and you can elect NOT to have the import routine empty the db table first. You do so by passing the filename and a yes or no flag to the import.
rake stats:import_master[More-players.csv,no] # Imports from a played named More-players.csv WITHOUT emptying Master first
rake stats:import_batting[new-batting.csv,yes] # Imports batting stats from new-batting.csv after DELETING all records in Batting
Dan Sadaka, Datakey, Inc. North Miami Beach, FL 33162 (305) 999-0191