view · edit · sidebar · attach · print · history

< Niklaus.20160425-ydim-html-ruby-2-3 | Index | Niklaus.20160419-ydim-html-ruby-1-9 >>



  • Fix error in YDIM html. Port ydim to Ruby 2.3



Keep in Mind for work to do
  • Fix dojo error
  • I removed on May-27 tests for ix_registrationss, fix_sequences, fix_compositions, fix_packages from test/test_plugin/swissmedic.rb,as he could not find any references for them in the src code. Did I erroneously remove stuff when cleaning up the swissmedic import earlier?
  • The whole test for older/newer Packages must be adapted to xlsx. One must compare the rows (e.g. by creating csv files) and do the same stuff in xlsx!
  • creat gem: task: input=file with ean-codes, standard output show ean-codes + atc-code. Source is Swissmedic Packungen.xlsx or XML.
  • Import via data/medreg_companies.yaml
  • Fix problem with radioactivatum 99m-technetio when parsing Wirkstoffe
  • Fix galenic_forms when parsing swissmedic.xlsx
  • Cleanup generic_type. Replace it everywhere by sl_generic_type and adapt code accordingly.
  • Get updated ATC-codes from EPha for, too.
  • Use refdatabase for, too.
  • Check whether we should revert the part which touche src/plugin/text_info.rb of commit 17af82ba4d76a5838683411b260de265531f9e74. We should improve test/stub/oddbapp.rb to work similar for update/pointer as the real oddbapp. In this case we would have a good Stub for plugins. May we need a different stub when working with plugins (which create/modify/destroy ODDB-Objects), when in most other cases a very simple stub is sufficient.
  • When a logged in admin user changes an atc_code of a product, the corresponding atc_class must update its sequences, too.
  • Order of entering search type and value should not matter. Both should show long URL with search
  • Remove parser for minifi (but keep the minifi)
  • BSV-Plugin does not send mail. Is it sending two mails at once?
  • remove obsolete pdf_patinfo in model, admin/views

Fix error in YDIM html. Port ydim to Ruby 2.3

Must make all unit test pass for ydim and make it work on oddb-ci2. Done. ydimd start now on oddb-ci2. Same for ydim-html. Must now change the RubyPath to ruby 2.3.0

Now I am able to create a new customer which had initially a UTF-8 name "Über", but which is rendered inccorectyl as shown here:

Also the street is rendered as an Array instead of a single String. After pressing the "Neue Rechnnung" I get the following debug output.

/var/www/ cannot load such file -- rclconf
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:118:in `rescue in require'
/usr/lib64/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:124:in `require'
/var/www/ `<top (required)>'
/var/www/ `load'
/var/www/ `<top (required)>'
/usr/lib64/ruby/1.9.1/apache/ruby-debug.rb:54:in `load'
/usr/lib64/ruby/1.9.1/apache/ruby-debug.rb:54:in `handler'

This error goes away if a logical link for the rclconf like this ln -s /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/rclconf-1.0.0/lib/rclconf.rb /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/site_ruby/2.3.0/x86_64-linux/

But adding some debugging output in the doc/index.rbx show that we still have a lot of ruby 1.9.1 paths, as mod_ruby was compiled with ruby 1.9.1. Output is

After patching ruby 1.9.1 cgi.rb by adding $stderr.puts "#{__FILE__} #{__LINE__}: key #{key.inspect} val #{value.inspect} #{value.encoding}" I get (among other) the following apache error output

/usr/lib64/ruby/1.9.1/cgi/core.rb 666: key "debitor_type" val "dt_hosting" UTF-8
/usr/lib64/ruby/1.9.1/cgi/core.rb 666: key "name" val "\u00DCber" UTF-8

Now compiling mod_ruby with 2.3.0. This should enable me to use the pry debugger. Downloading and install ruby 2.3.0 from using ./configure; make; sudo make install. Verified that apache really uses the new ruby with

niklaus@oddb-ci2 /v/w/> sudo -iHu apache which ruby
niklaus@oddb-ci2 /v/w/> sudo -iHu apache ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]

Using sudo /usr/local/bin/gem install bundler and /usr/local/bin/bundle install --system to install all needed gems for ydim-html (being in /var/www/

Gem seem to be installed correctyl now
ls /usr/local/lib/ruby/gems/2.3.0/gems/
bundler-1.11.2/  deprecated-2.0.1/    htmlgrid-1.0.7/               minitest-5.8.3/    power_assert-0.2.6/  rake-10.4.2/    rrba-1.0.0/                rspec-support-3.4.1/  test-unit-3.1.5/
byebug-8.2.4/    did_you_mean-1.0.0/  mail-2.6.4/                   needle-1.3.0/      power_assert-0.2.7/  rake-11.1.2/    rspec-3.4.0/               ruby-ole-1.2.12/      test-unit-3.1.8/
coderay-1.1.1/   diff-lcs-1.2.5/      method_source-0.8.2/          net-telnet-0.1.1/  pry-0.10.3/          rclconf-1.0.0/  rspec-core-3.4.4/          sbsm-1.2.6/           transaction-simple-
color-1.8/       flexmock-2.0.5/      mime-types-3.0/               odba-1.1.0/        pry-byebug-3.3.0/    rdoc-4.2.1/     rspec-expectations-3.4.0/  slop-3.6.0/           yard-
dbd-pg-0.3.9/    hpricot-0.8.6/       mime-types-data-3.2016.0221/  pg-0.18.4/         pry-doc-0.8.0/       rmail-1.1.2/    rspec-mocks-3.4.1/         syck-1.1.0/

ls -l /usr/local/lib/ruby/site_ruby/2.3.0/x86_64-linux/
insgesamt 0

But we see that the site_ruby is empty.

To make ydim work, called sudo /usr/local/bin/gem install pkg/ydim-1.0.1.gem, same for pdf-writer sudo /usr/local/bin/gem install pkg/pdf-writer-1.2.3.gem

But now when I start ydimd using sudo -u apache /usr/local/bin/ruby bin/ydimd I get again the error not delegated (ArgumentError) as seen in

Pushed commit Added some development dependencies to gemspec to able to run on a clone of my ruby-dbi repository sudo /usr/local/bin/gem install pkg/dbi-0.4.6.gem. Now ydimd starts fine again.

The apache error-log still shows ruby 1.8 paths like

[Wed Apr 20 13:42:01 2016] [error] access to / failed for (null), reason: Wed Apr 20 13:42:01 +0200 2016 - 70307778362460 - NameError - uninitialized constant CGI::Session::DRbSession
[Wed Apr 20 13:42:01 2016] [error] access to / failed for (null), reason: /usr/lib/ruby/site_ruby/1.8/sbsm/request.rb:152:in `drb_process'
[Wed Apr 20 13:42:01 2016] [error] access to / failed for (null), reason: /usr/lib/ruby/site_ruby/1.8/sbsm/request.rb:70:in `process'
[Wed Apr 20 13:42:01 2016] [error] access to / failed for (null), reason: /var/www/
[Wed Apr 20 13:42:01 2016] [error] access to / failed for (null), reason: /usr/lib/ruby/1.8/apache/ruby-debug.rb:54:in `load'
[Wed Apr 20 13:42:01 2016] [error] access to / failed for (null), reason: /usr/lib/ruby/1.8/apache/ruby-debug.rb:54:in `handler'

My has only /usr/lib in its path no /usr/local/ as shown by the output of

Should I recompile ruby 2.3.0 and install it into /usr instead of /usr/local? Or should I update my portage tree and install ruby 2.3.0 from it? Or try a hack like using patchelf

Mod_ruby was generated with this snippet

#!/bin/bash -v
cd mod_ruby.2.3
export RUBY=/usr/local/bin/ruby
$RUBY -v
make  clean
$RUBY ./configure.rb \
  --with-apxs=/usr/sbin/apxs \
  --with-apr-includes=/usr/include/apr-1 \
sudo cp -v /usr/lib64/apache2/modules/
$RUBY -v

Pushed commit

No all unit-tests for ydim pass, when one calls bundle exec test/suite.rb.

Pushed Now bundle exec test/suite.rb begins to start to fix minor problem when calling bundle install and bundle exec test/suite.rb. Ydim-HTML has only selenium test, which fail like this when calling bundle exec test/suite.rb

bundle exec test/suite.rb
/opt/src/ydim-html/test/selenium.rb:159:in `do_command': Object#timeout is deprecated, use Timeout.timeout instead.
./opt/src/ydim-html/test/selenium.rb:159:in `do_command': Object#timeout is deprecated, use Timeout.timeout instead.
/opt/src/ydim-html/test/selenium.rb:159:in `do_command': Object#timeout is deprecated, use Timeout.timeout instead.
/opt/src/ydim-html/test/selenium.rb:173:in `block in do_command': SeleniumCommandError
        from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'
        from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/timeout.rb:33:in `block in catch'
        from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/timeout.rb:33:in `catch'
        from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/timeout.rb:33:in `catch'
        from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/timeout.rb:106:in `timeout'
        from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/timeout.rb:120:in `timeout'
        from /opt/src/ydim-html/test/selenium.rb:159:in `do_command'
        from /opt/src/ydim-html/test/selenium.rb:180:in `get_string'
        from /opt/src/ydim-html/test/selenium.rb:149:in `start'
        from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/delegate.rb:83:in `method_missing'
        from /opt/src/ydim-html/test/selenium/unit.rb:49:in `<top (required)>'
        from /opt/src/ydim-html/test/selenium/test_autoinvoice.rb:8:in `require'
        from /opt/src/ydim-html/test/selenium/test_autoinvoice.rb:8:in `<top (required)>'
        from test/suite.rb:13:in `require'
        from test/suite.rb:13:in `block in <main>'
        from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/find.rb:49:in `block (2 levels) in find'
        from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/find.rb:48:in `catch'
        from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/find.rb:48:in `block in find'
        from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/find.rb:43:in `each'
        from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/find.rb:43:in `find'
        from test/suite.rb:11:in `<main>'

Hannes created a stub for the http server where one finds the encouring note compatibility-brainfuck for integrating Apache-SBSM-Requests with WEBrick, while trying to make the tests pass.

Zeno insists that I must create a script to set all the prefix, wheras I relied on the the following output of ./configure --help of Ruby 2.3.0

By default, `make install' will install all the files in
`/usr/local/bin', `/usr/local/lib' etc.  You can specify
an installation prefix other than `/usr/local' using `--prefix',
for instance `--prefix=$HOME'.

My gen_ruby_2.3 is here: Attach:gen_ruby_2.3.txt

Now I had to rebuild some gem like this
sudo /usr/local/bin/gem230 pristine byebug --version 8.2.4
sudo /usr/local/bin/gem230 pristine hpricot --version 0.8.6
sudo /usr/local/bin/gem230 pristine pg --version 0.18.4
sudo /usr/local/bin/gem230 pristine syck --version 1.1.0

Checking ruby path in apache again. Fixed a few of them. Now I am missing some Ruby 1.9 gems. Remade ruby 1.9.3-p547 using a similar script as for ruby 2.3.0 (versions replaced, logs generated). See Attach:gen_ruby_1.9.3.txt

In I ran sudo /usr/local/bin/gem193 install bundler and bundle install --system to install all gems I need. But I have now a few problems, because flexmock, syck and mime-types-data must be handled differently under 1.9.3 and >= 2.0. And we already did see, that ruby 1.9.3 does not work with needle. There I must decide next week whether to:

  • Try againg to make ydim/ydim-html support Umlauts via mod_ruby from 1.9.3
  • Use Ruby 2.3.0 with mod_ruby from 1.9.3
  • Use Ruby 2.3.0 wit mod_ruby from 2.3.0
  • Switch to nginx + alternative to mod_ruby like phusion-passenger, webrick

Installing nginx + passenger seems to need a small hack as dokumented under

I think I got the passenger module working in Nginx. Actually you don't need any overlay. 
If you read the ebuild carefully, there's a variable 'NGINX_ADD_MODULES'.

Anyway, I'm posting here the steps that I followed just in case anyone else is also interested but 
note that this is not officially supported.
1. Download passenger tar ball (passenger-4.0.43.tar.gz) from Phusion and move it to /usr/src
2. Extract the tar ball: tar xvf passenger-4.0.43.tar.gz
3. cd /usr/src/passenger-4.0.43/ext/nginx
4. Manually compile the Nginx module: rake nginx CACHING=false
5. Add the following line to make.conf: NGINX_ADD_MODULES="/usr/src/passenger-4.0.43/ext/nginx"
6. Run emerge nginx

I guess this post should be moved to 'Unsupported Software'

See also:

view · edit · sidebar · attach · print · history
Page last modified on April 20, 2016, at 06:52 PM