glimmer 1.0.1 → 1.0.6

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: e658a13d552f17f352fa3a932ded6dbcaaef5e423fda5f02d7fa0a6b93d1152a
4
- data.tar.gz: bd5291701f81271b2f3c005c4e1a0216cc90d7bcdb3a386afc751430e57f425e
3
+ metadata.gz: cc6506323777ae44ace532c9b99f7b8070c27343be8ec954f133b60970719380
4
+ data.tar.gz: 54946885ac6ff008e1b5034f30a31d04bd089a6c90deb444a5070602acc1efaf
5
5
  SHA512:
6
- metadata.gz: ac46e59a6f2e75ad89df1725bb7ebd5b740512544969e016cef62670d214a14d1dc6d1873c7e9a268f726ad0b21214c4760a8001111afae9c2a8d3db088f12ec
7
- data.tar.gz: 3cc604177fd6101d53a9aa6a26c36f9eda889d81c5fc16f432289c50961e99bd7bf4401563b3fd27317796c3baaffd91f2b00f801a8002b555b26e5c4dbddb45
6
+ metadata.gz: 6798e108d8dc6f66800872394d2f4b8d0aca7cb68e746b8fe09258938f871785f698e56d6ad61a16c5460087c08f6ef6c7c48acd33aa5c5ac1b6f1320aa66efb
7
+ data.tar.gz: 05b52b53015bd04689e465da7d6d2a6da6ec5db9603f87471ec550ca732c11cb31b9b2ad378d06da91f278d726c6bb670c572b02df0db73ba3db1ed547411f1f
@@ -3,9 +3,31 @@
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.6
7
+
8
+ - Update ModelBinding to raise an error if called to make a change while configurd as binding_options[:read_only]=true
9
+
10
+ ## 1.0.5
11
+
12
+ - Fix issue in Opal regarding auto-definition of observable methods in a Class/Module directly (as opposed to a class instance)
13
+
14
+ ## 1.0.4
15
+
16
+ - Ensure that `ObservableModel#remove_observer` clears observer registrations from `Observer` (just like `Observer#unobserve`)
17
+ - `ObservableModel#remove_observers` and `ObservableModel#remove_all_observers` methods
18
+
19
+ ## 1.0.3
20
+
21
+ - Upgraded array_include_methods gem to v1.0.4
22
+
23
+ ## 1.0.2
24
+
25
+ - Support ObservableArray notifications on `unshift`, `prepend`, and `append`
26
+
6
27
  ## 1.0.1
7
28
 
8
29
  - Fixed issue with excluded keywords getting caught up by the infinite-loop-detection check
30
+ - Upgraded to array_include_method v1.0.3
9
31
 
10
32
  ## 1.0.0
11
33
 
@@ -25,7 +47,7 @@ Related Change Logs:
25
47
 
26
48
  ## 0.10.1
27
49
 
28
- - excluded_keyword_checkers option for filtering certain keywords from Glimmer DSL processing
50
+ - excluded_keyword_checkers option for filtering certain keywords from Glimmer DSL processing
29
51
  - Updates to logging levels to be more appropriate
30
52
  - Fixed an issue to avoid crashing when calling observer.unregister/unobserve on a non-observable
31
53
 
@@ -87,7 +109,7 @@ Related Change Logs:
87
109
  - Fix verbiage for summary/description in scaffolding custom shell gems (change custom widget reference to custom shell)
88
110
  - Scaffolding builds a proper binary for custom shell gems and includes it in executables in Rakefile
89
111
  - Scaffolding adds about/preferences menu actions to apps/custom-shell-gems
90
- - Make custom widget/shell options writable
112
+ - Make custom widget/shell options writable
91
113
  - Support "dialog" Glimmer DSL keyword
92
114
 
93
115
  ## 0.7.7
@@ -137,7 +159,7 @@ Related Change Logs:
137
159
  - Fix freezing issue upon logging observables and raising observable errors by overriding inspect on Observable to avoid printing nested tree of observers
138
160
  - Added validation for shell widget parentage (accepting a shell or nil) in shell expression
139
161
  - Support bidirectional data-binding of menu item selection (e.g. radio menu item)
140
- - Make shell auto-activate on show with 0.25 delay
162
+ - Make shell auto-activate on show with 0.25 delay
141
163
 
142
164
  ## 0.7.0
143
165
 
