Many general components are the same as used in YouSource. You can find plenty of useful information in the YouSource Wiki for Developers. On this page, you can find information specific to YouData for development.
YouData was started as the Judo project, so some parts of the application report are still valid.
The basic idea is that files are placed under projects, which in turn are controlled by the users and groups. Categories are used to organized files in projects. The files are referred in datafiles, which contain both metadata about the file and the information to retrieve the file from MongoDB, where the actual files are stored.
Anonymous upload is handled by creating a datafile, which is not associated with any project yet. When the file is accepted as part of a project, the datafile’s project association is set to the project and the AnonymousAddendum metaobject is removed. AnonymousAddendum contains metadata about the anonymous upload.
The file download to user is handled by the Apache xsendfile module. The application sets the headers for xsendfile in production environment.
The file upload uses mod_porter configured in the Apache settings.
Components in YouData
delayed_job manages the processes which should happen behind the scenes for users. Currently it is used to query for Korppi groups from LDAP.
Net::LDAP is used for authentication with the Korppi LDAP (finnish). Note that version 0.2.2 of the gem did not work properly with Korppi LDAP, so version 0.1.1 was used instead.
Cron is used to manage the deleting of temporarily created files in the folders. The temporary files are stored under the application root directory, within the subdirectories tmp/files and tmp/zip. Cron is also used to delete anonymously uploaded files which have been sent over 14 days ago. For this, the application contains a rake task called cron. You can run the task with
bundle exec rake cron RAILS_ENV=production.
jQuery File Upload plugin is used to handle file uploading for projects.
Compass is used to manage the CSS files in YouData. Make CSS changes to the
app/stylesheets/youdata.scss file and run
compass compile on the command line to compile new CSS files.
Server administration is mostly identical to YouSource’s server administration. The application resides in
/var/www/youdata/ instead of
/var/www/yousource/ and for method 2 restart, run
sudo /sbin/service httpd restart.
You can also directly view the MongoDB database using the mongo console, you can start the console by running
mongo, then in the console access the YouData database by typing
use youdata_production (by default, the database name is youdata_production). See related documentation for using the mongo console.
Make sure the background worker delayed_job is running. You can start and stop the service with
RAILS_ENV=production script/delayed_job start and
RAILS_ENV=production script/delayed_job stop. See related documentation for delayed_job.
Tests are handled with Rspec. You can run all the tests from the YouData folder by executing the following:
bundle exec rspec spec/
Specific test files can be run by specifying the filename or directory:
bundle exec rspec spec/controllers/projects_controller_spec.rb
runs the tests for Projects-controller. To run specific set of tests, you can specify the linenumber where the tests are specified:
bundle exec rspec spec/controllers/projects_controller_spec.rb:225
runs the tests for Projects-controller which are specified in the block starting at line 225.
The tests use factory_girl for fixtures, defined in the file spec/factories.rb. Rest of the test gems in Gemfile are used to help run the tests along with Rails and Mongoid.