Development Environment Setup
Install RVM and Ruby
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) source ~/.bash_profile rvm install ruby-2.0.0-p645 rvm use ruby-2.0.0-p645
sudo apt-get install node brew install node
Clone the Halloped Project Repository
git clone firstname.lastname@example.org:ayystudentunion/hhj.git
Install Gem Dependencies
cd hhj rvm pkg install zlib openssl libxml2 libxslt rvm reinstall ruby-2.0.0-p645 sudo apt-get install libqt4-dev # For qmake on Linux brew install Qt # For qmake on OS X
If you're getting trouble from nokogiri, do
rm -rf $rvm_path/usr rvm requirements # Copy the apt-get [...] part and sudo it rvm reinstall ruby-2.0.0-p645
Then install bundled dependencies
gem install bundler bundle install
Initialize development database
Run only unit tests
Run only system tests
Re-initialize development database later when needed
rake db:drop db:seed
University custom folder
All customization files of universities are in single place, under public/universities. See public/universities/helsinki for an example.
Adding a new university
Create yaml file that has university organisation. See public/universities/helsinki/helsinki.yml for an example Note! The file name and folder name must be the same as the first part of university domain name. E.g. for helsinki.fi => helsinki/helsinki.yml or for TTY tty/tty.yml. Application will internally use that part or domain name as a key for university. It will also show in the url, e.g. halloped.fi/fi/helsinki. So if you name your folder wrong way or import organization from file with wrong name, then your organization will not work. Execute the rake task: RAILS_ENV=production rake db:import:university ./public/universities/myuniversity/myuniversity.yml
Custom stylesheet for university is public/universities/myuniversity/stylesheet/myuniversity.css.styl
Custom pdf prints are e.g. for calls in public/universities/myuniversity/calls/show.pdf.slim See template overriding below for more info
Custom fields for position applications
University can have its own custom fields in position applications for applicants. See example from public/universities/helsinki _fields.html.slim (used to render extra applicaiton fields and showing the preview of them to the applicant) _fields_show.html.slim (used for showing the data for call admin)
Localizations needed for the custom fields in position applications are in public/universities/myuniversity/locales. See public/universities/helsinki/locales for example You should also be able to override any localization in config/locales for current university using the university specific locale file.
Basicly all ui templates can be overriden for university. The current university custom folder has top priority when Rails searches for ui templates. For example, if helsinki is current university, then the open calls page calls/index.html.slim is first searched under the public/universities/helsinki and if not found then under app/views. This is how the overriding of print templates etc. is achieved. Even though it is possible to override other than pdf print templates also, be aware that it should not be done just because you can and will probably lead to maintenance problems and other dark places.
Keep in mind that all university specific files are under pubic folder, so they can be directly accessed freely if you know the resource path. This should not be a problem since there is no sensitive data by default there. And this whole repo is open anyway.
Database can be administrated using rails_admin plugin (https://github.com/sferik/rails_admin) Admin url is https://halloped.fi/en/admin/ You can basicly add Organ, Organization, User, more Admins or whatever with it. You can edit names etc. If you need to edit localized string that is stored in database (like organ name) you can change the language of admin view to edit the string for that language. E.g. https://halloped.fi/fi/admin/ Remember to use very strong passwords for all the admins!!!
You can define eligibility rules for applicants using the Admin view. First add new Eligibility rule. Currently only rules that compare a known haka edu person field to a list of valid values is supported. Then add a rule set to hold the rule you created. You need to add the rule set also to a root level organization (university). You can of course define multiple rules for rulesets. And rulesets can share rules, even between universities. But rulesets are university specific. They will show up in the new call form, where you can select any rule set you have defined for university. If eligibility rules are not met by applicant then applicant is marked as not eligible. Call admin can then decide whether to reject or select the applicant. Eligibility rules do not technically prevent selecting applicant, that decision is always made by human.
Production environment Setup
Install Qt (PDF printing has qt dependency)
yum install qt
You might also need to install wkhtmltopdf binary manually. At least Redhat could not use the wkhtmltopdf binary that comes with the gems. Install working wkhtmltopdf binary to ~/bin folder (app is configured to use it from there)
Technology stack and documentation
Application is built with the Rails conventions and using lot of existing gems. If you need documentation of application, then this is good place to start guides.rubyonrails.org/
Same applies also to many other parts of applicaiton that uses existing gems. Check the gem, google for its documentation and read it.
Just to mention some technologies used: Rails 3 MongoDB using mongoid and mongoid-tree CoffeeScript Cucumber FactoryGirl
See more from the Gemfile (and google them for documentation if you need any)