Skip to content

Development

Leonardo Crauss Daronco edited this page Apr 5, 2017 · 9 revisions

For the development version of Mconf-Web from the branch master.

This version uses uses Rails 4 and Ruby 2.2.5.

Setting up the development environment

Initial setup

  • First, you need to install some system packages used by Mconf-Web:
$ sudo apt-get install wget make curl git-core libruby aspell-es aspell-en libxml2-dev \
        libxslt1-dev libmagickcore-dev libmagickwand-dev imagemagick libmysqlclient-dev \
        mysql-server zlib1g-dev build-essential libqtwebkit-dev libreadline-dev \
        libsqlite3-dev libssl-dev libffi-dev redis-server 
  • Then install Ruby. We recommend the use of rbenv. You can see below the commands to install everything you need, but first please look at the links pointed below to learn what those tools are used for and how they work:

    • rbenv's README file describes what it is and has instructions on how to install it
    • ruby-build is a plugin for rbenv used to install rubies.

    (Note that if you have RVM installed, you should remove it first!)

# Install rbenv
$ git clone git://github.com/rbenv/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ source ~/.bashrc
# install ruby build
$ git clone git://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
# install ruby
$ rbenv install 2.2.5
$ rbenv rehash
# set this version of ruby as the default (optional) and check it is correct
$ rbenv global 2.2.5
$ rbenv version # > 2.2.5 (set by /home/mconf/.rbenv/version)
# install bundler
$ gem install bundler -v '1.3.5'
$ rbenv rehash
  • Clone mconf-web:
$ git clone git://github.com/mconf/mconf-web.git
  • Install the dependencies:
$ bundle install
  • Open MySQL's console (mysql -u root -p) to setup your MySQL user and password:
# change the passwords in the commands below!
CREATE USER "mconf"@"localhost" IDENTIFIED BY "password";
GRANT ALL PRIVILEGES ON mconf_development.* TO "mconf"@"localhost" IDENTIFIED BY "password";
GRANT ALL PRIVILEGES ON mconf_test.* TO "mconf"@"localhost" IDENTIFIED BY "password";
FLUSH PRIVILEGES;
  • Configuration files. You need to create and edit the files below. They don't exist yet in your repository, but they all have example files in the same directory that can be copied and used. The files are:

    • config/database.yml: Configures the database. Use the user mconf and the password you configured on MySQL in the step below. See this page for more details about it.
    • config/setup_conf.yml: Contains the basic configuration data that will be used during the database setup and when the application is initialized. See this page for more details about it.
  • Setup the database. It will drop and recreate your development database and create the seeding data you need to run the application.

$ bundle exec rake db:setup
  • Run the command below to start the server:
$ bundle exec rails server
  • Open your browser and go to localhost:3000 to access the application. Log in with the admin user you configured on you setup_conf.yml.

Fake test data

You can create fake data in your development database using the following rake task:

$ bundle exec rake db:populate

Re-creating the database

The easiest way to empty your database and start over again is running the tasks below:

$ bundle exec rake db:reset

If you get an error saying that your database is at the wrong version, just run db:migrate once and then try the commands above once again and they should work.

Testing

Proceed to this page.

Development Tips

Proceed to this page.

Configuring the website

Mconf-Web stores all its configurations in a database and provides a management interface in the website where the admin user can edit most of these configurations. See this page for more details.

Also, the configurations that can be edited in the management interface can also be configured using the file config/setup_conf.yml. See this page for more details on how it works.

Clone this wiki locally