Skip to content

Get started with RYS

RYS is the older packaging format for Easy8 features: a Rails engine delivered as a gem. The Easy8 engines in easy_engines/ still use it, but new features are written as Easy plugins, and RYS engines are being converted to plugins. For your own code, use a modification_<name> plugin as described in Where to put your code and change existing classes with patches.

Read these pages when you need to understand or maintain an existing RYS engine.

What is RYS?

A RYS is a Rails engine, developed like a standard Rails gem (see the Rails engines guide). It adds or changes backend functionality and its controllers, and its features can be switched on and off.

The rys gem provides the feature toggler, the patch management and the plugin management. ryspec provides the test setup. Both live in the gems/ directory of the Easy8 source.

The source of the rys gem is also published at github.com/easysoftware/rys.

Structure of a RYS

  • A RYS that adds new functionality follows the common Rails layout and puts new classes into lib/.
  • A RYS that changes existing functionality puts the changes into the patches/ directory. If it changes another RYS, the code goes into a subdirectory of patches/ named after that RYS.
  • The .gemspec file holds the author, version, short description and licence.

Settings of a RYS

Settings of a RYS are stored as EasySetting records named <rys_name>_<key>:

EasySetting.value(:my_rys_my_value)
EasySetting.find_by(name: "my_rys_my_value")

The engines in easy_engines/ also expose them through a service method of the engine module, for example EasyAI.setting(:my_value). A RYS can render its own settings form in the file app/views/rys_management/plugins/_my_rys.html.erb:

<p><%= form.label :my_value %> <%= form.text_field :my_value %></p>