Trying to get rid of error in pdfinvoice and pdf-writer like pdfinvoice/invoice.rb:100: invalid multibyte char (US-ASCII) (SyntaxError)
When I tried sudo -u apache /usr/bin/ruby19 -rubygems /usr/bin/ydimd
I got the following error:
/usr/local/lib64/ruby/gems/1.9.1/gems/needle-1.3.0/lib/needle/thread.rb:42:in `lock': undefined method `critical=' for Thread:Class (NoMethodError) from <internal:prelude>:8:in `synchronize' from /usr/local/lib64/ruby/gems/1.9.1/gems/needle-1.3.0/lib/needle/service-point.rb:117:in `instance' from /usr/local/lib64/ruby/gems/1.9.1/gems/needle-1.3.0/lib/needle/container.rb:308:in `get' from /usr/local/lib64/ruby/gems/1.9.1/gems/needle-1.3.0/lib/needle/registry.rb:124:in `bootstrap' from /usr/local/lib64/ruby/gems/1.9.1/gems/needle-1.3.0/lib/needle/registry.rb:106:in `initialize' from /usr/lib64/ruby/site_ruby/1.9.1/ydim/server.rb:71:in `new' from /usr/lib64/ruby/site_ruby/1.9.1/ydim/server.rb:71:in `initialize' from /usr/bin/ydimd:35:in `new' from /usr/bin/ydimd:35:in `<main>'
I had forgotten that needle does not work under Ruby 1.9 and 2.0. It runs fine under 2.1 and later.
Trying to make pdf-writer run its test using ruby19 bin/techbook
.
encoding: utf-8
to lib/pdf/writer.rb
Must fix now the following error
uby19 bin/techbook Using default document 'manual.pwd'. /usr/local/lib64/ruby/gems/1.9.1/gems/transaction-simple-1.4.0.2/lib/transaction/simple.rb:161:in `dump' /usr/local/lib64/ruby/gems/1.9.1/gems/transaction-simple-1.4.0.2/lib/transaction/simple.rb:161:in `start_transaction' /usr/lib64/ruby/site_ruby/1.9.1/pdf/techbook.rb:469:in `techbook_heading' /usr/lib64/ruby/site_ruby/1.9.1/pdf/techbook.rb:566:in `block in techbook_parse' /usr/lib64/ruby/site_ruby/1.9.1/pdf/techbook.rb:537:in `each' /usr/lib64/ruby/site_ruby/1.9.1/pdf/techbook.rb:537:in `techbook_parse' /usr/lib64/ruby/site_ruby/1.9.1/pdf/techbook.rb:886:in `run' bin/techbook:24:in `<main>' /usr/local/lib64/ruby/gems/1.9.1/gems/transaction-simple-1.4.0.2/lib/transaction/simple.rb:161:in `dump': no _dump_data is defined for class Mutex (TypeError) from /usr/local/lib64/ruby/gems/1.9.1/gems/transaction-simple-1.4.0.2/lib/transaction/simple.rb:161:in `start_transaction' from /usr/lib64/ruby/site_ruby/1.9.1/pdf/techbook.rb:469:in `techbook_heading' from /usr/lib64/ruby/site_ruby/1.9.1/pdf/techbook.rb:566:in `block in techbook_parse' from /usr/lib64/ruby/site_ruby/1.9.1/pdf/techbook.rb:537:in `each' from /usr/lib64/ruby/site_ruby/1.9.1/pdf/techbook.rb:537:in `techbook_parse' from /usr/lib64/ruby/site_ruby/1.9.1/pdf/techbook.rb:886:in `run' from bin/techbook:24:in `<main>'
Creating a Gemfile to simplify testing. Switched to Ruby 2.3.0 and I got a little further. Next errors are
bundle exec bin/techbook Using default document 'manual.pwd'. Error in document around line 205: undefined method `/' for nil:NilClass Backtrace: /home/niklaus/git/pdf-writer/lib/pdf/techbook.rb:692:in `eval' /home/niklaus/git/pdf-writer/lib/pdf/writer/graphics.rb:549:in `add_image_from_file' (eval):10:in `block in techbook_directive_endeval' /home/niklaus/git/pdf-writer/lib/pdf/techbook.rb:692:in `eval' /home/niklaus/git/pdf-writer/lib/pdf/techbook.rb:692:in `block in techbook_directive_endeval' Error in document around line 210: undefined method `/' for nil:NilClass Backtrace: /home/niklaus/git/pdf-writer/lib/pdf/techbook.rb:692:in `eval' /home/niklaus/git/pdf-writer/lib/pdf/writer/graphics.rb:549:in `add_image_from_file' (eval):10:in `block in techbook_directive_endeval' /home/niklaus/git/pdf-writer/lib/pdf/techbook.rb:692:in `eval' /home/niklaus/git/pdf-writer/lib/pdf/techbook.rb:692:in `block in techbook_directive_endeval' Error in document around line 361: (eval):50: syntax error, unexpected tIDENTIFIER, expecting keyword_do or '{' or '(' 1<Introduction to PDF::Writer for Ruby>Introduction
Files like pdf-writer/images/bluesmoke.jpg are read but don't get recognized as JPEG, but as OTHER type. This must be fixed.
Porting some fixes:
There is even a pull request which would get Ruby 2.0 compatibity, see https://github.com/metaskills/pdf-writer/pull/3. Even this one has another pull request from https://github.com/jcrate/pdf-writer.git.
But both have problems running bin/textbook under ruby 2.3 and 2.1. Installing ruby 2.0 to see whether they work there.
With a small patch bin/techbook works now.
Started a Gemfile for ydim-html. Now must first create a Gemfile for ydim as we want to have a separate Gem ydim for auto-invoicing. Solved. Now starting sudo -u apache /home/niklaus/.rbenv/shims/bundle exec bin/ydim-htmld
in /var/www/ydim.ywesee.com
complains about pdfinvoice/config
Starting ydimd also complains about pdfinvoice/config
. We must therefore add it to the ydim source.
Now ydimd begins to starts, connects to the database and throws the error
/home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `initialize' may cause serious problems /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `object_id' may cause serious problems /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/needle-1.3.0/lib/needle/definition-context.rb:36: warning: undefining `__send__' may cause serious problems FEHLER: Relation �object� existiert bereits FEHLER: Relation �prefetchable_index� existiert bereits FEHLER: Relation �extent_index� existiert bereits FEHLER: Relation �object_connection� existiert bereits FEHLER: Relation �target_id_index� existiert bereits FEHLER: Relation �collection� existiert bereits /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/delegate.rb:387:in `__getobj__': not delegated (ArgumentError) from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/2.3.0/delegate.rb:340:in `block in delegating_block' from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/ruby-dbi-dcd6239fd5f8/lib/dbi/handles/statement.rb:214:in `fetch' from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/ruby-dbi-dcd6239fd5f8/lib/dbi/handles/statement.rb:240:in `each' from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/ruby-dbi-dcd6239fd5f8/lib/dbi/handles/database.rb:130:in `block in select_all' from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/ruby-dbi-dcd6239fd5f8/lib/dbi/handles/database.rb:88:in `execute' from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/ruby-dbi-dcd6239fd5f8/lib/dbi/handles/database.rb:128:in `select_all' from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/dbd-pg-0.3.9/lib/dbd/pg/database.rb:173:in `columns' from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/bundler/gems/ruby-dbi-dcd6239fd5f8/lib/dbi/handles/database.rb:161:in `columns' from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/odba-1.1.0/lib/odba/connection_pool.rb:39:in `block in method_missing' from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/odba-1.1.0/lib/odba/connection_pool.rb:29:in `next_connection' from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/odba-1.1.0/lib/odba/connection_pool.rb:38:in `method_missing' from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/odba-1.1.0/lib/odba/storage.rb:526:in `setup' from /home/niklaus/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/odba-1.1.0/lib/odba/cache.rb:473:in `setup' from /home/niklaus/git/ydim/bin/ydimd:20:in `<main>'
Pushed patches from last week and today:
Maybe a need a onigurama for Ruby 2.3.0 as well.
Will investigate tomorrow.
Looking for problematic cases via
grep 'DSCRD>.</DSCR' ausgabe/2.3.6/oddb2xml__e/oddb_article.xml <DSCRD>y</DSCRD> <DSCRD>.</DSCRD>
But I cannot find any empty description.
Changing the oddb2xml to require a minimal length of 3 and a maximal length of 120 (max seen 108) for the german/french description.
Had to reorganize a little bit the build_article/product, as the DSCRD/DSCRF must be checked before emitting them.
Seems to work. Comitted locally the changes. Running oddb2xml -e
and bundle exec rspec
a second time to ensure, that everything is okay.
Should be fixed with the following commits: