glimmer 1.0.3 → 1.0.8

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: 6c811a5ad9035fc6c1694381ae4616a733a6b2df5a24d822b081cd6ed2abe0bf
4
- data.tar.gz: 4de150db297d177b2e040dd0026186f44bd0b8536a574a723332f7cf9c012ca6
3
+ metadata.gz: 6f3b9d6aa82ade846c56a4c1128d51fdcb7fcffbd5aa4e0c3a30272556538a07
4
+ data.tar.gz: bdbc807624d438309c9b6f5581056412d68008b14b60b28016cdd486b1d05270
5
5
  SHA512:
6
- metadata.gz: fcac37985eab50d992b68ea5a0068c0a942609f25980d995d6d2221047af14d5635b61fae3c6a5444a831f5a6683a49a4cb60aa8adc8aee23ef77a3e0341f242
7
- data.tar.gz: 2e398c63b3d8c12230ae177dc7ee91e0a98d48c4131d89264b29fa8cb27784727259a9d1ea130d415692a6264c5384145f7a771f7ac8f95f9fd49ced91cdf604
6
+ metadata.gz: af20767a864c17dcb33decb04c24439f34a103dd1205e0adb79983227dcef684dfd7af6c1a6ccde7b9541befb7ddc027aa74d25dc0f07cc4c857cb2079b0f835
7
+ data.tar.gz: 9a1e882342a1a08912e365d2e7950e195b50a83b7a554a4df2de447151c324c1b91ecc93d56e10aaaf248b2dace385e184439ac50717bf81e8d39c4ef08e8d76
@@ -3,6 +3,29 @@
3
3
  Related Change Logs:
4
4
  - [glimmer-dsl-swt/CHANGELOG.md](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/CHANGELOG.md)
5
5
 
6
+ ## 1.0.8
7
+
8
+ - Concurrent Array/Hash/Set data structures to better support parallel multi-threading
9
+ - Fix issue with a certain nil static_expression case not handled properly in Glimmer::DSL::Engine
10
+
11
+ ## 1.0.7
12
+
13
+ - Refactor generated `__original_{method_name}` methods in `ObservableModel` to have double-underscore after the word "original" as `__original__{method_name}` to improve clarity that the method is generated via meta-programming of a pre-existing method
14
+ - Fix issue regarding testing array object observer on a nil object
15
+
16
+ ## 1.0.6
17
+
18
+ - Update ModelBinding to raise an error if called to make a change while configurd as binding_options[:read_only]=true
19
+
20
+ ## 1.0.5
21
+
22
+ - Fix issue in Opal regarding auto-definition of observable methods in a Class/Module directly (as opposed to a class instance)
23
+
24
+ ## 1.0.4
25
+
26
+ - Ensure that `ObservableModel#remove_observer` clears observer registrations from `Observer` (just like `Observer#unobserve`)
27
+ - `ObservableModel#remove_observers` and `ObservableModel#remove_all_observers` methods
28
+
6
29
  ## 1.0.3
7
30
 
8
31
  - Upgraded array_include_methods gem to v1.0.4
@@ -1,4 +1,4 @@
1
- Copyright (c) 2007-2020 Andy Maleh
1
+ Copyright (c) 2007-2021 Andy Maleh
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/PROCESS.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Glimmer Process (Beyond Agile)
2
2
 
