glimmer 0.5.0 → 0.5.2

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: 3a01513e043e5d19086d90cb571aa4043235a2753b3164413e680591073f6644
4
- data.tar.gz: 56949c7c670c1864804e5ed28d33f7efddcdca7b0b50d465011b149ca7585969
3
+ metadata.gz: 0c305f675b946595a08012449c49518559acb8238f486c154b3720c0428b5c88
4
+ data.tar.gz: 3f5d4ece86f4c737f7d0ae9cb1f6f235fca33694653c6a760afe33fcc6117692
5
5
  SHA512:
6
- metadata.gz: dce0753c615d6c148d7065741463dc3eb95fa3bd437082c757be5ec8569ae812af8ef993fa726a43cdda99e32b748f4201b709c46b10666f78866f27317809f7
7
- data.tar.gz: 3a764178e11e57d1b8ac15b5089decdc4933846b3392b0e7904511114c2dab1ae0635f77ac6be644e3151723350caee7f248bc9c19ce36c018879deb302a7a38
6
+ metadata.gz: 42ea536ecec59e08a94f1dd561b614d6eb64f4d44c8c2ac9de8ef4170a3f6399659de613cd08acb52b2fea68524f65e28e578ecdfa64842f6faf8711efc3b076
7
+ data.tar.gz: 245ace0d9f7f92efc9071c86b96de8a64b2b624c8194ae5af85c9f74ea77db924028f5cc57505807c7f309d5d8688a0d072e5a50ad40e9e4d0c01ae62dc6b32c
@@ -1,4 +1,4 @@
1
- # Glimmer 0.5.0 Beta (JRuby Desktop UI DSL + Data-Binding)
1
+ # Glimmer 0.5.2 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.0
114
+ jgem install glimmer -v 0.5.2
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.0'
121
+ gem 'glimmer', '~> 0.5.2'
122
122
  ```
123
123
 
124
124
  And, then run:
@@ -1188,6 +1188,36 @@ Last but not least, these are the available hooks:
1188
1188
  - `before_body`: takes a block that executes in the custom widget instance scope before calling `body`. Useful for initializing variables to later use in `body`
1189
1189
  - `after_body`: takes a block that executes in the custom widget instance scope after calling `body`. Useful for setting up observers on widgets built in `body` (set in instance variables) and linking to other shells.
1190
1190
 
1191
+ #### Gotcha
1192
+
1193
+ Beware of defining a custom attribute that is a common SWT widget property name.
1194
+ For example, if you define `text=` and `text` methods to accept a custom text and then later you write this body:
1195
+
1196
+ ```ruby
1197
+ # ...
1198
+ def text
1199
+ # ...
1200
+ end
1201
+
1202
+ def text=(value)
1203
+ # ...
1204
+ end
1205
+
1206
+ body {
1207
+ composite {
1208
+ label {
1209
+ text "Hello"
1210
+ }
1211
+ label {
1212
+ text "World"
1213
+ }
1214
+ }
1215
+ }
1216
+ # ...
1217
+ ```
1218
+
1219
+ The `text` method invoked in the custom widget body will call the one you defined above it. To avoid this gotcha, simply name the text property above something else, like `custom_text`.
1220
+
1191
1221
  ### Custom Shells
1192
1222
 
1193
1223
  Custom shells are a kind of custom widgets that have shells only as the body root. They can be self-contained applications that may be opened and hidden/closed independently of the main app.
@@ -1542,6 +1572,32 @@ Example:
1542
1572
  jruby -J-XstartOnFirstThread -J-classpath "path_to/swt.jar" -r glimmer -S application.rb
1543
1573
  ```
1544
1574
 
