Gem Based Targets and Tools
COSMOS supports sharing and reusing targets and tools by bundling the target and tool configuration and code into Ruby gems. This document provides the information necessary to use and create gem based targets and tools.
Using Gem Based Targets
Step one is to install the gem based target into you COSMOS project by adding a line like the following to your project Gemfile:
After making the Gemfile modification above, you can install the gem by running bundle install
in your COSMOS project folder. Note if the gem is not hosted at rubygems.org and you just have the file locally, you will most likely need to manually gem install cosmos-xxxxxxx.gem
before running bundle install
.
Step two is to let the COSMOS system know about the gem based target in config/system/system.txt:
Step three is to configure the interface to the target in config/tools/cmd_tlm_server/cmd_tlm_server.txt. This is done exactly the same way as any other target.
Step four is to configure telemetry screens in config/tools/tlm_viewer/tlm_viewer.txt. This is again done exactly the same way as any other target.
That’s it! You should now be able to connect and interact with your gem based target.
Using Gem Based Tools
First, install the gem based tool into your COSMOS project in the same way as installing a target gem above. Then you will need to tell the COSMOS Launcher about the tool in launcher.txt like so:
That’s it! Click the new button in launcher to launch the tool.
Creating Gem Based Targets
Creating gem based targets is easy. All that is required is creating a cosmos-xxxxxx.gemspec (replace xxxxxxx with your target name) file in the target folder you wish to make into a gem. The folder structure should be just like what is in a normal target folder (ie.):
The gem name must start with “cosmos-“, and should then be followed by the actual target name. For example: cosmos-apcpdu.gemspec could be the gem name for a target called APCPDU.
Example config/targets/XXXXXX/cosmos-xxxxxx.gemspec file:
After organizing the files as required and creating the gemspec, create the actual gem with the following:
To publish your gem for other COSMOS users consider putting the source on Github and publishing your gem to Rubygems.
Creating Gem Based Tools
Creating a gem based tool is very similar to creating a gem based target. However, generally it will need to be done outside of your COSMOS project folder otherwise careful crafting in the “files” section of the gemspec file is required. In general, you will need to create a cosmos-xxxxxx.gemspec (replace xxxxxx with your tool name) file and a directory structure like this:
The gem name must start with “cosmos-“, and should then be followed by the actual tool name. For example: cosmos-satvis.gemspec could be the gem name for a tool called Satvis.
Example cosmos-xxxxxx.gemspec file for a tool:
After organizing the files as required and creating the gemspec, create the actual gem with the following:
To publish your gem for other COSMOS users consider putting the source on Github and publishing your gem to Rubygems.