glimmer 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.markdown +70 -33
- data/lib/glimmer.rb +2 -0
- data/lib/glimmer/package.rb +7 -0
- data/lib/glimmer/rake_task.rb +11 -1
- data/lib/glimmer/swt/shell_proxy.rb +0 -6
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34181d1d8318f14c036ebfdd848818600e16db5cc38ffcab6d5bb4be066d71af
|
4
|
+
data.tar.gz: 280f6bb988e28a5c22a691df979616b20036e6d918a68595c1a7e5236ff8e7ac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c65e1dcdd54e3c9a98b5cc16bc422c5a1ee38f4b0f85a9f9c761dce93ab3b0682b4ee708b7e5212dc24e875a1b7bcf37578f75cd975f5a6093312e0caf2c8f7
|
7
|
+
data.tar.gz: e7ea759b31719d58f05bef4ef0b1fd4a5301fa9240412c3eac75c98d961a0515b02703a84e86f0f06e32effffea168e7f7c9e38ed00b116b69bcb61dfa90d69e
|
data/README.markdown
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Glimmer 0.5.
|
1
|
+
# Glimmer 0.5.7 Beta (JRuby Desktop UI DSL + Data-Binding)
|
2
2
|
[![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer?branch=master)
|
3
3
|
|
4
4
|
Glimmer is a native-UI cross-platform desktop development library written in Ruby. Glimmer's main innovation is a JRuby DSL that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust platform-native Eclipse SWT library. Glimmer additionally innovates by having built-in data-binding support to greatly facilitate synchronizing the UI with domain models. As a result, that achieves true decoupling of object oriented components, enabling developers to solve business problems without worrying about UI concerns, or alternatively drive development UI-first, and then write clean business components test-first afterwards.
|
@@ -111,14 +111,14 @@ Please follow these instructions to make the `glimmer` command available on your
|
|
111
111
|
|
112
112
|
Run this command to install directly:
|
113
113
|
```
|
114
|
-
jgem install glimmer -v 0.5.
|
114
|
+
jgem install glimmer -v 0.5.7
|
115
115
|
```
|
116
116
|
|
117
117
|
### Option 2: Bundler
|
118
118
|
|
119
119
|
Add the following to `Gemfile`:
|
120
120
|
```
|
121
|
-
gem 'glimmer', '~> 0.5.
|
121
|
+
gem 'glimmer', '~> 0.5.7'
|
122
122
|
```
|
123
123
|
|
124
124
|
And, then run:
|
@@ -1117,37 +1117,26 @@ The alternative syntax can be helpful if you prefer to separate Glimmer observer
|
|
1117
1117
|
|
1118
1118
|
#### Observing Models
|
1119
1119
|
|
1120
|
-
|
1121
|
-
|
1122
|
-
To register observer, one has to call the `#observe` method and pass in the observable and the property(ies) to observe.
|
1120
|
+
Glimmer DSL includes an `observe` keyword used to register an observer by passing in the observable and the property(ies) to observe, and then specifying in a block what happens on notification.
|
1123
1121
|
|
1124
1122
|
```ruby
|
1125
1123
|
class TicTacToe
|
1126
1124
|
include Glimmer
|
1127
|
-
include Observer
|
1128
1125
|
|
1129
1126
|
def initialize
|
1130
1127
|
# ...
|
1131
|
-
observe(@tic_tac_toe_board, :game_status)
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
display_win_message if game_status == TicTacToeBoard::WIN
|
1136
|
-
display_draw_message if game_status == TicTacToeBoard::DRAW
|
1128
|
+
observe(@tic_tac_toe_board, :game_status) { |game_status|
|
1129
|
+
display_win_message if game_status == TicTacToeBoard::WIN
|
1130
|
+
display_draw_message if game_status == TicTacToeBoard::DRAW
|
1131
|
+
}
|
1137
1132
|
end
|
1138
1133
|
# ...
|
1139
1134
|
end
|
1140
1135
|
```
|
1141
1136
|
|
1142
|
-
|
1143
|
-
```ruby
|
1144
|
-
observer = Observer.proc { |new_value| puts new_value }
|
1145
|
-
observer.observe(@tic_tac_toe_board, :game_status)
|
1146
|
-
```
|
1137
|
+
Observers can be a good mechanism for displaying dialog messages in Glimmer (using SWT's `MessageBox`).
|
1147
1138
|
|
1148
|
-
|
1149
|
-
|
1150
|
-
Look at `samples/tictactoe/tic_tac_toe.rb` for an `Observer` dialog message example (sample below).
|
1139
|
+
Look at [`samples/tictactoe/tic_tac_toe.rb`](samples/tictactoe/tic_tac_toe.rb) for more details starting with the code included below.
|
1151
1140
|
|
1152
1141
|
```ruby
|
1153
1142
|
class TicTacToe
|
@@ -1156,12 +1145,10 @@ class TicTacToe
|
|
1156
1145
|
|
1157
1146
|
def initialize
|
1158
1147
|
# ...
|
1159
|
-
observe(@tic_tac_toe_board, :game_status)
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1163
|
-
display_win_message if game_status == TicTacToeBoard::WIN
|
1164
|
-
display_draw_message if game_status == TicTacToeBoard::DRAW
|
1148
|
+
observe(@tic_tac_toe_board, :game_status) { |game_status|
|
1149
|
+
display_win_message if game_status == TicTacToeBoard::WIN
|
1150
|
+
display_draw_message if game_status == TicTacToeBoard::DRAW
|
1151
|
+
}
|
1165
1152
|
end
|
1166
1153
|
|
1167
1154
|
def display_win_message
|
@@ -1685,6 +1672,7 @@ To use:
|
|
1685
1672
|
require_relative '../app/my_application.rb'
|
1686
1673
|
```
|
1687
1674
|
- (Optional) If you'd like to include an icon for your app (.icns format on the Mac), place it under `package/macosx` matching your application local directory name (e.g. 'MathBowling.icns' for MathBowling). You may generate your Mac icon easily using tools like Image2Icon (http://www.img2icnsapp.com/) or manually using the Mac terminal command `iconutil` (iconutil guide: https://applehelpwriter.com/tag/iconutil/)
|
1675
|
+
- (Optional) You may optionally add the following to `Rakefile` to configure extra arguments for javapackager: `Glimmer::Packager.javapackager_extra_args = "..."` (Useful to avoid re-entering extra arguments on every run of rake task.)
|
1688
1676
|
|
1689
1677
|
Now, you can run the following rake command to package your app into a Mac DMG file (using both Warbler and javapackager):
|
1690
1678
|
```
|
@@ -1703,20 +1691,69 @@ rake glimmer:package:config
|
|
1703
1691
|
|
1704
1692
|
This will generate `config/warble.rb`, which you may configure and then run `rake glimmer:package` afterwards.
|
1705
1693
|
|
1706
|
-
In any case,
|
1694
|
+
In any case, in order to pass extra options to configure Mac package and sign your Mac app to distribute on the App Store, you can read more advanced instructions for `javapackager` here:
|
1695
|
+
- https://docs.oracle.com/javase/9/tools/javapackager.htm#JSWOR719
|
1696
|
+
- https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javapackager.html
|
1697
|
+
- https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#BCGICFDB
|
1698
|
+
- https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html
|
1699
|
+
|
1700
|
+
Glimmer rake task allows passing extra options to javapackager via `Glimmer::Packager.javapackager_extra_args` in your application Rakefile or environment variable `JAVAPACKAGER_EXTRA_ARGS`
|
1707
1701
|
|
1708
|
-
|
1702
|
+
Example (Rakefile):
|
1709
1703
|
|
1704
|
+
```ruby
|
1705
|
+
Glimmer::Package.javapackager_extra_args = '-srcfiles "LICENSE.txt" -BlicenseFile="LICENSE.txt" -BlicenseType="MIT" -Bmac.CFBundleVersion="1.0.0" -Bmac.category="arithmetic" -Bmac.signing-key-developer-id-app="Andy Maleh"'
|
1710
1706
|
```
|
1711
|
-
|
1707
|
+
|
1708
|
+
Example (env var):
|
1709
|
+
|
1710
|
+
```
|
1711
|
+
JAVAPACKAGER_EXTRA_ARGS='-Bmac.CFBundleName="Math Bowling Game"' rake glimmer:package
|
1712
1712
|
```
|
1713
1713
|
|
1714
|
-
|
1714
|
+
That overrides the default application display name.
|
1715
|
+
|
1716
|
+
### Mac Application Distribution
|
1717
|
+
|
1718
|
+
Recent macOS versions (starting with Catalina) have very stringent security requirements requiring all applications to be signed before running (unless the user goes to System Preferences -> Privacy -> General tab and clicks "Open Anyway" after failing to open application the first time they run it). So, to release a desktop application on the Mac, it is recommended to enroll in the [Apple Developer Program](https://developer.apple.com/programs/) to distribute on the [Mac App Store](https://developer.apple.com/distribute/) or otherwise request [app notarization from Apple](https://developer.apple.com/documentation/xcode/notarizing_macos_software_before_distribution) to distribute independently.
|
1719
|
+
|
1720
|
+
### Self Signed Certificate
|
1721
|
+
|
1722
|
+
You may still release a signed DMG file without enrolling into the Apple Developer Program with the caveat that users will always fail in opening the app the first time, and have to go to System Preferences -> Privacy -> General tab to "Open Anyway".
|
1723
|
+
|
1724
|
+
To do so, you may follow these steps (abbreviated version from https://developer.apple.com/library/archive/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW2):
|
1725
|
+
- Open Keychain Access
|
1726
|
+
- Choose Keychain Access > Certificate Assistant > Create Certificate ...
|
1727
|
+
- Enter Name (referred to below as "CertificateName")
|
1728
|
+
- Set 'Certificate Type' to 'Code Signing'
|
1729
|
+
- Create (if you alternatively override defaults, make sure to enable all capabilities)
|
1730
|
+
- Add the following option to javapackager: `-Bmac.signing-key-developer-id-app="CertificateName"` via `Glimmer::Package.javapackager_extra_args` or `JAVAPACKAGER_EXTRA_ARGS`
|
1731
|
+
|
1732
|
+
Example:
|
1733
|
+
|
1734
|
+
```ruby
|
1735
|
+
Glimmer::Package.javapackager_extra_args = '-Bmac.signing-key-developer-id-app="Andy Maleh"'
|
1736
|
+
```
|
1737
|
+
|
1738
|
+
Now, when you run `rake glimmer:package`, it builds a self-signed DMG file. When you make available online, and users download, upon launching application, they are presented with your certificate, which they have to sign if they trust you in order to use the application.
|
1739
|
+
|
1740
|
+
### Gotchas
|
1741
|
+
|
1742
|
+
1. Specifying License File
|
1743
|
+
|
1744
|
+
The javapackager documentation states that a license file may be specified with "-BlicenseFile" javapackager option. However, in order for that to work, one must specify as a source file via "-srcfiles" javapackager option.
|
1745
|
+
|
1746
|
+
Example:
|
1747
|
+
|
1748
|
+
```ruby
|
1749
|
+
Glimmer::Package.javapackager_extra_args = '-srcfiles "LICENSE.txt" -BlicenseFile="LICENSE.txt" -BlicenseType="MIT"'
|
1750
|
+
```
|
1715
1751
|
|
1716
|
-
|
1752
|
+
2. Mounted DMG Residue
|
1717
1753
|
|
1718
|
-
|
1754
|
+
If you run `rake glimmer:package` multiple times, sometimes it leaves a mounted DMG project in your finder. Unmount before you run the command again or it might fail with an error saying: "Error: Bundler "DMG Installer" (dmg) failed to produce a bundle."
|
1719
1755
|
|
1756
|
+
By the way, keep in mind that during normal operation, it does also indicate a false-negative while completing successfully (please ignore): "Exec failed with code 2 command [[/usr/bin/SetFile, -c, icnC, /var/folders/4_/g1sw__tx6mjdgyh3mky7vydc0000gp/T/fxbundler4076750801763032201/images/MathBowling/.VolumeIcon.icns] in unspecified directory"
|
1720
1757
|
|
1721
1758
|
## Resources
|
1722
1759
|
|
data/lib/glimmer.rb
CHANGED
data/lib/glimmer/rake_task.rb
CHANGED
@@ -1,9 +1,12 @@
|
|
1
|
+
require 'glimmer/package'
|
2
|
+
|
1
3
|
namespace :glimmer do
|
2
4
|
namespace :package do
|
3
5
|
desc 'Generate JAR config file'
|
4
6
|
task :config do
|
5
7
|
project_name = File.basename(File.expand_path('.'))
|
6
8
|
if !File.exists?('config/warble.rb')
|
9
|
+
puts 'Generating JAR configuration (config/warble.rb) to use with Warbler...'
|
7
10
|
system('mkdir -p config')
|
8
11
|
system('warble config')
|
9
12
|
new_config = File.read('config/warble.rb').split("\n").inject('') do |output, line|
|
@@ -22,11 +25,18 @@ namespace :glimmer do
|
|
22
25
|
|
23
26
|
desc 'Package app for distribution'
|
24
27
|
task :package => 'package:config' do
|
28
|
+
require 'facets/string/titlecase'
|
29
|
+
require 'facets/string/underscore'
|
25
30
|
project_name = File.basename(File.expand_path('.'))
|
31
|
+
human_name = project_name.underscore.titlecase
|
26
32
|
system('mkdir -p dist')
|
33
|
+
puts "Generating JAR with Warbler..."
|
27
34
|
system('warble')
|
28
|
-
command = "javapackager -deploy -native -outdir packages -outfile #{project_name} -
|
35
|
+
command = "javapackager -deploy -native -outdir packages -outfile #{project_name} -srcfiles \"dist/#{project_name}.jar\" -appclass JarMain -name \"#{project_name}\" -title \"#{human_name}\" -BjvmOptions=-XstartOnFirstThread"
|
36
|
+
command += " -Bmac.CFBundleName=\"#{human_name}\""
|
37
|
+
command += " #{Glimmer::Package.javapackager_extra_args}" if Glimmer::Package.javapackager_extra_args
|
29
38
|
command += " #{ENV['JAVAPACKAGER_EXTRA_ARGS']}" if ENV['JAVAPACKAGER_EXTRA_ARGS']
|
39
|
+
puts "Generating DMG/PKG/APP/JNLP with javapackager..."
|
30
40
|
puts command
|
31
41
|
system command
|
32
42
|
end
|
@@ -14,18 +14,12 @@ module Glimmer
|
|
14
14
|
|
15
15
|
WIDTH_MIN = 130
|
16
16
|
HEIGHT_MIN = 0
|
17
|
-
CUSTOM_ATTRIBUTES = %w[app_name app_version]
|
18
17
|
|
19
18
|
attr_reader :opened_before
|
20
19
|
alias opened_before? opened_before
|
21
20
|
|
22
21
|
# Instantiates ShellProxy with same arguments expected by SWT Shell
|
23
22
|
def initialize(*args)
|
24
|
-
if args.last.is_a?(Hash)
|
25
|
-
app_attributes = args.delete(args.last)
|
26
|
-
Display.setAppName(app_attributes[:app_name])
|
27
|
-
Display.setAppVersion(app_attributes[:app_version])
|
28
|
-
end
|
29
23
|
if args.first.is_a?(ShellProxy)
|
30
24
|
args[0] = args[0].swt_widget
|
31
25
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
@@ -255,6 +255,7 @@ files:
|
|
255
255
|
- lib/glimmer/error.rb
|
256
256
|
- lib/glimmer/invalid_keyword_error.rb
|
257
257
|
- lib/glimmer/launcher.rb
|
258
|
+
- lib/glimmer/package.rb
|
258
259
|
- lib/glimmer/rake_task.rb
|
259
260
|
- lib/glimmer/swt/color_proxy.rb
|
260
261
|
- lib/glimmer/swt/display_proxy.rb
|