AndyObtiva / glimmer-dsl-swt

Glimmer DSL for SWT (JRuby Desktop Development Cross-Platform Native GUI Framework) - The Quickest Way From Zero To GUI - If You Liked Shoes, You'll Love Glimmer!
MIT License
106 stars 6 forks source link

`Gem::LoadError` When executing `glimmer run` on fresh scaffold app. #23

Closed jayczech23 closed 2 years ago

jayczech23 commented 2 years ago

Desktop (please complete the following information and make sure it matches Glimmer Pre-Requisites before reporting an issue):

x86_64

MacOS 12.4

JDK 16.0.2

jruby 9.3.6.0

4.24.1.0

Describe the issue I am having an issue when trying to execute the newly created app from glimmer scaffold command. However, I did notice an error that occurred during the end phase of glimmer scaffold. I am not sure if this has anything to do with the proceeding error. Please see error at gist below:

Error running scaffold

Ignoring the above error, I then attempted to run newly scaffolded app as-is with glimmer run, and receive the following error upon doing so:

Error on glimmer run

Where could the issue be? Could it be with the environment?

AndyObtiva commented 2 years ago

Interesting.

I tested scaffolding successfully with v4.24.1.0 when I released it on July 22, 2022. In fact, I still have the scaffolded app on my machine, and I was able to run glimmer run from it just fine.

I just scaffolded a new app with v4.24.1.0, and I got the error you mentioned:

LoadError: no such file to load -- rspec/core

This seems to be caused by some prerequisite gems getting updated, and breaking the expectations of the glimmer-dsl-swt gem somehow. jar-dependencies 0.4.2 definitely seems like an offender. I wonder if there is a bug with the gem. I couldn't know for sure without spending more time digging into the problem.

The outcome of this is that scaffolding got interrupted, so development-related functionality is not fully scaffolded. However, the application code is fully scaffolded.

One workaroud for running the app that worked for me is to follow these steps:

1) Edit Gemfile and disable all :development gems except warbler, and then run bundle. That will get rid of the jar-dependencies gem dependency. The file should look like this at the end:

# frozen_string_literal: true

source 'https://rubygems.org'

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

gem 'glimmer-dsl-swt', '~> 4.24.1.0'

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

2) Disable juwelier, rspec and simplecov related code in Rakefile. Your Rakefile should end up looking like this:

# encoding: utf-8

require 'rubygems'
require 'bundler'
begin
  Bundler.setup(:default, :development)
rescue Bundler::BundlerError => e
  $stderr.puts e.message
  $stderr.puts "Run `bundle install` to install missing gems"
  exit e.status_code
end
require 'glimmer/launcher'
require 'rake'
#  require 'juwelier'
# Juwelier::Tasks.new do |gem|
#   # gem is a Gem::Specification... see http://guides.rubygems.org/specification-reference/ for more options
#   gem.name = "snowboard_utah"
#   gem.homepage = "http://github.com/AndyObtiva/snowboard_utah"
#   gem.license = "MIT"
#   gem.summary = %Q{Snowboard Utah}
#   gem.description = %Q{Snowboard Utah}
#   gem.email = "andy.am@gmail.com"
#   gem.authors = ["Andy Maleh"]
# 
#   gem.files = Dir['VERSION', 'LICENSE.txt', 'app/**/*', 'bin/**/*', 'config/**/*', 'db/**/*', 'docs/**/*', 'fonts/**/*', 'icons/**/*', 'images/**/*', 'lib/**/*', 'script/**/*', 'sounds/**/*', 'vendor/**/*', 'videos/**/*']
#   gem.require_paths = ['vendor', 'lib', 'app']
#   gem.executables = ['snowboard_utah']
#   # dependencies defined in Gemfile
# end
# Juwelier::RubygemsDotOrgTasks.new
# require 'rspec/core'
# require 'rspec/core/rake_task'
# RSpec::Core::RakeTask.new(:spec) do |spec|
#   spec.pattern = FileList['spec/**/*_spec.rb']
#   spec.ruby_opts = [Glimmer::Launcher.jruby_os_specific_options]
# end
# 
# desc "Code coverage detail"
# task :simplecov do
#   ENV['COVERAGE'] = "true"
#   Rake::Task['spec'].execute
# end
# 
# task :default => :spec
# 
# require 'rdoc/task'
# Rake::RDocTask.new do |rdoc|
#   version = File.exist?('VERSION') ? File.read('VERSION') : ""
# 
#   rdoc.rdoc_dir = 'rdoc'
#   rdoc.title = "snowboard_utah #{version}"
#   rdoc.rdoc_files.include('README*')
#   rdoc.rdoc_files.include('lib/**/*.rb')
# end

