A very very basic repository for terms, their URIs, and their properties that EOL maintains on the site.
Add the following to your Gemfile:
gem 'eol_terms', git: 'https://github.com/EOL/eol_terms.git'
- Someone edits the terms.yml file.
- Someone bumps the version, then
- builds and installs the gem locally
rake build ; rake install ; irb -r eol_terms
...then runs EolTerms.validate
to ensure it's valid. If not, return to step 1.
- That same person figures out the path of their repo (i.e.:
path = '/Users/jrice/git/eol_terms'
), runsEolTerms.rebuild_ids("#{path}/resources/uri_ids.yml")
, then - commits/pushes the changes to the repository, then
- goes to beta (the worker is the important container) and runs
bundle update eol_terms
(and checks the log for the line confirming the version changed), and - runs
TermBootstrapper.new.load
from a console or withrails runner
, making note of any errors or exceptions. - Someone should check that everything looks acceptable... and, if so,
- run the
bundle update eol_terms
andTermBootstrapper.new.load
on production, and finally, - restart the workers (
bin/stop_work
usually does the trick).
See the crib.txt file for JRice's "instructions" on how to do the former.
Get a list of "known" URIs with #uris
.
> EolTerms.uris
=> ["http://eol.org/schema/terms/µmol_cell-1", "http://eol.org/schema/terms/conePlusHalfSphere-20Percent", etc...]
> EolTerms.validate
Valid.
=> nil
EolTerms also stores an internal hash of Terms. You can get them with .by_uri
:
> EolTerms.by_uri('http://eol.org/schema/terms/percentPerMonth')
=> {"attribution"=>"", "definition"=>"a measure of specific growth rate", etc...}
If you add a URI to the eol_terms.yml
file, you will need to give IDs to the new terms. This is accomplished with the
rebuild_ids
method (note that the URIs will necessarily be lowercase when added to the file; URIs are
case-insensitive, so this is just for simplicity):
> EolTerms.rebuild_ids
Adding missing key: http://eol.org/schema/terms/coneplushalfsphere-20percent (#1)
Done.
=> nil