1575
+ ## Packaging
1576
+
1577
+ Glimmer apps may be packaged and distributed on the Mac, Windows, and Linux via these tools:
1578
+ - Warbler (https://github.com/jruby/warbler): Enables bundling a Glimmer app into a JAR file
1579
+ - javapackager (https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javapackager.html): Enables packaging a JAR file as a DMG file on Mac, EXE on Windows, and multiple Linux supported formats on Linux.
1580
+
1581
+ Glimmer simplifies the process for general packaging on the Mac by providing a rake task.
1582
+
1583
+ - Create `Rakefile` in your app root directory
1584
+ - Add the following line to it: `require 'glimmer/rake_task'`
1585
+
1586
+ Now, you can run the following command to package your app into a Mac DMG file (using both Warbler and javapackager):
1587
+ ```
1588
+ rake glimmer:package
1589
+ ```
1590
+
1591
+ This will generate a JAR file under `./dist` directory and DMG file under `./packages/bundles`. Both will match your application local directory name (e.g. `MathBowling.jar` and `MathBowling-1.0.dmg` for `~/code/MathBowling`)
1592
+
1593
+ By default, the package only includes these directories: app, config, db, lib, script, bin, images, sounds, videos
1594
+
1595
+ After running once, you will find a `config/warble.rb` file. It has the JAR packaging configuration. You may adjust included directories in it if needed, and then rerun `rake glimmer:package` and it will pick up your custom configuration.
1596
+
1597
+ Otherwise, you may find more advanced instructions for javapackager (https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html#BCGICFDB) and (https://docs.oracle.com/javase/8/docs/technotes/guides/deploy/self-contained-packaging.html) in order to sign your Mac app and distribute on the App Store.
1598
+
1599
+ Additionally, read their documentation on how to set an icon/assets for the application: https://docs.oracle.com/javase/8/docs/technotes/tools/unix/javapackager.html
1600
+
1545
1601
  ## Resources
1546
1602
 
1547
1603
  * [Eclipse Zone Tutorial](http://eclipse.dzone.com/articles/an-introduction-glimmer)
@@ -2,13 +2,13 @@
2
2
  # interfaces using the robust platform-independent Eclipse SWT library. Glimmer
3
3
  # comes with built-in data-binding support to greatly facilitate synchronizing
4
4
  # UI with domain models.
5
-
6
5
  require 'facets'
7
6
  require 'super_module'
8
7
  require 'logger'
9
8
  require 'java'
10
9
  require 'set'
11
10
  require 'nested_inherited_jruby_include_package'
11
+ require 'fileutils'
12
12
 
13
13
  # Glimmer provides a JRuby Desktop UI DSL + Data-Binding functionality
14
14
  #
@@ -0,0 +1,24 @@
1
+ namespace :glimmer do
2
+ desc 'Package app for distribution'
3
+ task :package do
4
+ project_name = File.basename(File.expand_path('.'))
5
+ if !File.exists?('config/warble.rb')
6
+ system('mkdir -p config')
7
+ system('warble config')
8
+ new_config = File.read('config/warble.rb').split("\n").inject('') do |output, line|
9
+ if line.include?('config.dirs =')
10
+ line = line.sub('# ', '').sub(/=[^=\n]+$/, '= %w(app config db lib script bin images sounds videos)')
11
+ end
12
+ if line.include?('config.autodeploy_dir =')
13
+ line = line.sub('# ', '')
14
+ end
15
+ output + "\n" + line
16
+ end
17
+ File.write('config/warble.rb', new_config)
18
+ end
19
+ system('mkdir -p dist')
20
+ system('warble')
21
+ puts("javapackager -deploy -native -outdir packages -outfile #{project_name} -srcdir dist -srcfiles #{project_name}.jar -appclass JarMain -name \"#{project_name}\" -title \"#{project_name}\" -BjvmOptions=-XstartOnFirstThread")
22
+ system("javapackager -deploy -native -outdir packages -outfile #{project_name} -srcdir dist -srcfiles #{project_name}.jar -appclass JarMain -name \"#{project_name}\" -title \"#{project_name}\" -BjvmOptions=-XstartOnFirstThread")
23
+ end
24
+ end
@@ -239,8 +239,8 @@ module Glimmer
239
239
 
240
240
  def add_listener(underscored_listener_name, &block)
241
241
  widget_add_listener_method, listener_class, listener_method = self.class.find_listener(@swt_widget.getClass, underscored_listener_name)
242
- listener = listener_class.new(listener_method.getName => block)
243
- @swt_widget.send(widget_add_listener_method.getName, listener)
242
+ listener = listener_class.new(listener_method => block)
243
+ @swt_widget.send(widget_add_listener_method, listener)
244
244
  WidgetListenerProxy.new(listener)
245
245
  end
246
246
 
@@ -257,7 +257,7 @@ module Glimmer
257
257
  widget_add_listener_method.getParameterTypes.each do |listener_type|
258
258
  listener_type.getMethods.each do |listener_method|
259
259
  if (listener_method.getName == listener_method_name)
260
- @listeners[listener_key] = [widget_add_listener_method, listener_class(listener_type), listener_method]
260
+ @listeners[listener_key] = [widget_add_listener_method.getName, listener_class(listener_type), listener_method.getName]
261
261
  return @listeners[listener_key]
262
262
  end
263
263
  end
@@ -329,6 +329,12 @@ module Glimmer
329
329
  :background => color_converter,
330
330
  :background_image => proc do |value|
331
331
  if value.is_a?(String)
332
+ if value.start_with?('uri:classloader')
333
+ value = value.sub(/^uri\:classloader\:\//, '')
334
+ object = java.lang.Object.new
335
+ value = object.java_class.resource_as_stream(value)
336
+ value = java.io.BufferedInputStream.new(value)
337
+ end
332
338
  image_data = ImageData.new(value)
333
339
  # TODO in the future, look into unregistering this listener when no longer needed
334
340
  on_event_Resize do |resize_event|
@@ -74,7 +74,25 @@ module Glimmer
74
74
  }
75
75
 
76
76
  def source
77
- file ? "file://#{file}" : url
77
+ file_source = file
78
+ if file_source
79
+ if file_source.start_with?('uri:classloader')
80
+ file_path = file_source.split(/\/\//).last
81
+ file_name = File.basename(file_source)
82
+ # supporting windows ENV['temp'] or mac/unix /tmp
83
+ tmp_dir = ENV['temp'] ? File.expand_path(ENV['temp']) : '/tmp'
84
+ tmp_dir += '/glimmer/lib/glimmer/ui/video'
85
+ FileUtils.mkdir_p(tmp_dir)
86
+ tmp_file = File.join(tmp_dir, file_name)
87
+ file_content = File.binread(file_source) rescue File.binread(file_path)
88
+ File.binwrite(tmp_file, file_content)
89
+ "file://#{tmp_file}"
90
+ else
91
+ "file://#{file_source}"
92
+ end
93
+ else
94
+ url
95
+ end
78
96
  end
79
97
 
80
98
  def play
metadata CHANGED
@@ -1,19 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.5.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-11 00:00:00.000000000 Z
11
+ date: 2020-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
15
15
  requirements:
16
- - - '='
16
+ - - "~>"
17
17
  - !ruby/object:Gem::Version
18
18
  version: 3.1.0
19
19
  name: facets
@@ -21,13 +21,13 @@ dependencies:
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '='
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: 3.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  requirement: !ruby/object:Gem::Requirement
29
29
  requirements:
30
- - - '='
30
+ - - "~>"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 1.0.0
33
33
  name: os
@@ -35,13 +35,13 @@ dependencies:
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '='
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: 1.0.0
41
41
  - !ruby/object:Gem::Dependency
42
42
  requirement: !ruby/object:Gem::Requirement
43
43
  requirements:
44
- - - '='
44
+ - - "~>"
45
45
  - !ruby/object:Gem::Version
46
46
  version: 1.4.0
47
47
  name: super_module
@@ -49,13 +49,13 @@ dependencies:
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '='
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 1.4.0
55
55
  - !ruby/object:Gem::Dependency
56
56
  requirement: !ruby/object:Gem::Requirement
57
57
  requirements:
58
- - - '='
58
+ - - "~>"
59
59
  - !ruby/object:Gem::Version
60
60
  version: 0.3.0
61
61
  name: nested_inherited_jruby_include_package
@@ -63,9 +63,37 @@ dependencies:
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - '='
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.3.0
69
+ - !ruby/object:Gem::Dependency
70
+ requirement: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 2.0.5
75
+ name: warbler
76
+ type: :runtime
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: 2.0.5
83
+ - !ruby/object:Gem::Dependency
84
+ requirement: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: 10.0.0
89
+ name: rake
90
+ type: :runtime
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: 10.0.0
69
97
  - !ruby/object:Gem::Dependency
70
98
  requirement: !ruby/object:Gem::Requirement
71
99
  requirements:
@@ -225,6 +253,7 @@ files:
225
253
  - lib/glimmer/error.rb
226
254
  - lib/glimmer/invalid_keyword_error.rb
227
255
  - lib/glimmer/launcher.rb
256
+ - lib/glimmer/rake_task.rb
228
257
  - lib/glimmer/swt/color_proxy.rb
229
258
  - lib/glimmer/swt/display_proxy.rb
230
259
  - lib/glimmer/swt/font_proxy.rb