glimmer 1.0.4 → 1.0.9

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: 6a96adb1115f9dc1c50eba4fcfcc83e154de790c72945dca8038d42263093043
4
- data.tar.gz: d874c3dd3f138b0a726110a8ea5d1099d2aae952b786e2f4efb28c8c7c7fef99
3
+ metadata.gz: 78b3aa3c65d53cbdca49fe3e5ac96b6daa602e54ba7a79f1195fc79a75057746
4
+ data.tar.gz: 9f16f383e0c2aa7f3748dedae65225b85456276fc07aa00b2790dd3a314435f0
5
5
  SHA512:
6
- metadata.gz: ceda055a6ba36a0690eb473863eccb4e118178a800c06751fe32cdad534a51e4449b1bb42dcc354aa191208d634b08d220bf3e62c58ee67db69769487cdf2833
7
- data.tar.gz: 4ae5d45861735a8a0e4276150aeb3945c9a9f516a5e5938b5fa08465d643f5214ab667f596590c70ec40fa8fff12bdf03faf347ce22771fcba38d4774e62f0e7
6
+ metadata.gz: 2b0c3e251536486ce4aacad9fa04332c7fd39be472593d01e3c4b10aa92ac90fb66c2bf3ca13147836d8e537f2edc62ac681a9a7cbec8d1d21d0fdaa2cfac2a1
7
+ data.tar.gz: 3fa2edb9b9d68b82ef128869ad8a07a4caccbc2786d5c2bed99949819193f3d2952f865c67ac7ff57ad81ab6a953293e1a10c63c9a898726e8bee62a5ec9b320
@@ -3,6 +3,28 @@
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.9
7
+
8
+ - Fixed issue with top-level static expressions sometimes not working (e.g. async_exec in DSL for SWT) with DSL detected as nil
9
+
10
+ ## 1.0.8
11
+
12
+ - Concurrent Array/Hash/Set data structures to better support parallel multi-threading
13
+ - Fix issue with a certain nil static_expression case not handled properly in Glimmer::DSL::Engine
14
+
15
+ ## 1.0.7
16
+
17
+ - 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
18
+ - Fix issue regarding testing array object observer on a nil object
19
+
20
+ ## 1.0.6
21
+
22
+ - Update ModelBinding to raise an error if called to make a change while configurd as binding_options[:read_only]=true
23
+
24
+ ## 1.0.5
25
+
26
+ - Fix issue in Opal regarding auto-definition of observable methods in a Class/Module directly (as opposed to a class instance)
27
+
6
28
  ## 1.0.4
7
29
 
8
30
  - Ensure that `ObservableModel#remove_observer` clears observer registrations from `Observer` (just like `Observer#unobserve`)
@@ -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.4 - 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.9 - 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.4](#-glimmer-104)
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.9](#-glimmer-109---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,18 +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)
68
+
69
+ ### Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
70
+
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).
69
72
 
70
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).
71
74
 
72
- ### Glimmer DSL for SWT Samples
75
+ #### Glimmer DSL for SWT Samples
73
76
 
74
- #### Hello, World!
77
+ ##### Hello, World!
75
78
 
76
- Glimmer code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_world.rb)):
79
+ Glimmer GUI code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_world.rb)):
77
80
  ```ruby
78
81
  include Glimmer
79
82
 
@@ -85,23 +88,16 @@ shell {
85
88
  }.open
86
89
  ```
87
90
 
88
- Run:
89
- ```
90
- glimmer sample:run[hello_world]
91
- ```
92
-
93
91
  Glimmer app:
94
92
 
95
93
  ![Hello World](images/glimmer-hello-world.png)
96
94
 
97
- #### Tic Tac Toe
95
+ ##### Tic Tac Toe
98
96
 
99
- 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)):
100
98
 
101
99
  ```ruby
102
100
  # ...
103
- @tic_tac_toe_board = Board.new
104
-
105
101
  @shell = shell {
106
102
  text "Tic-Tac-Toe"
107
103
  minimum_size 150, 178
@@ -122,27 +118,16 @@ Glimmer code (from [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObt
122
118
  }
123
119
  }
124
120
  }
125
-
126
- observe(@tic_tac_toe_board, :game_status) { |game_status|
127
- display_win_message if game_status == Board::WIN
128
- display_draw_message if game_status == Board::DRAW
129
- }
130
121
  # ...
131
122
  ```
132
123
 
133
- Run:
134
-
135
- ```
136
- glimmer sample:run[tic_tac_toe]
137
- ```
138
-
139
124
  Glimmer app:
140
125
 
141
126
  ![Tic Tac Toe](images/glimmer-tic-tac-toe-in-progress.png)
142
127
 
143
- #### Contact Manager
128
+ ##### Contact Manager
144
129
 
145
- 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)):
146
131
 
147
132
  ```ruby
148
133
  # ...
@@ -255,144 +240,21 @@ Glimmer code (from [samples/elaborate/contact_manager.rb](https://github.com/And
255
240
  # ...
256
241
  ```
257
242
 
258
- Run:
259
-
260
- ```
261
- glimmer sample:run[contact_manager]
262
- ```
263
-
264
243
  Glimmer App:
265
244
 
266
245
  ![Contact Manager](images/glimmer-contact-manager.png)
267
246
 
268
- ### Production Desktop Apps Built with Glimmer DSL for SWT
247
+ #### Production Desktop Apps Built with Glimmer DSL for SWT
269
248
 
270
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
271
250
 
272
- ![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)
273
252
 
274
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
275
254
 
276
- ![Math Bowling App Screenshot](https://raw.githubusercontent.com/AndyObtiva/MathBowling/master/Math-Bowling-Screenshot.png)
277
-
278
- ## Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
279
-
280
- [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.).
281
-
282
- 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).
283
-
284
- 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/).
285
-
286
- [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:
287
- - Declarative DSL syntax that visually maps to the GUI widget hierarchy
288
- - Convention over configuration via smart defaults and automation of low-level details
289
- - Requiring the least amount of syntax possible to build GUI
290
- - Bidirectional Data-Binding to declaratively wire and automatically synchronize GUI with Business Models
291
- - Custom Widget support
292
- - Scaffolding for new custom widgets, apps, and gems
293
- - Native-Executable packaging on Mac, Windows, and Linux
294
-
295
- 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).
296
-
297
- ### Glimmer DSL for Tk Samples
298
-
299
- #### Hello, World!
300
-
301
- Glimmer code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_world.rb)):
302
-
303
- ```ruby
304
- include Glimmer
305
-
306
- root {
307
- label {
308
- text 'Hello, World!'
309
- }
310
- }.open
311
- ```
312
-
313
- Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
314
-
315
- ```
316
- ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_world.rb'"
317
- ```
318
-
319
- Glimmer app:
320
-
321
- ![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)
322
-
323
- #### Hello, Tab!
255
+ [![Math Bowling App Screenshot](https://raw.githubusercontent.com/AndyObtiva/MathBowling/master/Math-Bowling-Screenshot.png)](https://github.com/AndyObtiva/MathBowling)
324
256
 
325
- Glimmer code (from [samples/hello/hello_tab.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_tab.rb)):
326
-
327
- ```ruby
328
- include Glimmer
329
-
330
- root {
331
- title 'Hello, Tab!'
332
-
333
- notebook {
334
- frame(text: 'English') {
335
- label {
336
- text 'Hello, World!'
337
- }
338
- }
339
-
340
- frame(text: 'French') {
341
- label {
342
- text 'Bonjour, Univers!'
343
- }
344
- }
345
- }
346
- }.open
347
- ```
348
-
349
- Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
350
-
351
- ```
352
- ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_tab.rb'"
353
- ```
354
-
355
- Glimmer app:
356
-
357
- ![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)
358
- ![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)
359
-
360
- #### Hello, Combo!
361
-
362
- Glimmer code (from [samples/hello/hello_combo.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_combo.rb)):
363
-
364
- ```ruby
365
- # ... more code precedes
366
- root {
367
- title 'Hello, Combo!'
368
-
369
- combobox { |proxy|
370
- state 'readonly'
371
- text bind(person, :country)
372
- }
373
-
374
- button { |proxy|
375
- text "Reset Selection"
376
- command {
377
- person.reset_country
378
- }
379
- }
380
- }.open
381
- # ... more code follows
382
- ```
383
-
384
- Run (with the [glimmer-dsl-tk](https://rubygems.org/gems/glimmer-dsl-tk) gem installed):
385
-
386
- ```
387
- ruby -r glimmer-dsl-tk -e "require '../samples/hello/hello_combo.rb'"
388
- ```
389
-
390
- Glimmer app:
391
-
392
- ![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)
393
- ![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)
394
-
395
- ## 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)
396
258
 
397
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.
398
260
 
@@ -400,9 +262,9 @@ Glimmer DSL for Opal webifier successfully reuses the entire [Glimmer](https://g
400
262
 
401
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).
402
264
 
403
- ### Glimmer DSL for Opal Samples
265
+ #### Glimmer DSL for Opal Samples
404
266
 
405
- #### Hello, Computed!
267
+ ##### Hello, Computed!
406
268
 
407
269
  Add the following require statement to `app/assets/javascripts/application.rb`
408
270
 
@@ -521,7 +383,7 @@ You should see "Hello, Computed!"
521
383
 
522
384
  ![Glimmer DSL for Opal Hello Computed](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-opal/master/images/glimmer-dsl-opal-hello-computed.png)
523
385
 
524
- #### Glimmer Calculator
386
+ ##### Glimmer Calculator
525
387
 
526
388
  Add the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem to `Gemfile` (without requiring):
527
389
 
@@ -601,13 +463,13 @@ You should see "Apple Calculator Theme"
601
463
 
602
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)
603
465
 
604
- ## Glimmer DSL for XML (& HTML)
466
+ ### Glimmer DSL for XML (& HTML)
605
467
 
606
468
  [Glimmer DSL for XML](https://github.com/AndyObtiva/glimmer-dsl-xml) provides Ruby syntax for building XML (eXtensible Markup Language) documents.
607
469
 
608
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).
609
471
 
610
- ### XML DSL
472
+ #### XML DSL
611
473
 
612
474
  Simply start with `html` keyword and add HTML inside its block using Glimmer DSL syntax.
613
475
  Once done, you may call `to_s`, `to_xml`, or `to_html` to get the formatted HTML output.
@@ -639,13 +501,13 @@ Output:
639
501
  <html><head><meta name="viewport" content="width=device-width, initial-scale=2.0" /></head><body><h1>Hello, World!</h1></body></html>
640
502
  ```
641
503
 
642
- ## Glimmer DSL for CSS
504
+ ### Glimmer DSL for CSS
643
505
 
644
506
  [Glimmer DSL for CSS](https://github.com/AndyObtiva/glimmer-dsl-css) provides Ruby syntax for building CSS (Cascading Style Sheets).
645
507
 
646
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).
647
509
 
648
- ### CSS DSL
510
+ #### CSS DSL
649
511
 
650
512
  Simply start with `css` keyword and add stylesheet rule sets inside its block using Glimmer DSL syntax.
651
513
  Once done, you may call `to_s` or `to_css` to get the formatted CSS output.
@@ -678,33 +540,328 @@ Output:
678
540
  body{font-size:1.1em;background:white}body > h1{background-color:red;font-size:2em}
679
541
  ```
680
542
 
681
- ## Multi-DSL Support
543
+ ### Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
682
544
 
683
- 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`)
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.).
684
546
 
685
- Glimmer allows mixing DSLs, which comes in handy when doing things like using a desktop Browser widget with HTML and CSS.
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:
656
+
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)
659
+
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.
686
663
 
687
664
  Glimmer DSL syntax consists mainly of:
688
- - keywords (e.g. `table` for a table widget)
689
- - style/args (e.g. :multi as in `table(:multi)` for a multi-line selection table widget)
690
- - 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)
691
-
692
- 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.
693
-
694
- ## Glimmer Supporting Libraries
695
-
696
- Here is a list of notable 3rd party gems used by Glimmer and Glimmer DSLs:
697
- - [jeweler](https://github.com/technicalpickles/jeweler): generates app gems during [Glimmer Scaffolding](https://github.com/AndyObtiva/glimmer-dsl-swt#scaffolding)
698
- - [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)
699
- - [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
700
- - [os](https://github.com/rdp/os): provides OS detection capabilities (e.g. `OS.mac?` or `OS.windows?`) to write cross-platform code inexpensively
701
- - [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`)
702
- - [rake](https://github.com/ruby/rake): used to implement and execute `glimmer` commands
703
- - [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.
704
- - [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)
705
- - [super_module](https://github.com/AndyObtiva/super_module): used to cleanly write the Glimmer::UI:CustomWidget and Glimmer::UI::CustomShell modules
706
- - [text-table](https://github.com/aptinio/text-table): renders textual data in a textual table for the command-line interface of Glimmer
707
- - [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
708
865
 
709
866
  ## Glimmer Process
710
867
 
@@ -756,7 +913,7 @@ Glimmer DSL Engine specific tasks are at:
756
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).
757
914
 
758
915
  You may apply for contributing to any of these Glimmer DSL gems whether you prefer to focus on the desktop or web:
759
- - [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)
760
917
  - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
761
918
  - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
762
919
  - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
@@ -779,7 +936,7 @@ If your company would like to invest fulltime in further development of the Glim
779
936
 
780
937
  [MIT](LICENSE.txt)
781
938
 
782
- Copyright (c) 2007-2020 - Andy Maleh.
939
+ Copyright (c) 2007-2021 - Andy Maleh.
783
940
 
784
941
  --
785
942