Rake tasks

From mx Help Wiki
Jump to: navigation, search


Setting the environment

Some of the most important tasks for an mx developer are those that move data in and out of the database (tasks starting with "mx:db:"). Since RAILS_ENV defaults to 'production' in our current environment.rb, you have to specify if you want to operate on the development database, for example:

rake mx:db:restore_last RAILS_ENV=development

You can see more about a specific task (if there is more to see) with --describe

rake --describe mx:db:restore_last

Available mx tasks

This is in progress, starred tasks are not recently (re)tested.


Loads one or more Nexus formatted matrices. In addition to the matrix file a YAML metadata file is required that looks like:

Full_file_name_of_matrix.nex:                # the name of the file, not indented
   :data_source_ref_id: 12                   # a mx Ref#id, referenced everywhere a ref_id is needed
   :title: "some title"                      # the matrix title
   :data_source_name: "some datasource name" # the datasource tile (essentially the same thing in this case)
   :notes: "Some note here."                 # not yet implemented
   :generate_short_chr_name: true            # creates a truncated character name
   :generate_otu_name_with_ds_id: 2          # false or DataSource#id, adds the data source ID to the Otu#name 
   :generate_chr_name_with_ds_id: 4          # false or DataSource#id, adds the data source ID to the Chr#name
   :match_otu_to_db_using_name: false        # attempts to match incoming Otus to Otu#name
   :match_otu_to_db_using_matrix_name: false # attempts to match incoming Otus to Otu#matrix_name
   :match_chr_to_db_using_name: false        # attempts to match incoming Chrs to Chr#name
   :generate_chr_with_ds_ref_id: false       # needs a valid Ref#id (not tested)
   :generate_otu_with_ds_ref_id: false       # needs a valid Ref#id (not tested)

You can repeat the above for all the matrices you have to add many matrices at once.

mx:clean_author_initials *

Removes all characters other than A-Z


Dumps a copy of the database to /dumps.


Dump the data, recreate the tables a...


Dump the data as a backup, then rest...


Dumps the current data to /dumps, then restores the data from the (next) youngest dump file (like "2008_07_03_224250.sql") in /dumps.


(not working yet)


deprecated with upcoming migrations Generate the foreign key statements ...


Call like: "rake mx:load_images img_...


should deprecate with migration, a one-time use Loads the language table. Call like: "rake mx:load_languages f...


Debug a nexus file against the parser.


Load one or more matrices.


Export a copy of the mx source code ...


Creates the directories mx uses for ...


Update all Ref display_name fields.

Personal tools