view · edit · sidebar · attach · print · history

20160704-migrate-davaz-com-to-ruby-231

<< 20160705-migrate-davaz-com-dojo-to-17 | Index | 20160702-setup-davaz-com >>


Summary

  • Run davaz.com in local machine with Ruby 2.3.1
  • Debug Htmlgrid and Dojo

Commits / Patches / Pull Requests, Scripts

Index


Update to Ruby 2.3.1

Install script for Ruby 2.3.1:
Attach:gen-ruby-231.sh.txt

character-encodings 's native extension is not correctly compiled with this ruby version.
But I think, that this gem is not needed any more for Ruby 2.3.1.

I've tried without following gems:

  • character-encodings
  • fastthread
  • smtp_tls (by doc, "Provides SMTP STARTTLS support for Ruby 1.8.6 (built-in for 1.8.7+)")

Then I've started to find version (new version) of dependent gems to match new ruby.

KCODE

Just remove
 $KCO!! [[#htmlgrid-and-dojo]] Htmlgrid and Dojo
DE = "u" 
, Ruby 2.3.1's default encoding is UTF-8

Iconv

We can replace iconv with string.encoding like this:

body.encode('ISO-8859-1', :invalid => :replace, :undef => :replace, :replace => '?')

Tmail

Replace with mikel/mail

RMagick

Use new version and rename RMagick to rmagick

Setup test for davaz.com

The davaz.com has test code on selenium.
So, I try setup selenium.

emerge -av iceadtea . (It seems that current selenium depends icedtea-bin 7)

How to run test (example):

WORKSPACE=/usr/local                                 

# Ruby 1.8.6                                                                       
sudo -u USER \                                                                 
  ${WORKSPACE}/bin/ruby186 \                                                       
  -rubygems \                                                                      
  -I${WORKSPACE}/src/davaz.com/src \                                               
  -I${WORKSPACE}/src/davaz.com/test \                                              
  -I${WORKSPACE}/lib/ruby/gems/1.8/gems/htmlgrid-1.0.3/lib \                       
  -I${WORKSPACE}/lib/ruby/gems/1.8/gems/rclconf-1.0.0/lib \                        
  test/selenium/test_shop.rb    

Encoding issue

The text data from database comes as ASCII-8BIT.

[2] 2.3.1-p112(#<DAVAZ::View::TextBlock>)> map.keys
=> ["Dieter Zimmer", "morphogenesis", "morphopolis", "P1", "P2", "P3", "Palette", "webpage"]
[3] 2.3.1-p112(#<DAVAZ::View::TextBlock>)> txt.encoding
=> #<Encoding:ASCII-8BIT>
[4] 2.3.1-p112(#<DAVAZ::View::TextBlock>)> map.keys.join('').encoding
=> #<Encoding:ASCII-8BIT>

I've migrated mysql gem to mysql2 gem with encoding option.

Mysql2::Client.new(                                                                
  :host     => @@db_data['host'],                                                  
  :username => @@db_data['user'],                                                  
  :password => @@db_data['password'],                                              
  :database => @@db_data['db'],                                                    
  :encoding => @@db_data['encoding']                                               
)

Assets location

All Css/image paths contain strange path /sbsm :

;; z.B.
http://localhost/resources/sbsm/css/navigation.css

Its path must be:

http://localhost/resources/css/navigation.css

This 'sbsm text comes from here (as @session.flavor).
https://github.com/zdavatz/sbsm/blob/1c7a9a006716cc18dc03f68a6c8157b8d2fe3cd7/lib/sbsm/lookandfeel.rb#L135 (current master)

Then I've created stub method flavor. Because davaz.com does not use any sbsm flavor.

# It works :)
[1] 2.3.1-p112(#<DAVAZ::View::Personal::Init>)> path
=> "http://localhost/resources/css/navigation.css"

Then davazd works on Ruby 2.3.1, expectedly.

Htmlgrid and Dojo

Current production (davaz.com) works with dojo 0.3.0 + htmlgrid 1.0.3.
I update this dojo to 1.7 with htmlgrid.

ywesee.widget does not work with Dojo 1.7.
This widgets have old syntax, described at here:
http://dojotoolkit.org/reference-guide/1.7/dojo/provide.html#dojo-1-7-amd

view · edit · sidebar · attach · print · history
Page last modified on July 04, 2016, at 03:22 PM