glimmer-dsl-swt 4.17.2.4 → 4.17.3.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 790b2acf622313d3b41027169575662d7eea029bf1fc30555ed1198e6f0d291a
4
- data.tar.gz: 8d6f48a5eb0a8e3d1469292a8c697acd4106c17bf567188f75ae8929ec3165e1
3
+ metadata.gz: 6a29cc3fc40ad3ed6f5aff4fc924a1e5d29dfc505df8f66857e669f687c177be
4
+ data.tar.gz: 6e93601aedd65dbce5379f0629f4e42f60a5211829e2c7ffb3e203fb5ae39551
5
5
  SHA512:
6
- metadata.gz: d41b1753d14ae5905b157e2fedd75679b8bcf627e5a7ef4277dbf5340ce1fde97b1badea9fe6ff644351c0b43918c4b085e90967ccbfe4cfc17f3d1e5deddcbd
7
- data.tar.gz: cf2e38dc4254d96b38a0e6c2ed3b414e74df29771e2a3a6f7af4bae5a1c1a36d796eac6b627de3f0b99ffd833ea1089e47bcade4b994fc4e09b0efade7e620c1
6
+ metadata.gz: d13f68897613eb659020350fd9ca3877de30f2033e4615c8b07e9ff0539646b9730e7d8b51dfd0f7b49f8d83c30cc22c9bceaca26fa3e7aabbe7a0178bb6b6e0
7
+ data.tar.gz: f175a664d832335006ae3a3d7bfc3ba8aabd8f8684247d735eb37e683b8e2ccf77ac37221c611e73a690f5df9e4f5e4378425e97b347fd2c03b1f8b95afcaa80
@@ -1,10 +1,23 @@
1
1
  # Change Log
2
2
 
3
+ ### 4.17.3.0
4
+
5
+ - `glimmer scaffold:desktopify[appname,website]` Mac
6
+ - `glimmer scaffold:desktopify[appname,website]` Windows
7
+ - `glimmer scaffold:desktopify[appname,website]` Linux (have scaffolding include the glimmer-cw-browser-chromium gem in scaffolded app on Linux)
8
+ - Remove the native packaging from Linux scaffolding since it is not officially supported
9
+ - Add gem packaging as part of scaffolding on Linux
10
+ - Launch the app at the end of scaffolding in Linux
11
+ - Provide a `glimmer package:gem` task
12
+ - Add support for scaffolding "app/scaffolded_app/launch" and "lib/namespace/custom_shell/launch" to enable launching SWT apps in Glimmer DSL for Opal without changing a line of code
13
+ - Add a binary executable shell in "app" mode (just like "custom shell gem" mode)
14
+ - Have glimmer packaging check the Java version and give a warning if an unsupported version is used.
15
+
16
+
3
17
  ### 4.17.2.4
4
18
 
5
19
  - New `glimmer run` glimmer command task.
6
20
  - Add built in support for handling jar file paths like that in ImageProxy code processing "uri:classloader" path
7
- - Document that gif background_image only works without on_top and no_trim styles in Windows
8
21
  - Give a good error message when Git is not properly setup for Glimmer Scaffolding
9
22
  - Give an error message when attempting to scaffold over an already scaffolded directory
10
23
  - Fix issue on Windows regarding use of the new EXPERIMENTAL Animated gif support in the `composite#background_image` property
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.17.2.4
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for SWT 4.17.3.0
2
2
  ## JRuby Desktop Development GUI Library