data/PROCESS.md CHANGED
@@ -3,13 +3,13 @@
3
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
- - **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.
7
- - **Software Architecture and Design Diagrams**: Perform software architecture and design activities as necessary by analyzing requirements and creating diagrams.
8
- - **Initial Release Plan**: This guideline's motto is "Plans are Nothing. Planning is Everything" (said by Dwight D. Eisenhower) because the initial release plan is not set in stone and might change completely, but is still invaluable in launching a new project forward. Consider including alpha releases (for internal testing) and beta releases (for customer testing).
9
- - **Small Releases**: Develop and release in small increments. Do not release more than 3-weeks worth of work, preferring releases that are shorter than a week worth of work whenever possible. Break releases down. If you need to support multiple platforms, release for a platform at a time. If a feature includes a number of other features, then release them one by one instead of all at once. If a feature involves multiple options, release the default version first, and then release extra options later.
10
- - **Usability Testing**: Make sure to observe a user using your software the first few releases or when releasing critical brand new unproven features. Ask them to complete a list of goals using the software, but do not help them to complete them unless they get very stuck. Write down notes silently while observing them use your software. Once done with usability testing, you may then ask further questions about any of the notes you wrote down, and afterwards add the notes as feature enhancements and bug fixes. Implement them and then do another usability test with the improvements in place. Repeat as necessary only.
11
- - **Automated Tests**: Cover sensitive parts of the code with automated tests at the appropriate level of testing needed. Run tests in a continuous integration server.
12
- - **Refactoring**: Simplify code, eliminate code duplication, improve code organization, extract reusable components, and extract reusable libraries at every opportunity possible.
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.
7
+ 2. **Software Architecture and Design Diagrams**: Perform software architecture and design activities as necessary by analyzing requirements and creating diagrams.
8
+ 3. **Initial Release Plan**: This guideline's motto is "Plans are Nothing. Planning is Everything" (said by Dwight D. Eisenhower) because the initial release plan is not set in stone and might change completely, but is still invaluable in launching a new project forward. Consider including alpha releases (for internal testing) and beta releases (for customer testing).
9
+ 4. **Small Releases**: Develop and release in small increments. Do not release more than 3-weeks worth of work, preferring releases that are shorter than a week worth of work whenever possible. Break releases down. If you need to support multiple platforms, release for a platform at a time. If a feature includes a number of other features, then release them one by one instead of all at once. If a feature involves multiple options, release the default version first, and then release extra options later.
10
+ 5. **Usability Testing**: Make sure to observe a user using your software the first few releases or when releasing critical brand new unproven features. Ask them to complete a list of goals using the software, but do not help them to complete them unless they get very stuck. Write down notes silently while observing them use your software. Once done with usability testing, you may then ask further questions about any of the notes you wrote down, and afterwards add the notes as feature enhancements and bug fixes. Implement them and then do another usability test with the improvements in place. Repeat as necessary only.
11
+ 6. **Automated Tests**: Cover sensitive parts of the code with automated tests at the appropriate level of testing needed. Run tests in a continuous integration server.
12
+ 7. **Refactoring**: Simplify code, eliminate code duplication, improve code organization, extract reusable components, and extract reusable libraries at every opportunity possible.
13
13
 
14
14
  --
15
15
 
