diff --git a/DEV/README.md b/DEV/README.md index 9f21dd9e6a554a5d425b48d9f826b0bfc14b808c..efb0e3557cfb3d1b03ed9673579220097f89c6e0 100644 --- a/DEV/README.md +++ b/DEV/README.md @@ -6,6 +6,7 @@ 3. [Separate new plugin](#3-separate-new-plugin) 4. [Core implementations](#4-core-implementations) 2. [Development](#development) + 1. [RYS engines](./RYS.md) 3. [Code style](./CODE_STYLE.md) 4. [Common errors](./COMMON_ERRORS.md) 5. [Repositories](./REPOSITORIES.md) diff --git a/DEV/RYS.md b/DEV/RYS.md new file mode 100644 index 0000000000000000000000000000000000000000..dd1f1fce14ea824dc22ab2945d64d01e3e9c3c93 --- /dev/null +++ b/DEV/RYS.md @@ -0,0 +1,122 @@ +# Redmine plugins as a engines +We introduce new way of development plugins for Redmine (and Easy Redmine of course) which is almast same as developing standard rails gems. + +# Introduce +RYS engines are separated to few gems, and source code is on github. So for full documentation what is RYS and how it works, please check our github page. + + https://github.com/easysoftware/rys + +# Lukas's personal workflow +How to start develop with RYS? There are some of my recommendations... + +## You need Redmine of Easy Redmine first +Because RYS is designed for developing (easy)Redmine plugins, you need download one of it. + +We have prepared simple generator of RYS engines + +> HINT: Easy Redmine from platform version 04.00 includes rys gem. The best is use our 'devel' + +### Generate your engine + +1. Add in your Redmine gem "rys" +2. Run rails generate of RYS + + rails generate rys:plugin NAME + +### Move generated code to work directory + +All engines will have separated GIT repository. Its better to store engines outside of ER git repository. + +> HINT: Use `--path` with generator. + +### Dummy application + +I like rails engines, and Rails 5 engines is the best to develop with dummy application, which not contains lot of unnecessary code. In Ruby Mine I have opened only RYS, so its fast and faster :) + +So I take our 'devel' repository, clone as `dummy` and remove *_ALL unnecessary plugins_*. + +This dummy I have symlinked to `test/dummy` in RYS engine. + + +### Prepare to test + +1. bundle install - based my experience you need run this many times :) +1. Be sure you have configured `config/database.yml` in your dummy. +1. rake app:db:create app:db:migrate && rake app:easyproject:install +1. rspec + +## Example + +How I do this... (working example) + +1. Get Easy Redmine + + git clone devel -b devel devel + +2. Setup Easy Redmine (database.yml) + + bundle install --without rmagick xapian + +3. Generate RYS + + rails g rys:plugin ruzovy_jednorozec --path ../ + +4. Prepare dummy + + git clone devel -b devel dummy + cd dummy/plugins + rm -r * && git checkout easyproject easy_job + cd easyproject/easy_plugins + rm -r * && git checkout easy_extensions # and all plugins requried by featue + cd ../../../ + vim config/database.yml + +5. Link dummy to RYS + + cd ../ruzovy_jednorozec + mkdir test + test folder is in `.gitignore` by default + + ln -s [~/projects/ or absolute path]dummy test/dummy + +6. Make it together + + bundle install --without rmagick xapian + rake app:db:create app:db:migrate + rake app:easyproject:install # this work from ER 05.00 + +7. Ready for use + +RYS is ready, open RubyMine and do some code ! After that run `rspec` + +```bash +.* + +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 +``` +### Conclusion + +When code is pushed to gitlab, CI will run test with whole devel repository (by default). +This is guide based my experience with RYS development, it may not be for everyone ok... + +#### Cons +* Test only part of application - other plugins can change behaviour and in this way you missed it... +* Another window with whole ER is needed. + +#### Pros +* Very fast development - test finished in few seconds, almost like in real world. +* Based on LOC in every RYS engine, Ruby Mine work faster, consume less RAM - on my old Mac is much better. +* TDD is now possible.