require 'glimmer/rake_task'
Glimmer::RakeTask::Package.jpackage_extra_args =
  " --name 'Snowboard Utah'" +
  " --description 'Snowboard Utah'"
  # You can add more options from https://docs.oracle.com/en/java/javase/16/jpackage/packaging-tool-user-guide.pdf

3) Run the app via either glimmer run or the scaffolded bin/app_name script. For example, if I run either glimmer run or bin/snowboard_utah (name of my app), I get this screen.

Screen Shot 2022-08-04 at 10 57 25 PM

This keeps packaging functionality intact!

For example, I was able to run:

glimmer "package[dmg]"

Screen Shot 2022-08-04 at 11 13 53 PM

I'm keeping this issue open till it is properly resolved, but you have a workaround in the meantime to avoid being stuck.

AndyObtiva commented 2 years ago

I just updated my previous response with a better workaround solution that enables running glimmer run successfully as well as glimmer "package[dmg]". Please re-read if you read my response before this latest update.

AndyObtiva commented 2 years ago

Good news!

The jar-dependencies gem version 0.4.2 definitely turned out to be the culprit. It was only released yesterday.

I just released a v4.24.1.1 patch update for glimmer-dsl-swt that freezes the jar-dependencies gem version to 0.4.1 to avoid the issue altogether.

It now scaffolds successfully again all the way to launching the application.

For example:

% glimmer "scaffold[snowboard_utah]"
Fetching kamelcase-0.0.2.gem
Fetching nokogiri-1.13.8-java.gem
Fetching highline-2.0.3.gem
Fetching multi_xml-0.6.0.gem
Fetching semver2-3.4.2.gem
Fetching multi_json-1.15.0.gem
Fetching rack-2.2.4.gem
Fetching jwt-2.4.1.gem
Fetching ruby2_keywords-0.0.5.gem
Fetching faraday-retry-1.0.3.gem
Fetching faraday-rack-1.0.0.gem
Fetching faraday-patron-1.0.0.gem
Fetching faraday-net_http_persistent-1.2.0.gem
Fetching faraday-net_http-1.0.1.gem
Fetching multipart-post-2.2.3.gem
Fetching faraday-multipart-1.0.4.gem
Fetching faraday-httpclient-1.0.1.gem
Fetching faraday-excon-1.1.0.gem
Fetching faraday-em_synchrony-1.0.0.gem
Fetching faraday-em_http-1.0.0.gem
Fetching faraday-1.10.0.gem
Fetching oauth2-1.4.10.gem
Fetching hashie-3.6.0.gem
Fetching thread_safe-0.3.6-java.gem
Fetching descendants_tracker-0.0.4.gem
Fetching public_suffix-4.0.7.gem
Fetching addressable-2.8.0.gem
Fetching github_api-0.19.0.gem
Fetching rchardet-1.8.0.gem
Fetching git-1.11.0.gem
Fetching builder-3.2.4.gem
Fetching juwelier-2.4.9.gem
Successfully installed semver2-3.4.2
Successfully installed nokogiri-1.13.8-java
Successfully installed kamelcase-0.0.2
Successfully installed highline-2.0.3
Successfully installed rack-2.2.4
Successfully installed multi_xml-0.6.0
Successfully installed multi_json-1.15.0
Successfully installed jwt-2.4.1
Successfully installed ruby2_keywords-0.0.5
Successfully installed faraday-retry-1.0.3
Successfully installed faraday-rack-1.0.0
Successfully installed faraday-patron-1.0.0
Successfully installed faraday-net_http_persistent-1.2.0
Successfully installed faraday-net_http-1.0.1
Successfully installed multipart-post-2.2.3
Successfully installed faraday-multipart-1.0.4
Successfully installed faraday-httpclient-1.0.1
Successfully installed faraday-excon-1.1.0
Successfully installed faraday-em_synchrony-1.0.0
Successfully installed faraday-em_http-1.0.0
Successfully installed faraday-1.10.0

