Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JRuby issue when running this project. #2

Closed
zw963 opened this issue Jul 21, 2024 · 13 comments
Closed

JRuby issue when running this project. #2

zw963 opened this issue Jul 21, 2024 · 13 comments

Comments

@zw963
Copy link

zw963 commented Jul 21, 2024

Moved from AndyObtiva/glimmer-dsl-web#4 (comment)

I am current running Arch Linux.

╰─ $ java --version
java 22.0.1 2024-04-16
Java(TM) SE Runtime Environment (build 22.0.1+8-16)
Java HotSpot(TM) 64-Bit Server VM (build 22.0.1+8-16, mixed mode, sharing)

 ╰─ $ rvm current
jruby-9.2.19.0@glimmer_tetris

It get following error message when bundle install.

error report

--- ERROR REPORT TEMPLATE -------------------------------------------------------

Error Report

Questions

Please fill out answers to these questions, it'll help us figure out
why things are going wrong.

  • What did you do?

    I ran the command /home/zw963/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/bin/bundle install

  • What did you expect to happen?

    I expected Bundler to...

  • What happened instead?

    Instead, what happened was...

  • Have you tried any solutions posted on similar issues in our issue tracker, stack overflow, or google?

    I tried...

  • Have you read our issues document, https://github.com/rubygems/rubygems/blob/master/bundler/doc/contributing/ISSUES.md?

    ...

Backtrace

NameError: uninitialized constant Bundler::RubygemsIntegration::YamlLibrarySyntaxError
Did you mean?  Bundler::YamlSyntaxError
  org/jruby/RubyModule.java:3766:in `const_missing'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/rubygems_integration.rb:116:in `configuration'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/fetcher.rb:247:in `connection'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/fetcher.rb:89:in `initialize'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/source/rubygems.rb:291:in `block in fetchers'
  org/jruby/RubyArray.java:2588:in `map'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/source/rubygems.rb:289:in `fetchers'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/source/rubygems.rb:428:in `block in remote_specs'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/index.rb:9:in `build'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/source/rubygems.rb:427:in `remote_specs'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/source/rubygems.rb:127:in `specs'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/resolver.rb:168:in `index_for'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/resolver.rb:176:in `results_for'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/resolver.rb:114:in `search_for'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/resolver.rb:256:in `block in verify_gemfile_dependencies_are_found!'
  org/jruby/RubyArray.java:1820:in `each'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/resolver.rb:253:in `verify_gemfile_dependencies_are_found!'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/resolver.rb:50:in `start'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/resolver.rb:23:in `resolve'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/definition.rb:262:in `resolve'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/definition.rb:178:in `resolve_remotely!'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/installer.rb:283:in `resolve_if_needed'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/installer.rb:82:in `block in run'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/process_lock.rb:12:in `block in lock'
  org/jruby/RubyIO.java:1158:in `open'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/process_lock.rb:9:in `lock'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/installer.rb:71:in `run'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/installer.rb:23:in `install'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/cli/install.rb:60:in `run'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/cli.rb:252:in `block in install'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/settings.rb:131:in `temporary'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/cli.rb:251:in `install'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor/command.rb:27:in `run'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor.rb:392:in `dispatch'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/cli.rb:31:in `dispatch'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/vendor/thor/lib/thor/base.rb:485:in `start'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/cli.rb:25:in `start'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/exe/bundle:49:in `block in <main>'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/lib/bundler/friendly_errors.rb:128:in `with_friendly_errors'
  /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/gems/bundler-2.2.27/exe/bundle:37:in `<main>'
  org/jruby/RubyKernel.java:1009:in `load'
  /home/zw963/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/bin/bundle:25:in `<main>'

Environment

Bundler             2.2.27
  Platforms         ruby, universal-java-22
Ruby                2.5.8p0 (2021-06-15 revision 67882) [java]
  Full Path         /home/common/.rvm/rubies/jruby-9.2.19.0/bin/jruby
  Config Dir        /home/common/.rvm/rubies/jruby-9.2.19.0/etc
RubyGems            3.1.6
  Gem Home          /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris
  Gem Path          /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris:/home/common/.rvm/rubies/jruby-9.2.19.0/lib/ruby/gems/shared
  User Home         /home/zw963
  User Path         /home/zw963/.gem/jruby/2.5.0
  Bin Dir           /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/bin
OpenSSL
  Compiled          JRuby-OpenSSL 0.14.3
  Loaded            JRuby-OpenSSL 0.14.3
  Cert File         /usr/lib/jvm/java-22-jdk/lib/security/cacerts
  Cert Dir          /etc/ssl/certs
Tools
  Git               2.45.2
  RVM               1.29.12-next (master)
  rbenv             not installed
  chruby            not installed
  rubygems-bundler  (1.4.5)

Bundler Build Metadata

Built At          2021-09-03
Git SHA           b737e1c930
Released Version  true

Bundler settings

# bundle_build.nokogiri
  You have not configured a value for `# bundle_build.nokogiri`
# bundle_build.pg
  You have not configured a value for `# bundle_build.pg`
# bundle_disable_multisource
  You have not configured a value for `# bundle_disable_multisource`
# bundle_global_gem_cache
  You have not configured a value for `# bundle_global_gem_cache`
# bundle_specific_platform
  You have not configured a value for `# bundle_specific_platform`
default_install_use_path
  Set for the current user (/home/zw963/.bundle/config): "true"
git.allow_insecure
  Set for the current user (/home/zw963/.bundle/config): true
job
  Set for the current user (/home/zw963/.bundle/config): "4"
mirror.https://rubygems.org/
  Set for the current user (/home/zw963/.bundle/config): "https://gems.ruby-china.com"
only_update_to_newer_versions
  Set for the current user (/home/zw963/.bundle/config): "true"
retry
  Set for the current user (/home/zw963/.bundle/config): 2
source
  Set for the current user (/home/zw963/.bundle/config): "https:[REDACTED]"

Gemfile

Gemfile

# frozen_string_literal: true

source 'https://rubygems.org'

git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }

gem 'glimmer-dsl-swt', '~> 4.20.0.0'
gem 'glimmer-cp-bevel', '~> 0.1.1'

group :development do
  gem 'rspec', '~> 3.5.0'
  gem 'juwelier', '2.4.9'
  gem 'warbler', '2.0.5'
  gem 'simplecov', '>= 0'
