Closed ashkulz closed 1 year ago
The tests pass on my fork, had to disable testing with JRuby 9.4 due to jruby/activerecord-jdbc-adapter#1125.
Outstanding! Thanks for your contribution.
@haffla it seems that PostgreSQL support for JRuby 9.4 still needs to be worked on (see linked issue) and I think this PR can be merged for now :+1:
@ashkulz 1.3.7 released. Thank you.
@haffla thanks for merging! I see it on RubyGems but don't see commits here?
Either way, you'll need to build it on JRuby itself for the JRuby-specific gem to be built properly -- the URL should show 1.3.7-java
in that case and the filename would be as mentioned in the PR description.
Ya, forgot to push.
Hm I need to build on jruby? OK, didn't know that. Let me see.
Hey @ashkulz. So I've installed jruby (jruby-9.3.9.0). I am actually able to gem build and it creates jsonb_accessor-1.3.7-java.gem
. However when I just want to bundle install
it doesn't work. I am getting the following error.
I would like to resolve this before pushing.
Gem::Requirement::BadRequirementError: Illformed requirement [" < 50.1 (java)"]
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/stdlib/rubygems/requirement.rb:106:in `parse'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/stdlib/rubygems/requirement.rb:138:in `block in initialize'
org/jruby/RubyArray.java:2699:in `map!'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/stdlib/rubygems/requirement.rb:138:in `initialize'
org/jruby/RubyClass.java:890:in `new'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/resolver.rb:142:in `block in no_versions_incompatibility_for'
org/jruby/RubyArray.java:2667:in `map'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/resolver.rb:142:in `no_versions_incompatibility_for'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb:130:in `choose_package_version'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb:41:in `work'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/vendor/pub_grub/lib/pub_grub/version_solver.rb:58:in `solve'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/resolver.rb:76:in `solve_versions'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/resolver.rb:37:in `start'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/definition.rb:551:in `start_resolution'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/definition.rb:278:in `resolve'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/definition.rb:176:in `resolve_remotely!'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/installer.rb:261:in `resolve_if_needed'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/installer.rb:82:in `block in run'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/process_lock.rb:12:in `block in lock'
org/jruby/RubyIO.java:1148:in `open'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/process_lock.rb:9:in `lock'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/installer.rb:71:in `run'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/installer.rb:23:in `install'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/cli/install.rb:62:in `run'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/cli.rb:260:in `block in install'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/settings.rb:131:in `temporary'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/cli.rb:259:in `install'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/cli.rb:34:in `dispatch'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/cli.rb:28:in `start'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/exe/bundle:45:in `block in <main>'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared/gems/bundler-2.4.1/exe/bundle:33:in `<main>'
org/jruby/RubyKernel.java:1052:in `load'
/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/bin/bundle:23:in `<main>'
Bundler 2.4.1
Platforms ruby, universal-java-19
Ruby 2.6.8p0 (2022-10-24 revision 67951) [universal-java-19]
Full Path /Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/bin/jruby
Config Dir /Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/etc
RubyGems 3.2.33
Gem Home /Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared
Gem Path /Users/jacke/.gem/jruby/2.6.0:/Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/lib/ruby/gems/shared
User Home /Users/jacke
User Path /Users/jacke/.gem/jruby/2.6.0
Bin Dir /Users/jacke/.asdf/installs/ruby/jruby-9.3.9.0/bin
OpenSSL
Compiled JRuby-OpenSSL 0.14.0
Loaded JRuby-OpenSSL 0.14.0
Cert File /usr/local/Cellar/openjdk/19.0.1/libexec/openjdk.jdk/Contents/Home/lib/security/cacerts
Cert Dir /etc/ssl/certs
Tools
Git 2.37.1 (Apple Git-137.1)
RVM not installed
rbenv not installed
chruby not installed
Built At 2022-12-24
Git SHA f3175f033c
Released Version true
build.puma
Set for the current user (/Users/jacke/.bundle/config): "--with-cflags=-Wno-error=implicit-function-declaration"
https://rubygems.pkg.github.com/tourlane/
Set for the current user (/Users/jacke/.bundle/config): "haffla:[REDACTED]"
rubygems.pkg.github.com
Set via BUNDLE_RUBYGEMS__PKG__GITHUB__COM: "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"
# frozen_string_literal: true
source "https://rubygems.org"
# Specify your gem's dependencies in jsonb_accessor.gemspec
gemspec
PATH
remote: .
specs:
jsonb_accessor (1.3.7)
activerecord (>= 5.0)
activesupport (>= 5.0)
pg (>= 0.18.1)
GEM
remote: https://rubygems.org/
specs:
activemodel (7.0.4)
activesupport (= 7.0.4)
activerecord (7.0.4)
activemodel (= 7.0.4)
activesupport (= 7.0.4)
activesupport (7.0.4)
concurrent-ruby (~> 1.0, >= 1.0.2)
i18n (>= 1.6, < 2)
minitest (>= 5.1)
tzinfo (~> 2.0)
appraisal (2.2.0)
bundler
rake
thor (>= 0.14.0)
ast (2.4.2)
awesome_print (1.9.2)
coderay (1.1.3)
concurrent-ruby (1.1.10)
database_cleaner (1.6.2)
diff-lcs (1.5.0)
i18n (1.12.0)
concurrent-ruby (~> 1.0)
json (2.6.2)
method_source (1.0.0)
minitest (5.16.3)
parallel (1.22.1)
parser (3.1.2.0)
ast (~> 2.4.1)
pg (1.4.5)
pry (0.14.1)
coderay (~> 1.1)
method_source (~> 1.0)
pry-doc (1.3.0)
pry (~> 0.11)
yard (~> 0.9.11)
pry-nav (1.0.0)
pry (>= 0.9.10, < 0.15)
psych (3.3.2)
rainbow (3.1.1)
rake (13.0.6)
regexp_parser (2.5.0)
rexml (3.2.5)
rspec (3.6.0)
rspec-core (~> 3.6.0)
rspec-expectations (~> 3.6.0)
rspec-mocks (~> 3.6.0)
rspec-core (3.6.0)
rspec-support (~> 3.6.0)
rspec-expectations (3.6.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-mocks (3.6.0)
diff-lcs (>= 1.2.0, < 2.0)
rspec-support (~> 3.6.0)
rspec-support (3.6.0)
rubocop (1.32.0)
json (~> 2.3)
parallel (~> 1.10)
parser (>= 3.1.0.0)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.19.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 1.4.0, < 3.0)
rubocop-ast (1.19.1)
parser (>= 3.1.1.0)
ruby-progressbar (1.11.0)
thor (1.2.1)
tzinfo (2.0.5)
concurrent-ruby (~> 1.0)
unicode-display_width (2.2.0)
webrick (1.7.0)
yard (0.9.28)
webrick (~> 1.7.0)
PLATFORMS
ruby
DEPENDENCIES
appraisal (~> 2.2.0)
awesome_print
database_cleaner (~> 1.6.0)
jsonb_accessor!
pry
pry-doc
pry-nav
psych (~> 3)
rake (>= 12.3.3)
rspec (~> 3.6.0)
rubocop (~> 1)
BUNDLED WITH
2.1.4
# frozen_string_literal: true
lib = File.expand_path("lib", __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require "jsonb_accessor/version"
is_java = RUBY_PLATFORM == "java"
Gem::Specification.new do |spec|
spec.name = "jsonb_accessor"
spec.version = JsonbAccessor::VERSION
spec.authors = ["Michael Crismali", "Joe Hirn", "Jason Haruska"]
spec.email = ["michael@crismali.com", "joe@devmynd.com", "jason@haruska.com"]
spec.platform = "java" if is_java
spec.summary = "Adds typed jsonb backed fields to your ActiveRecord models."
spec.description = "Adds typed jsonb backed fields to your ActiveRecord models."
spec.homepage = "https://github.com/devmynd/jsonb_accessor"
spec.license = "MIT"
spec.required_ruby_version = ">= 2"
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) || f.match(/png\z/) }
spec.bindir = "exe"
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
spec.require_paths = ["lib"]
spec.add_dependency "activerecord", ">= 5.0"
spec.add_dependency "activesupport", ">= 5.0"
if is_java
spec.add_dependency "activerecord-jdbcpostgresql-adapter", ">= 50.0"
else
spec.add_dependency "pg", ">= 0.18.1"
end
spec.add_development_dependency "appraisal", "~> 2.2.0"
spec.add_development_dependency "awesome_print"
spec.add_development_dependency "database_cleaner", "~> 1.6.0"
spec.add_development_dependency "pry"
spec.add_development_dependency "pry-doc"
spec.add_development_dependency "pry-nav"
spec.add_development_dependency "psych", "~> 3"
spec.add_development_dependency "rake", ">= 12.3.3"
spec.add_development_dependency "rspec", "~> 3.6.0"
spec.add_development_dependency "rubocop", "~> 1"
end
Hmm, not sure if it's asdf
but all looks good under rvm
:
~/projects/jsonb_accessor$ rvm install jruby-9.3.9.0
Unknown ruby string (do not know how to handle): jruby-9.3.9.0.
Unknown ruby string (do not know how to handle): jruby-9.3.9.0.
Searching for binary rubies, this might take some time.
Unknown ruby string (do not know how to handle): jruby-9.3.9.0.
Unknown ruby string (do not know how to handle): jruby-9.3.9.0.
Found remote file https://repo1.maven.org/maven2/org/jruby/jruby-dist/9.3.9.0/jruby-dist-9.3.9.0-bin.tar.gz
Checking requirements for osx.
Requirements installation successful.
jruby-9.3.9.0 - #configure
Unknown ruby string (do not know how to handle): jruby-9.3.9.0.
jruby-9.3.9.0 - #download
jruby-9.3.9.0 - #validate archive
jruby-9.3.9.0 - #extract
jruby-9.3.9.0 - #validate binary
jruby-9.3.9.0 - #setup
jruby-9.3.9.0 - #gemset created /Users/kulkarni/.rvm/gems/jruby-9.3.9.0@global
jruby-9.3.9.0 - #importing gemset /Users/kulkarni/.rvm/gemsets/jruby/global.gems.....
jruby-9.3.9.0 - #generating global wrappers........
jruby-9.3.9.0 - #gemset created /Users/kulkarni/.rvm/gems/jruby-9.3.9.0
jruby-9.3.9.0 - #importing gemsetfile /Users/kulkarni/.rvm/gemsets/default.gems evaluated to empty gem list
jruby-9.3.9.0 - #generating default wrappers........
~/projects/jsonb_accessor$ rvm use jruby-9.3.9.0
Using /Users/kulkarni/.rvm/gems/jruby-9.3.9.0
~/projects/jsonb_accessor$ bundle
Fetching gem metadata from https://rubygems.org/........
Resolving dependencies...
Using rake 13.0.6
Fetching concurrent-ruby 1.1.10
Fetching minitest 5.16.3
Fetching jdbc-postgres 42.2.25
Fetching zeitwerk 2.6.6
Installing zeitwerk 2.6.6
Installing minitest 5.16.3
Installing concurrent-ruby 1.1.10
Using bundler 2.4.1
Fetching thor 1.2.1
Installing jdbc-postgres 42.2.25
Fetching ast 2.4.2
Installing thor 1.2.1
Installing ast 2.4.2
Fetching awesome_print 1.9.2
Fetching coderay 1.1.3
Fetching database_cleaner 1.6.2
Installing awesome_print 1.9.2
Installing coderay 1.1.3
Fetching diff-lcs 1.5.0
Installing database_cleaner 1.6.2
Installing diff-lcs 1.5.0
Fetching ffi 1.15.5 (java)
Using jar-dependencies 0.4.1
Fetching json 2.6.3 (java)
Installing json 2.6.3 (java)
Fetching method_source 1.0.0
Installing ffi 1.15.5 (java)
Installing method_source 1.0.0
Fetching parallel 1.22.1
Using webrick 1.7.0
Fetching rainbow 3.1.1
Fetching regexp_parser 2.6.1
Installing parallel 1.22.1
Installing rainbow 3.1.1
Installing regexp_parser 2.6.1
Using rexml 3.2.5
Fetching rspec-support 3.6.0
Fetching ruby-progressbar 1.11.0
Installing rspec-support 3.6.0
Installing ruby-progressbar 1.11.0
Fetching unicode-display_width 2.3.0
Installing unicode-display_width 2.3.0
Fetching parser 3.1.3.0
Fetching appraisal 2.2.0
Fetching i18n 1.12.0
Fetching tzinfo 2.0.5
Installing appraisal 2.2.0
Installing i18n 1.12.0
Installing tzinfo 2.0.5
Installing parser 3.1.3.0
Using psych 3.3.4 (java)
Fetching yard 0.9.28
Fetching spoon 0.0.6
Installing spoon 0.0.6
Fetching rspec-core 3.6.0
Installing yard 0.9.28
Installing rspec-core 3.6.0
Fetching rspec-expectations 3.6.0
Installing rspec-expectations 3.6.0
Fetching rspec-mocks 3.6.0
Installing rspec-mocks 3.6.0
Fetching activesupport 6.1.7
Fetching pry 0.14.1 (java)
Installing activesupport 6.1.7
Installing pry 0.14.1 (java)
Fetching rubocop-ast 1.24.0
Installing rubocop-ast 1.24.0
Fetching rspec 3.6.0
Fetching rubocop 1.41.1
Installing rspec 3.6.0
Fetching pry-nav 1.0.0
Installing rubocop 1.41.1
Installing pry-nav 1.0.0
Fetching activemodel 6.1.7
Installing activemodel 6.1.7
Fetching pry-doc 1.3.0
Fetching activerecord 6.1.7
Installing activerecord 6.1.7
Fetching activerecord-jdbc-adapter 61.2 (java)
Installing activerecord-jdbc-adapter 61.2 (java)
Installing pry-doc 1.3.0
Fetching activerecord-jdbcpostgresql-adapter 61.2 (java)
Installing activerecord-jdbcpostgresql-adapter 61.2 (java)
Using jsonb_accessor 1.3.7 (java) from source at `.`
Bundle complete! 11 Gemfile dependencies, 46 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
~/projects/jsonb_accessor$ gem build jsonb_accessor.gemspec
WARNING: description and summary are identical
WARNING: open-ended dependency on activerecord (>= 5.0) is not recommended
if activerecord is semantically versioned, use:
add_runtime_dependency 'activerecord', '~> 5.0'
WARNING: open-ended dependency on activesupport (>= 5.0) is not recommended
if activesupport is semantically versioned, use:
add_runtime_dependency 'activesupport', '~> 5.0'
WARNING: open-ended dependency on activerecord-jdbcpostgresql-adapter (>= 50.0) is not recommended
if activerecord-jdbcpostgresql-adapter is semantically versioned, use:
add_runtime_dependency 'activerecord-jdbcpostgresql-adapter', '~> 50.0'
WARNING: open-ended dependency on awesome_print (>= 0, development) is not recommended
use a bounded requirement, such as '~> x.y'
WARNING: open-ended dependency on pry (>= 0, development) is not recommended
use a bounded requirement, such as '~> x.y'
WARNING: open-ended dependency on pry-doc (>= 0, development) is not recommended
use a bounded requirement, such as '~> x.y'
WARNING: open-ended dependency on pry-nav (>= 0, development) is not recommended
use a bounded requirement, such as '~> x.y'
WARNING: open-ended dependency on rake (>= 12.3.3, development) is not recommended
if rake is semantically versioned, use:
add_development_dependency 'rake', '~> 12.3', '>= 12.3.3'
WARNING: See https://guides.rubygems.org/specification-reference/ for help
Successfully built RubyGem
Name: jsonb_accessor
Version: 1.3.7
File: jsonb_accessor-1.3.7-java.gem
~/projects/jsonb_accessor$
git grep -F 50.1
returns me nothing, so not sure where that requirement is coming from @haffla 🤷♂️
Yea, odd. Seems to be an issue with my installed version. I've tried it in Docker. Works there. I've never used jruby and probably will never do. So I am not gonna investigate further.
I am gonna push it now. Please try if it works and let me know.
It seems to be working correctly. Thanks for looking into this over the holiday season and wish you a happy new year in advance, @haffla 🎉
This replaces the
pg
dependency withactiverecord-jdbcpostgresql-adapter
(only on JRuby, other platforms are unaffected) and adds Rails 5.2/6.0 support along with Ruby 3.2 to the CI.Would appreciate a new release and pushing this variant to RubyGems as well (e.g.
jsonb_accessor-1.3.7-java.gem
) :grin: