Corrupted memory in brain. Directory is of course "lib" like in rails, not "dir". sorry for confusion Josef
On Wed, 24 Jul 2013 15:47:31 +0200 Josef Reidinger <[email protected]> wrote: > Hi, > in short, I add in ruby bindings automatic inclusion of "dir" > repositories in Y2 paths to ruby load path. Reason is to have common > place to have pure ruby private ( in sense of not share it with rest > of ruby world ) files. Its intended usage is for various modules, > classes and other stuff that makes your plugins nicer. Include > directory is not good as it contain now translated code and contain > some special magic to make it work in ycp-way. > > Namespace is shared between plugins so it make sense to use own > namespace there same way as in "include" directory. > > Thanks locilka for initial idea. > > Long story: > For code now there is modules, clients and includes. Modules is > intended for modules that share its functionality over component > system. You can import it. Clients is scripts, that can be executed by > Yast2 environment. Include is tricky as it is code snippets that is > internally shared, but it has few limitations - It must be included in > code, it must be ensured that it is included only once, so it is very > limited compared to ruby ( or perl, python ) ability to share code > parts. > That leads to idea, that we need directory where you can have > proprietary parts of code that is intended only for given module and > its usage depends on language. > > Current status is that it is supported only in ruby-bindings, but plan > is also to add it to perl and python bindings, if there is someone who > is interested in it (e.g. now in perl it must be all in one file or > use some tricky loading or write upstream perl library, that can be > called). > > Example demonstration ( not working, just to demonstrate, real example > comes after Milestone 4 ): > > client C: > > require "services/main_dialog" > > data = Services.load > dialog = MainDialog.new data > result = dialog.run > > if result == :ok > Services.save dialog.data > end > > return result > > > dir/services/main_dialog.rb: > require "yast" > > class Services > > attr_reader :data > > def initialize > ... > end > > def run > ... > end > end > > > Josef -- To unsubscribe, e-mail: [email protected] To contact the owner, e-mail: [email protected]