You have installed oauth2 version 1.4.10, which is EOL.
No further support is anticipated for the 1.4.x series.

OAuth2 version 2 is released.
There are BREAKING changes, but most will not encounter them, and upgrading should be easy!

Please see:
• https://github.com/oauth-xx/oauth2#what-is-new-for-v20
• https://github.com/oauth-xx/oauth2/blob/master/CHANGELOG.md

Please upgrade, report issues, and support the project! Thanks, |7eter l-|. l3oling

Successfully installed oauth2-1.4.10
Successfully installed hashie-3.6.0
Successfully installed thread_safe-0.3.6-java
Successfully installed descendants_tracker-0.0.4
Successfully installed public_suffix-4.0.7
Successfully installed addressable-2.8.0
Successfully installed github_api-0.19.0
Successfully installed rchardet-1.8.0
Successfully installed git-1.11.0
Successfully installed builder-3.2.4
Successfully installed juwelier-2.4.9
32 gems installed
    create  .gitignore
    create  Rakefile
    create  Gemfile
    create  LICENSE.txt
    create  README.markdown
    create  .document
    create  lib
    create  lib/snowboard_utah.rb
    create  .rspec
Juwelier has prepared your gem in ./snowboard_utah
Created snowboard_utah/.gitignore
Created snowboard_utah/.ruby-version
Created snowboard_utah/.ruby-gemset
Created snowboard_utah/VERSION
Created snowboard_utah/LICENSE.txt
Created snowboard_utah/Gemfile
Created snowboard_utah/Rakefile
Created snowboard_utah/app/snowboard_utah.rb
Created snowboard_utah/app/snowboard_utah/view/app_view.rb
Created snowboard_utah/icons/windows/Snowboard Utah.ico
Created snowboard_utah/icons/macosx/Snowboard Utah.icns
Created snowboard_utah/icons/linux/Snowboard Utah.png
Created snowboard_utah/app/snowboard_utah/launch.rb
Created snowboard_utah/bin/snowboard_utah
Fetching gem metadata from https://rubygems.org/.......
Resolving dependencies...................
Using rake 13.0.6
Using public_suffix 4.0.7
Using addressable 2.8.0
Using array_include_methods 1.4.0
Using awesome_print 1.9.2
Using builder 3.2.4
Using bundler 2.3.17
Using thread_safe 0.3.6 (java)
Using concurrent-ruby 1.1.10
Fetching diff-lcs 1.5.0
Fetching docile 1.4.0
Using facets 3.1.0
Using faraday-em_http 1.0.0
Using faraday-em_synchrony 1.0.0
Using faraday-excon 1.1.0
Using faraday-httpclient 1.0.1
Using multipart-post 2.2.3
Using faraday-multipart 1.0.4
Using faraday-net_http 1.0.1
Using faraday-net_http_persistent 1.2.0
Using faraday-patron 1.0.0
Using faraday-rack 1.0.0
Using faraday-retry 1.0.3
Using ruby2_keywords 0.0.5
Using rchardet 1.8.0
Using faraday 1.10.0
Using hashie 3.6.0
Using jwt 2.4.1
Using multi_xml 0.6.0
Using multi_json 1.15.0
Using glimmer 2.7.3
Using rack 2.2.4
Using jruby-win32ole 0.8.5
Using nested_inherited_jruby_include_package 0.3.0
Using puts_debuggerer 0.13.5
Using os 1.1.4
Using tty-cursor 0.7.1
Using tty-color 0.6.0
Using wisper 2.0.1
Using tty-screen 0.8.1
Using rouge 3.30.0
Using method_source 1.0.0
Using text-table 1.2.4
Using jar-dependencies 0.4.1
Using highline 2.0.3
Fetching jruby-rack 1.1.21
Fetching jruby-jars 9.3.6.0
Installing docile 1.4.0
Installing diff-lcs 1.5.0
Installing jruby-rack 1.1.21
Using semver2 3.4.2
Fetching psych 4.0.4 (java)
Fetching racc 1.6.0 (java)
Installing racc 1.6.0 (java)
Installing psych 4.0.4 (java)
Fetching rspec-support 3.5.0
Installing rspec-support 3.5.0
Fetching rubyzip 1.3.0
  jar dependencies for psych-4.0.4-java.gemspec . . .
Installing gem 'ruby-maven' . . .
Installing rubyzip 1.3.0
Fetching simplecov-html 0.12.3
Installing simplecov-html 0.12.3
Fetching simplecov_json_formatter 0.1.4
Installing simplecov_json_formatter 0.1.4
Using descendants_tracker 0.0.4
Using git 1.11.0
Using oauth2 1.4.10
Using pastel 0.8.0
Using tty-reader 0.9.0
Using super_module 1.4.1
Using kamelcase 0.0.2
Using nokogiri 1.13.8 (java)
Fetching rspec-core 3.5.4
Installing rspec-core 3.5.4
Fetching rspec-expectations 3.5.0
Installing rspec-expectations 3.5.0
Fetching rspec-mocks 3.5.0
Using github_api 0.19.0
Using tty-prompt 0.23.1
Fetching simplecov 0.21.2
Installing simplecov 0.21.2
Installing rspec-mocks 3.5.0
Using rake-tui 0.2.3
Using glimmer-dsl-swt 4.24.1.1
Fetching rspec 3.5.0
Installing jruby-jars 9.3.6.0
Installing rspec 3.5.0
Fetching warbler 2.0.5

using maven for the first time results in maven
downloading all its default plugin and can take time.
as those plugins get cached on disk and further execution
of maven is much faster then the first time.

Installing warbler 2.0.5
2022-08-04T23:49:07.324-04:00 [main] WARN FilenoUtil : Native subprocess control requires open access to the JDK IO subsystem
Pass '--add-opens java.base/sun.nio.ch=ALL-UNNAMED --add-opens java.base/java.io=ALL-UNNAMED' to enable.
      org.yaml:snakeyaml:1.28:compile
Fetching rdoc 6.4.0
Installing rdoc 6.4.0
Using juwelier 2.4.9
Bundle complete! 6 Gemfile dependencies, 74 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
   exist   .rspec
  create   spec/spec_helper.rb
Created snowboard_utah/spec/spec_helper.rb
Launching Glimmer Application: ./bin/snowboard_utah
Launching Glimmer Application: /Users/andymaleh/code/glimmer-dsl-swt/tmp/snowboard_utah/app/snowboard_utah/launch.rb

screenshot hello world

This resolves the issue completely, so I am closing it.

In any case, if you have any other questions, feel free to reply here or hit me up in Gitter Chat (or open a new issue if you encounter another one).

Cheers!

jayczech23 commented 2 years ago

Hi @AndyObtiva thanks for the prompt reply.

That worked after updating glimmer-dsl-swt to 4.24.1.1.

Thanks for the help!