end

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    addressable (2.7.0)
      public_suffix (>= 2.0.2, < 5.0)
    array_include_methods (1.0.4)
    awesome_print (1.9.2)
    builder (3.2.4)
    concurrent-ruby (1.1.9)
    descendants_tracker (0.0.4)
      thread_safe (~> 0.3, >= 0.3.1)
    diff-lcs (1.4.4)
    docile (1.4.0)
    facets (3.1.0)
    faraday (1.4.3)
      faraday-em_http (~> 1.0)
      faraday-em_synchrony (~> 1.0)
      faraday-excon (~> 1.1)
      faraday-net_http (~> 1.0)
      faraday-net_http_persistent (~> 1.1)
      multipart-post (>= 1.2, < 3)
      ruby2_keywords (>= 0.0.4)
    faraday-em_http (1.0.0)
    faraday-em_synchrony (1.0.0)
    faraday-excon (1.1.0)
    faraday-net_http (1.0.1)
    faraday-net_http_persistent (1.1.0)
    git (1.8.1)
      rchardet (~> 1.8)
    github_api (0.19.0)
      addressable (~> 2.4)
      descendants_tracker (~> 0.0.4)
      faraday (>= 0.8, < 2)
      hashie (~> 3.5, >= 3.5.2)
      oauth2 (~> 1.0)
    glimmer (1.3.1)
      array_include_methods (>= 1.0.4, < 2.0.0)
      concurrent-ruby (>= 1.1.7, < 2.0.0)
      facets (>= 3.1.0, < 4.0.0)
    glimmer-cp-bevel (0.1.1)
      glimmer-dsl-swt (>= 4.18.7.4, < 5.0.0.0)
    glimmer-dsl-swt (4.20.0.0)
      glimmer (~> 1.3.1)
      jruby-win32ole (>= 0.8.5, < 2.0.0)
      logging (>= 2.3.0, < 3.0.0)
      nested_inherited_jruby_include_package (>= 0.3.0, < 2.0.0)
      os (>= 1.0.0, < 2.0.0)
      puts_debuggerer (>= 0.12.0, < 2.0.0)
      rake (>= 13.0.0)
      rake-tui (>= 0.2.3, < 2.0.0)
      rouge (>= 3.26.0, < 4.0.0)
      super_module (>= 1.4.1, < 2.0.0)
      text-table (>= 1.2.4, < 2.0.0)
    hashie (3.6.0)
    highline (2.0.3)
    jar-dependencies (0.4.1)
    jruby-jars (9.2.19.0)
    jruby-rack (1.1.21)
    jruby-win32ole (0.8.5)
    juwelier (2.4.9)
      builder
      bundler
      git
      github_api
      highline
      kamelcase (~> 0)
      nokogiri
      psych
      rake
      rdoc
      semver2
    jwt (2.2.3)
    kamelcase (0.0.2)
      semver2 (~> 3)
    little-plugger (1.1.4)
    logging (2.3.0)
      little-plugger (~> 1.1)
      multi_json (~> 1.14)
    method_source (1.0.0)
    multi_json (1.15.0)
    multi_xml (0.6.0)
    multipart-post (2.1.1)
    nested_inherited_jruby_include_package (0.3.0)
    nokogiri (1.11.7-java)
      racc (~> 1.4)
    oauth2 (1.4.7)
      faraday (>= 0.8, < 2.0)
      jwt (>= 1.0, < 3.0)
      multi_json (~> 1.3)
      multi_xml (~> 0.5)
      rack (>= 1.2, < 3)
    os (1.1.1)
    pastel (0.8.0)
      tty-color (~> 0.5)
    psych (4.0.1-java)
      jar-dependencies (>= 0.1.7)
    public_suffix (4.0.6)
    puts_debuggerer (0.12.0)
      awesome_print (~> 1.9.2)
    racc (1.5.2-java)
    rack (2.2.3)
    rake (13.0.6)
    rake-tui (0.2.3)
      tty-prompt
    rchardet (1.8.0)
    rdoc (6.3.1)
    rouge (3.26.0)
    rspec (3.5.0)
      rspec-core (~> 3.5.0)
      rspec-expectations (~> 3.5.0)
      rspec-mocks (~> 3.5.0)
    rspec-core (3.5.4)
      rspec-support (~> 3.5.0)
    rspec-expectations (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-mocks (3.5.0)
      diff-lcs (>= 1.2.0, < 2.0)
      rspec-support (~> 3.5.0)
    rspec-support (3.5.0)
    ruby2_keywords (0.0.4)
    rubyzip (1.3.0)
    semver2 (3.4.2)
    simplecov (0.21.2)
      docile (~> 1.1)
      simplecov-html (~> 0.11)
      simplecov_json_formatter (~> 0.1)
    simplecov-html (0.12.3)
    simplecov_json_formatter (0.1.3)
    super_module (1.4.1)
      method_source (>= 0.8.2, < 1.1.0)
    text-table (1.2.4)
    thread_safe (0.3.6-java)
    tty-color (0.6.0)
    tty-cursor (0.7.1)
    tty-prompt (0.23.1)
      pastel (~> 0.8)
      tty-reader (~> 0.8)
    tty-reader (0.9.0)
      tty-cursor (~> 0.7)
      tty-screen (~> 0.8)
      wisper (~> 2.0)
    tty-screen (0.8.1)
    warbler (2.0.5)
      jruby-jars (>= 9.0.0.0)
      jruby-rack (>= 1.1.1, < 1.3)
      rake (>= 10.1.0)
      rubyzip (~> 1.0, < 1.4)
    wisper (2.0.1)

PLATFORMS
  universal-java-1.8

DEPENDENCIES
  glimmer-cp-bevel (~> 0.1.1)
  glimmer-dsl-swt (~> 4.20.0.0)
  juwelier (= 2.4.9)
  rspec (~> 3.5.0)
  simplecov
  warbler (= 2.0.5)

BUNDLED WITH
   2.2.27

--- TEMPLATE END ----------------------------------------------------------------

Unfortunately, an unexpected error occurred, and Bundler cannot continue.

First, try this link to see if there are any existing issue reports for this error:
https://github.com/rubygems/rubygems/search?q=uninitialized+constant+Bundler++RubygemsIntegration++YamlLibrarySyntaxError&type=Issues

If there aren't any reports for this error yet, please copy and paste the report template above into a new issue. Don't forget to anonymize any private data! The new issue form is located at:
https://github.com/rubygems/rubygems/issues/new?labels=Bundler&template=bundler-related-issue.md

Then, i switch to Ruby 3.3.4 with new rvmset ruby-3.3.4@glimmer-dsl-libui, and ran gem install glimmer-dsl-libui successful, but failed again when try to run glimmer examples.

install glimmer-dsl-libui logs
 ╭─ 12:41  zw963 ⮀ ~/ruby/glimmer_tetris ⮀ ⭠ (77b25bd) master % u=  ➦ ruby-3.3.4@glimmer-dsl-libui
 ╰─ $ gem install glimmer-dsl-libui
Fetching text-table-1.2.4.gem
Fetching method_source-1.0.0.gem
Fetching super_module-1.4.1.gem
Fetching rouge-3.30.0.gem
Fetching wisper-2.0.1.gem
Fetching tty-screen-0.8.2.gem
Fetching tty-cursor-0.7.1.gem
Fetching tty-reader-0.9.0.gem
Fetching tty-color-0.6.0.gem
Fetching pastel-0.8.0.gem
Fetching tty-prompt-0.23.1.gem
Fetching rake-tui-0.2.3.gem
Fetching awesome_print-1.9.2.gem
Fetching puts_debuggerer-1.0.1.gem
Fetching equalizer-0.0.11.gem
Fetching perfect-shape-1.0.8.gem
Fetching glimmer-dsl-libui-0.12.2.gem
Fetching os-1.1.4.gem
Fetching libui-0.1.2.pre.gem
Fetching facets-3.1.0.gem
Fetching array_include_methods-1.5.1.gem
Fetching glimmer-2.7.9.gem
Fetching color-1.8.gem
Fetching chunky_png-1.4.0.gem
Successfully installed text-table-1.2.4
Successfully installed method_source-1.0.0
Successfully installed super_module-1.4.1
Successfully installed rouge-3.30.0
Successfully installed wisper-2.0.1
Successfully installed tty-screen-0.8.2
Successfully installed tty-cursor-0.7.1
Successfully installed tty-reader-0.9.0
Successfully installed tty-color-0.6.0
Successfully installed pastel-0.8.0
Successfully installed tty-prompt-0.23.1
Successfully installed rake-tui-0.2.3
Successfully installed awesome_print-1.9.2
Successfully installed puts_debuggerer-1.0.1
Successfully installed equalizer-0.0.11
Successfully installed perfect-shape-1.0.8
Successfully installed os-1.1.4
Successfully installed libui-0.1.2.pre
Successfully installed facets-3.1.0
Successfully installed array_include_methods-1.5.1
Successfully installed glimmer-2.7.9
Successfully installed color-1.8
Successfully installed chunky_png-1.4.0
Successfully installed glimmer-dsl-libui-0.12.2

 ╰─ $ 7  glimmer examples
Resolving dependencies...
Could not find glimmer-dsl-swt-4.20.0.0, glimmer-cp-bevel-0.1.1, rspec-3.5.0, juwelier-2.4.9, warbler-2.0.5, simplecov-0.21.2, glimmer-1.3.1, jruby-win32ole-0.8.5, logging-2.3.0, nested_inherited_jruby_include_package-0.3.0, os-1.1.1, puts_debuggerer-0.12.0, rake-13.0.6, rouge-3.26.0, rspec-core-3.5.4, rspec-expectations-3.5.0, rspec-mocks-3.5.0, builder-3.2.4, git-1.8.1, github_api-0.19.0, highline-2.0.3, kamelcase-0.0.2, rdoc-6.3.1, semver2-3.4.2, jruby-jars-9.2.19.0, jruby-rack-1.1.21, rubyzip-1.3.0, docile-1.4.0, simplecov-html-0.12.3, simplecov_json_formatter-0.1.3, array_include_methods-1.0.4, concurrent-ruby-1.1.9, little-plugger-1.1.4, multi_json-1.15.0, rspec-support-3.5.0, diff-lcs-1.4.4, rchardet-1.8.0, addressable-2.7.0, descendants_tracker-0.0.4, faraday-1.4.3, hashie-3.6.0, oauth2-1.4.7, public_suffix-4.0.6, faraday-em_http-1.0.0, faraday-em_synchrony-1.0.0, faraday-excon-1.1.0, faraday-net_http-1.0.1, faraday-net_http_persistent-1.1.0, multipart-post-2.1.1, ruby2_keywords-0.0.4, jwt-2.2.3, multi_xml-0.6.0, rack-2.2.3, tty-screen-0.8.1 in locally installed gems
Run `bundle install` to install missing gems

Anyway, I think JRuby is a niche thing in the Ruby world, in my decade of working with Ruby, I haven't even seen anyone use it, if we could run Tetris on a very small web server (e.g. Roda, Sinatra, even webrick), it would actually be easier to reproduce.

@AndyObtiva
Copy link
Owner

AndyObtiva commented Jul 22, 2024

This project is not made for LibUI. It’s only for Glimmer DSL for SWT. I told you in your original ticket on Glimmer DSL for Web that Tetris is included in Glimmer DSL for LibUI. You don’t need this project for it. I don’t know why you don’t follow my instructions to the letter. Just follow them correctly and you shouldn’t get into trouble.

In a 100% clean CRuby environment with no Tetris:

gem install glimmer-dsl-libui
glimmer examples

It's that simple. It works for everyone I know that follows the instructions correctly without mixing multiple projects together or adding unnecessary gems.

@AndyObtiva
Copy link
Owner

AndyObtiva commented Jul 22, 2024

Your gem install command mentions glimmer-dsl-swt which seems to indicate that you are not installing glimmer-dsl-LibUI in a clean Ruby gem set or environment. The two gems might conflict. They’re not designed to run together. I use RVM gemsets to avoid that. Or just start a clean Ruby environment and uninstall anything related to glimmer-dsl-swt and this Tetris from it. You’re didn’t follow my instructions from your original issue cleanly or else everything would have worked. I know of many people who got glimmer dsl LibUI working with no trouble.

In a 100% clean CRuby environment with no Tetris:

gem install glimmer-dsl-libui
glimmer examples

It's that simple. It works for everyone I know that follow the instructions correctly without mixing multiple projects together or adding unnecessary projects.

@AndyObtiva
Copy link
Owner

By the way, I worked at 3 different companies in the USA in the past that used JRuby. It’s not a niche technology. It is very popular at some Java shops given that Java is very popular too.

Running a server for desktop apps is over engineering and in my opinion is very unintelligent.

@AndyObtiva
Copy link
Owner

Going back to JRuby, you should try to get small JRuby programs running at first.

Like try to run this program (hello_world.rb):

puts 'hello world'

By running:

jruby hello_world..rb

It's always a good idea in software engineering to scale down your problem when you are into issues running a bigger program (like one with GUI).

Can you even run that code above?

@AndyObtiva
Copy link
Owner

This command makes no sense:

/home/zw963/.rvm/gems/jruby-9.2.19.0@glimmer_tetris/bin/bundle install

The way to use this Tetris from glimmer-dsl-swt is not like that at all. So, your issue is caused by user error.

Just run this from JRuby:

gem install glimmer_tetris

Then run:

glimmer_tetris

I don't know why you don't follow instructions (they're in the README) and complicate things for yourself. If you followed the instructions, it would have worked.

Alternatively, you can clone the project. In that case, you can run bundle, but after you go into the project directory:

cd glimmer_tetris
bundle
glimmer run

@zw963
Copy link
Author

zw963 commented Jul 22, 2024

Sorry, I may have lost some of the details you mentioned in the old reply.

image

Anyway, it works now! i will investigate more code details in the next few days.

@zw963 zw963 closed this as completed Jul 22, 2024
@zw963
Copy link
Author

zw963 commented Jul 22, 2024

Your gem install command mentions glimmer-dsl-swt which seems to indicate that you are not installing glimmer-dsl-LibUI in a clean Ruby gem set or environment. The two gems might conflict. They’re not designed to run together. I

You totally are right, i use same RVM gemset for those two gem, I admit that I may have some bias against JRuby and lack patience(Because i not familiar with it)

By the way, I worked at 3 different companies in the USA in the past that used JRuby. It’s not a niche technology. It is very popular at some Java shops given that Java is very popular too.

This probably not true in China.

Just run this from JRuby:

gem install glimmer_tetris

Then run:

glimmer_tetris

I try on a totally new JRuby environment, install gem succesful now.

but still get some unexpected error when run glimmer_tetris, but anyway,
i can investigate how to write tetris now use another code example.

thanks

 ╰─ $ glimmer_tetris
The signal QUIT is in use by the JVM and will not work correctly on this platform
The signal QUIT is in use by the JVM and will not work correctly on this platform
LoadError: no such file to load -- bundler/setup
             require at org/jruby/RubyKernel.java:974
             require at /home/common/.rvm/rubies/jruby-9.2.19.0/lib/ruby/stdlib/rubygems/core_ext/kernel_require.rb:83
              <main> at /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris1/gems/glimmer_tetris-1.0.1/app/glimmer_tetris.rb:25
             require at org/jruby/RubyKernel.java:974
    require_relative at org/jruby/RubyKernel.java:1002
              <main> at /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris1/gems/glimmer_tetris-1.0.1/app/glimmer_tetris/launch.rb:1
                load at org/jruby/RubyKernel.java:1009
              launch at /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris1/gems/glimmer-dsl-swt-4.20.0.5/lib/glimmer/launcher.rb:144
  launch_application at /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris1/gems/glimmer-dsl-swt-4.20.0.5/lib/glimmer/launcher.rb:175
              launch at /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris1/gems/glimmer-dsl-swt-4.20.0.5/lib/glimmer/launcher.rb:167
              <main> at /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris1/gems/glimmer_tetris-1.0.1/bin/glimmer_tetris:12
                load at org/jruby/RubyKernel.java:1009
              <main> at /home/zw963/.rvm/gems/jruby-9.2.19.0@glimmer_tetris1/bin/glimmer_tetris:23
                eval at org/jruby/RubyKernel.java:1048
              <main> at /home/zw963/.rvm/gems/jruby-9.2.19.0@glimmer_tetris1/bin/jruby_executable_hooks:22

@AndyObtiva
Copy link
Owner

it's odd that the gem name is glimmer_tetris1 as in /home/common/.rvm/gems/jruby-9.2.19.0@glimmer_tetris1

I would uninstall and re-install as glimmer_tetris.

glimmer_tetris does run on my Ubuntu Linux with a different version of JRuby right now, but it has the wrong dimensions because some Linux distros calculate width and height in a weird way, so the app needs to be adjusted for them. It did have the right dimensions on an older version of Ubuntu Linux from what I remember.

Either way, it should run at least.

Regarding the error about this code:

require 'bundler/setup'

I believe this can be caused if you have a version of the bundler gem that does not have bundler/setup. You might have a version of bundler that is not compatible with glimmer_tetris or glimmer-dsl-swt.

Could you please look into the directory of your bundler gem and see if it has lib/bundler/setup.rb?

@AndyObtiva
Copy link
Owner

AndyObtiva commented Jul 22, 2024

Actually, nevermind! the error for bundler/setup is normal. It happens when running an app without bundler, like by installing the gem directly. The exception is raised and then caught in this code:

begin
  require 'bundler/setup'
  Bundler.require(:default)
rescue
  require 'glimmer-dsl-swt'
  require 'glimmer-cp-bevel'
end

If it is not getting caught on your machine, that is weird. I would adjust rescue to rescue Exception (the super class of all errors) and that should guarantee catching the error and executing normally.

@AndyObtiva
Copy link
Owner

AndyObtiva commented Jul 22, 2024

OK, it seems you are having issues with the require statement, which should have run successfully (if it returns LoadError, that does not fall under StandardError, so won't get caught by rescue block that does not specify an error class). If Bundler.require(:default) fails, then it returns other errors, which are caught normally. I think the code was designed so that bundler is always there. But, it seems the require statement is failing in your machine.

Either way, I will likely adjust that code in future versions of glimmer to rescue Exception in the future just in case the require statement fails too.

@AndyObtiva
Copy link
Owner

I just made a new release of glimmer_tetris (version 1.0.2) that should fix this issue that you had (by adding rescue exception as per my explanation above).

I hope it resolves your issue.

@zw963
Copy link
Author

zw963 commented Jul 22, 2024

I just made a new release of glimmer_tetris (version 1.0.2) that should fix this issue that you had (by adding rescue exception as per my explanation above).

It works now.

image

This is probably the first JRuby application I have ran.

OK, it seems you are having issues with the require statement, which should have run successfully (if it returns LoadError, that does not fall under StandardError

I consider this is a over design of Ruby, many of my former colleagues were completely don't know StandardError, don't know rescue no exception only intercepts up to this level by default too, Crystal fix this.

begin
  File.read("foo")
rescue
  puts "failed"
end

# Same as

begin
  File.read("foo")
rescue Exception
  puts "failed"
end

@AndyObtiva
Copy link
Owner

I'm glad you got it working (albeit with the dimensions issue I mentioned earlier).

To fix the dimensions, clone the project repo locally, run bundle, and then edit the file app/glimmer_tetris/view/app_view.rb to update the shell minimum_size:

      body {
        shell(:no_resize) {
          grid_layout 2, false
          text 'Glimmer Tetris'
          minimum_size 500, 500 # replace with the dimensions that work best on your Linux

For example, I am boosting to 1000, 1000 here:

      body {
        shell(:no_resize) {
          grid_layout 2, false
          text 'Glimmer Tetris'
          minimum_size 1000, 1000

Finally, run:

glimmer run

I hope that works for you.

You can package a new gem for yourself by running:

glimmer package:gem

It would generate under /pkg directory inside glimmer_tetris. You can install it from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants