Closed infominer33 closed 2 months ago
Sorry if I don't understand what's your error. Can you explain in detail - I assume it's a version mismatch.
Is it not working with the latest ruby version? If yes, what version did you try?
Is it not working with the latest activerecord / activesupport version? If yes, what version did you try / use?
Thanks for helping out in finding out what needs to get updated / patched.
I don't remember why, but I was using 2.6. I assume because it wasn't working with higher versions, or maybe I just found that you had used that version, somewhere.
That activesupport error I shared was just telling me that pluto now required a higher version of activesupport, but that didn't work and had to upgrade ruby anyways.
It's not working with 2.7.0, 2.7.0rc and I've also tried with 3.0.0.
The error is:
pluto --verbose b companies.ini -t companies -o docs/companies
pluto/1.3.4 on Ruby 3.0.0 (2020-12-25) [x86_64-linux]
[debug] executing command build
[debug] hello from build command
[info] db settings:
[info] {:adapter=>"sqlite3", :database=>"./companies.db"}
[debug] ar configurations (before):
[debug] #<ActiveRecord::DatabaseConfigurations:0x0000557aac8eebb8 @configurations=[]>
*** error: undefined method `to_h' for #<ActiveRecord::DatabaseConfigurations:0x0000557aac8eebb8 @configurations=[]>
Did you mean? to_s
/home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pluto-models-1.6.2/lib/pluto/connecter.rb:67:in `connect': undefined method `to_h' for #<ActiveRecord::DatabaseConfigurations:0x0000557aac8eebb8 @configurations=[]> (NoMethodError)
Did you mean? to_s
from /home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pluto-models-1.6.2/lib/pluto/models.rb:90:in `connect'
from /home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pluto-models-1.6.2/lib/pluto/models.rb:94:in `connect!'
from /home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pluto-1.3.4/lib/pluto/cli/main.rb:281:in `block (3 levels) in <top (required)>'
from /home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pluto-1.3.4/lib/pluto/cli/main.rb:270:in `each'
from /home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pluto-1.3.4/lib/pluto/cli/main.rb:270:in `block (2 levels) in <top (required)>'
from /home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/gli-2.20.1/lib/gli/command_support.rb:131:in `execute'
from /home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/gli-2.20.1/lib/gli/app_support.rb:296:in `block in call_command'
from /home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/gli-2.20.1/lib/gli/app_support.rb:309:in `call_command'
from /home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/gli-2.20.1/lib/gli/app_support.rb:83:in `run'
from /home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pluto-1.3.4/lib/pluto/cli/main.rb:390:in `<top (required)>'
from <internal:/home/lovelace/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from <internal:/home/lovelace/.rbenv/versions/3.0.0/lib/ruby/3.0.0/rubygems/core_ext/kernel_require.rb>:85:in `require'
from /home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pluto-1.3.4/lib/pluto.rb:24:in `main'
from /home/lovelace/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/pluto-1.3.4/bin/pluto:5:in `<top (required)>'
from /home/lovelace/.rbenv/versions/3.0.0/bin/pluto:23:in `load'
from /home/lovelace/.rbenv/versions/3.0.0/bin/pluto:23:in `<main>'
These are the packages I'm using:
Successfully installed rubyzip-2.3.2
Successfully installed iniparser-1.0.1
Successfully installed props-1.2.0
Successfully installed logutils-0.6.1
Successfully installed concurrent-ruby-1.1.9
Successfully installed tzinfo-2.0.4
Successfully installed i18n-1.8.11
Successfully installed activesupport-7.0.0
Successfully installed textutils-1.4.0
Successfully installed activemodel-7.0.0
Successfully installed activerecord-7.0.0
Successfully installed props-activerecord-0.2.0
Successfully installed logutils-activerecord-0.2.1
Successfully installed feedparser-2.2.0
Successfully installed feedfilter-1.1.1
Successfully installed date-formatter-0.1.1
Successfully installed activityutils-0.1.2
Successfully installed activerecord-utils-0.4.1
Successfully installed pluto-models-1.6.2
Successfully installed fetcher-0.4.5
Successfully installed pluto-feedfetcher-0.1.6
Successfully installed opmlparser-1.0.1
Successfully installed pluto-update-1.6.4
Successfully installed pluto-tasks-1.5.3
Successfully installed liquid-5.1.0
Successfully installed pakman-1.1.0
Successfully installed pluto-merge-1.1.0
Successfully installed gli-2.20.1
Successfully installed pluto-1.3.4
Successfully installed nokogiri-1.12.5-x86_64-linux
Successfully installed crass-1.0.6
Successfully installed sanitize-6.0.0
I think that's all I know :)
Again thanks for reporting - on a quick review it looks like the error / bug is with ActiveRecord::DatabaseConfigurations and, thus, with ActiveRecord.
Rails 7 just got published yesterday or so if I can remember with a new version of ActiveRecord (with new deprecated methods) and Ruby 3.1 is around the corner (Dec 25, 2021) I assume.
I hope you don't mind if I hold of this issue until January 2022. For sure I don't give up on pluto even if it may look otherwise. All the best. Thanks for your understanding.
do you know a way i can force it to use an older version of active-record? or some other hack to get by in the mean-time?
I found even though I install an older version, pluto is still looking for the newest.. tho I haven't isolated precisely where it calls activerecord
do you know a way i can force it to use an older version of active-record?
The standard classic way is to use a Gemfile and list the activerecord gem with the version you want to nail down - the bundler tool handles / figures out all the dependencies in the (one-time calculated / derived) Gemfile.lock file. To start a script with a Gemfile use bundle exec if I remember correctly (or power user / scripter you can write your own ruby starter script with the bundler start-up load path "magic" included - "hand-crafted" that are a couple of lines). Sorry for the trouble. Cheers. Prost.
brilliant!!! this will simplify my Actions too !
No trouble at all! I should have known this already. Thanks for helping to expand my comprehension of Ruby.
Here's the fix ( https://github.com/Identosphere/identity-blogcatcher/commit/f1ee0acdc36c3a4fa6ccf25ea48f348977f0658b ) in case anyone else is desperate to keep pluto running in the meantime :D
fyi - sorry for the long wait. this bug should now be fixed and the models work with the latest activerecord 7+. i am closing this issue / ticket. if you run into a trouble, please report back and open a new issue / ticket. thks.
The core issue seems to be this
to_h
method:We've been getting depreciation warnings for this method, and now the time is up.
Previously running Pluto with Ruby 2.6, and got this message.
Ofc I tried to just install the other version of active support, or some different versions of ruby, on different machines.
I got it all to install under 2.6 with just the gentle depreciation warning, but that only worked once.. (but couldn't see any difference between the packages installed from working version to broken). maybe there is some hidden way to get back to the soft warning.
I understand you've been otherwise occupied, and its the holidays and all, so I'm certainly not expecting miracles... tho some quick fix would be super.
I have the next 2 weeks off from the newsletter, so I will have some time to hunt for a replacement, if necessary :-[.....