3
3
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-swt.svg)](http://badge.fury.io/rb/glimmer-dsl-swt)
4
4
  [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer-dsl-swt.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer-dsl-swt)
@@ -431,7 +431,7 @@ jgem install glimmer-dsl-swt
431
431
 
432
432
  Or this command if you want a specific version:
433
433
  ```
434
- jgem install glimmer-dsl-swt -v 4.17.2.4
434
+ jgem install glimmer-dsl-swt -v 4.17.3.0
435
435
  ```
436
436
 
437
437
  Note: Gem version numbers are in sync with the SWT library versions. The first two digits represent the SWT version number. The last two digits represent the minor and patch versions of Glimmer DSL for SWT.
@@ -508,7 +508,7 @@ bin/glimmer sample:run[hello_world]
508
508
  Below are the full usage instructions that come up when running `glimmer` without args.
509
509
 
510
510
  ```
511
- Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.2.4
511
+ Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v4.17.3.0
512
512
 
513
513
  Usage: glimmer [--bundler] [--pd] [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
514
514
 
@@ -625,7 +625,7 @@ This will run the hello_tab sample and output its code:
625
625
  ```
626
626
  $ glimmer sample:run[hello_tab]
627
627
 
628
- # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.2.4/samples/hello/hello_tab.rb
628
+ # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.3.0/samples/hello/hello_tab.rb
629
629
 
630
630
  class HelloTab
631
631
  include Glimmer
@@ -670,7 +670,7 @@ Example:
670
670
  ```
671
671
  $ glimmer sample:code[tic_tac_toe]
672
672
 
673
- # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.2.4/samples/elaborate/tic_tac_toe.rb
673
+ # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.3.0/samples/elaborate/tic_tac_toe.rb
674
674
 
675
675
  require_relative "tic_tac_toe/board"
676
676
 
@@ -731,7 +731,7 @@ TicTacToe.new.open
731
731
  # # #
732
732
 
733
733
 
734
- # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.2.4/samples/elaborate/tic_tac_toe/cell.rb
734
+ # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.3.0/samples/elaborate/tic_tac_toe/cell.rb
735
735
 
736
736
  class TicTacToe
737
737
  class Cell
@@ -764,7 +764,7 @@ end
764
764
  # # #
765
765
 
766
766
 
767
- # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.2.4/samples/elaborate/tic_tac_toe/board.rb
767
+ # /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-4.17.3.0/samples/elaborate/tic_tac_toe/board.rb
768
768
 
769
769
  require_relative 'cell'
770
770
 
@@ -913,7 +913,9 @@ letting Glimmer scaffolding take care of initial app file structure concerns, su
913
913
  - Icon (under `package/{platform}/{App Name}.{icon_extension}` for `macosx` .icns, `windows` .ico, and `linux` .png)
914
914
  - Bin file for starting application (`bin/{app_name}.rb`)
915
915
 
916
- NOTE: You need to have your Git `user.name` and `github.user` configured before scaffolding since Glimmer uses Juwelier, which relies on them in creating a Git repo for your Glimmer app.
916
+ You need to have your Git `user.name` and `github.user` configured before scaffolding since Glimmer uses Juwelier, which relies on them in creating a Git repo for your Glimmer app.
917
+
918
+ NOTE: Linux is not fully supported yet with scaffolding. Please report any issues you may encounter.
917
919
 
918
920
  #### App
919
921
 
@@ -925,7 +927,7 @@ To scaffold a Glimmer app from scratch, run the following command:
925
927
  glimmer scaffold[AppName]
926
928
  ```
927
929
 
928
- This will generate an advanced "Hello, World!" app, package it as a Mac native file (DMG/PKG/APP), and launch it all in one fell swoop.
930
+ This will generate an advanced "Hello, World!" app, package it as a Mac or Windows native file (DMG/PKG/APP/MSI), and launch it all in one fell swoop.
929
931
 
930
932
  Suppose you run:
931
933
 
@@ -1001,6 +1003,101 @@ or:
1001
1003
  glimmer bin/greeter
1002
1004
  ```
1003
1005
 
1006
+ #### Desktopify
1007
+
1008
+ This scaffolding mode enables you to desktopify a web app. Glimmer Scaffolding basically wraps the website with a [Browser Widget](#browser-widget).
1009
+
1010
+ The desktopify app is similar to the standard scaffolded app. It can be extended and the [browser may even be instrumented](https://help.eclipse.org/2020-09/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/browser/Browser.html).
1011
+
1012
+ The app even remembers your cookies if you log into the website, close the app, and reopen again.
1013
+
1014
+ Note that on Linux, the default SWT browser, which runs on webkit, does not support HTML5 Video out of the box. If you need video support, open `Gemfile` after scaffolding and enable the line that has the `glimmer-cw-browser-chromium` gem then replace the `browser` in "app/views/snowboard_utah/app_view.rb" with `browser(:chromium)`
1015
+
1016
+ Before you start, make sure you are in a JRuby environment with Glimmer gem installed as per "Direct Install" pre-requisites.
1017
+
1018
+ To scaffold a Glimmer desktopify app from scratch, run the following command:
1019
+
1020
+ ```
1021
+ glimmer scaffold:desktopify[app_name,website]
1022
+ ```
1023
+
1024
+ This will generate a Glimmer app, package it as a Mac or Windows native file (DMG/PKG/APP/MSI), and launch it all in one fell swoop.
1025
+
1026
+ Suppose you run:
1027
+
1028
+ ```
1029
+ glimmer scaffold:desktopify[snowboard_utah,https://www.brightonresort.com]
1030
+ ```
1031
+
1032
+ You should see output like the following:
1033
+
1034
+ ```
1035
+ $ glimmer scaffold:desktopify[snowboard_utah,https://www.brightonresort.com]
1036
+ Fetching kamelcase-0.0.2.gem
1037
+ Fetching github_api-0.19.0.gem
1038
+ Fetching highline-2.0.3.gem
1039
+ Fetching juwelier-2.4.9.gem
1040
+ Fetching hashie-3.6.0.gem
1041
+ Fetching nokogiri-1.10.10-java.gem
1042
+ Fetching semver2-3.4.2.gem
1043
+ Successfully installed semver2-3.4.2
1044
+ Successfully installed kamelcase-0.0.2
1045
+ Successfully installed highline-2.0.3
1046
+ Successfully installed hashie-3.6.0
1047
+ Successfully installed github_api-0.19.0
1048
+ Successfully installed nokogiri-1.10.10-java
1049
+ Successfully installed juwelier-2.4.9
1050
+ 7 gems installed
1051
+ create .gitignore
1052
+ create Rakefile
1053
+ create Gemfile
1054
+ create LICENSE.txt
1055
+ create README.markdown
1056
+ create .document
1057
+ create lib
1058
+ create lib/snowboard_utah.rb
1059
+ create .rspec
1060
+ Juwelier has prepared your gem in ./snowboard_utah
1061
+ Created snowboard_utah/.gitignore
1062
+ Created snowboard_utah/.ruby-version
1063
+ Created snowboard_utah/.ruby-gemset
1064
+ Created snowboard_utah/VERSION
1065
+ Created snowboard_utah/LICENSE.txt
1066
+ Created snowboard_utah/Gemfile
1067
+ Created snowboard_utah/Rakefile
1068
+ Created snowboard_utah/app/snowboard_utah.rb
1069
+ Created snowboard_utah/app/views/snowboard_utah/app_view.rb
1070
+ Created snowboard_utah/package/windows/Snowboard Utah.ico
1071
+ Created snowboard_utah/package/macosx/Snowboard Utah.icns
1072
+ Created snowboard_utah/package/linux/Snowboard Utah.png
1073
+ Created snowboard_utah/bin/snowboard_utah
1074
+ ...
1075
+ ```
1076
+
1077
+ Eventually, it will launch a desktopified version of "https://www.brightonresort.com" having the title of ("Snowboard Utah").
1078
+
1079
+ Desktopified App on Mac
1080
+
1081
+ ![Glimmer Scaffold App](images/glimmer-scaffolding-desktopify.png)
1082
+
1083
+ It also comes with a boilerplate About dialog.
1084
+
1085
+ ![Glimmer Scaffold App About](images/glimmer-scaffolding-desktopify-about.png)
1086
+
1087
+ Desktopified App on Windows
1088
+
1089
+ ![Glimmer Scaffold App](images/glimmer-scaffolding-desktopify-windows.png)
1090
+
1091
+ Desktopified App on Linux
1092
+
1093
+ ![Glimmer Scaffold App](images/glimmer-scaffolding-desktopify-linux.png)
1094
+
1095
+ In order to run the app after making changes, you must run the `glimmer run`. It automatically detects the generated run script under the `bin` directory and uses it as an argument.
1096
+
1097
+ ```
1098
+ glimmer run
1099
+ ```
1100
+
1004
1101
  #### Custom Shell
1005
1102
 
1006
1103
  To scaffold a Glimmer custom shell (full window view) for an existing Glimmer app, run the following command:
@@ -1208,8 +1305,8 @@ Output:
1208
1305
 
1209
1306
  Css glimmer-dsl-css 1.1.0 AndyMaleh Glimmer DSL for CSS
1210
1307
  Opal glimmer-dsl-opal 0.3.0 AndyMaleh Glimmer DSL for Opal
1211
- Swt glimmer-dsl-swt 4.17.2.4 AndyMaleh Glimmer DSL for SWT
1212
- Tk glimmer-dsl-tk 0.0.5 AndyMaleh Glimmer DSL for Tk
1308
+ Swt glimmer-dsl-swt 4.17.3.0 AndyMaleh Glimmer DSL for SWT
1309
+ Tk glimmer-dsl-tk 0.0.6 AndyMaleh Glimmer DSL for Tk
1213
1310
  Xml glimmer-dsl-xml 1.1.0 AndyMaleh Glimmer DSL for XML
1214
1311
  ```
1215
1312
 
@@ -2000,7 +2097,7 @@ The `image` keyword creates an instance of [org.eclipse.swt.graphics.Image](http
2000
2097
 
2001
2098
  It is a graphics `Image` object (not a widget), but is used used in setting the `image` property on `label` and `background_image` on `composite` (and subclasses)
2002
2099
 
2003
- Glimmer recently included **EXPERIMENTAL** gif animation support for the `background_image` property on `composite' since SWT does not support animation by default.
2100
+ Glimmer recently included **EXPERIMENTAL** gif animation support for the `background_image` property on `composite' since SWT does not support animation by default. On Windows, it only works inside composites nested under standard shells, not ones that have the SWT styles :on_top or :no_trim
2004
2101
 
2005
2102
  Learn more about images in general at this SWT Image guide: https://www.eclipse.org/articles/Article-SWT-images/graphics-resources.html
2006
2103
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 4.17.2.4
1
+ 4.17.3.0
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: glimmer-dsl-swt 4.17.2.4 ruby lib
5
+ # stub: glimmer-dsl-swt 4.17.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer-dsl-swt".freeze
9
- s.version = "4.17.2.4"
9
+ s.version = "4.17.3.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["AndyMaleh".freeze]
14
- s.date = "2020-10-17"
14
+ s.date = "2020-10-18"
15
15
  s.description = "Glimmer DSL for SWT (JRuby Desktop Development GUI Library)".freeze
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.executables = ["glimmer".freeze, "girb".freeze]
@@ -95,6 +95,11 @@ namespace :glimmer do
95
95
  Glimmer::RakeTask::Package.gemspec
96
96
  end
97
97
 
98
+ desc 'Generate gem'
99
+ task :gem do
100
+ Glimmer::RakeTask::Package.gem
101
+ end
102
+
98
103
  desc 'Generate JAR config file'
99
104
  task :config do
100
105
  Glimmer::RakeTask::Package.config
@@ -123,7 +128,11 @@ namespace :glimmer do
123
128
  Rake::Task['glimmer:package:lock_jars'].execute
124
129
  Rake::Task['glimmer:package:config'].execute
125
130
  Rake::Task['glimmer:package:jar'].execute
126
- Rake::Task['glimmer:package:native'].execute(args)
131
+ if OS.linux?
132
+ Rake::Task['glimmer:package:gem'].execute
133
+ else
134
+ Rake::Task['glimmer:package:native'].execute(args)
135
+ end
127
136
  end
128
137
 
129
138
  desc 'Scaffold Glimmer application directory structure to build a new app'
@@ -153,6 +162,12 @@ namespace :glimmer do
153
162
  task :custom_widget, [:name, :namespace] => :customwidget
154
163
  task :"custom-widget", [:name, :namespace] => :customwidget
155
164
 
165
+ desc 'Desktopify a web app'
166
+ task :desktopify, [:app_name, :website] do |t, args|
167
+ require_relative 'rake_task/scaffold'
168
+ Glimmer::RakeTask::Scaffold.desktopify(args[:app_name], args[:website])
169
+ end
170
+
156
171
  namespace :gem do
157
172
  desc 'Scaffold Glimmer::UI::CustomShell subclass (full window view) under its own Ruby gem + app project (namespace is required) [alt: scaffold:gem:cs]'
158
173
  task :customshell, [:name, :namespace] do |t, args|
@@ -39,6 +39,10 @@ module Glimmer
39
39
  system 'rake gemspec:generate'
40
40
  end
41
41
 
42
+ def gem
43
+ system 'rake build'
44
+ end
45
+
42
46
  def lock_jars
43
47
  puts 'Locking gem jar-dependencies by downloading and storing in vendor/jars...'
44
48
  FileUtils.mkdir_p('vendor/jars')
@@ -85,9 +89,12 @@ module Glimmer
85
89
  end
86
90
 
87
91
  def native(native_type=nil, native_extra_args)
88
- puts "Generating native executable with javapackager/jpackage..."
92
+ puts "Generating native executable with javapackager/jpackage..."
93
+ java_version = `java -version`
94
+ puts "WARNING! Glimmer Packaging Pre-Requisite Java Version 1.8.0_241 Is Not Found!" unless java_version.include?('1.8.0_241')
89
95
  require 'facets/string/titlecase'
90
96
  require 'facets/string/underscore'
97
+ require 'facets/string/camelcase'
91
98
  project_name = File.basename(File.expand_path('.'))
92
99
  version_file = File.expand_path('./VERSION')
93
100
  version = (File.read(version_file).strip if File.exists?(version_file) && File.file?(version_file)) rescue nil
@@ -97,7 +104,7 @@ module Glimmer
97
104
  human_name = project_name.underscore.titlecase
98
105
  icon = "package/#{OS.mac? ? 'macosx' : 'windows'}/#{human_name}.#{OS.mac? ? 'icns' : 'ico'}"
99
106
  if (`javapackager`.to_s.include?('Usage: javapackager') rescue nil)
100
- command = "javapackager -deploy -native #{native_type} -outdir packages -outfile \"#{project_name}\" -srcfiles \"dist/#{project_name}.jar\" -appclass JarMain -name \"#{human_name}\" -title \"#{human_name}\" -Bmac.CFBundleName=\"#{human_name}\" -Bmac.CFBundleIdentifier=\"org.#{project_name}.application.#{project_name}\" -Bmac.category=\"public.app-category.business\" -BinstalldirChooser=true -Bvendor=\"#{human_name}\" -Bwin.menuGroup=\"#{human_name}\" "
107
+ command = "javapackager -deploy -native #{native_type} -outdir packages -outfile \"#{project_name}\" -srcfiles \"dist/#{project_name}.jar\" -appclass JarMain -name \"#{human_name}\" -title \"#{human_name}\" -Bmac.CFBundleName=\"#{human_name}\" -Bmac.CFBundleIdentifier=\"org.#{project_name}.application.#{project_name.camelcase(:upper)}\" -Bmac.category=\"public.app-category.business\" -BinstalldirChooser=true -Bvendor=\"#{human_name}\" -Bwin.menuGroup=\"#{human_name}\" "
101
108
  command += " -BsystemWide=false " if OS.windows?
102
109
  command += " -BjvmOptions=-XstartOnFirstThread " if OS.mac?
103
110
  command += " -BappVersion=#{version} -Bmac.CFBundleVersion=#{version} " if version
@@ -121,6 +121,14 @@ module Glimmer
121
121
  MULTI_LINE_STRING
122
122
 
123
123
  def app(app_name)
124
+ common_app(app_name)
125
+ end
126
+
127
+ def desktopify(app_name, website)
128
+ common_app(app_name, :desktopify, website: website)
129
+ end
130
+
131
+ def common_app(app_name, shell_type = :app, shell_options = {})
124
132
  gem_name = file_name(app_name)
125
133
  gem_summary = human_name(app_name)
126
134
  return puts("The directory '#{gem_name}' already exists. Please either remove or pick a different name.") if Dir.exist?(gem_name)
@@ -134,13 +142,17 @@ module Glimmer
134
142
  write '.ruby-gemset', app_name
135
143
  write 'VERSION', '1.0.0'
136
144
  write 'LICENSE.txt', "Copyright (c) #{Time.now.year} #{app_name}"
137
- write 'Gemfile', GEMFILE
145
+ write 'Gemfile', gemfile(shell_type)
138
146
  write 'Rakefile', gem_rakefile(app_name, nil, gem_name)
139
147
  mkdir 'app'
140
148
  write "app/#{file_name(app_name)}.rb", app_main_file(app_name)
141
149
  mkdir 'app/models'
142
150
  mkdir 'app/views'
143
- custom_shell('AppView', current_dir_name, :app)
151
+ if shell_type == :desktopify
152
+ custom_shell('AppView', current_dir_name, shell_type, shell_options)
153
+ else
154
+ custom_shell('AppView', current_dir_name, shell_type)
155
+ end
144
156
 
145
157
  mkdir_p 'package/windows'
146
158
  icon_file = "package/windows/#{human_name(app_name)}.ico"
@@ -157,14 +169,17 @@ module Glimmer
157
169
  cp File.expand_path('../../../../icons/scaffold_app.png', __FILE__), icon_file
158
170
  puts "Created #{current_dir_name}/#{icon_file}"
159
171
 
160
- mkdir 'bin'
161
- write "bin/#{file_name(app_name)}", app_bin_file(app_name)
172
+ mkdir_p "app/#{file_name(app_name)}"
173
+ write "app/#{file_name(app_name)}/launch.rb", app_launch_file(app_name)
174
+ mkdir_p 'bin'
175
+ write "bin/#{file_name(app_name)}", app_bin_command_file(app_name)
176
+ FileUtils.chmod 0755, "bin/#{file_name(app_name)}"
162
177
  if OS.windows?
163
178
  system "bundle"
164
179
  system "rspec --init"
165
180
  else
166
- system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n rspec --init\n'"
167
- end
181
+ system "bash -c '#{RVM_FUNCTION}\n cd .\n bundle\n rspec --init\n'"
182
+ end
168
183
  write 'spec/spec_helper.rb', spec_helper_file
169
184
  if OS.windows?
170
185
  system "glimmer package[image]"
@@ -174,18 +189,18 @@ module Glimmer
174
189
  if OS.mac?
175
190
  system "open packages/bundles/#{human_name(app_name).gsub(' ', '\ ')}.app"
176
191
  else
177
- system "glimmer bin/#{file_name(app_name)}"
192
+ system "glimmer run"
178
193
  end
179
- end
194
+ end
180
195
  end
181
196
 
182
- def custom_shell(custom_shell_name, namespace, shell_type = nil)
197
+ def custom_shell(custom_shell_name, namespace, shell_type = nil, shell_options = {})
183
198
  namespace ||= current_dir_name
184
199
  root_dir = File.exists?('app') ? 'app' : 'lib'
185
200
  parent_dir = "#{root_dir}/views/#{file_name(namespace)}"
186
201
  return puts("The file '#{parent_dir}/#{file_name(custom_shell_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(custom_shell_name)}.rb")
187
202
  mkdir_p parent_dir unless File.exists?(parent_dir)
188
- write "#{parent_dir}/#{file_name(custom_shell_name)}.rb", custom_shell_file(custom_shell_name, namespace, shell_type)
203
+ write "#{parent_dir}/#{file_name(custom_shell_name)}.rb", custom_shell_file(custom_shell_name, namespace, shell_type, shell_options)
189
204
  end
190
205
 
191
206
  def custom_widget(custom_widget_name, namespace)
@@ -228,9 +243,13 @@ module Glimmer
228
243
  append "lib/#{gem_name}.rb", gem_main_file(custom_shell_name, namespace)
229
244
  mkdir 'lib/views'
230
245
  custom_shell(custom_shell_name, namespace, :gem)
231
- mkdir 'bin'
232
- write "bin/#{gem_name}", gem_bin_file(gem_name, custom_shell_name, namespace)
233
- write "bin/#{file_name(custom_shell_name)}", gem_bin_command_file(gem_name)
246
+
247
+ mkdir_p "lib/#{file_name(namespace)}/#{file_name(custom_shell_name)}"
248
+ write "lib/#{file_name(namespace)}/#{file_name(custom_shell_name)}/launch.rb", gem_launch_file(gem_name, custom_shell_name, namespace)
249
+ mkdir_p 'bin'
250
+ write "bin/#{gem_name}", gem_bin_command_file(gem_name, custom_shell_name, namespace)
251
+ FileUtils.chmod 0755, "bin/#{gem_name}"
252
+ write "bin/#{file_name(custom_shell_name)}", gem_bin_command_file(gem_name, custom_shell_name, namespace)
234
253
  FileUtils.chmod 0755, "bin/#{file_name(custom_shell_name)}"
235
254
  if OS.windows?
236
255
  system "bundle"
@@ -263,7 +282,7 @@ module Glimmer
263
282
  if OS.mac?
264
283
  system "open packages/bundles/#{human_name(custom_shell_name).gsub(' ', '\ ')}.app" if OS.mac?
265
284
  else
266
- system "bin/#{file_name(custom_shell_name)}"
285
+ system "glimmer run"
267
286
  end
268
287
  end
269
288
  puts "Finished creating #{gem_name} Ruby gem."
@@ -350,6 +369,22 @@ module Glimmer
350
369
  def compact_name(gem_name)
351
370
  gem_name.underscore.camelcase.downcase
352
371
  end
372
+
373
+ def gemfile(shell_type)
374
+ if shell_type == :desktopify
375
+ lines = GEMFILE.split("\n")
376
+ require_glimmer_dsl_swt_index = lines.index(lines.detect {|l| l.include?("gem 'glimmer-dsl-swt'") })
377
+ lines[(require_glimmer_dsl_swt_index + 1)..(require_glimmer_dsl_swt_index + 1)] = [
378
+ "",
379
+ "# Enable Chromium Browser Glimmer Custom Widget gem if needed (e.g. Linux needs it to support HTML5 Video), and use `browser(:chromium)` in GUI.",
380
+ "# gem 'glimmer-cw-browser-chromium', '>= 0'",
381
+ "",
382
+ ]
383
+ lines.join("\n")
384
+ else
385
+ GEMFILE
386
+ end
387
+ end
353
388
 
354
389
  def app_main_file(app_name)
355
390
  <<~MULTI_LINE_STRING
@@ -386,40 +421,68 @@ module Glimmer
386
421
  MULTI_LINE_STRING
387
422
  end
388
423
 
389
- def app_bin_file(app_name)
424
+ def app_launch_file(app_name)
390
425
  <<~MULTI_LINE_STRING
391
- require_relative '../app/#{file_name(app_name)}'
426
+ require_relative '../#{file_name(app_name)}'
392
427
 
393
428
  #{class_name(app_name)}.new.open
394
429
  MULTI_LINE_STRING
395
430
  end
396
431
 
397
- def gem_bin_file(gem_name, custom_shell_name, namespace)
398
- # TODO change this so that it does not mix Glimmer unto the main object
432
+ def app_bin_command_file(app_name)
399
433
  <<~MULTI_LINE_STRING
400
- require_relative '../lib/#{gem_name}'
434
+ #!/usr/bin/env jruby
401
435
 
402
- class #{class_name(custom_shell_name)}App
403
- include Glimmer
436
+ runner = File.expand_path("../../app/#{file_name(app_name)}/launch.rb", __FILE__)
404
437
 
405
- def open
406
- #{dsl_widget_name(custom_shell_name)}.open
438
+ # Detect if inside a JAR file or not
439
+ if runner.include?('uri:classloader')
440
+ require runner
441
+ else
442
+ require 'glimmer/launcher'
443
+
444
+ launcher = Glimmer::Launcher.new([runner] + ARGV)
445
+ launcher.launch
446
+ end
447
+ MULTI_LINE_STRING
448
+ end
449
+
450
+ def gem_launch_file(gem_name, custom_shell_name, namespace)
451
+ # TODO change this so that it does not mix Glimmer unto the main object
452
+ <<~MULTI_LINE_STRING
453
+ require_relative '../../#{gem_name}'
454
+
455
+ module #{class_name(namespace)}
456
+ class #{class_name(custom_shell_name)}
457
+ class App
458
+ include Glimmer
459
+
460
+ def open
461
+ #{dsl_widget_name(custom_shell_name)}.open
462
+ end
463
+ end
407
464
  end
408
465
  end
409
466
 
410
- #{class_name(custom_shell_name)}App.new.open
467
+ #{class_name(namespace)}::#{class_name(custom_shell_name)}::App.new.open
411
468
  MULTI_LINE_STRING
412
469
  end
413
470
 
414
- def gem_bin_command_file(gem_name)
471
+ def gem_bin_command_file(gem_name, custom_shell_name, namespace)
415
472
  <<~MULTI_LINE_STRING
416
473
  #!/usr/bin/env jruby
417
474
 
418
- require 'glimmer/launcher'
475
+ runner = File.expand_path("../../lib/#{file_name(namespace)}/#{file_name(custom_shell_name)}/launch.rb", __FILE__)
419
476
 
420
- runner = File.expand_path("../#{gem_name}", __FILE__)
421
- launcher = Glimmer::Launcher.new([runner] + ARGV)
422
- launcher.launch
477
+ # Detect if inside a JAR file or not
478
+ if runner.include?('uri:classloader')
479
+ require runner
480
+ else
481
+ require 'glimmer/launcher'
482
+
483
+ launcher = Glimmer::Launcher.new([runner] + ARGV)
484
+ launcher.launch
485
+ end
423
486
  MULTI_LINE_STRING
424
487
  end
425
488
 
@@ -430,7 +493,8 @@ module Glimmer
430
493
  lines.insert(require_rake_line_index, "require 'glimmer/launcher'")
431
494
  gem_files_line_index = lines.index(lines.detect {|l| l.include?('# dependencies defined in Gemfile') })
432
495
  if custom_shell_name
433
- lines.insert(gem_files_line_index, " gem.files = Dir['VERSION', 'LICENSE.txt', 'lib/**/*', 'app/**/*', 'bin/**/*', 'vendor/**/*', 'package/**/*']")
496
+ lines.insert(gem_files_line_index, " gem.files = Dir['VERSION', 'LICENSE.txt', 'app/**/*', 'bin/**/*', 'config/**/*', 'db/**/*', 'docs/**/*', 'fonts/**/*', 'icons/**/*', 'images/**/*', 'lib/**/*', 'package/**/*', 'script/**/*', 'sounds/**/*', 'vendor/**/*', 'videos/**/*']")
497
+ # the second executable is needed for warbler as it matches the gem name, which is the default expected file (alternatively in the future, we could do away with it and configure warbler to use the other file)
434
498
  lines.insert(gem_files_line_index+1, " gem.executables = ['#{gem_name}', '#{file_name(custom_shell_name)}']")
435
499
  lines.insert(gem_files_line_index+2, " gem.require_paths = ['vendor', 'lib', 'app']")
436
500
  else
@@ -446,7 +510,7 @@ module Glimmer
446
510
  " -name '#{human_name(custom_shell_name)}'" +
447
511
  " -title '#{human_name(custom_shell_name)}'" +
448
512
  " -Bmac.CFBundleName='#{human_name(custom_shell_name)}'" +
449
- " -Bmac.CFBundleIdentifier='org.#{namespace ? compact_name(namespace) : compact_name(custom_shell_name)}.application.#{compact_name(custom_shell_name).capitalize}'"
513
+ " -Bmac.CFBundleIdentifier='org.#{namespace ? compact_name(namespace) : compact_name(custom_shell_name)}.application.#{compact_name(custom_shell_name).camelcase(:upper)}'"
450
514
  # " -BlicenseType=" +
451
515
  # " -Bmac.category=" +
452
516
  # " -Bmac.signing-key-developer-id-app="
@@ -476,7 +540,7 @@ module Glimmer
476
540
  lines.join("\n")
477
541
  end
478
542
 
479
- def custom_shell_file(custom_shell_name, namespace, shell_type)
543
+ def custom_shell_file(custom_shell_name, namespace, shell_type, shell_options = {})
480
544
  namespace_type = class_name(namespace) == class_name(current_dir_name) ? 'class' : 'module'
481
545
 
482
546
  custom_shell_file_content = <<-MULTI_LINE_STRING
@@ -501,14 +565,14 @@ module Glimmer
501
565
  # options :title, :background_color
502
566
  # option :width, default: 320
503
567
  # option :height, default: 240
504
- option :greeting, default: 'Hello, World!'
568
+ #{'# ' if shell_type == :desktopify}option :greeting, default: 'Hello, World!'
505
569
 
506
570
  ## Use before_body block to pre-initialize variables to use in body
507
571
  #
508
572
  #
509
573
  MULTI_LINE_STRING
510
574
 
511
- if %i[gem app].include?(shell_type)
575
+ if %i[gem app desktopify].include?(shell_type)
512
576
  custom_shell_file_content += <<-MULTI_LINE_STRING
513
577
  before_body {
514
578
  Display.setAppName('#{shell_type == :gem ? human_name(custom_shell_name) : human_name(namespace)}')
@@ -518,7 +582,7 @@ module Glimmer
518
582
  display_about_dialog
519
583
  }
520
584
  on_preferences {
521
- display_preferences_dialog
585
+ #{shell_type == :desktopify ? 'display_about_dialog' : 'display_preferences_dialog'}
522
586
  }
523
587
  }
524
588
  }
@@ -545,40 +609,72 @@ module Glimmer
545
609
  body {
546
610
  shell {
547
611
  # Replace example content below with custom shell content
548
- minimum_size 320, 240
612
+ minimum_size #{shell_type == :desktopify ? '1024, 768' : '320, 240'}
549
613
  image File.join(APP_ROOT, 'package', 'windows', "#{human_name(shell_type == :gem ? custom_shell_name : current_dir_name)}.ico") if OS.windows?
550
614
  text "#{human_name(namespace)} - #{human_name(custom_shell_name)}"
615
+
616
+ MULTI_LINE_STRING
617
+
618
+ if shell_type == :desktopify
619
+ custom_shell_file_content += <<-MULTI_LINE_STRING
620
+ browser {
621
+ url "#{shell_options[:website]}"
622
+ }
623
+ MULTI_LINE_STRING
624
+ else
625
+ custom_shell_file_content += <<-MULTI_LINE_STRING
551
626
  grid_layout
552
627
  label(:center) {
553
628
  text bind(self, :greeting)
554
629
  font height: 40
555
630
  layout_data :fill, :center, true, true
556
- }
631
+ }
632
+ MULTI_LINE_STRING
633
+ end
634
+
635
+ if %i[gem app desktopify].include?(shell_type)
636
+ custom_shell_file_content += <<-MULTI_LINE_STRING
637
+
557
638
  menu_bar {
558
639
  menu {
559
640
  text '&File'
641
+ menu_item {
642
+ text '&About...'
643
+ on_widget_selected {
644
+ display_about_dialog
645
+ }
646
+ }
560
647
  menu_item {
561
648
  text '&Preferences...'
562
649
  on_widget_selected {
563
- display_preferences_dialog
650
+ #{shell_type == :desktopify ? 'display_about_dialog' : 'display_preferences_dialog'}
564
651
  }
565
652
  }
566
653
  }
567
654
  }
655
+ MULTI_LINE_STRING
656
+ end
657
+
658
+ custom_shell_file_content += <<-MULTI_LINE_STRING
568
659
  }
569
660
  }
570
- MULTI_LINE_STRING
571
-
572
- if %i[gem app].include?(shell_type)
661
+ MULTI_LINE_STRING
662
+
663
+ if %i[gem app desktopify].include?(shell_type)
573
664
  custom_shell_file_content += <<-MULTI_LINE_STRING
574
665
 
575
666
  def display_about_dialog
576
667
  message_box(body_root) {
577
668
  text 'About'
578
- message "#{human_name(namespace)} - #{human_name(custom_shell_name)} \#{VERSION}\\n\\n\#{LICENSE}"
669
+ message "#{human_name(namespace)}#{" - #{human_name(custom_shell_name)}" if shell_type == :gem} \#{VERSION}\\n\\n\#{LICENSE}"
579
670
  }.open
580
671
  end
581
672
 
673
+ MULTI_LINE_STRING
674
+ end
675
+
676
+ if %i[gem app].include?(shell_type)
677
+ custom_shell_file_content += <<-MULTI_LINE_STRING
582
678
  def display_preferences_dialog
583
679
  dialog(swt_widget) {
584
680
  text 'Preferences'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-swt
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.17.2.4
4
+ version: 4.17.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-17 00:00:00.000000000 Z
11
+ date: 2020-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement