Very short description of the application.
Applicatoin is written in ruby language, using Ruby on Rails web framework.
# This insalls ruby-1.9.2 on Debian based distros
$ apt-get install ruby1.9.2
Bundler is used to manage ruby dependencies,
rubygems. To install all necessary gems use bundler
.
# This installs bundler
$ gem install bundler
# This installs all the dependencies into `vendor/bundle` folder
$ bundle install --deployment
This application is developed using ruby-1.9.2
, rails-3.2
,
bundler-1.1.4
and rubygems-1.8.24
.
Any database engine that is supported by ActiveRecord can be used, such as mysql
, sqlite3
or postgresql
. ActiveRecord is an ORM and it is one of the core components of Ruby on Rails.
To configure database connection define an environment variable like this:
# This uses `mysql2` adapter for the database connection
# Other adapters might require their gem to be pre-installed
ENV['DATABASE_URL'] = "mysql2://username:password@host/database-name"
or you can edit config/database.yml
file to configure each environment
database seperatly. It's default configuration is to use local sqlite
database.
development:
adapter: sqlite3
database: db/development.sqlite3
pool: 5
timeout: 5000
Once application is successfully connected to the database server, use this command to create and migrate the database:
# This creates a database
$ rake db:create
# This creates tables etc. on the database
$ rake db:migrate
Some of the database tables need to filled by initial data.
# This fills up the tables
$ rake db:seed
To enable e-mail notifications, smtp server credentials has to be set up. These configurations can be set up through environment variables during the deployment process.
ENV['SMTP_SERVER'] = "smtp.example.com"
ENV['SMTP_PORT'] = 25
ENV['SMTP_USERNAME'] = "mail@example.com"
ENV['SMTP_PASSWORD'] = "pas$w0rd"
This version of Ruby on Rails uses Asset Pipeline. Therefore, in the production environment assets such as images, css and javascript have to be compiled.
# This compiles all the assets into `public/assets`
$ rake assets:precompile
For the development easiest solution is to use:
# This starts WEBrick ruby server
$ rails server
=> Booting WEBrick
=> Rails 3.2.6 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
or you can use rack's rackup
command, since
every rails application is also a rack application.
# This also uses WEBrick ruby server
$ rackup
WEBrick is part of the ruby
's standart library and great as a
development server, but there are plenty of other options to choose from
for the production environment, such as: