glimmer 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/LICENSE.txt +1 -1
- data/PROCESS.md +2 -2
- data/README.md +156 -52
- data/VERSION +1 -1
- data/glimmer.gemspec +6 -6
- data/lib/glimmer.rb +5 -5
- data/lib/glimmer/config.rb +6 -6
- data/lib/glimmer/data_binding/model_binding.rb +2 -2
- data/lib/glimmer/data_binding/observable.rb +4 -4
- data/lib/glimmer/data_binding/observable_array.rb +1 -1
- data/lib/glimmer/data_binding/observable_model.rb +5 -5
- data/lib/glimmer/data_binding/observer.rb +1 -1
- data/lib/glimmer/dsl/engine.rb +2 -1
- data/lib/glimmer/dsl/expression.rb +1 -1
- data/lib/glimmer/dsl/expression_handler.rb +4 -4
- data/lib/glimmer/dsl/parent_expression.rb +4 -4
- data/lib/glimmer/dsl/static_expression.rb +6 -6
- data/lib/glimmer/dsl/top_level_expression.rb +4 -4
- data/lib/glimmer/error.rb +4 -4
- data/lib/glimmer/invalid_keyword_error.rb +4 -4
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 352b655dc654c87123cc2fb6b127f113ece434c0dac1ff18139caf8c709423d8
|
4
|
+
data.tar.gz: 6cb1ca7341fee34373460c7760bda62ce6ecbf52bf033b98590471868e114ff5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c80e09354d3851493cf3883ccf1706e3590d8945c54d7ddc35ce6e017b9aeb3b3b65c59cbc691944130007e49a24ad8e47e57667ab16d9e57ebf9ce73a75b01
|
7
|
+
data.tar.gz: c69d37a79ba5b2afd58dab6aa28cd0b88c912b9f57d28c48ac88ea5c8ae476ce6c84d49bec5503810418bdf0d6c6d9ab39e68d69828ee7a36d558eb46cc560ab
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,11 @@
|
|
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.7
|
7
|
+
|
8
|
+
- 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
|
9
|
+
- Fix issue regarding testing array object observer on a nil object
|
10
|
+
|
6
11
|
## 1.0.6
|
7
12
|
|
8
13
|
- Update ModelBinding to raise an error if called to make a change while configurd as binding_options[:read_only]=true
|
data/LICENSE.txt
CHANGED
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,6 +1,6 @@
|
|
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.
|
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.7 - DSL Framework
|
2
2
|
[![Gem Version](https://badge.fury.io/rb/glimmer.svg)](http://badge.fury.io/rb/glimmer)
|
3
|
-
[![
|
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)
|
@@ -9,44 +9,45 @@
|
|
9
9
|
|
10
10
|
**(The Original Glimmer Library Since 2007. Beware of Imitators!)**
|
11
11
|
|
12
|
-
[**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](#
|
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)
|
13
13
|
|
14
14
|
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
15
|
-
Featured in
|
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
16
|
|
17
|
-
[**Glimmer**](https://rubygems.org/gems/glimmer) is a DSL Framework that consists of two things:
|
18
|
-
- [DSL Engine](#dsl-engine): enables building DSLs
|
19
|
-
- [Data-Binding
|
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
20
|
|
21
21
|
[**Glimmer**](https://rubygems.org/gems/glimmer) is ***the cream of the crop*** when it comes to building DSLs in Ruby:
|
22
22
|
- Supports building the tersest most concise domain specific language syntax in Ruby.
|
23
|
-
-
|
24
|
-
-
|
23
|
+
- Maximum readability and maintainability.
|
24
|
+
- No extra unnecessary block variables when not needed.
|
25
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
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 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
|
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.
|
29
29
|
|
30
30
|
[**Glimmer**](https://rubygems.org/gems/glimmer) supports the following DSLs:
|
31
31
|
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
32
|
-
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
|
33
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)
|
34
33
|
- [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
|
35
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)
|
36
36
|
|
37
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.
|
38
38
|
|
39
|
-
## Table of
|
39
|
+
## Table of Contents
|
40
40
|
|
41
|
-
- [Glimmer 1.0.
|
42
|
-
- [
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
41
|
+
- [Glimmer 1.0.7](#-glimmer-107---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 Tk (Ruby Desktop Development GUI Library)](#glimmer-dsl-for-tk-ruby-desktop-development-gui-library)
|
45
|
+
- [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)
|
46
|
+
- [Glimmer DSL for XML (& HTML)](#glimmer-dsl-for-xml--html)
|
47
|
+
- [Glimmer DSL for CSS](#glimmer-dsl-for-css)
|
47
48
|
- [DSL Engine](#dsl-engine)
|
48
|
-
|
49
|
-
- [
|
49
|
+
- [Multi-DSL Support](#multi-dsl-support)
|
50
|
+
- [Data-Binding Library](#data-binding-library)
|
50
51
|
- [Glimmer Process](#glimmer-process)
|
51
52
|
- [Resources](#resources)
|
52
53
|
- [Help](#help)
|
@@ -58,16 +59,22 @@ Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.d
|
|
58
59
|
- [Contributors](#contributors)
|
59
60
|
- [Hire Me](#hire-me)
|
60
61
|
- [License](#license)
|
61
|
-
|
62
|
-
## Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
|
63
62
|
|
64
|
-
|
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).
|
65
72
|
|
66
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).
|
67
74
|
|
68
|
-
|
75
|
+
#### Glimmer DSL for SWT Samples
|
69
76
|
|
70
|
-
|
77
|
+
##### Hello, World!
|
71
78
|
|
72
79
|
Glimmer GUI code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_world.rb)):
|
73
80
|
```ruby
|
@@ -85,7 +92,7 @@ Glimmer app:
|
|
85
92
|
|
86
93
|
![Hello World](images/glimmer-hello-world.png)
|
87
94
|
|
88
|
-
|
95
|
+
##### Tic Tac Toe
|
89
96
|
|
90
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)):
|
91
98
|
|
@@ -118,7 +125,7 @@ Glimmer app:
|
|
118
125
|
|
119
126
|
![Tic Tac Toe](images/glimmer-tic-tac-toe-in-progress.png)
|
120
127
|
|
121
|
-
|
128
|
+
##### Contact Manager
|
122
129
|
|
123
130
|
Glimmer GUI code (from [samples/elaborate/contact_manager.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/contact_manager.rb)):
|
124
131
|
|
@@ -237,17 +244,17 @@ Glimmer App:
|
|
237
244
|
|
238
245
|
![Contact Manager](images/glimmer-contact-manager.png)
|
239
246
|
|
240
|
-
|
247
|
+
#### Production Desktop Apps Built with Glimmer DSL for SWT
|
241
248
|
|
242
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
|
243
250
|
|
244
|
-
![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)
|
245
252
|
|
246
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
|
247
254
|
|
248
|
-
![Math Bowling App Screenshot](https://raw.githubusercontent.com/AndyObtiva/MathBowling/master/Math-Bowling-Screenshot.png)
|
255
|
+
[![Math Bowling App Screenshot](https://raw.githubusercontent.com/AndyObtiva/MathBowling/master/Math-Bowling-Screenshot.png)](https://github.com/AndyObtiva/MathBowling)
|
249
256
|
|
250
|
-
|
257
|
+
### Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
|
251
258
|
|
252
259
|
[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.).
|
253
260
|
|
@@ -266,9 +273,9 @@ The trade-off is that while [SWT](https://www.eclipse.org/swt/) provides a pleth
|
|
266
273
|
|
267
274
|
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).
|
268
275
|
|
269
|
-
|
276
|
+
#### Glimmer DSL for Tk Samples
|
270
277
|
|
271
|
-
|
278
|
+
##### Hello, World!
|
272
279
|
|
273
280
|
Glimmer code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_world.rb)):
|
274
281
|
|
@@ -292,7 +299,7 @@ Glimmer app:
|
|
292
299
|
|
293
300
|
![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)
|
294
301
|
|
295
|
-
|
302
|
+
##### Hello, Tab!
|
296
303
|
|
297
304
|
Glimmer code (from [samples/hello/hello_tab.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_tab.rb)):
|
298
305
|
|
@@ -329,7 +336,7 @@ Glimmer app:
|
|
329
336
|
![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)
|
330
337
|
![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)
|
331
338
|
|
332
|
-
|
339
|
+
##### Hello, Combo!
|
333
340
|
|
334
341
|
Glimmer code (from [samples/hello/hello_combo.rb](https://github.com/AndyObtiva/glimmer-dsl-tk/blob/master/samples/hello/hello_combo.rb)):
|
335
342
|
|
@@ -364,7 +371,7 @@ Glimmer app:
|
|
364
371
|
![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)
|
365
372
|
![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)
|
366
373
|
|
367
|
-
|
374
|
+
### Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
|
368
375
|
|
369
376
|
[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.
|
370
377
|
|
@@ -372,9 +379,9 @@ Glimmer DSL for Opal webifier successfully reuses the entire [Glimmer](https://g
|
|
372
379
|
|
373
380
|
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).
|
374
381
|
|
375
|
-
|
382
|
+
#### Glimmer DSL for Opal Samples
|
376
383
|
|
377
|
-
|
384
|
+
##### Hello, Computed!
|
378
385
|
|
379
386
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
380
387
|
|
@@ -493,7 +500,7 @@ You should see "Hello, Computed!"
|
|
493
500
|
|
494
501
|
![Glimmer DSL for Opal Hello Computed](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-opal/master/images/glimmer-dsl-opal-hello-computed.png)
|
495
502
|
|
496
|
-
|
503
|
+
##### Glimmer Calculator
|
497
504
|
|
498
505
|
Add the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem to `Gemfile` (without requiring):
|
499
506
|
|
@@ -573,13 +580,13 @@ You should see "Apple Calculator Theme"
|
|
573
580
|
|
574
581
|
[![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)
|
575
582
|
|
576
|
-
|
583
|
+
### Glimmer DSL for XML (& HTML)
|
577
584
|
|
578
585
|
[Glimmer DSL for XML](https://github.com/AndyObtiva/glimmer-dsl-xml) provides Ruby syntax for building XML (eXtensible Markup Language) documents.
|
579
586
|
|
580
587
|
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).
|
581
588
|
|
582
|
-
|
589
|
+
#### XML DSL
|
583
590
|
|
584
591
|
Simply start with `html` keyword and add HTML inside its block using Glimmer DSL syntax.
|
585
592
|
Once done, you may call `to_s`, `to_xml`, or `to_html` to get the formatted HTML output.
|
@@ -611,13 +618,13 @@ Output:
|
|
611
618
|
<html><head><meta name="viewport" content="width=device-width, initial-scale=2.0" /></head><body><h1>Hello, World!</h1></body></html>
|
612
619
|
```
|
613
620
|
|
614
|
-
|
621
|
+
### Glimmer DSL for CSS
|
615
622
|
|
616
623
|
[Glimmer DSL for CSS](https://github.com/AndyObtiva/glimmer-dsl-css) provides Ruby syntax for building CSS (Cascading Style Sheets).
|
617
624
|
|
618
625
|
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).
|
619
626
|
|
620
|
-
|
627
|
+
#### CSS DSL
|
621
628
|
|
622
629
|
Simply start with `css` keyword and add stylesheet rule sets inside its block using Glimmer DSL syntax.
|
623
630
|
Once done, you may call `to_s` or `to_css` to get the formatted CSS output.
|
@@ -655,9 +662,9 @@ body{font-size:1.1em;background:white}body > h1{background-color:red;font-size:2
|
|
655
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.
|
656
663
|
|
657
664
|
Glimmer DSL syntax consists mainly of:
|
658
|
-
- keywords (e.g. `table` for a table widget)
|
659
|
-
- style/args (e.g. :multi as in `table(:multi)` for a multi-line selection table widget)
|
660
|
-
- content (e.g. `{ table_column { text 'Name'} }` as in `table(:multi) { table_column { text '
|
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)
|
661
668
|
|
662
669
|
The Glimmer DSL Engine's architecture is based on the following Design Patterns and Data Structures:
|
663
670
|
- **Interpreter Design Pattern**: to define interpretable expressions of DSL keywords
|
@@ -665,7 +672,7 @@ The Glimmer DSL Engine's architecture is based on the following Design Patterns
|
|
665
672
|
- **Adapter Design Pattern**: to adapt expressions into handlers in a chain of responsibility
|
666
673
|
- **Stack Data Structure**: to handle processing parent/child nesting of DSL keyword expressions in the correct order
|
667
674
|
|
668
|
-
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
|
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**.
|
669
676
|
|
670
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)`.
|
671
678
|
|
@@ -690,6 +697,56 @@ Every `Expression` sublcass must specify two methods at least:
|
|
690
697
|
|
691
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.
|
692
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
|
+
|
693
750
|
DSL expressions go into the `glimmer/dsl/{dsl_name}` namespace directory.
|
694
751
|
|
695
752
|
Also, every DSL requires a `glimmer/dsl/{dsl_name}/dsl.rb` file, which configures the DSL into Glimmer via a call to:
|
@@ -742,11 +799,58 @@ In summary, these are the files needed to author a Glimmer DSL:
|
|
742
799
|
|
743
800
|
### Multi-DSL Support
|
744
801
|
|
745
|
-
The Glimmer [DSL Engine](#dsl-engine) allows mixing DSLs, which comes in handy when doing things like
|
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
|
746
850
|
|
747
|
-
|
851
|
+
Example: `Glimmer::DSL::Engine.enabled_dsls = [:xml, :css]`
|
748
852
|
|
749
|
-
## Data-Binding
|
853
|
+
## Data-Binding Library
|
750
854
|
|
751
855
|
Data-Binding enables binding GUI properties (like text and color) to Model attributes (like name and age).
|
752
856
|
|
@@ -832,7 +936,7 @@ If your company would like to invest fulltime in further development of the Glim
|
|
832
936
|
|
833
937
|
[MIT](LICENSE.txt)
|
834
938
|
|
835
|
-
Copyright (c) 2007-
|
939
|
+
Copyright (c) 2007-2021 - Andy Maleh.
|
836
940
|
|
837
941
|
--
|
838
942
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.7
|
data/glimmer.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glimmer 1.0.
|
5
|
+
# stub: glimmer 1.0.7 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer".freeze
|
9
|
-
s.version = "1.0.
|
9
|
+
s.version = "1.0.7"
|
10
10
|
|
11
11
|
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
12
|
s.require_paths = ["lib".freeze]
|
13
13
|
s.authors = ["AndyMaleh".freeze]
|
14
|
-
s.date = "
|
15
|
-
s.description = "Glimmer is a Ruby DSL Framework consisting of a DSL Engine and Observable/Observer/Data-Binding Library. Used in the Glimmer DSL for SWT (JRuby Desktop Development GUI Framework), the Glimmer DSL for Tk (Ruby Desktop Development GUI Library), the Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), the Glimmer DSL for XML (& HTML), and the Glimmer DSL for CSS.".freeze
|
14
|
+
s.date = "2021-01-11"
|
15
|
+
s.description = "Glimmer is a Ruby DSL Framework consisting of a DSL Engine and an Observable/Observer/Data-Binding Library. Used in the Glimmer DSL for SWT (JRuby Desktop Development GUI Framework), the Glimmer DSL for Tk (Ruby Desktop Development GUI Library), the Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), the Glimmer DSL for XML (& HTML), and the Glimmer DSL for CSS.".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"CHANGELOG.md",
|
@@ -61,7 +61,7 @@ Gem::Specification.new do |s|
|
|
61
61
|
s.add_development_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
62
62
|
s.add_development_dependency(%q<jeweler>.freeze, [">= 2.0.0", "< 3.0.0"])
|
63
63
|
s.add_development_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
|
64
|
-
s.add_development_dependency(%q<coveralls>.freeze, ["
|
64
|
+
s.add_development_dependency(%q<coveralls>.freeze, [">= 0"])
|
65
65
|
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
|
66
66
|
s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
|
67
67
|
s.add_development_dependency(%q<rake-tui>.freeze, [">= 0"])
|
@@ -74,7 +74,7 @@ Gem::Specification.new do |s|
|
|
74
74
|
s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
75
75
|
s.add_dependency(%q<jeweler>.freeze, [">= 2.0.0", "< 3.0.0"])
|
76
76
|
s.add_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
|
77
|
-
s.add_dependency(%q<coveralls>.freeze, ["
|
77
|
+
s.add_dependency(%q<coveralls>.freeze, [">= 0"])
|
78
78
|
s.add_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
|
79
79
|
s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
|
80
80
|
s.add_dependency(%q<rake-tui>.freeze, [">= 0"])
|
data/lib/glimmer.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2007-
|
2
|
-
#
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -70,7 +70,7 @@ module Glimmer
|
|
70
70
|
end
|
71
71
|
Glimmer.loop_last_data = new_loop_data
|
72
72
|
Glimmer::Config.logger.info {"Interpreting keyword: #{method_symbol}"}
|
73
|
-
Glimmer::DSL::Engine.interpret(method_symbol, *args, &block)
|
73
|
+
Glimmer::DSL::Engine.interpret(method_symbol, *args, &block)
|
74
74
|
end
|
75
75
|
rescue InvalidKeywordError => e
|
76
76
|
Glimmer::Config.logger.error {"Encountered an invalid keyword at this object: #{self}"}
|
data/lib/glimmer/config.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2007-
|
2
|
-
#
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -46,7 +46,7 @@ module Glimmer
|
|
46
46
|
end
|
47
47
|
|
48
48
|
# Returns Glimmer logger (standard Ruby logger)
|
49
|
-
def logger
|
49
|
+
def logger
|
50
50
|
reset_logger! unless defined? @@logger
|
51
51
|
@@logger
|
52
52
|
end
|
@@ -56,7 +56,7 @@ module Glimmer
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def reset_logger!
|
59
|
-
self.logger = Logger.new(STDOUT).tap do |logger|
|
59
|
+
self.logger = Logger.new(STDOUT).tap do |logger|
|
60
60
|
logger.level = Logger::ERROR
|
61
61
|
begin
|
62
62
|
logger.level = ENV['GLIMMER_LOGGER_LEVEL'].strip.downcase if ENV['GLIMMER_LOGGER_LEVEL']
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2007-
|
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
|
@@ -209,7 +209,7 @@ module Glimmer
|
|
209
209
|
def call(value)
|
210
210
|
return if model.nil?
|
211
211
|
converted_value = value
|
212
|
-
invoke_property_writer(model, "#{property_name}=", converted_value) unless
|
212
|
+
invoke_property_writer(model, "#{property_name}=", converted_value) unless converted_value == evaluate_property
|
213
213
|
end
|
214
214
|
|
215
215
|
def evaluate_property
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2007-
|
2
|
-
#
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2007-
|
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
|
@@ -43,7 +43,7 @@ module Glimmer
|
|
43
43
|
lambda do |value|
|
44
44
|
old_value = self.send(property_name)
|
45
45
|
unregister_dependent_observers(property_name, old_value)
|
46
|
-
self.send("
|
46
|
+
self.send("__original__#{property_writer_name}", value)
|
47
47
|
notify_observers(property_name)
|
48
48
|
ensure_array_object_observer(property_name, value, old_value)
|
49
49
|
end
|
@@ -105,9 +105,9 @@ module Glimmer
|
|
105
105
|
method(property_writer_name)
|
106
106
|
ensure_array_object_observer(property_name, send(property_name))
|
107
107
|
begin
|
108
|
-
method("
|
108
|
+
method("__original__#{property_writer_name}")
|
109
109
|
rescue
|
110
|
-
define_singleton_method("
|
110
|
+
define_singleton_method("__original__#{property_writer_name}", property_writer_method(property_writer_name))
|
111
111
|
define_singleton_method(property_writer_name, &PROPERTY_WRITER_FACTORY.call(property_name))
|
112
112
|
end
|
113
113
|
rescue => e
|
@@ -126,7 +126,7 @@ module Glimmer
|
|
126
126
|
end
|
127
127
|
|
128
128
|
def ensure_array_object_observer(property_name, object, old_object = nil)
|
129
|
-
return unless object
|
129
|
+
return unless object&.is_a?(Array)
|
130
130
|
array_object_observer = array_object_observer_for(property_name)
|
131
131
|
array_observer_registration = array_object_observer.observe(object)
|
132
132
|
property_observer_list(property_name).each do |observer|
|
data/lib/glimmer/dsl/engine.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# Copyright (c) 2007-
|
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
|
@@ -165,6 +165,7 @@ module Glimmer
|
|
165
165
|
return puts(MESSAGE_NO_DSLS) if no_dsls?
|
166
166
|
keyword = keyword.to_s
|
167
167
|
dynamic_expression_dsl = (dynamic_expression_chains_of_responsibility.keys - disabled_dsls).first if dsl.nil?
|
168
|
+
# TODO consider pushing this code into interpret_expresion to provide hooks that work around it regardless of static vs dynamic
|
168
169
|
dsl_stack.push(dynamic_expression_dsl || dsl)
|
169
170
|
expression = dynamic_expression_chains_of_responsibility[dsl].handle(parent, keyword, *args, &block)
|
170
171
|
interpret_expression(expression, keyword, *args, &block)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2007-
|
2
|
-
#
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2007-
|
2
|
-
#
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2007-
|
2
|
-
#
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -35,11 +35,11 @@ module Glimmer
|
|
35
35
|
# (not needed if it only checks for keyword)
|
36
36
|
#
|
37
37
|
# StaticExpression subclasses must define `#interpret`.
|
38
|
-
#
|
38
|
+
#
|
39
39
|
# The direct parent namespace of a StaticExpression subclass must match the DSL name (case-insensitive)
|
40
40
|
# (e.g. Glimmer::DSL::SWT::WidgetExpression has a DSL of :swt)
|
41
41
|
class StaticExpression < Expression
|
42
|
-
class << self
|
42
|
+
class << self
|
43
43
|
def inherited(base)
|
44
44
|
Glimmer::DSL::Engine.add_static_expression(base.new)
|
45
45
|
super
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2007-
|
2
|
-
#
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
data/lib/glimmer/error.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2007-
|
2
|
-
#
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# Copyright (c) 2007-
|
2
|
-
#
|
1
|
+
# Copyright (c) 2007-2021 Andy Maleh
|
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
|
5
5
|
# "Software"), to deal in the Software without restriction, including
|
@@ -7,10 +7,10 @@
|
|
7
7
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
8
|
# permit persons to whom the Software is furnished to do so, subject to
|
9
9
|
# the following conditions:
|
10
|
-
#
|
10
|
+
#
|
11
11
|
# The above copyright notice and this permission notice shall be
|
12
12
|
# included in all copies or substantial portions of the Software.
|
13
|
-
#
|
13
|
+
#
|
14
14
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
15
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
16
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: array_include_methods
|
@@ -156,16 +156,16 @@ dependencies:
|
|
156
156
|
name: coveralls
|
157
157
|
requirement: !ruby/object:Gem::Requirement
|
158
158
|
requirements:
|
159
|
-
- -
|
159
|
+
- - ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
version: 0
|
161
|
+
version: '0'
|
162
162
|
type: :development
|
163
163
|
prerelease: false
|
164
164
|
version_requirements: !ruby/object:Gem::Requirement
|
165
165
|
requirements:
|
166
|
-
- -
|
166
|
+
- - ">="
|
167
167
|
- !ruby/object:Gem::Version
|
168
|
-
version: 0
|
168
|
+
version: '0'
|
169
169
|
- !ruby/object:Gem::Dependency
|
170
170
|
name: simplecov
|
171
171
|
requirement: !ruby/object:Gem::Requirement
|
@@ -208,7 +208,7 @@ dependencies:
|
|
208
208
|
- - ">="
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: '0'
|
211
|
-
description: Glimmer is a Ruby DSL Framework consisting of a DSL Engine and Observable/Observer/Data-Binding
|
211
|
+
description: Glimmer is a Ruby DSL Framework consisting of a DSL Engine and an Observable/Observer/Data-Binding
|
212
212
|
Library. Used in the Glimmer DSL for SWT (JRuby Desktop Development GUI Framework),
|
213
213
|
the Glimmer DSL for Tk (Ruby Desktop Development GUI Library), the Glimmer DSL for
|
214
214
|
Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), the Glimmer DSL for
|