data/README.md CHANGED
@@ -1,56 +1,51 @@
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 - 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.6 - 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
+ [![Travis CI](https://travis-ci.com/AndyObtiva/glimmer.svg?branch=master)](https://travis-ci.com/github/AndyObtiva/glimmer)
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
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](#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)
13
13
 
14
- [**Glimmer**](https://rubygems.org/gems/glimmer) is a DSL Framework that consists of:
15
- - DSL Engine: enables building DSLs for desktop GUI, XML/HTML documents, CSS styling, and webification of desktop apps.
16
- - Data-Binding/Observer/Observable Library: enables synchronizing GUI with Model Attributes bidirectionally.
14
+ [<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
15
+ Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do)
17
16
 
18
- [**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)
17
+ [**Glimmer**](https://rubygems.org/gems/glimmer) is a DSL Framework that consists of two things:
18
+ - [DSL Engine](#dsl-engine): enables building DSLs for desktop GUI, web GUI, XML/HTML documents, and CSS styling.
19
+ - [Data-Binding Support](#data-binding-support): 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
+ - No extra unnecessary block variables when not needed
24
+ - Maximum readability and maintainability
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 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
+
30
+ [**Glimmer**](https://rubygems.org/gems/glimmer) supports the following DSLs:
31
+ - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
20
32
  - [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)
33
+ - [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
34
  - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
23
35
  - [glimmer-dsl-css](https://github.com/AndyObtiva/glimmer-dsl-css): Glimmer DSL for CSS
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
39
  ## Table of contents
31
40
 
32
- - [Glimmer 1.0.1](#-glimmer-101)
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)
41
+ - [Glimmer 1.0.6](#-glimmer-106---dsl-framework)
42
+ - [Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](#glimmer-dsl-for-swt-jruby-desktop-development-gui-framework)
39
43
  - [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
- - [Hello, List Single Selection!](#hello-list-single-selection)
48
- - [Hello, List Multi Selection!](#hello-list-multi-selection)
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)
49
45
  - [Glimmer DSL for XML (& HTML)](#glimmer-dsl-for-xml--html)
50
- - [XML DSL](#xml-dsl)
51
46
  - [Glimmer DSL for CSS](#glimmer-dsl-for-css)
52
- - [CSS DSL](#css-dsl)
53
- - [Multi-DSL Support](#multi-dsl-support)
47
+ - [DSL Engine](#dsl-engine)
48
+ - [Data-Binding Support](#data-binding-support)
54
49
  - [Glimmer Supporting Libraries](#glimmer-supporting-libraries)
55
50
  - [Glimmer Process](#glimmer-process)
56
51
  - [Resources](#resources)
@@ -64,15 +59,17 @@ Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.d
64
59
  - [Hire Me](#hire-me)
65
60
  - [License](#license)
66
61
 
67
- ## Glimmer DSL for SWT (JRuby Desktop Development GUI Library)
62
+ ## Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
68
63
 
69
64
  [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).
70
65
 
66
+ 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
+
71
68
  ### Glimmer DSL for SWT Samples
72
69
 
73
70
  #### Hello, World!
74
71
 
75
- Glimmer code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_world.rb)):
72
+ Glimmer GUI code (from [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_world.rb)):
76
73
  ```ruby
77
74
  include Glimmer
78
75
 
@@ -84,23 +81,16 @@ shell {
84
81
  }.open
85
82
  ```
86
83
 
87
- Run:
88
- ```
89
- glimmer sample:run[hello_world]
90
- ```
91
-
92
84
  Glimmer app:
93
85
 
94
86
  ![Hello World](images/glimmer-hello-world.png)
95
87
 
96
88
  #### Tic Tac Toe
97
89
 
98
- Glimmer code (from [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/tic_tac_toe.rb)):
90
+ 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)):
99
91
 
100
92
  ```ruby
101
93
  # ...
102
- @tic_tac_toe_board = Board.new
103
-
104
94
  @shell = shell {
105
95
  text "Tic-Tac-Toe"
106
96
  minimum_size 150, 178
@@ -121,27 +111,16 @@ Glimmer code (from [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObt
121
111
  }
122
112
  }
123
113
  }
124
-
125
- observe(@tic_tac_toe_board, :game_status) { |game_status|
126
- display_win_message if game_status == Board::WIN
127
- display_draw_message if game_status == Board::DRAW
128
- }
129
114
  # ...
130
115
  ```
131
116
 
132
- Run:
133
-
134
- ```
135
- glimmer sample:run[tic_tac_toe]
136
- ```
137
-
138
117
  Glimmer app:
139
118
 
140
119
  ![Tic Tac Toe](images/glimmer-tic-tac-toe-in-progress.png)
141
120
 
142
121
  #### Contact Manager
143
122
 
144
- Glimmer code (from [samples/elaborate/contact_manager.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/contact_manager.rb)):
123
+ Glimmer GUI code (from [samples/elaborate/contact_manager.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/contact_manager.rb)):
145
124
 
146
125
  ```ruby
147
126
  # ...
@@ -254,12 +233,6 @@ Glimmer code (from [samples/elaborate/contact_manager.rb](https://github.com/And
254
233
  # ...
255
234
  ```
256
235
 
257
- Run:
258
-
259
- ```
260
- glimmer sample:run[contact_manager]
261
- ```
262
-
263
236
  Glimmer App:
264
237
 
265
238
  ![Contact Manager](images/glimmer-contact-manager.png)
@@ -291,6 +264,8 @@ The trade-off is that while [SWT](https://www.eclipse.org/swt/) provides a pleth
291
264
  - Scaffolding for new custom widgets, apps, and gems
292
265
  - Native-Executable packaging on Mac, Windows, and Linux
293
266
 
267
+ 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
+
294
269
  ### Glimmer DSL for Tk Samples
295
270
 
296
271
  #### Hello, World!
@@ -324,7 +299,7 @@ Glimmer code (from [samples/hello/hello_tab.rb](https://github.com/AndyObtiva/gl
324
299
  ```ruby
325
300
  include Glimmer
326
301
 
327
- root {
302
+ root {
328
303
  title 'Hello, Tab!'
329
304
 
330
305
  notebook {
@@ -364,7 +339,7 @@ root {
364
339
  title 'Hello, Combo!'
365
340
 
366
341
  combobox { |proxy|
367
- state 'readonly'
342
+ state 'readonly'
368
343
  text bind(person, :country)
369
344
  }
370
345
 
@@ -389,12 +364,14 @@ Glimmer app:
389
364
  ![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)
390
365
  ![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)
391
366
 
392
- ## Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
367
+ ## Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)
393
368
 
394
- [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.
369
+ [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.
395
370
 
396
371
  Glimmer DSL for Opal webifier successfully reuses the entire [Glimmer](https://github.com/AndyObtiva/glimmer) core DSL engine in [Opal Ruby](https://opalrb.com/) inside a web browser, and as such inherits the full range of powerful Glimmer desktop [data-binding](https://github.com/AndyObtiva/glimmer#data-binding) capabilities for the web.
397
372
 
373
+ 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
+
398
375
  ### Glimmer DSL for Opal Samples
399
376
 
400
377
  #### Hello, Computed!
@@ -516,129 +493,63 @@ You should see "Hello, Computed!"
516
493
 
517
494
  ![Glimmer DSL for Opal Hello Computed](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-opal/master/images/glimmer-dsl-opal-hello-computed.png)
518
495
 
519
- #### Hello, List Single Selection!
520
-
521
- Add the following require statement to `app/assets/javascripts/application.rb`
522
-
523
-
524
- ```ruby
525
- require 'samples/hello/hello_list_single_selection'
526
- ```
527
-
528
- Or add the Glimmer code directly if you prefer to play around with it:
529
-
530
- ```ruby
531
- class Person
532
- attr_accessor :country, :country_options
533
-
534
- def initialize
535
- self.country_options=["", "Canada", "US", "Mexico"]
536
- self.country = "Canada"
537
- end
538
-
539
- def reset_country
540
- self.country = "Canada"
541
- end
542
- end
543
-
544
- class HelloListSingleSelection
545
- include Glimmer
546
- def launch
547
- person = Person.new
548
- shell {
549
- composite {
550
- list {
551
- selection bind(person, :country)
552
- }
553
- button {
554
- text "Reset"
555
- on_widget_selected do
556
- person.reset_country
557
- end
558
- }
559
- }
560
- }.open
561
- end
562
- end
563
-
564
- HelloListSingleSelection.new.launch
565
- ```
566
- Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
567
-
568
- ![Glimmer DSL for SWT Hello List Single Selection](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-hello-list-single-selection.png)
496
+ #### Glimmer Calculator
569
497
 
570
- Glimmer app on the web (using `glimmer-dsl-opal` gem):
498
+ Add the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem to `Gemfile` (without requiring):
571
499
 
572
- Start the Rails server:
573
500
  ```
574
- rails s
501
+ gem 'glimmer-cs-calculator', require: false
575
502
  ```
576
503
 
577
- Visit `http://localhost:3000`
578
-
579
- You should see "Hello, List Single Selection!"
580
-
581
- ![Glimmer DSL for Opal Hello List Single Selection](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-opal/master/images/glimmer-dsl-opal-hello-list-single-selection.png)
582
-
583
- #### Hello, List Multi Selection!
584
-
585
504
  Add the following require statement to `app/assets/javascripts/application.rb`
586
505
 
587
506
  ```ruby
588
- require 'samples/hello/hello_list_multi_selection'
507
+ require 'glimmer-cs-calculator/launch'
589
508
  ```
590
509
 
591
- Or add the Glimmer code directly if you prefer to play around with it:
510
+ Sample GUI code (relies on custom widgets `command_button`, `operation_button`, and `number_button`):
592
511
 
593
512
  ```ruby
594
- class Person
595
- attr_accessor :provinces, :provinces_options
596
-
597
- def initialize
598
- self.provinces_options=[
599
- "",
600
- "Quebec",
601
- "Ontario",
602
- "Manitoba",
603
- "Saskatchewan",
604
- "Alberta",
605
- "British Columbia",
606
- "Nova Skotia",
607
- "Newfoundland"
608
- ]
609
- self.provinces = ["Quebec", "Manitoba", "Alberta"]
610
- end
611
-
612
- def reset_provinces
613
- self.provinces = ["Quebec", "Manitoba", "Alberta"]
614
- end
615
- end
616
-
617
- class HelloListMultiSelection
618
- include Glimmer
619
- def launch
620
- person = Person.new
621
- shell {
622
- composite {
623
- list(:multi) {
624
- selection bind(person, :provinces)
625
- }
626
- button {
627
- text "Reset"
628
- on_widget_selected do
629
- person.reset_provinces
630
- end
631
- }
632
- }
633
- }.open
634
- end
635
- end
636
-
637
- HelloListMultiSelection.new.launch
513
+ shell {
514
+ minimum_size (OS.mac? ? 320 : (OS.windows? ? 390 : 520)), 240
515
+ image File.join(APP_ROOT, 'package', 'windows', "Glimmer Calculator.ico") if OS.windows?
516
+ text "Glimmer - Calculator"
517
+ grid_layout 4, true
518
+ # Setting styled_text to multi in order for alignment options to activate
519
+ styled_text(:multi, :wrap, :border) {
520
+ text bind(@presenter, :result)
521
+ alignment swt(:right)
522
+ right_margin 5
523
+ font height: 40
524
+ layout_data(:fill, :fill, true, true) {
525
+ horizontal_span 4
526
+ }
527
+ editable false
528
+ caret nil
529
+ }
530
+ command_button('AC')
531
+ operation_button('÷')
532
+ operation_button('×')
533
+ operation_button('−')
534
+ (7..9).each { |number|
535
+ number_button(number)
536
+ }
537
+ operation_button('+', font: @button_font_big, vertical_span: 2)
538
+ (4..6).each { |number|
539
+ number_button(number)
540
+ }
541
+ (1..3).each { |number|
542
+ number_button(number)
543
+ }
544
+ command_button('=', font: @button_font_big, vertical_span: 2)
545
+ number_button(0, horizontal_span: 2)
546
+ operation_button('.')
547
+ }
638
548
  ```
639
- Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
640
549
 
641
- ![Glimmer DSL for SWT Hello List Multi Selection](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-hello-list-multi-selection.png)
550
+ Glimmer app on the desktop (using the [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
551
+
552
+ ![Glimmer Calculator Linux](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-linux.png)
642
553
 
643
554
  Glimmer app on the web (using `glimmer-dsl-opal` gem):
644
555
 
@@ -648,10 +559,19 @@ rails s
648
559
  ```
649
560
 
650
561
  Visit `http://localhost:3000`
562
+ (or visit: http://glimmer-cs-calculator-server.herokuapp.com)
563
+
564
+ You should see "Glimmer Calculator"
565
+
566
+ [![Glimmer Calculator Opal](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-opal.png)](http://glimmer-cs-calculator-server.herokuapp.com)
567
+
568
+ Here is an Apple Calculator CSS themed version (with [CSS only](https://github.com/AndyObtiva/glimmer-cs-calculator/blob/master/server/glimmer-cs-calculator-server/app/assets/stylesheets/welcomes_apple.scss), no app code changes):
651
569
 
652
- You should see "Hello, List Multi Selection!"
570
+ Visit http://glimmer-cs-calculator-server.herokuapp.com/welcomes/apple
653
571
 
654
- ![Glimmer DSL for Opal Hello List Multi Selection](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-opal/master/images/glimmer-dsl-opal-hello-list-multi-selection.png)
572
+ You should see "Apple Calculator Theme"
573
+
574
+ [![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)
655
575
 
656
576
  ## Glimmer DSL for XML (& HTML)
657
577
 
@@ -730,36 +650,118 @@ Output:
730
650
  body{font-size:1.1em;background:white}body > h1{background-color:red;font-size:2em}
731
651
  ```
732
652
 
733
- ## Multi-DSL Support
734
-
735
- 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`)
653
+ ## DSL Engine
736
654
 
737
- Glimmer allows mixing DSLs, which comes in handy when doing things like using a desktop Browser widget with HTML and CSS.
655
+ 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.
738
656
 
739
657
  Glimmer DSL syntax consists mainly of:
740
658
  - keywords (e.g. `table` for a table widget)
741
659
  - style/args (e.g. :multi as in `table(:multi)` for a multi-line selection table widget)
742
660
  - 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)
743
661
 
744
- 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.
662
+ The Glimmer DSL Engine's architecture is based on the following Design Patterns and Data Structures:
663
+ - **Interpreter Design Pattern**: to define interpretable expressions of DSL keywords
664
+ - **Chain of Responsibility Design Pattern / Queue Data Structure**: to chain expression handlers in order of importance for processing DSL keywords
665
+ - **Adapter Design Pattern**: to adapt expressions into handlers in a chain of responsibility
666
+ - **Stack Data Structure**: to handle processing parent/child nesting of DSL keyword expressions in the correct order
667
+
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**, but stumbled upon it anyways through following the Gang of Four Design Patterns mentioned above, chiefly the **Interpreter Design Pattern**.
669
+
670
+ 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
+
672
+ Expressions are either:
673
+ - **Static** (subclass of `StaticExpression`, which is a subclass of `Expression`): if they represent a single pre-identified keyword (e.g. `color` or `display`)
674
+ - **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>`)
675
+
676
+ Optionally, expressions can be parent expressions that contain other expressions, and must include the `ParentExpression` mixin module as such.
677
+
678
+ Additionally, every expression that serves as a top-level entry point into the DSL must mixin `TopLevelExpression`
679
+
680
+ 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.
681
+
682
+ Every `Expression` sublcass must specify two methods at least:
683
+ - `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.
684
+ - `interpret(parent, keyword, *args, &block)`: to go ahead and interpret a DSL expression that qualified for interpretation
685
+
686
+ `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.
687
+
688
+ `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:
689
+ - `add_content(parent, &block)`
690
+
691
+ 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
+
693
+ DSL expressions go into the `glimmer/dsl/{dsl_name}` namespace directory.
694
+
695
+ Also, every DSL requires a `glimmer/dsl/{dsl_name}/dsl.rb` file, which configures the DSL into Glimmer via a call to:
696
+ ```ruby
697
+ Glimmer::DSL::Engine.add_dynamic_expressions(DSLNameModule, expression_names_array)
698
+ ```
699
+
700
+ Expression names are underscored verions of `Expression` subclass names minus the `_expression` suffix.
701
+
702
+ For example, here is an SWT DSL configuration:
703
+
704
+ ```ruby
705
+ require 'glimmer/launcher'
706
+ require Glimmer::Launcher.swt_jar_file
707
+ require 'glimmer/dsl/engine'
708
+ Dir[File.expand_path('../*_expression.rb', __FILE__)].each {|f| require f}
709
+
710
+ module Glimmer
711
+ module DSL
712
+ module SWT
713
+ Engine.add_dynamic_expressions(
714
+ SWT,
715
+ %w[
716
+ layout
717
+ widget_listener
718
+ combo_selection_data_binding
719
+ checkbox_group_selection_data_binding
720
+ radio_group_selection_data_binding
721
+ list_selection_data_binding
722
+ tree_items_data_binding
723
+ table_items_data_binding
724
+ data_binding
725
+ cursor
726
+ font
727
+ image
728
+ property
729
+ block_property
730
+ widget
731
+ custom_widget
732
+ ]
733
+ )
734
+ end
735
+ end
736
+ end
737
+ ```
738
+
739
+ In summary, these are the files needed to author a Glimmer DSL:
740
+ - `glimmer/dsl/[dsl_name]/dsl.rb`: requires and adds all dynamic expressions to [dsl_name] Glimmer DSL
741
+ - `glimmer/dsl/[dsl_name]/[expresion_name]_expresion.rb`: needed for every [expresion_name] expression, whether dynamic or static
742
+
743
+ ### Multi-DSL Support
744
+
745
+ The Glimmer [DSL Engine](#dsl-engine) allows mixing DSLs, which comes in handy when doing things like using a desktop GUI DSL `browser` widget with the HTML DSL and CSS DSL.
746
+
747
+ DSLs are activated by top-level keywords (expressions denoted as `TopLevelExpression`). 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.
748
+
749
+ ## Data-Binding Support
750
+
751
+ Data-Binding enables binding GUI properties (like text and color) to Model attributes (like name and age).
745
752
 
746
- ## Glimmer Supporting Libraries
753
+ It relies on the Observer Design Pattern and MVP (Model-View-Presenter) Architectural Pattern (a variation on MVC)
747
754
 
748
- Here is a list of notable 3rd party gems used by Glimmer and Glimmer DSLs:
749
- - [jeweler](https://github.com/technicalpickles/jeweler): generates app gems during [Glimmer Scaffolding](https://github.com/AndyObtiva/glimmer-dsl-swt#scaffolding)
750
- - [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)
751
- - [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
752
- - [os](https://github.com/rdp/os): provides OS detection capabilities (e.g. `OS.mac?` or `OS.windows?`) to write cross-platform code inexpensively
753
- - [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`)
754
- - [rake](https://github.com/ruby/rake): used to implement and execute `glimmer` commands
755
- - [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.
756
- - [super_module](https://github.com/AndyObtiva/super_module): used to cleanly write the Glimmer::UI:CustomWidget and Glimmer::UI::CustomShell modules
757
- - [text-table](https://github.com/aptinio/text-table): renders textual data in a textual table for the command-line interface of Glimmer
758
- - [warbler](https://github.com/jruby/warbler): converts a Glimmer app into a Java JAR file during packaging
755
+ These are the main classes concerning data-binding:
756
+ - `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`)
757
+ - `Observable`: General super-module for all observables. Main methods concerned are: `add_observer` and `remove_observer`
758
+ - `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.
759
+ - `ObservableArray`: Mixin module for any observable array collection that automatically handles notifying observers upon performing array mutation operations (e.g. `push` or `delete`)
760
+ - `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
759
761
 
760
762
  ## Glimmer Process
761
763
 
762
- [Glimmer Process](PROCESS.md) is the lightweight software development process used for building Glimmer libraries and Glimmer apps, which goes beyond Agile, rendering all Agile processes obsolete. [Glimmer Process](PROCESS.md) is simply made up of 7 guidelines to pick and choose as necessary until software development needs are satisfied.
764
+ [Glimmer Process](PROCESS.md) is the lightweight software development process used for building Glimmer libraries and Glimmer apps, which goes beyond Agile, rendering all Agile processes obsolete. [Glimmer Process](PROCESS.md) is simply made up of 7 guidelines to pick and choose as necessary until software development needs are satisfied.
763
765
 
764
766
  Learn more by reading the [GPG](PROCESS.md) (Glimmer Process Guidelines)
765
767
 
@@ -782,7 +784,7 @@ You may submit [issues](https://github.com/AndyObtiva/glimmer/issues) on [GitHub
782
784
 
783
785
  ### Chat
784
786
 
785
- If you need live help, try to [![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)
787
+ If you need live help, try to [![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)
786
788
 
787
789
  ## Feature Suggestions
788
790
 
@@ -807,7 +809,7 @@ Glimmer DSL Engine specific tasks are at:
807
809
  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).
808
810
 
809
811
  You may apply for contributing to any of these Glimmer DSL gems whether you prefer to focus on the desktop or web:
810
- - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Library)
812
+ - [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)
811
813
  - [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
812
814
  - [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
813
815
  - [glimmer-dsl-xml](https://github.com/AndyObtiva/glimmer-dsl-xml): Glimmer DSL for XML (& HTML)
@@ -830,7 +832,7 @@ If your company would like to invest fulltime in further development of the Glim
830
832
 
831
833
  [MIT](LICENSE.txt)
832
834
 
833
- Copyright (c) 2007-2020 - Andy Maleh.
835
+ Copyright (c) 2007-2020 - Andy Maleh.
834
836
 
835
837
  --
836
838
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.1
1
+ 1.0.6
@@ -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.1 ruby lib
5
+ # stub: glimmer 1.0.6 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "glimmer".freeze
9
- s.version = "1.0.1"
9
+ s.version = "1.0.6"
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 = "2020-10-04"
15
- s.description = "Glimmer is a Ruby DSL engine with support for the Glimmer DSL for SWT (JRuby Desktop Development GUI Library), the Glimmer DSL for Tk (Ruby Desktop Development GUI Library), the Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps), the Glimmer DSL for XML (& HTML), and the Glimmer DSL for CSS.".freeze
14
+ s.date = "2020-12-15"
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
16
16
  s.email = "andy.am@gmail.com".freeze
17
17
  s.extra_rdoc_files = [
18
18
  "CHANGELOG.md",
@@ -53,7 +53,7 @@ Gem::Specification.new do |s|
53
53
  end
54
54
 
55
55
  if s.respond_to? :add_runtime_dependency then
56
- s.add_runtime_dependency(%q<array_include_methods>.freeze, [">= 1.0.3", "< 2.0.0"])
56
+ s.add_runtime_dependency(%q<array_include_methods>.freeze, [">= 1.0.4", "< 2.0.0"])
57
57
  s.add_runtime_dependency(%q<facets>.freeze, [">= 3.1.0", "< 4.0.0"])
58
58
  s.add_development_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
59
59
  s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
@@ -64,8 +64,9 @@ Gem::Specification.new do |s|
64
64
  s.add_development_dependency(%q<coveralls>.freeze, ["= 0.8.23"])
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
+ s.add_development_dependency(%q<rake-tui>.freeze, [">= 0"])
67
68
  else
68
- s.add_dependency(%q<array_include_methods>.freeze, [">= 1.0.3", "< 2.0.0"])
69
+ s.add_dependency(%q<array_include_methods>.freeze, [">= 1.0.4", "< 2.0.0"])
69
70
  s.add_dependency(%q<facets>.freeze, [">= 3.1.0", "< 4.0.0"])
70
71
  s.add_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
71
72
  s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
@@ -76,6 +77,7 @@ Gem::Specification.new do |s|
76
77
  s.add_dependency(%q<coveralls>.freeze, ["= 0.8.23"])
77
78
  s.add_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
78
79
  s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
80
+ s.add_dependency(%q<rake-tui>.freeze, [">= 0"])
79
81
  end
80
82
  end
81
83
 
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 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
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
@@ -81,9 +81,9 @@ module Glimmer
81
81
  end
82
82
 
83
83
  def apply_converter(converter, value)
84
- return value if converter.nil?
85
- return value.send(converter) if (converter.is_a?(String) || converter.is_a?(Symbol)) && value.respond_to?(converter)
86
- return converter.call(value) if converter.respond_to?(:call, value)
84
+ return value if converter.nil?
85
+ return value.send(converter) if (converter.is_a?(String) || converter.is_a?(Symbol)) && value.respond_to?(converter)
86
+ return converter.call(value) if converter.respond_to?(:call, value)
87
87
  raise Glimmer::Error, "Unsupported bind converter: #{converter.inspect}"
88
88
  end
89
89
 
@@ -213,7 +213,7 @@ module Glimmer
213
213
  end
214
214
 
215
215
  def evaluate_property
216
- value = nil
216
+ value = nil
217
217
  value = invoke_property_reader(model, property_name) unless model.nil?
218
218
  convert_on_read(value)
219
219
  end
@@ -242,7 +242,7 @@ module Glimmer
242
242
  end
243
243
 
244
244
  def invoke_property_writer(object, property_expression, value)
245
- return if @binding_options[:read_only]
245
+ raise "Cannot invoke `#{property_expression}` because ModelBinding#binding_options[:read_only]=true" if @binding_options[:read_only]
246
246
  value = convert_on_write(value)
247
247
  if property_indexed?(property_expression)
248
248
  property_method = '[]='
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 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
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
@@ -48,7 +48,7 @@ module Glimmer
48
48
  def add_element_observer(element, observer)
49
49
  element_properties_for(observer).each do |property|
50
50
  observer.observe(element, property)
51
- end
51
+ end
52
52
  end
53
53
 
54
54
  def remove_observer(observer, *element_properties)
@@ -62,20 +62,20 @@ module Glimmer
62
62
  property_observer_list.delete(observer)
63
63
  observer_element_properties.delete(observer)
64
64
  each { |element| remove_element_observer(element, observer) }
65
- end
65
+ end
66
66
  observer
67
67
  end
68
68
 
69
69
  def remove_element_observers(element)
70
70
  property_observer_list.each do |observer|
71
71
  remove_element_observer(element, observer)
72
- end
72
+ end
73
73
  end
74
74
 
75
75
  def remove_element_observer(element, observer)
76
76
  element_properties_for(observer).each do |property|
77
77
  observer.unobserve(element, property)
78
- end
78
+ end
79
79
  end
80
80
 
81
81
  def has_observer?(observer)
@@ -104,17 +104,18 @@ module Glimmer
104
104
 
105
105
  def <<(element)
106
106
  super(element).tap do
107
- add_element_observers(element)
107
+ add_element_observers(element)
108
108
  notify_observers
109
109
  end
110
110
  end
111
111
  alias push <<
112
+ alias append <<
112
113
 
113
114
  def []=(index, value)
114
115
  old_value = self[index]
115
116
  unregister_dependent_observers(old_value)
116
117
  remove_element_observers(old_value)
117
- add_element_observers(value)
118
+ add_element_observers(value)
118
119
  super(index, value).tap do
119
120
  notify_observers
120
121
  end
@@ -150,7 +151,7 @@ module Glimmer
150
151
  if block_given?
151
152
  old_array = Array.new(self)
152
153
  super(&block).tap do |new_array|
153
- (old_array - new_array).each do |element|
154
+ (old_array - new_array).each do |element|
154
155
  unregister_dependent_observers(element)
155
156
  remove_element_observers(element)
156
157
  end
@@ -261,6 +262,14 @@ module Glimmer
261
262
  end
262
263
  end
263
264
 
265
+ def unshift(element)
266
+ super(element).tap do
267
+ add_element_observers(element)
268
+ notify_observers
269
+ end
270
+ end
271
+ alias prepend unshift
272
+
264
273
  def reject!(&block)
265
274
  if block.nil?
266
275
  super
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 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
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
@@ -57,7 +57,26 @@ module Glimmer
57
57
  end
58
58
 
59
59
  def remove_observer(observer, property_name)
60
- property_observer_list(property_name).delete(observer)
60
+ if has_observer?(observer, property_name)
61
+ property_observer_list(property_name).delete(observer)
62
+ observer.unobserve(self, property_name)
63
+ end
64
+ end
65
+
66
+ def remove_observers(property_name)
67
+ property_observer_hash[property_name.to_sym].each do |observer|
68
+ remove_observer(observer, property_name)
69
+ end
70
+ property_observer_hash.delete(property_name.to_sym)
71
+ end
72
+
73
+ def remove_all_observers
74
+ all_observers = property_observer_hash.clone
75
+ property_observer_hash.keys.each do |property_name|
76
+ remove_observers(property_name)
77
+ end
78
+ property_observer_hash.clear
79
+ all_observers
61
80
  end
62
81
 
63
82
  def has_observer?(observer, property_name)
@@ -86,7 +105,7 @@ module Glimmer
86
105
  method(property_writer_name)
87
106
  ensure_array_object_observer(property_name, send(property_name))
88
107
  begin
89
- singleton_method("__original_#{property_writer_name}")
108
+ method("__original_#{property_writer_name}")
90
109
  rescue
91
110
  define_singleton_method("__original_#{property_writer_name}", property_writer_method(property_writer_name))
92
111
  define_singleton_method(property_writer_name, &PROPERTY_WRITER_FACTORY.call(property_name))
@@ -97,7 +116,7 @@ module Glimmer
97
116
  end
98
117
 
99
118
  def property_writer_method(property_writer_name)
100
- self.class.instance_method(property_writer_name) rescue self.method(property_writer_name)
119
+ self.class.instance_method(property_writer_name) rescue self.method(property_writer_name)
101
120
  end
102
121
 
103
122
  def unregister_dependent_observers(property_name, old_value)
@@ -118,7 +137,7 @@ module Glimmer
118
137
  end
119
138
 
120
139
  def array_object_observer_for(property_name)
121
- @array_object_observers ||= {}
140
+ @array_object_observers ||= {}
122
141
  @array_object_observers[property_name] = ObservableModel::Notifier.new(self, property_name) unless @array_object_observers.has_key?(property_name)
123
142
  @array_object_observers[property_name]
124
143
  end
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 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
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
@@ -51,6 +51,7 @@ module Glimmer
51
51
  observer.unobserve(observable, property)
52
52
  end
53
53
  alias unobserve unregister
54
+ alias deregister unregister
54
55
  end
55
56
 
56
57
  class << self
@@ -99,13 +100,14 @@ module Glimmer
99
100
  def unregister(observable, property = nil)
100
101
  return unless observable.is_a?(Observable)
101
102
  # TODO optimize performance in the future via indexing and/or making a registration official object/class
102
- observable.remove_observer(*[self, property].compact)
103
103
  registration = registration_for(observable, property)
104
104
  dependents_for(registration).each do |dependent|
105
105
  dependent.unregister
106
106
  remove_dependent(registration => dependent)
107
107
  end
108
- registrations.delete(registration)
108
+ registrations.delete(registration).tap do |registration|
109
+ observable.remove_observer(*[self, property].compact)
110
+ end
109
111
  end
110
112
  alias unobserve unregister
111
113
 
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 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
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
@@ -51,7 +51,7 @@ module Glimmer
51
51
  end
52
52
  if interpretation
53
53
  interpretation
54
- else
54
+ else
55
55
  raise Glimmer::Error, "Unsupported keyword: #{keyword}" unless static_expression_dsl || retrieved_static_expression
56
56
  Glimmer::DSL::Engine.dsl_stack.push(static_expression_dsl || Glimmer::DSL::Engine.dsl)
57
57
  static_expression = Glimmer::DSL::Engine.static_expressions[keyword][Glimmer::DSL::Engine.dsl]
@@ -62,8 +62,8 @@ module Glimmer
62
62
  Glimmer::DSL::Engine.interpret_expression(static_expression, keyword, *args, &block)
63
63
  end
64
64
  end
65
- end
66
- end
65
+ end
66
+ end
67
67
  end
68
68
 
69
69
  class << self
@@ -115,7 +115,7 @@ module Glimmer
115
115
  # Static expressions indexed by keyword and dsl
116
116
  def static_expressions
117
117
  @static_expressions ||= {}
118
- end
118
+ end
119
119
 
120
120
  # Sets dynamic expression chains of responsibility. Useful for internal testing
121
121
  attr_writer :dynamic_expression_chains_of_responsibility
@@ -132,7 +132,7 @@ module Glimmer
132
132
  # Pattern when interpretting a DSL expression
133
133
  def add_dynamic_expressions(dsl_namespace, *expression_names)
134
134
  expression_names = expression_names.flatten
135
- dsl = dsl_namespace.name.split("::").last.downcase.to_sym
135
+ dsl = dsl_namespace.name.split("::").last.downcase.to_sym
136
136
  dynamic_expression_chains_of_responsibility[dsl] = expression_names.reverse.map do |expression_name|
137
137
  expression_class(dsl_namespace, expression_name).new
138
138
  end.reduce(nil) do |last_expresion_handler, expression|
@@ -140,7 +140,7 @@ module Glimmer
140
140
  expression_handler = ExpressionHandler.new(expression)
141
141
  expression_handler.next = last_expresion_handler if last_expresion_handler
142
142
  expression_handler
143
- end
143
+ end
144
144
  end
145
145
 
146
146
  def add_static_expression(static_expression)
@@ -161,7 +161,7 @@ module Glimmer
161
161
  end
162
162
 
163
163
  # Interprets Glimmer dynamic DSL expression consisting of keyword, args, and block (e.g. shell(:no_resize) { ... })
164
- def interpret(keyword, *args, &block)
164
+ def interpret(keyword, *args, &block)
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?
@@ -185,7 +185,7 @@ module Glimmer
185
185
  def add_content(parent, expression, &block)
186
186
  if block_given? && expression.is_a?(ParentExpression)
187
187
  dsl_stack.push(expression.class.dsl)
188
- parent_stack.push(parent)
188
+ parent_stack.push(parent)
189
189
  begin
190
190
  expression.add_content(parent, &block)
191
191
  ensure
@@ -1,5 +1,5 @@
1
1
  # Copyright (c) 2007-2020 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
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
@@ -29,7 +29,7 @@ module Glimmer
29
29
  #
30
30
  # Expressions subclasses follow the convention of using `and` and `or`
31
31
  # english versino of Ruby's boolean operations. This allows easy DSL-like
32
- # readability of the rules, and easy tagging with pd when troubleshooting.
32
+ # readability of the rules, and easy printout with puts_debuggerer when troubleshooting.
33
33
  class Expression
34
34
  class << self
35
35
  def dsl
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.1
4
+ version: 1.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - AndyMaleh
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-10-04 00:00:00.000000000 Z
11
+ date: 2020-12-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: array_include_methods
@@ -16,7 +16,7 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.3
19
+ version: 1.0.4
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
22
  version: 2.0.0
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 1.0.3
29
+ version: 1.0.4
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.0.0
@@ -194,10 +194,25 @@ dependencies:
194
194
  - - "~>"
195
195
  - !ruby/object:Gem::Version
196
196
  version: 0.7.0
197
- description: Glimmer is a Ruby DSL engine with support for the Glimmer DSL for SWT
198
- (JRuby Desktop Development GUI Library), the Glimmer DSL for Tk (Ruby Desktop Development
199
- GUI Library), the Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps), the Glimmer
200
- DSL for XML (& HTML), and the Glimmer DSL for CSS.
197
+ - !ruby/object:Gem::Dependency
198
+ name: rake-tui
199
+ requirement: !ruby/object:Gem::Requirement
200
+ requirements:
201
+ - - ">="
202
+ - !ruby/object:Gem::Version
203
+ version: '0'
204
+ type: :development
205
+ prerelease: false
206
+ version_requirements: !ruby/object:Gem::Requirement
207
+ requirements:
208
+ - - ">="
209
+ - !ruby/object:Gem::Version
210
+ version: '0'
211
+ description: Glimmer is a Ruby DSL Framework consisting of a DSL Engine and Observable/Observer/Data-Binding
212
+ Library. Used in the Glimmer DSL for SWT (JRuby Desktop Development GUI Framework),
213
+ the Glimmer DSL for Tk (Ruby Desktop Development GUI Library), the Glimmer DSL for
214
+ Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), the Glimmer DSL for
215
+ XML (& HTML), and the Glimmer DSL for CSS.
201
216
  email: andy.am@gmail.com
202
217
  executables: []
203
218
  extensions: []