3
- **Glimmer Process** is the lightweight software development process used for building [Glimmer](https://github.com/AndyObtiva/glimmer) libraries and [Glimmer](https://github.com/AndyObtiva/glimmer) apps, which goes beyond Agile, rendering all Agile processes obsolete. **Glimmer Process** is simply made up of 7 guidelines to pick and choose as necessary until software development needs are satisfied. Not all guidelines need to be incorporated into every project, but it is still important to think through every one of them before ruling any out. Guidelines can be followed in any order.
3
+ **Glimmer Process** is the lightweight software development process used for building [Glimmer](https://github.com/AndyObtiva/glimmer) libraries and [Glimmer](https://github.com/AndyObtiva/glimmer) apps, which goes beyond Agile, rendering all Agile processes obsolete. **Glimmer Process** is simply made up of 7 guidelines to pick and choose as necessary until software development needs are satisfied. Not all guidelines need to be incorporated into every project, but it is still important to think through every one of them before ruling any out. Guidelines can be followed in any order.
4
4
 
5
5
  ## GPG (Glimmer Process Guidelines):
6
6
  1. **Requirements Gathering**: Spend no more than a few hours writing the initial requirements you know from the business owner, gathering missing requirements, and planning to elicit more requirements from users, customers, and stakeholders. Requirements are not set in stone, but serve as a good starting point in understanding what a project is about. After initial release, only document small tasks going forward.
@@ -13,7 +13,7 @@
13
13
 
14
14
  --
15
15
 
16
- Copyright (c) 2020 Andy Maleh
16
+ Copyright (c) 2020-2021 Andy Maleh
17
17
 
18
18
  Permission is hereby granted, free of charge, to any person obtaining
19
19
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -1,56 +1,53 @@
1
- # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 style="position: relative; top: 20px;" />](https://rubygems.org/gems/glimmer) Glimmer 1.0.3 - DSL Framework
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 style="position: relative; top: 20px;" />](https://rubygems.org/gems/glimmer) Glimmer 1.0.8 - DSL Framework
2
2
  [![Gem Version](https://badge.fury.io/rb/glimmer.svg)](http://badge.fury.io/rb/glimmer)
3
- [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer)
3
+ [![rspec](https://github.com/AndyObtiva/glimmer/workflows/rspec/badge.svg)](https://github.com/AndyObtiva/glimmer/actions?query=workflow%3Arspec)
4
4
  [![Coverage Status](https://coveralls.io/repos/github/AndyObtiva/glimmer/badge.svg?branch=master)](https://coveralls.io/github/AndyObtiva/glimmer?branch=master)
5
5
  [![Maintainability](https://api.codeclimate.com/v1/badges/38fbc278022862794414/maintainability)](https://codeclimate.com/github/AndyObtiva/glimmer/maintainability)
6
6
  [![Join the chat at https://gitter.im/AndyObtiva/glimmer](https://badges.gitter.im/AndyObtiva/glimmer.svg)](https://gitter.im/AndyObtiva/glimmer?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
7
7
 
8
8
  **[Contributors Wanted! (Submit a Glimmer App Sample to Get Started)](#contributing)**
9
9
 
10
- (The Original Glimmer Library Since 2007. Beware of Imitators!)
10
+ **(The Original Glimmer Library Since 2007. Beware of Imitators!)**
11
11
 
12
- [**Glimmer**](https://rubygems.org/gems/glimmer) is a DSL Framework that consists of:
13
- - DSL Engine: enables building DSLs for desktop GUI, XML/HTML documents, CSS styling, and webification of desktop apps.
14
- - Data-Binding/Observer/Observable Library: enables synchronizing GUI with Model Attributes bidirectionally.
12
+ [**Glimmer**](https://rubygems.org/gems/glimmer) started out as a [GUI Library](https://github.com/AndyObtiva/glimmer-dsl-swt) and grew into a full-fledged [DSL Framework](#dsl-engine) with support for multiple GUI DSLs. Glimmer's namesake is referring to the Glimmer of Ruby in Graphical User Interfaces (contrary to popular myth perpetrated by [Charles Nutter](http://blog.headius.com/2007/11/tab-sweep.html), Glimmer has nothing to do with the ill-fated Whitney Houston movie, which does not in fact share the same name)
15
13
 
16
- [**Glimmer**](https://rubygems.org/gems/glimmer) started out as [GUI Library](https://github.com/AndyObtiva/glimmer-dsl-swt) and grew into a full-fledged [DSL Framework](#multi-dsl-support). Glimmer's namesake is referring to the Glimmer of Ruby in Graphical User Interfaces (contrary to popular myth perpetrated by [Charles Nutter](http://blog.headius.com/2007/11/tab-sweep.html), Glimmer has nothing to do with the ill-fated Whitney Houston movie, which does not in fact share the same name)
14
+ [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
15
+ Featured in JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do) and [Chalmers/Gothenburg University Software Engineering Master's Lecture Material](http://www.cse.chalmers.se/~bergert/slides/guest_lecture_DSLs.pdf)
16
+
17
+ [**Glimmer**](https://rubygems.org/gems/glimmer) is a DSL (Domain-Specific Language) Framework that consists of two things:
18
+ - [DSL Engine](#dsl-engine): enables building internal DSLs embedded in Ruby (e.g. for GUI, XML, or CSS).
19
+ - [Data-Binding Library](#data-binding-library): enables synchronizing GUI with Model Attributes bidirectionally.
20
+
21
+ [**Glimmer**](https://rubygems.org/gems/glimmer) is ***the cream of the crop*** when it comes to building DSLs in Ruby:
22
+ - Supports building the tersest most concise domain specific language syntax in Ruby.
23
+ - Maximum readability and maintainability.
24
+ - No extra unnecessary block variables when not needed.
25
+ - DSL Blocks are true Ruby closures that can conveniently leverage variables from the outside and utilize standard Ruby code in and around. Just code in Ruby as usual and be happy! No surprising restrictions or strange uses of `instance_exec`/`eval`.
26
+ - DSL syntax is limited to classes that mixin the `Glimmer` module, so the rest of the code is fully safe from namespace pollution.
27
+ - Multiple DSLs may be [mixed](#multi-dsl-support) together safely to achieve maximum expressability, composability, and productivity.
28
+ - DSLs are fully configurable, so you may activate and deactivate DSLs as per your current needs only.
17
29
 
18
30
  [**Glimmer**](https://rubygems.org/gems/glimmer) supports the following DSLs:
19
- - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Library)
20
- - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
21
- - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
31
+ - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
32
+ - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
22
33
  - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
23
34
  - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
35
+ - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
24
36
 
25
37
  [Glimmer and/or Glimmer DSLs receive two updates per month](https://rubygems.org/gems/glimmer-dsl-swt/versions). You can trust [Glimmer](https://rubygems.org/gems/glimmer) with your Ruby development needs.
26
38
 
27
- [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
28
- Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do)
29
-
30
- ## Table of contents
31
-
32
- - [Glimmer 1.0.3](#-glimmer-103)
33
- - [Glimmer DSL for SWT (JRuby Desktop Development GUI Library)](#glimmer-dsl-for-swt-jruby-desktop-development-gui-library)
34
- - [Glimmer DSL for SWT Samples](#glimmer-dsl-for-swt-samples)
35
- - [Hello, World!](#hello-world)
36
- - [Tic Tac Toe](#tic-tac-toe)
37
- - [Contact Manager](#contact-manager)
38
- - [Production Desktop Apps Built with Glimmer DSL for SWT](#production-desktop-apps-built-with-glimmer-dsl-for-swt)
39
- - [Glimmer DSL for Tk (Ruby Desktop Development GUI Library)](#glimmer-dsl-for-tk-ruby-desktop-development-gui-library)
40
- - [Glimmer DSL for Tk Samples](#glimmer-dsl-for-tk-samples)
41
- - [Hello, World!](#hello-world)
42
- - [Hello, Tab!](#hello-tab)
43
- - [Hello, Combo!](#hello-combo)
44
- - [Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)](#glimmer-dsl-for-opal-web-gui-adapter-for-desktop-apps)
45
- - [Glimmer DSL for Opal Samples](#glimmer-dsl-for-opal-samples)
46
- - [Hello, Computed!](#hello-computed)
47
- - [Glimmer Calculator](#glimmer-calculator)
48
- - [Glimmer DSL for XML (& HTML)](#glimmer-dsl-for-xml--html)
49
- - [XML DSL](#xml-dsl)
50
- - [Glimmer DSL for CSS](#glimmer-dsl-for-css)
51
- - [CSS DSL](#css-dsl)
52
- - [Multi-DSL Support](#multi-dsl-support)
53
- - [Glimmer Supporting Libraries](#glimmer-supporting-libraries)
39
+ ## Table of Contents
40
+
41
+ - [Glimmer 1.0.8](#-glimmer-108---dsl-framework)
42
+ - [Official DSLs](#official-dsls)
43
+ - [Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](#glimmer-dsl-for-swt-jruby-desktop-development-gui-framework)
44
+ - [Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](#glimmer-dsl-for-opal-pure-ruby-web-gui-and-auto-webifier-of-desktop-apps)
45
+ - [Glimmer DSL for XML (& HTML)](#glimmer-dsl-for-xml--html)
46
+ - [Glimmer DSL for CSS](#glimmer-dsl-for-css)
47
+ - [Glimmer DSL for Tk (Ruby Desktop Development GUI Library)](#glimmer-dsl-for-tk-ruby-desktop-development-gui-library)
48
+ - [DSL Engine](#dsl-engine)
49
+ - [Multi-DSL Support](#multi-dsl-support)
50
+ - [Data-Binding Library](#data-binding-library)
54
51
  - [Glimmer Process](#glimmer-process)
55
52
  - [Resources](#resources)
56
53
  - [Help](#help)
@@ -62,16 +59,24 @@ Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.d
62
59
  - [Contributors](#contributors)
63
60
  - [Hire Me](#hire-me)
64
61
  - [License](#license)
65
-
66
- ## Glimmer DSL for SWT (JRuby Desktop Development GUI Library)
67
62
 
68
- [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://rubygems.org/gems/glimmer)'s main innovation is a declarative [Ruby DSL](https://github.com/AndyObtiva/glimmer-dsl-swt#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) additionally innovates by having built-in [data-binding](https://github.com/AndyObtiva/glimmer-dsl-swt#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns. To get started quickly, [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) offers [scaffolding](https://github.com/AndyObtiva/glimmer-dsl-swt#scaffolding) options for [Apps](https://github.com/AndyObtiva/glimmer-dsl-swt#in-production), [Gems](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-shell-gem), and [Custom Widgets](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-widgets). [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) also includes native-executable [packaging](https://github.com/AndyObtiva/glimmer-dsl-swt#packaging--distribution) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/) and MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows).
63
+ ## Official DSLs
64
+
65
+ Here, we showcase official Glimmer DSLs; that is [gems starting with the `glimmer-dsl-` prefix](https://rubygems.org/search?query=glimmer-dsl-).
66
+
67
+ (you can skip ahead if you prefer to learn more about the Glimmer [DSL Engine](#dsl-engine) or [Data-Binding Library](#data-binding-library) first)
69
68
 
70
- ### Glimmer DSL for SWT Samples
69
+ ### Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
71
70
 
72
- #### Hello, World!
71
+ [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://rubygems.org/gems/glimmer)'s main innovation is a declarative [Ruby DSL](https://github.com/AndyObtiva/glimmer-dsl-swt#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) additionally innovates by having built-in [data-binding](https://github.com/AndyObtiva/glimmer-dsl-swt#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns, or alternatively drive development GUI-first, and then write clean business models (test-first) afterwards. To get started quickly, [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) offers [scaffolding](https://github.com/AndyObtiva/glimmer-dsl-swt#scaffolding) options for [Apps](https://github.com/AndyObtiva/glimmer-dsl-swt#in-production), [Gems](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-shell-gem), and [Custom Widgets](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-widgets). [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) also includes native-executable [packaging](https://github.com/AndyObtiva/glimmer-dsl-swt#packaging--distribution) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/) and MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows).
73
72
 
74
- Glimmer code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_world.rb)):
73
+ To get started, visit the [Glimmer DSL for SWT project page](https://github.com/AndyObtiva/glimmer-dsl-swt#pre-requisites) for instructions on installing the [glimmer-dsl-swt gem](https://rubygems.org/gems/glimmer-dsl-swt).
74
+
75
+ #### Glimmer DSL for SWT Samples
76
+
77
+ ##### Hello, World!
78
+
79
+ Glimmer GUI code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_world.rb)):
75
80
  ```ruby
76
81
  include Glimmer
77
82
 
@@ -83,23 +88,16 @@ shell {
83
88
  }.open
84
89
  ```
85
90
 
86
- Run:
87
- ```
88
- glimmer sample:run[hello_world]
89
- ```
90
-
91
91
  Glimmer app:
92
92
 
93
93
  ![Hello World](images/glimmer-hello-world.png)
94
94
 
95
- #### Tic Tac Toe
95
+ ##### Tic Tac Toe
96
96
 
97
- Glimmer code (from [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/tic_tac_toe.rb)):
97
+ Glimmer GUI code (from [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/tic_tac_toe.rb)):
98
98
 
99
99
  ```ruby
100
100
  # ...
101
- @tic_tac_toe_board = Board.new
102
-
103
101
  @shell = shell {
104
102
  text "Tic-Tac-Toe"
105
103
  minimum_size 150, 178
@@ -120,27 +118,16 @@ Glimmer code (from [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObt
120
118
  }
121
119
  }
122
120
  }
123
-
124
- observe(@tic_tac_toe_board, :game_status) { |game_status|
125
- display_win_message if game_status == Board::WIN
126
- display_draw_message if game_status == Board::DRAW
127
- }
128
121
  # ...
129
122
  ```
130
123
 
131
- Run:
132
-
133
- ```
134
- glimmer sample:run[tic_tac_toe]
135
- ```
136
-
137
124
  Glimmer app:
138
125
 
139
126
  ![Tic Tac Toe](images/glimmer-tic-tac-toe-in-progress.png)
140
127
 
141
- #### Contact Manager
128
+ ##### Contact Manager
142
129
 
143
- Glimmer code (from [samples/elaborate/contact_manager.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/contact_manager.rb)):
130
+ Glimmer GUI code (from [samples/elaborate/contact_manager.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/contact_manager.rb)):
144
131
 
145
132
  ```ruby
146
133
  # ...
@@ -253,150 +240,31 @@ Glimmer code (from [samples/elaborate/contact_manager.rb](https://github.com/And
253
240
  # ...
254
241
  ```
255
242
 
256
- Run:
257
-
258
- ```
259
- glimmer sample:run[contact_manager]
260
- ```
261
-
262
243
  Glimmer App:
263
244
 
264
245
  ![Contact Manager](images/glimmer-contact-manager.png)
265
246
 
266
- ### Production Desktop Apps Built with Glimmer DSL for SWT
247
+ #### Production Desktop Apps Built with Glimmer DSL for SWT
267
248
 
268
249
  [<img alt="Are We There Yet Logo" src="https://raw.githubusercontent.com/AndyObtiva/are-we-there-yet/master/are-we-there-yet-logo.svg" width="40" />Are We There Yet?](https://github.com/AndyObtiva/are-we-there-yet) - Small Project Tracking App
269
250
 
270
- ![Are We There Yet? App Screenshot](https://raw.githubusercontent.com/AndyObtiva/are-we-there-yet/master/are-we-there-yet-screenshot-windows.png)
251
+ [![Are We There Yet? App Screenshot](https://raw.githubusercontent.com/AndyObtiva/are-we-there-yet/master/are-we-there-yet-screenshot-windows.png)](https://github.com/AndyObtiva/are-we-there-yet)
271
252
 
272
253
  [<img alt="Math Bowling Logo" src="https://raw.githubusercontent.com/AndyObtiva/MathBowling/master/images/math-bowling-logo.png" width="40" />Math Bowling](https://github.com/AndyObtiva/MathBowling) - Elementary Level Math Game Featuring Bowling Rules
273
254
 
274
- ![Math Bowling App Screenshot](https://raw.githubusercontent.com/AndyObtiva/MathBowling/master/Math-Bowling-Screenshot.png)
275
-
276
- ## Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
277
-
278
- [Tcl/Tk](https://www.tcl.tk/) has evolved into a practical desktop GUI toolkit due to gaining truely native looking widgets on Mac, Windows, and Linux in [Tk version 8.5](https://www.tcl.tk/software/tcltk/8.5.html#:~:text=Highlights%20of%20Tk%208.5&text=Font%20rendering%3A%20Now%20uses%20anti,and%20window%20layout%2C%20and%20more.).
279
-
280
- Additionally, [Ruby](https://www.ruby-lang.org/en/) 3.0 Ractor (formerly known as [Guilds](https://olivierlacan.com/posts/concurrency-in-ruby-3-with-guilds/)) supports truly parallel multi-threading, making both [MRI](https://github.com/ruby/ruby) and [Tk](https://www.tcl.tk/) finally viable for support in [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library) as an alternative to [JRuby on SWT](https://github.com/AndyObtiva/glimmer-dsl-swt).
281
-
282
- The trade-off is that while [SWT](https://www.eclipse.org/swt/) provides a plethora of high quality reusable widgets for the Enterprise (such as [Nebula](https://www.eclipse.org/nebula/)), [Tk](https://www.tcl.tk/) enables very fast app startup time via [MRI Ruby](https://www.ruby-lang.org/en/).
283
-
284
- [Glimmer DSL for Tk](https://github.com/AndyObtiva/glimmer-dsl-tk) aims to provide a DSL similar to the [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) to enable more productive desktop development in Ruby with:
285
- - Declarative DSL syntax that visually maps to the GUI widget hierarchy
286
- - Convention over configuration via smart defaults and automation of low-level details
287
- - Requiring the least amount of syntax possible to build GUI
288
- - Bidirectional Data-Binding to declaratively wire and automatically synchronize GUI with Business Models
289
- - Custom Widget support
290
- - Scaffolding for new custom widgets, apps, and gems
291
- - Native-Executable packaging on Mac, Windows, and Linux
292
-
293
- ### Glimmer DSL for Tk Samples
294
-
295
- #### Hello, World!
296
-
297
- Glimmer code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_world.rb)):
298
-
299
- ```ruby
300
- include Glimmer
301
-
302
- root {
303
- label {
304
- text 'Hello, World!'
305
- }
306
- }.open
307
- ```
308
-
309
- Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
310
-
311
- ```
312
- ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_world.rb'"
313
- ```
314
-
315
- Glimmer app:
316
-
317
- ![glimmer dsl tk screenshot sample hello world](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-world.png)
318
-
319
- #### Hello, Tab!
320
-
321
- Glimmer code (from [samples/hello/hello_tab.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_tab.rb)):
322
-
323
- ```ruby
324
- include Glimmer
325
-
326
- root {
327
- title 'Hello, Tab!'
328
-
329
- notebook {
330
- frame(text: 'English') {
331
- label {
332
- text 'Hello, World!'
333
- }
334
- }
335
-
336
- frame(text: 'French') {
337
- label {
338
- text 'Bonjour, Univers!'
339
- }
340
- }
341
- }
342
- }.open
343
- ```
344
-
345
- Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
346
-
347
- ```
348
- ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_tab.rb'"
349
- ```
350
-
351
- Glimmer app:
352
-
353
- ![glimmer dsl tk screenshot sample hello tab English](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-tab-english.png)
354
- ![glimmer dsl tk screenshot sample hello tab French](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-tab-french.png)
255
+ [![Math Bowling App Screenshot](https://raw.githubusercontent.com/AndyObtiva/MathBowling/master/Math-Bowling-Screenshot.png)](https://github.com/AndyObtiva/MathBowling)
355
256
 
356
- #### Hello, Combo!
357
-
358
- Glimmer code (from [samples/hello/hello_combo.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_combo.rb)):
359
-
360
- ```ruby
361
- # ... more code precedes
362
- root {
363
- title 'Hello, Combo!'
364
-
365
- combobox { |proxy|
366
- state 'readonly'
367
- text bind(person, :country)
368
- }
369
-
370
- button { |proxy|
371
- text "Reset Selection"
372
- command {
373
- person.reset_country
374
- }
375
- }
376
- }.open
377
- # ... more code follows
378
- ```
379
-
380
- Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
381
-
382
- ```
383
- ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_combo.rb'"
384
- ```
385
-
386
- Glimmer app:
387
-
388
- ![glimmer dsl tk screenshot sample hello combo](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-combo.png)
389
- ![glimmer dsl tk screenshot sample hello combo dropdown](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-combo-dropdown.png)
390
-
391
- ## Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
257
+ ### Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
392
258
 
393
259
  [Glimmer DSL for Opal](https://github.com/AndyObtiva/glimmer-dsl-opal) is an experimental proof-of-concept web GUI adapter for [Glimmer](https://github.com/AndyObtiva/glimmer) desktop apps (i.e. apps built with [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt)). It webifies them via [Rails](https://rubyonrails.org/), allowing Ruby desktop apps to run on the web via [Opal Ruby](https://opalrb.com/) without changing a line of code. Apps may then be custom-styled for the web with standard CSS.
394
260
 
395
261
  Glimmer DSL for Opal webifier successfully reuses the entire [Glimmer](https://github.com/AndyObtiva/glimmer) core DSL engine in [Opal Ruby](https://opalrb.com/) inside a web browser, and as such inherits the full range of powerful Glimmer desktop [data-binding](https://github.com/AndyObtiva/glimmer#data-binding) capabilities for the web.
396
262
 
397
- ### Glimmer DSL for Opal Samples
263
+ To get started, visit the [Glimmer DSL for Opal project page](https://github.com/AndyObtiva/glimmer-dsl-opal) for instructions on installing the [glimmer-dsl-opal gem](https://rubygems.org/gems/glimmer-dsl-opal).
264
+
265
+ #### Glimmer DSL for Opal Samples
398
266
 
399
- #### Hello, Computed!
267
+ ##### Hello, Computed!
400
268
 
401
269
  Add the following require statement to `app/assets/javascripts/application.rb`
402
270
 
@@ -515,7 +383,7 @@ You should see "Hello, Computed!"
515
383
 
516
384
  ![Glimmer DSL for Opal Hello Computed](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-opal/master/images/glimmer-dsl-opal-hello-computed.png)
517
385
 
518
- #### Glimmer Calculator
386
+ ##### Glimmer Calculator
519
387
 
520
388
  Add the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem to `Gemfile` (without requiring):
521
389
 
@@ -585,7 +453,7 @@ Visit `http://localhost:3000`
585
453
 
586
454
  You should see "Glimmer Calculator"
587
455
 
588
- ![Glimmer Calculator Opal](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-opal.png)
456
+ [![Glimmer Calculator Opal](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-opal.png)](http://glimmer-cs-calculator-server.herokuapp.com)
589
457
 
590
458
  Here is an Apple Calculator CSS themed version (with [CSS only](https://github.com/AndyObtiva/glimmer-cs-calculator/blob/master/server/glimmer-cs-calculator-server/app/assets/stylesheets/welcomes_apple.scss), no app code changes):
591
459
 
@@ -593,15 +461,15 @@ Visit http://glimmer-cs-calculator-server.herokuapp.com/welcomes/apple
593
461
 
594
462
  You should see "Apple Calculator Theme"
595
463
 
596
- ![Glimmer Calculator Opal Apple Calculator Theme](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-opal-apple.png)
464
+ [![Glimmer Calculator Opal Apple Calculator Theme](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-opal-apple.png)](http://glimmer-cs-calculator-server.herokuapp.com/welcomes/apple)
597
465
 
598
- ## Glimmer DSL for XML (& HTML)
466
+ ### Glimmer DSL for XML (& HTML)
599
467
 
600
468
  [Glimmer DSL for XML](https://github.com/AndyObtiva/glimmer-dsl-xml) provides Ruby syntax for building XML (eXtensible Markup Language) documents.
601
469
 
602
470
  Within the context of desktop development, Glimmer DSL for XML is useful in providing XML data for the [SWT Browser widget](https://github.com/AndyObtiva/glimmer/tree/master#browser-widget).
603
471
 
604
- ### XML DSL
472
+ #### XML DSL
605
473
 
606
474
  Simply start with `html` keyword and add HTML inside its block using Glimmer DSL syntax.
607
475
  Once done, you may call `to_s`, `to_xml`, or `to_html` to get the formatted HTML output.
@@ -633,13 +501,13 @@ Output:
633
501
  <html><head><meta name="viewport" content="width=device-width, initial-scale=2.0" /></head><body><h1>Hello, World!</h1></body></html>
634
502
  ```
635
503
 
636
- ## Glimmer DSL for CSS
504
+ ### Glimmer DSL for CSS
637
505
 
638
506
  [Glimmer DSL for CSS](https://github.com/AndyObtiva/glimmer-dsl-css) provides Ruby syntax for building CSS (Cascading Style Sheets).
639
507
 
640
508
  Within the context of [Glimmer](https://github.com/AndyObtiva/glimmer) app development, Glimmer DSL for CSS is useful in providing CSS for the [SWT Browser widget](https://github.com/AndyObtiva/glimmer/tree/master#browser-widget).
641
509
 
642
- ### CSS DSL
510
+ #### CSS DSL
643
511
 
644
512
  Simply start with `css` keyword and add stylesheet rule sets inside its block using Glimmer DSL syntax.
645
513
  Once done, you may call `to_s` or `to_css` to get the formatted CSS output.
@@ -672,33 +540,328 @@ Output:
672
540
  body{font-size:1.1em;background:white}body > h1{background-color:red;font-size:2em}
673
541
  ```
674
542
 
675
- ## Multi-DSL Support
543
+ ### Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
544
+
545
+ [Tcl/Tk](https://www.tcl.tk/) has evolved into a practical desktop GUI toolkit due to gaining truely native looking widgets on Mac, Windows, and Linux in [Tk version 8.5](https://www.tcl.tk/software/tcltk/8.5.html#:~:text=Highlights%20of%20Tk%208.5&text=Font%20rendering%3A%20Now%20uses%20anti,and%20window%20layout%2C%20and%20more.).
546
+
547
+ Additionally, [Ruby](https://www.ruby-lang.org/en/) 3.0 Ractor (formerly known as [Guilds](https://olivierlacan.com/posts/concurrency-in-ruby-3-with-guilds/)) supports truly parallel multi-threading, making both [MRI](https://github.com/ruby/ruby) and [Tk](https://www.tcl.tk/) finally viable for support in [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library) as an alternative to [JRuby on SWT](https://github.com/AndyObtiva/glimmer-dsl-swt).
548
+
549
+ The trade-off is that while [SWT](https://www.eclipse.org/swt/) provides a plethora of high quality reusable widgets for the Enterprise (such as [Nebula](https://www.eclipse.org/nebula/)), [Tk](https://www.tcl.tk/) enables very fast app startup time via [MRI Ruby](https://www.ruby-lang.org/en/).
550
+
551
+ [Glimmer DSL for Tk](https://github.com/AndyObtiva/glimmer-dsl-tk) aims to provide a DSL similar to the [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) to enable more productive desktop development in Ruby with:
552
+ - Declarative DSL syntax that visually maps to the GUI widget hierarchy
553
+ - Convention over configuration via smart defaults and automation of low-level details
554
+ - Requiring the least amount of syntax possible to build GUI
555
+ - Bidirectional Data-Binding to declaratively wire and automatically synchronize GUI with Business Models
556
+ - Custom Widget support
557
+ - Scaffolding for new custom widgets, apps, and gems
558
+ - Native-Executable packaging on Mac, Windows, and Linux
559
+
560
+ To get started, visit the [Glimmer DSL for Tk project page](https://github.com/AndyObtiva/glimmer-dsl-tk#pre-requisites) for instructions on installing the [glimmer-dsl-tk gem](https://rubygems.org/gems/glimmer-dsl-tk).
561
+
562
+ #### Glimmer DSL for Tk Samples
563
+
564
+ ##### Hello, World!
565
+
566
+ Glimmer code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_world.rb)):
567
+
568
+ ```ruby
569
+ include Glimmer
570
+
571
+ root {
572
+ label {
573
+ text 'Hello, World!'
574
+ }
575
+ }.open
576
+ ```
577
+
578
+ Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
579
+
580
+ ```
581
+ ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_world.rb'"
582
+ ```
583
+
584
+ Glimmer app:
585
+
586
+ ![glimmer dsl tk screenshot sample hello world](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-world.png)
587
+
588
+ ##### Hello, Tab!
589
+
590
+ Glimmer code (from [samples/hello/hello_tab.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_tab.rb)):
591
+
592
+ ```ruby
593
+ include Glimmer
594
+
595
+ root {
596
+ title 'Hello, Tab!'
597
+
598
+ notebook {
599
+ frame(text: 'English') {
600
+ label {
601
+ text 'Hello, World!'
602
+ }
603
+ }
604
+
605
+ frame(text: 'French') {
606
+ label {
607
+ text 'Bonjour, Univers!'
608
+ }
609
+ }
610
+ }
611
+ }.open
612
+ ```
613
+
614
+ Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
615
+
616
+ ```
617
+ ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_tab.rb'"
618
+ ```
619
+
620
+ Glimmer app:
621
+
622
+ ![glimmer dsl tk screenshot sample hello tab English](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-tab-english.png)
623
+ ![glimmer dsl tk screenshot sample hello tab French](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-tab-french.png)
624
+
625
+ ##### Hello, Combo!
626
+
627
+ Glimmer code (from [samples/hello/hello_combo.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_combo.rb)):
628
+
629
+ ```ruby
630
+ # ... more code precedes
631
+ root {
632
+ title 'Hello, Combo!'
633
+
634
+ combobox { |proxy|
635
+ state 'readonly'
636
+ text bind(person, :country)
637
+ }
638
+
639
+ button { |proxy|
640
+ text "Reset Selection"
641
+ command {
642
+ person.reset_country
643
+ }
644
+ }
645
+ }.open
646
+ # ... more code follows
647
+ ```
648
+
649
+ Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
650
+
651
+ ```
652
+ ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_combo.rb'"
653
+ ```
654
+
655
+ Glimmer app:
676
656
 
677
- Glimmer official DSL gems always start with `glimmer-dsl-`. That said, other libraries may use the Glimmer DSL engine too not for building GUI apps (e.g. `bundler-download`)
657
+ ![glimmer dsl tk screenshot sample hello combo](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-combo.png)
658
+ ![glimmer dsl tk screenshot sample hello combo dropdown](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-tk/master/images/glimmer-dsl-tk-screenshot-sample-hello-combo-dropdown.png)
678
659
 
679
- Glimmer allows mixing DSLs, which comes in handy when doing things like using a desktop Browser widget with HTML and CSS.
660
+ ## DSL Engine
661
+
662
+ Glimmer is fundamentally a DSL Engine that can support any number of DSLs like the official Glimmer DSLs (gems starting with the `glimmer-dsl-` prefix like `glimmer-dsl-swt`) or any DSLs for that matter.
680
663
 
681
664
  Glimmer DSL syntax consists mainly of:
682
- - keywords (e.g. `table` for a table widget)
683
- - style/args (e.g. :multi as in `table(:multi)` for a multi-line selection table widget)
684
- - content (e.g. `{ table_column { text 'Name'} }` as in `table(:multi) { table_column { text 'name'} }` for a multi-line selection table widget with a table column having header text property `'Name'` as content)
685
-
686
- DSLs are activated by specific keywords. For example, the `html` keyword activates the Glimmer DSL for XML. Glimmer automatically recognizes top-level keywords in each DSL and activates the DSL accordingly. Once done processing a nested DSL top-level keyword, Glimmer switches back to the prior DSL automatically.
687
-
688
- ## Glimmer Supporting Libraries
689
-
690
- Here is a list of notable 3rd party gems used by Glimmer and Glimmer DSLs:
691
- - [jeweler](https://github.com/technicalpickles/jeweler): generates app gems during [Glimmer Scaffolding](https://github.com/AndyObtiva/glimmer-dsl-swt#scaffolding)
692
- - [logging](https://github.com/TwP/logging): provides extra logging capabilities not available in Ruby Logger such as multi-threaded buffered asynchronous logging (to avoid affecting app performance) and support for multiple appenders such as stdout, syslog, and log files (the last one is needed on Windows where syslog is not supported)
693
- - [nested_inherited_jruby_include_package](https://github.com/AndyObtiva/nested_inherited_jruby_include_package): makes included [SWT](https://www.eclipse.org/swt/)/[Java](https://www.java.com/en/) packages available to all classes/modules that mix in the Glimmer module without having to manually reimport
694
- - [os](https://github.com/rdp/os): provides OS detection capabilities (e.g. `OS.mac?` or `OS.windows?`) to write cross-platform code inexpensively
695
- - [puts_debuggerer](https://github.com/AndyObtiva/puts_debuggerer): helps in troubleshooting when adding `require 'pd'` and using the `pd` command instead of `puts` or `p` (also `#pd_inspect` or `#pdi` instead of `#inspect`)
696
- - [rake](https://github.com/ruby/rake): used to implement and execute `glimmer` commands
697
- - [rake-tui](https://github.com/AndyObtiva/rake-tui): Rake Text-based User Interface. Allows navigating rake tasks with arrow keys and filtering task list by typing to quickly find an run a rake task.
698
- - [rouge](https://github.com/rouge-ruby/rouge): Ruby syntax highlighter used in the `code_text` [Glimmer DSL for SWT custom widget](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-widgets) leveraged by the [Glimmer Meta-Sample](https://github.com/AndyObtiva/glimmer-dsl-swt#samples)
699
- - [super_module](https://github.com/AndyObtiva/super_module): used to cleanly write the Glimmer::UI:CustomWidget and Glimmer::UI::CustomShell modules
700
- - [text-table](https://github.com/aptinio/text-table): renders textual data in a textual table for the command-line interface of Glimmer
701
- - [warbler](https://github.com/jruby/warbler): converts a Glimmer app into a Java JAR file during packaging
665
+ - **keywords** (e.g. `table` for a table widget)
666
+ - **style/args** (e.g. :multi as in `table(:multi)` for a multi-line selection table widget)
667
+ - **content** (e.g. `{ table_column { text 'Name'} }` as in `table(:multi) { table_column { text 'Name'} }` for a multi-line selection table widget with a table column having header text property `'Name'` as content)
668
+
669
+ The Glimmer DSL Engine's architecture is based on the following Design Patterns and Data Structures:
670
+ - **Interpreter Design Pattern**: to define interpretable expressions of DSL keywords
671
+ - **Chain of Responsibility Design Pattern / Queue Data Structure**: to chain expression handlers in order of importance for processing DSL keywords
672
+ - **Adapter Design Pattern**: to adapt expressions into handlers in a chain of responsibility
673
+ - **Stack Data Structure**: to handle processing parent/child nesting of DSL keyword expressions in the correct order
674
+
675
+ Glimmer's use of the **Interpreter Design Pattern** in processing DSLs is also known as the **Virtual Machine Architectural Style**. After all, DSL expressions are virtual machine opcodes that process nested keywords stored in a stack. I built Glimmer's original DSL back in 2007 without knowing the **Virtual Machine Architectural Style** (except perhaps as an esoteric technology powering Java), but stumbled upon it anyways through following the Gang of Four Design Patterns mentioned above, chiefly the **Interpreter Design Pattern**.
676
+
677
+ Every keyword in a Glimmer DSL is represented by a DSL expression that is processed by an `Expression` subclass selected from a chain of expressions (interpreters) pre-configured in a DSL chain of responsibility via `Glimmer::DSL::Engine.add_dynamic_expressions(DSLNameModule, expression_names_array)`.
678
+
679
+ Expressions are either:
680
+ - **Static** (subclass of `StaticExpression`, which is a subclass of `Expression`): if they represent a single pre-identified keyword (e.g. `color` or `display`)
681
+ - **Dynamic** (subclass of `Expression`): if they represent keywords calculated on the fly during processing (e.g. an SWT widget like `label` or a random XML element called `folder` representing `<folder></folder>`)
682
+
683
+ Optionally, expressions can be parent expressions that contain other expressions, and must include the `ParentExpression` mixin module as such.
684
+
685
+ Additionally, every expression that serves as a top-level entry point into the DSL must mixin `TopLevelExpression`
686
+
687
+ Static expressions are optimized in performance since they pre-define methods on the `Glimmer` module matching the static keywords they represent (e.g. `color` causes creating a `Glimmer#color` method for processing `color` expressions) and completely bypass as a result the Glimmer DSL Engine Chain of Responsibility. That said, they must be avoided if the same keyword might occur multiple times, but with different requirements for arguments, block, and parenthood type.
688
+
689
+ Every `Expression` sublcass must specify two methods at least:
690
+ - `can_interpret?(parent, keyword, *args, &block)`: to quickly test if the keyword and arg/block/parent combination qualifies for interpretation by the current `Expression` or to otherwise delegate to the next expression in the chain of responsibility.
691
+ - `interpret(parent, keyword, *args, &block)`: to go ahead and interpret a DSL expression that qualified for interpretation
692
+
693
+ `StaticExpression` sublcasses may skip the `can_interpret?` method since they include a default implementation for it that matches the name of the keyword from the class name by convention. For example, a `color` keyword would have a `ColorExpression` class, so `color` is inferred automatically from class name and used in deciding whether the class can handle a `color` keyword or not.
694
+
695
+ `ParentExpression` subclasses can optionally override this extra method, which is included by default and simply invokes the parent's passed block to process its children:
696
+ - `add_content(parent, &block)`
697
+
698
+ For example, some parent widgets use their block for other reasons or process their children at very specific times, so they may override that method and disable it, or otherwise call `super` and do additional work.
699
+
700
+ Example of a dynamic expression:
701
+
702
+ ```ruby
703
+ module Glimmer
704
+ module DSL
705
+ module SWT
706
+ class WidgetExpression < Expression
707
+ include ParentExpression
708
+
709
+ EXCLUDED_KEYWORDS = %w[shell display tab_item]
710
+
711
+ def can_interpret?(parent, keyword, *args, &block)
712
+ !EXCLUDED_KEYWORDS.include?(keyword) and
713
+ parent.respond_to?(:swt_widget) and
714
+ Glimmer::SWT::WidgetProxy.widget_exists?(keyword)
715
+ end
716
+
717
+ def interpret(parent, keyword, *args, &block)
718
+ Glimmer::SWT::WidgetProxy.create(keyword, parent, args)
719
+ end
720
+
721
+ def add_content(parent, &block)
722
+ super
723
+ parent.post_add_content
724
+ end
725
+
726
+ end
727
+ end
728
+ end
729
+ end
730
+ ```
731
+
732
+ Example of a static expression (does not need `can_interpret?`):
733
+
734
+ ```ruby
735
+ module Glimmer
736
+ module DSL
737
+ module Opal
738
+ class ColorExpression < StaticExpression
739
+ include TopLevelExpression
740
+
741
+ def interpret(parent, keyword, *args, &block)
742
+ Glimmer::SWT::ColorProxy.new(*args)
743
+ end
744
+ end
745
+ end
746
+ end
747
+ end
748
+ ```
749
+
750
+ DSL expressions go into the `glimmer/dsl/{dsl_name}` namespace directory.
751
+
752
+ Also, every DSL requires a `glimmer/dsl/{dsl_name}/dsl.rb` file, which configures the DSL into Glimmer via a call to:
753
+ ```ruby
754
+ Glimmer::DSL::Engine.add_dynamic_expressions(DSLNameModule, expression_names_array)
755
+ ```
756
+
757
+ Expression names are underscored verions of `Expression` subclass names minus the `_expression` suffix.
758
+
759
+ For example, here is an SWT DSL configuration:
760
+
761
+ ```ruby
762
+ require 'glimmer/launcher'
763
+ require Glimmer::Launcher.swt_jar_file
764
+ require 'glimmer/dsl/engine'
765
+ Dir[File.expand_path('../*_expression.rb', __FILE__)].each {|f| require f}
766
+
767
+ module Glimmer
768
+ module DSL
769
+ module SWT
770
+ Engine.add_dynamic_expressions(
771
+ SWT,
772
+ %w[
773
+ layout
774
+ widget_listener
775
+ combo_selection_data_binding
776
+ checkbox_group_selection_data_binding
777
+ radio_group_selection_data_binding
778
+ list_selection_data_binding
779
+ tree_items_data_binding
780
+ table_items_data_binding
781
+ data_binding
782
+ cursor
783
+ font
784
+ image
785
+ property
786
+ block_property
787
+ widget
788
+ custom_widget
789
+ ]
790
+ )
791
+ end
792
+ end
793
+ end
794
+ ```
795
+
796
+ In summary, these are the files needed to author a Glimmer DSL:
797
+ - `glimmer/dsl/[dsl_name]/dsl.rb`: requires and adds all dynamic expressions to [dsl_name] Glimmer DSL
798
+ - `glimmer/dsl/[dsl_name]/[expresion_name]_expresion.rb`: needed for every [expresion_name] expression, whether dynamic or static
799
+
800
+ ### Multi-DSL Support
801
+
802
+ The Glimmer [DSL Engine](#dsl-engine) allows mixing DSLs, which comes in handy when doing things like rendering a desktop GUI DSL `browser` widget additionally leveraging the HTML DSL and CSS DSL for its content.
803
+
804
+ DSLs are activated by top-level keywords (expressions denoted as `TopLevelExpression`). For example, the `html` keyword activates the [Glimmer DSL for XML](https://github.com/AndyObtiva/glimmer-dsl-xml) and the `css` keyword activates the [Glimmer DSL for CSS](https://github.com/AndyObtiva/glimmer-dsl-css). Glimmer automatically recognizes top-level keywords in each DSL and activates the DSL accordingly. Once done processing a nested DSL top-level keyword, Glimmer switches back to the prior DSL automatically.
805
+
806
+ By default, all loaded DSLs (required glimmer DSL gems) are enabled.
807
+
808
+ For example, this shows "Hello, World!" inside a [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) desktop app `browser` widget using `html` and `css` from [Glimmer DSL for XML](https://github.com/AndyObtiva/glimmer-dsl-xml) and [Glimmer DSL for CSS](https://github.com/AndyObtiva/glimmer-dsl-css):
809
+
810
+ ```ruby
811
+ require 'glimmer-dsl-swt'
812
+ require 'glimmer-dsl-xml'
813
+ require 'glimmer-dsl-css'
814
+
815
+ include Glimmer
816
+
817
+ shell {
818
+ minimum_size 130, 130
819
+ @browser = browser {
820
+ text html {
821
+ head {
822
+ meta(name: "viewport", content: "width=device-width, initial-scale=2.0")
823
+ style {
824
+ css {
825
+ h1 {
826
+ background 'yellow'
827
+ }
828
+ }
829
+ }
830
+ }
831
+ body {
832
+ h1 { "Hello, World!" }
833
+ }
834
+ }
835
+ }
836
+ }.open
837
+ ```
838
+
839
+ **API methods to enable/disable DSLs:**
840
+
841
+ `Glimmer::DSL::Engine.disable_dsl(dsl)`: disables a particular DSL
842
+
843
+ Example: `Glimmer::DSL::Engine.disable_dsl(:swt)`
844
+
845
+ `Glimmer::DSL::Engine.enable_dsl(dsl)`: enables a particular DSL
846
+
847
+ Example: `Glimmer::DSL::Engine.disable_dsl(:swt)`
848
+
849
+ `Glimmer::DSL::Engine.enabled_dsls=(dsls)`: enables only the specified DSLs, disabling all other loaded DSLs
850
+
851
+ Example: `Glimmer::DSL::Engine.enabled_dsls = [:xml, :css]`
852
+
853
+ ## Data-Binding Library
854
+
855
+ Data-Binding enables binding GUI properties (like text and color) to Model attributes (like name and age).
856
+
857
+ It relies on the Observer Design Pattern and MVP (Model-View-Presenter) Architectural Pattern (a variation on MVC)
858
+
859
+ These are the main classes concerning data-binding:
860
+ - `Observer`: Provides general observer support including unique registration and deregistration for cleanup and prevention of memory leaks. Main methods concerned are: `call`, `register` (alias: `observe`), and `unregister` (alias: `unobserve` or `deregister`)
861
+ - `Observable`: General super-module for all observables. Main methods concerned are: `add_observer` and `remove_observer`
862
+ - `ObservableModel`: Mixin module for any observable model with observable attributes. In addition to `Observable` methods, it has a `notify_observers` method to be called when changes occur. It automatically enhances all attribute setters (ending with `=`) to notify observers on changes. Also, it automatically handles observing array attributes using `ObservableArray` appropriately so they would notify observers upon array mutation changes.
863
+ - `ObservableArray`: Mixin module for any observable array collection that automatically handles notifying observers upon performing array mutation operations (e.g. `push` or `delete`)
864
+ - `ModelBinding`: a higher-level abstraction that relies on all the other observer/observable classes to support basic data-binding, nested data-binding, and computed data-binding
702
865
 
703
866
  ## Glimmer Process
704
867
 
@@ -750,7 +913,7 @@ Glimmer DSL Engine specific tasks are at:
750
913
  If you would like to contribute to Glimmer, please study up on Glimmer and [SWT](https://github.com/AndyObtiva/glimmer-dsl-swt#swt-reference), run all Glimmer [samples](https://github.com/AndyObtiva/glimmer-dsl-swt#samples), and build a small sample app (perhaps from [this TODO list](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/TODO.md#samples)) to add to [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt) Hello or Elaborate samples via a Pull Request. Once done, contact me on [Chat](#chat).
751
914
 
752
915
  You may apply for contributing to any of these Glimmer DSL gems whether you prefer to focus on the desktop or web:
753
- - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Library)
916
+ - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
754
917
  - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
755
918
  - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
756
919
  - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
@@ -773,7 +936,7 @@ If your company would like to invest fulltime in further development of the Glim
773
936
 
774
937
  [MIT](LICENSE.txt)
775
938
 
776
- Copyright (c) 2007-2020 - Andy Maleh.
939
+ Copyright (c) 2007-2021 - Andy Maleh.
777
940
 
778
941
  --
779
942