quintel / energymixer

Answer multiple-choice questions to determine a future energy scenario – Not maintained
http://mixer.et-model.com
1 stars 0 forks source link

EnergyMixer

Setting Up EnergyMixer

The EnergyMixer application is "partitioned" into question sets, each containing a number of questions which may be answered by a user in order to design their scenario. Each question set has a name matching the subdomain to which it is deployed. For example:

"mixer"    #=> mixer.et-model.com
"gasmixer" #=> gasmixer.et-model.com

Firstly, copy the sample configuration file "config/config.sample.yml" to "config/config.yml".

As EnergyMixer determines which question set is to be shown depending on the subdomain you use, you must set up Pow to mimic this behaviour. In the OS X terminal, go to the EnergyMixer directory then:

ln -s `pwd` ~/Library/Application\ Support/Pow/Hosts/mixer.mixer
ln -s `pwd` ~/Library/Application\ Support/Pow/Hosts/gasmixer.mixer

The EnergyMixer will now be available at http://mixer.mixer.dev/ and http://gasmixer.mixer.dev/, with the "mixer" and "gasmixer" question sets respectively.

Configuration

In config.yml you will find the configuration for the application. This file is split into two sections: an "application" section, whose setting apply to all partitions, and separate configurations which apply to each partition.

Notable application settings:
Notable partition settings:

Deployment

A single instance of the EnergyMixer application is used to run both the mixer.et-model.com and gasmixer.et-model.com websites. Merge your changes into the "production" branch, then run cap production deploy.

Be careful with configuration data: your local "config/config.yml" is not copied to the server. Instead, the file is stored on the server in "/u/apps/energymixer/shared/config/config.yml". Capistrano will take care of creating the appropriate symlinks after deploying.

Caching

The application caches the current scenario. To clear the cache, log in to the admin section and click "Reset Cache". Alternatively, fire up the Rails console:

$ cd /u/apps/energymixer/current
$ bin/rails console production
irb(main):001:0> Rails.cache.clear
irb(main):002:0> exit

The QuestionSet class has a method related to this cache: QuestionSet.current_scenario which returns the cached value if available, and goes to ETEngine for the values if not.

Themes

Each partition can be customised with it's own views; controllers will prepend "app/views/{partition.name}. This means that any view in that directory (including layouts) will be rendered if available. Otherwise the default view will be used.