Commit 15a0eff
authored
gem: add ostruct as dependency for Ruby 4.0 (#159)
When run tests with Ruby 4.0 or later, it causes following error:
```
$ bundle exec rake test
/home/watson/.rbenv/versions/4.0.0/bin/ruby -w -I"lib:lib:test" /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb "test/fixtures/schema.rb" "test/plugin/test_in_sql.rb" "test/plugin/test_in_sql_with_custom_time.rb" "test/plugin/test_in_sql_with_state_file.rb" "test/plugin/test_out_sql.rb"
/home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activesupport-7.1.6/lib/active_support/core_ext/object/to_query.rb:3: warning: CGI library is removed from Ruby 4.0. Please use cgi/escape instead for CGI.escape and CGI.unescape features.
If you need to use the full features of CGI library, Please install cgi gem.
-- create_table("logs", {force: :cascade})
-> 0.0384s
-- create_table("messages", {force: :cascade})
-> 0.0042s
-- create_table("messages_custom_time", {force: :cascade})
-> 0.0046s
/home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/fluentd-1.19.1/lib/fluent/plugin_helper.rb:46: warning: method redefined; discarding old inherited
/home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/fluentd-1.19.1/lib/fluent/plugin_helper.rb:46: warning: previous definition of inherited was here
/home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activerecord-import-1.8.1/lib/activerecord-import/import.rb:3: warning: ostruct used to be loaded from the standard library, but is not part of the default gems since Ruby 4.0.0.
You can add ostruct to your Gemfile or gemspec to fix this error.
/home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require': cannot load such file -- ostruct (LoadError)
Did you mean? tsort
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activerecord-import-1.8.1/lib/activerecord-import/import.rb:3:in '<top (required)>'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activerecord-import-1.8.1/lib/activerecord-import/base.rb:42:in '<top (required)>'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activerecord-import-1.8.1/lib/activerecord-import.rb:6:in 'block in <top (required)>'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activesupport-7.1.6/lib/active_support/lazy_load_hooks.rb:97:in 'Module#class_eval'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activesupport-7.1.6/lib/active_support/lazy_load_hooks.rb:97:in 'block in ActiveSupport::LazyLoadHooks#execute_hook'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activesupport-7.1.6/lib/active_support/lazy_load_hooks.rb:87:in 'ActiveSupport::LazyLoadHooks#with_execution_control'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activesupport-7.1.6/lib/active_support/lazy_load_hooks.rb:92:in 'ActiveSupport::LazyLoadHooks#execute_hook'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activesupport-7.1.6/lib/active_support/lazy_load_hooks.rb:62:in 'block in ActiveSupport::LazyLoadHooks#on_load'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activesupport-7.1.6/lib/active_support/lazy_load_hooks.rb:61:in 'Array#each'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activesupport-7.1.6/lib/active_support/lazy_load_hooks.rb:61:in 'ActiveSupport::LazyLoadHooks#on_load'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/activerecord-import-1.8.1/lib/activerecord-import.rb:5:in '<top (required)>'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
from /home/watson/src/fluent-plugin-sql/lib/fluent/plugin/out_sql.rb:4:in '<top (required)>' from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require' from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
from /home/watson/src/fluent-plugin-sql/test/helper.rb:5:in '<top (required)>'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
from /home/watson/src/fluent-plugin-sql/test/plugin/test_in_sql.rb:1:in '<top (required)>'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'Kernel.require'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/4.0.0/bundled_gems.rb:60:in 'block (2 levels) in Kernel#replace_require'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb:21:in 'block in <main>'
from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb:6:in 'Array#select' from /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb:6:in '<main>'
rake aborted! Command failed with status (1): [ruby -w -I"lib:lib:test" /home/watson/.rbenv/versions/4.0.0/lib/ruby/gems/4.0.0/gems/rake-13.3.1/lib/rake/rake_test_loader.rb "test/fixtures/schema.rb" "test/plugin/test_in_sql.rb" "test/plugin/test_in_sql_with_custom_time.rb" "test/plugin/test_in_sql_with_state_file.rb" "test/plugin/test_out_sql.rb" ]
/home/watson/.rbenv/versions/4.0.0/bin/bundle:25:in '<main>'
Tasks: TOP => test (See full trace by running task with --trace)
```
Ref.
https://github.com/fluent/fluent-plugin-sql/actions/runs/20903527287
To fix this error, we need to add `ostruct` as dependency,
or update `activerecord-import` to v2.0+.
Ref. zdennis/activerecord-import#860
Signed-off-by: Shizuo Fujita <fujita@clear-code.com>1 parent b9a9e2d commit 15a0eff
1 file changed
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
0 commit comments