glimmer 0.5.10 → 0.5.11

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: 07ac7dc0e7c7beab5855763da9b232037f6561b93c0b8240db5a96fc74a3e026
4
- data.tar.gz: 934ff722e09b38eec4c4ede3c369f910ead8d070bbb151f42ec59feac7d66328
3
+ metadata.gz: e6264cb7899c16ec9e6df0a24fc1365d1cd116633c6ce20010723badd50e4041
4
+ data.tar.gz: 98e5d5bb061edaae3a139540c6e0b7721bdba5c703a4cb7ce26e3232e85f62f4
5
5
  SHA512:
6
- metadata.gz: abd9390fb32d7e5aaa099d8002527371825d7109e69adeb1fc91e2440dd8b92010691839983bcbed177ce27d5b7c469f9294a62a77261b971eba301986e0e3ae
7
- data.tar.gz: c75edc6edce8909868465a75d26ba9cd054192ac256d34f2bc8f271e129326e504e91c3ca1f84b7a0be1c0079f609ab05995e21091002a4aa2d29d8f91a38d28
6
+ metadata.gz: d33841165b7d420be235057b4a95cf6f7a7ec6f4b3d04b7fcedd7e5233cdf2d3b3597bc83694fae30288ebf2f32741b9d1a0941be98472c1270190f2146a0890
7
+ data.tar.gz: 627a9b85c3709fd097e7b2cbb54266091e9c83f5a2005a5d9e97fa3bff1c68b6a32d76f67f70f67f19f44254a12c65d3f22b064cd6351c42e1f7fcf11503b825
@@ -1,4 +1,4 @@
1
- # Glimmer 0.5.10 Beta (JRuby Desktop UI DSL + Data-Binding)
1
+ # Glimmer 0.5.11 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.
@@ -70,7 +70,7 @@ NOTE: Glimmer is in beta mode. Please help make better by adopting for small or
70
70
  ## Table of Contents
71
71
 
72
72
  <!-- TOC START min:1 max:3 link:true asterisk:false update:true -->
73
- - [Glimmer 0.5.10 Beta (JRuby Desktop UI DSL + Data-Binding)](#glimmer-058-beta-jruby-desktop-ui-dsl--data-binding)
73
+ - [Glimmer 0.5.11 Beta (JRuby Desktop UI DSL + Data-Binding)](#glimmer-058-beta-jruby-desktop-ui-dsl--data-binding)
74
74
  - [Examples](#examples)
75
75
  - [Hello World](#hello-world)
76
76
  - [Tic Tac Toe](#tic-tac-toe)
@@ -163,14 +163,14 @@ Please follow these instructions to make the `glimmer` command available on your
163
163
 
164
164
  Run this command to install directly:
165
165
  ```
166
- jgem install glimmer -v 0.5.10
166
+ jgem install glimmer -v 0.5.11
167
167
  ```
168
168
 
169
169
  ### Option 2: Bundler
170
170
 
171
171
  Add the following to `Gemfile`:
172
172
  ```
173
- gem 'glimmer', '~> 0.5.10'
173
+ gem 'glimmer', '~> 0.5.11'
174
174
  ```
175
175
 
176
176
  And, then run:
@@ -1753,6 +1753,15 @@ Gladiator has been made available in [Glimmer's gem](https://rubygems.org/gems/g
1753
1753
 
1754
1754
  If you cloned this project and followed [CONTRIBUTING.md](CONTRIBUTING.md) instructions, you may invoke via `bin/gladiator` instead.
1755
1755
 
1756
+ Gotcha:
1757
+
1758
+ Gladiator repetitively displays a signaling error that is harmless in practice:
1759
+ ```
1760
+ The signal HUP is in use by the JVM and will not work correctly on this platform
1761
+ The signal INT is in use by the JVM and will not work correctly on this platform
1762
+ The signal TERM is in use by the JVM and will not work correctly on this platform
1763
+ ```
1764
+
1756
1765
  ## In Production
1757
1766
 
1758
1767
  The following production apps have been built with Glimmer:
@@ -1885,15 +1894,22 @@ To use:
1885
1894
  ```ruby
1886
1895
  require_relative '../app/my_application.rb'
1887
1896
  ```
1888
- - (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/)
1889
- - (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.)
1897
+ - Include Icon (Optional): If you'd like to include an icon for your app (.icns format on the Mac), place it under `package/macosx` matching the humanized application local directory name (e.g. 'Math Bowling.icns' [containing space] for MathBowling or math_bowling). 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/)
1898
+ - Include Version (Optional): Create a `VERSION` file in your application and fill it your app version on one line (e.g. `1.1.0`)
1899
+ - Include License (Optional): Create a `LICENSE.txt` file in your application and fill it up with your license (e.g. MIT). It will show up to people when installing your app. Note that, you may optionally also specify license type, but you'd have to do so manually via `-BlicenseType=MIT` shown in an [example below](#javapackager-extra-arguments).
1900
+ - Extra args (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.). Read about them in [their section below](#javapackager-extra-arguments).
1890
1901
 
1891
1902
  Now, you can run the following rake command to package your app into a Mac DMG file (using both Warbler and javapackager):
1892
1903
  ```
1893
1904
  rake glimmer:package
1894
1905
  ```
1895
1906
 
1896
- This will generate a JAR file under `./dist` directory, which is then used to generate a DMG file (and pkg/app) under `./packages/bundles`. Both will match your application local directory name (e.g. `MathBowling.jar` and `MathBowling-1.0.dmg` for `~/code/MathBowling`)
1907
+ This will generate a JAR file under `./dist` directory, which is then used to generate a DMG file (and pkg/app) under `./packages/bundles`.
1908
+ JAR file name will match your application local directory name (e.g. `MathBowling.jar` for `~/code/MathBowling`)
1909
+ DMG file name will match the humanized local directory name + dash + application version (e.g. `Math Bowling-1.0.dmg` for `~/code/MathBowling` with version 1.0 or unspecified)
1910
+
1911
+ THe rake task will automatically set "mac.CFBundleIdentifier" to ="org.#{project_name}.application.#{project_name}".
1912
+ You may override by configuring as an extra argument for javapackger (e.g. Glimmer::Package.javapackager_extra_args = " -Bmac.CFBundleIdentifier=org.andymaleh.application.MathBowling")
1897
1913
 
1898
1914
  ### Defaults
1899
1915
 
@@ -1926,7 +1942,7 @@ The Glimmer rake task allows passing extra options to javapackager via:
1926
1942
  Example (Rakefile):
1927
1943
 
1928
1944
  ```ruby
1929
- 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"'
1945
+ Glimmer::Package.javapackager_extra_args = '-BlicenseType="MIT" -Bmac.category="arithmetic" -Bmac.signing-key-developer-id-app="Andy Maleh"'
1930
1946
  ```
1931
1947
 
1932
1948
  Example (env var):
@@ -1983,12 +1999,13 @@ Now, when you run `rake glimmer:package`, it builds a self-signed DMG file. When
1983
1999
 
1984
2000
  1. Specifying License File
1985
2001
 
1986
- 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.
2002
+ 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.
2003
+ Keep that in mind if you are not going to rely on the default `LICENSE.txt` support.
1987
2004
 
1988
2005
  Example:
1989
2006
 
1990
2007
  ```ruby
1991
- Glimmer::Package.javapackager_extra_args = '-srcfiles "LICENSE.txt" -BlicenseFile="LICENSE.txt" -BlicenseType="MIT"'
2008
+ Glimmer::Package.javapackager_extra_args = '-srcfiles "ACME.txt" -BlicenseFile="ACME.txt" -BlicenseType="ACME"'
1992
2009
  ```
1993
2010
 
1994
2011
  2. Mounted DMG Residue
@@ -28,14 +28,19 @@ namespace :glimmer do
28
28
  require 'facets/string/titlecase'
29
29
  require 'facets/string/underscore'
30
30
  project_name = File.basename(File.expand_path('.'))
31
+ version_file = File.expand_path('./VERSION')
32
+ version = (File.read(version_file).strip if File.exists?(version_file) && File.file?(version_file)) rescue nil
33
+ license_file = File.expand_path('./LICENSE.txt')
34
+ license = (File.read(license_file).strip if File.exists?(license_file) && File.file?(license_file)) rescue nil
31
35
  human_name = project_name.underscore.titlecase
32
36
  system('mkdir -p dist')
33
37
  puts "Generating JAR with Warbler..."
34
38
  system('warble')
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
38
- command += " #{ENV['JAVAPACKAGER_EXTRA_ARGS']}" if ENV['JAVAPACKAGER_EXTRA_ARGS']
39
+ command = "javapackager -deploy -native -outdir packages -outfile \"#{project_name}\" -srcfiles \"dist/#{project_name}.jar\" -appclass JarMain -name \"#{human_name}\" -title \"#{human_name}\" -BjvmOptions=-XstartOnFirstThread -Bmac.CFBundleName=\"#{human_name}\" -Bmac.CFBundleIdentifier=\"org.#{project_name}.application.#{project_name}\" "
40
+ command += " -BappVersion=#{version} -Bmac.CFBundleVersion=#{version} " if version
41
+ command += " -srcfiles LICENSE.txt -BlicenseFile=LICENSE.txt " if license
42
+ command += " #{Glimmer::Package.javapackager_extra_args} " if Glimmer::Package.javapackager_extra_args
43
+ command += " #{ENV['JAVAPACKAGER_EXTRA_ARGS']} " if ENV['JAVAPACKAGER_EXTRA_ARGS']
39
44
  puts "Generating DMG/PKG/APP/JNLP with javapackager..."
40
45
  puts command
41
46
  system command
@@ -54,9 +54,7 @@ module Glimmer
54
54
  </style>
55
55
  </head>
56
56
  <body>
57
- <video id="video" #{browser_video_width} #{browser_video_height} #{browser_video_loop} #{browser_video_controls} #{browser_video_autoplay}>
58
- <source id="source" src="#{source}" type="video/mp4">
59
- Your browser does not support the video tag.
57
+ <video id="video" src="#{source}" #{browser_video_width} #{browser_video_height} #{browser_video_loop} #{browser_video_controls} #{browser_video_autoplay}>
60
58
  </video>
61
59
  </body>
62
60
  </html>
@@ -89,6 +87,16 @@ module Glimmer
89
87
  end
90
88
  end
91
89
 
90
+ def file=(a_file)
91
+ options[:file] = a_file
92
+ set_video_source
93
+ end
94
+
95
+ def url=(a_url)
96
+ options[:url] = a_url
97
+ set_video_source
98
+ end
99
+
92
100
  def play
93
101
  video_action('play')
94
102
  end
@@ -198,6 +206,12 @@ module Glimmer
198
206
  'loaded' => 'canplay',
199
207
  }
200
208
 
209
+ def set_video_source
210
+ run_on_completed do
211
+ video_attribute_set('src', source)
212
+ end
213
+ end
214
+
201
215
  def video_action(action)
202
216
  run_on_completed do
203
217
  swt_widget.execute("document.getElementById('video').#{action}()")
@@ -58,7 +58,7 @@ class Gladiator
58
58
  @selected_child&.write_dirty_content
59
59
  new_child = Gladiator::File.new(selected_path)
60
60
  begin
61
- if new_child.lines.any?
61
+ unless new_child.dirty_content.nil?
62
62
  self.selected_child&.stop_filewatcher
63
63
  self.selected_child = new_child
64
64
  self.selected_child.start_filewatcher
@@ -144,6 +144,7 @@ class Gladiator
144
144
 
145
145
  def comment_line!
146
146
  old_lines = lines
147
+ return if old_lines.size < 1
147
148
  old_selection_count = self.selection_count
148
149
  old_caret_position = self.caret_position
149
150
  old_caret_position_line_index = line_index_for_caret_position(old_caret_position)
@@ -177,13 +178,14 @@ class Gladiator
177
178
  end
178
179
 
179
180
  def indent!
181
+ new_lines = lines
180
182
  old_lines = lines
183
+ return if old_lines.size < 1
181
184
  old_selection_count = self.selection_count
182
185
  old_caret_position = self.caret_position
183
186
  old_caret_position_line_index = line_index_for_caret_position(old_caret_position)
184
187
  old_caret_position_line_caret_position = caret_position_for_line_index(old_caret_position_line_index)
185
188
  old_end_caret_line_index = end_caret_position_line_index(caret_position, selection_count)
186
- new_lines = lines
187
189
  delta = 2
188
190
  line_indices_for_selection(caret_position, selection_count).each do |the_line_index|
189
191
  the_line = old_lines[the_line_index]
@@ -200,13 +202,14 @@ class Gladiator
200
202
  end
201
203
 
202
204
  def outdent!
205
+ new_lines = lines
203
206
  old_lines = lines
207
+ return if old_lines.size < 1
204
208
  old_selection_count = self.selection_count
205
209
  old_caret_position = self.caret_position
206
210
  old_caret_position_line_index = line_index_for_caret_position(old_caret_position)
207
211
  old_caret_position_line_caret_position = caret_position_for_line_index(old_caret_position_line_index)
208
212
  old_end_caret_line_index = end_caret_position_line_index(caret_position, selection_count)
209
- new_lines = lines
210
213
  delta = 0
211
214
  line_indices_for_selection(caret_position, selection_count).each do |the_line_index|
212
215
  the_line = old_lines[the_line_index]
@@ -231,6 +234,7 @@ class Gladiator
231
234
 
232
235
  def kill_line!
233
236
  new_lines = lines
237
+ return if new_lines.size < 2
234
238
  line_indices = line_indices_for_selection(caret_position, selection_count)
235
239
  new_lines = new_lines[0...line_indices.first] + new_lines[(line_indices.last+1)...new_lines.size]
236
240
  old_caret_position = self.caret_position
@@ -239,13 +243,14 @@ class Gladiator
239
243
  end
240
244
 
241
245
  def duplicate_line!
246
+ new_lines = lines
242
247
  old_lines = lines
248
+ return if old_lines.size < 1
243
249
  old_selection_count = self.selection_count
244
250
  old_caret_position = self.caret_position
245
251
  old_caret_position_line_index = line_index_for_caret_position(old_caret_position)
246
252
  old_caret_position_line_caret_position = caret_position_for_caret_position_start_of_line(old_caret_position_line_index)
247
253
  old_end_caret_line_index = end_caret_position_line_index(caret_position, selection_count)
248
- new_lines = lines
249
254
  the_line_indices = line_indices_for_selection(caret_position, selection_count)
250
255
  the_lines = lines_for_selection(caret_position, selection_count)
251
256
  delta = the_lines.join("\n").size + 1
@@ -292,14 +297,15 @@ class Gladiator
292
297
  end
293
298
 
294
299
  def ensure_find_next
300
+ return if find_text.to_s.empty? || dirty_content.to_s.strip.size < 1
295
301
  find_next unless dirty_content[caret_position, find_text.size] == find_text
296
302
  end
297
303
 
298
- def replace_next
299
- return if find_text.to_s.empty?
304
+ def replace_next!
305
+ return if find_text.to_s.empty? || dirty_content.to_s.strip.size < 1
300
306
  ensure_find_next
301
307
  new_dirty_content = dirty_content
302
- new_dirty_content[caret_position, find_text.size] = replace_text
308
+ new_dirty_content[caret_position, find_text.size] = replace_text.to_s
303
309
  self.dirty_content = new_dirty_content
304
310
  find_next
305
311
  end
@@ -322,6 +328,7 @@ class Gladiator
322
328
 
323
329
  def move_up!
324
330
  old_lines = lines
331
+ return if old_lines.size < 2
325
332
  old_selection_count = self.selection_count
326
333
  old_caret_position = self.caret_position
327
334
  old_caret_position_line_index = line_index_for_caret_position(old_caret_position)
@@ -345,6 +352,7 @@ class Gladiator
345
352
 
346
353
  def move_down!
347
354
  old_lines = lines
355
+ return if old_lines.size < 2
348
356
  old_selection_count = self.selection_count
349
357
  old_caret_position = self.caret_position
350
358
  old_caret_position_line_index = line_index_for_caret_position(old_caret_position)
@@ -435,8 +443,8 @@ class Gladiator
435
443
  return if config_yaml.to_s.strip.empty?
436
444
  @config = YAML.load(config_yaml)
437
445
  Gladiator::Dir.local_dir.selected_child_path = @config[:selected_child_path] if @config[:selected_child_path]
438
- Gladiator::Dir.local_dir.selected_child.caret_position = Gladiator::Dir.local_dir.selected_child.caret_position_for_caret_position_start_of_line(@config[:caret_position]) if @config[:caret_position]
439
- Gladiator::Dir.local_dir.selected_child.top_index = @config[:top_index] if @config[:top_index]
446
+ Gladiator::Dir.local_dir.selected_child&.caret_position = Gladiator::Dir.local_dir.selected_child&.caret_position_for_caret_position_start_of_line(@config[:caret_position]) if @config[:caret_position]
447
+ Gladiator::Dir.local_dir.selected_child&.top_index = @config[:top_index] if @config[:top_index]
440
448
  end
441
449
  end
442
450
 
@@ -610,7 +618,7 @@ class Gladiator
610
618
  }
611
619
  on_key_pressed { |key_event|
612
620
  if key_event.keyCode == swt(:cr)
613
- Gladiator::Dir.local_dir.selected_child.replace_next
621
+ Gladiator::Dir.local_dir.selected_child.replace_next!
614
622
  elsif key_event.keyCode == swt(:esc)
615
623
  @text.swt_widget.setFocus
616
624
  end
@@ -707,4 +715,11 @@ class Gladiator
707
715
  end
708
716
  end
709
717
 
718
+ include Glimmer
719
+ at_exit do
720
+ async_exec do
721
+ Gladiator::Dir.local_dir.selected_child&.write_dirty_content
722
+ end
723
+ end
724
+
710
725
  Gladiator.new.launch
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.10
4
+ version: 0.5.11
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-25 00:00:00.000000000 Z
11
+ date: 2020-04-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement