Getting started with RYS
In this article you will learn what it is and how our new RYS plugin system works.
What is RYS?
We've introduced a new way of developing plugins for Easy8 and Redmine. It is almost the same as developing standard Rails gems based on the Rails engine system.
RYSes are used for isolated features and allow on-the-fly enabling/disabling of their features.
RYS consists of:
- RYS (contains Feature toggler, patch management and generators)
- RYSPEC (contains testing RYSes)
- RYS management (contains RYS configuration and management).
Where to find RYSes?
Each RYS has its own repository and depending on the platform configuration can be changed and installed if needed. RYS always only changes backend functionality and its controllers.
Full documentation what RYSes, including source code can be found in github.
How RYS works?
It is important to understand how RYSes are built inside so let's look at the way they are structured. The overall structure is driven by what it does, whether it adds new functions or changes existing functionality.
In case of the RYS adds new functionality then their structure follows the common Rails architecture and adds new classes into lib folder.
In case of RYS changes or enhances functionality then the structure follows this logic:
- Into the
patchfolder go all alterations to existing files that affect any platform files. - Following the same logic, if new RYS alters functionality of another RYS then new code files go in the
patchfolder and the subfolder of the changed RYS.
Each RYS should contain information about its author, version, short description about its functionality and under what license it can be used. All this is saved in its very own .gemspec file.
How to install RYS?
- As your first step you have to add to your gem file (Gemfile, gemfile.local, gems.rb,...)
git_source(:github) {|name| "https://github.com/#{name}.git" }
group :default, :rys do
gem 'rys', github: 'easysoftware/rys', branch: 'master'
end
- Next install your gem file
- As a next step add additional
This will generate a new Redmine plugin (plugins/NAME) contains basic plugins (
rys-bundler,ryspec, ...) and generated skeleton for adding more ryses (plugins/NAME/Gemfile).
- And a last step is generate RYS with name NAME and follow instruction.
And that is it. RYS platform is fully installed and ready to use.
RYS Builder
How to install RYS Builder?
If you want to download RYS Builder copy/symlink all rys dependencies into your project directory.
- First of all copy gems into
plugins/easysoftware/gems
- Link gems into
plugins/easysoftware/gems
- Revent gems from
plugins/easysoftware/gems
- Revent gems from plugins/easysoftware/local
And that is all Now you call successfully use RYS Builder.
How to start developing with RYS? (Best practice one of our developers)
As a first step you will need Redmine or Easy8.
Because RYSes are designed for developing (Easy) Redmine plugins, you need to have it set up first.
Easy8 platform version 04.00 and up includes the rys gem.
Generate your engine
We have prepared a simple generator of RYS engines.
-
Add the
rysgem if not already included -
Run rails generator
Move generated code to work directory
All engines will have separate GIT repository. It's better to store engines outside of ER git repository.
Use
--pathgenerator option.
Dummy application
Rails 5 engines are best developed with a dummy application, which doesn't contain a lot of unnecessary code. In RubyMine you only need to open the RYS source, so its fast and easy.
So you take our devel repository, clone it as dummy and remove ALL unnecessary plugins. It can be found here
develcorresponds with devel/devel.git#develmasterwith devel/devel.git#master
You symlink this dummy to test/dummy in the RYS engine.
Running tests
- Run
- Make sure you have configured
config/database.ymlin your dummy. - Run migration
- Build Easy8
- Run rspec
Example of getting dummy app and running tests
- Get Easy8
- Setup Easy8 (database.yml)
- Generate RYS
- Prepare dummy
git clone [email protected]:easyproject-client/dummy.git -b devel dummy
vim config/database.yml
- Link dummy to RYS
- test folder is in
.gitignoreby default
- Put it together
bundle install --without rmagick xapian
rake app:db:create app:db:migrate
rake app:easyproject:install # this work from ER 05.00
- Ready to use
RYS is ready. Open RubyMine and write some code! After that run rspec.
.*
Pending: (Failures listed here are expected and do not affect your suite's status)
1) Model test Fail something
# No reason given
Failure/Error: expect(true).to eq false
expected: false
got: true
(compared using ==)
# ./spec/models/model_spec.rb:8:in `block (2 levels) in '
Finished in 0.50731 seconds (files took 2.92 seconds to load)
2 examples, 0 failures, 1 pending