glimmer 1.0.0 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -3
- data/PROCESS.md +7 -7
- data/README.md +82 -125
- data/VERSION +1 -1
- data/glimmer.gemspec +83 -0
- data/lib/glimmer.rb +11 -10
- data/lib/glimmer/config.rb +1 -1
- data/lib/glimmer/data_binding/model_binding.rb +7 -7
- data/lib/glimmer/data_binding/observable_array.rb +19 -10
- data/lib/glimmer/data_binding/observable_model.rb +26 -7
- data/lib/glimmer/data_binding/observer.rb +6 -5
- data/lib/glimmer/dsl/expression.rb +4 -4
- metadata +27 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 308cb6947a4ddd903bda7c12eef7043dc05fa5c8473b679168e16245d0cb7097
|
4
|
+
data.tar.gz: 6d49e9dfc418ab7ef67542e033e30b32e84497023f320853d694ad3c1ac8f808
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6ca04445656d701c8729b92aae37f8dda83d11d382a3f489d0d10aad1616c40b830774998f844a713fa6c90651042178d32b47618aee29ecef7a63f4e92e2a8f
|
7
|
+
data.tar.gz: a7d26e3e9aaa5fe6c559a7d86ca796933ad8e00d0bfd284e8d9ac59a27e3496291d1e1dc838e42d16e1bfdae8db88edaf9560d85df6c320813eb1598164e2968
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,28 @@
|
|
3
3
|
Related Change Logs:
|
4
4
|
- [glimmer-dsl-swt/CHANGELOG.md](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/CHANGELOG.md)
|
5
5
|
|
6
|
+
## 1.0.5
|
7
|
+
|
8
|
+
- Fix issue in Opal regarding auto-definition of observable methods in a Class/Module directly (as opposed to a class instance)
|
9
|
+
|
10
|
+
## 1.0.4
|
11
|
+
|
12
|
+
- Ensure that `ObservableModel#remove_observer` clears observer registrations from `Observer` (just like `Observer#unobserve`)
|
13
|
+
- `ObservableModel#remove_observers` and `ObservableModel#remove_all_observers` methods
|
14
|
+
|
15
|
+
## 1.0.3
|
16
|
+
|
17
|
+
- Upgraded array_include_methods gem to v1.0.4
|
18
|
+
|
19
|
+
## 1.0.2
|
20
|
+
|
21
|
+
- Support ObservableArray notifications on `unshift`, `prepend`, and `append`
|
22
|
+
|
23
|
+
## 1.0.1
|
24
|
+
|
25
|
+
- Fixed issue with excluded keywords getting caught up by the infinite-loop-detection check
|
26
|
+
- Upgraded to array_include_method v1.0.3
|
27
|
+
|
6
28
|
## 1.0.0
|
7
29
|
|
8
30
|
- Code/Documentation preparation for version 1.0.0
|
@@ -21,7 +43,7 @@ Related Change Logs:
|
|
21
43
|
|
22
44
|
## 0.10.1
|
23
45
|
|
24
|
-
- excluded_keyword_checkers option for filtering certain keywords from Glimmer DSL processing
|
46
|
+
- excluded_keyword_checkers option for filtering certain keywords from Glimmer DSL processing
|
25
47
|
- Updates to logging levels to be more appropriate
|
26
48
|
- Fixed an issue to avoid crashing when calling observer.unregister/unobserve on a non-observable
|
27
49
|
|
@@ -83,7 +105,7 @@ Related Change Logs:
|
|
83
105
|
- Fix verbiage for summary/description in scaffolding custom shell gems (change custom widget reference to custom shell)
|
84
106
|
- Scaffolding builds a proper binary for custom shell gems and includes it in executables in Rakefile
|
85
107
|
- Scaffolding adds about/preferences menu actions to apps/custom-shell-gems
|
86
|
-
- Make custom widget/shell options writable
|
108
|
+
- Make custom widget/shell options writable
|
87
109
|
- Support "dialog" Glimmer DSL keyword
|
88
110
|
|
89
111
|
## 0.7.7
|
@@ -133,7 +155,7 @@ Related Change Logs:
|
|
133
155
|
- Fix freezing issue upon logging observables and raising observable errors by overriding inspect on Observable to avoid printing nested tree of observers
|
134
156
|
- Added validation for shell widget parentage (accepting a shell or nil) in shell expression
|
135
157
|
- Support bidirectional data-binding of menu item selection (e.g. radio menu item)
|
136
|
-
- Make shell auto-activate on show with 0.25 delay
|
158
|
+
- Make shell auto-activate on show with 0.25 delay
|
137
159
|
|
138
160
|
## 0.7.0
|
139
161
|
|
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
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
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,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.5 - 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)
|
@@ -9,7 +9,13 @@
|
|
9
9
|
|
10
10
|
(The Original Glimmer Library Since 2007. Beware of Imitators!)
|
11
11
|
|
12
|
-
[**Glimmer**](https://rubygems.org/gems/glimmer) is a
|
12
|
+
[**Glimmer**](https://rubygems.org/gems/glimmer) is a DSL Framework that consists of:
|
13
|
+
- DSL Engine: enables building DSLs for desktop GUI, XML/HTML documents, CSS styling, and webification of desktop apps.
|
14
|
+
- Data-Binding/Observer/Observable Library: enables synchronizing GUI with Model Attributes bidirectionally.
|
15
|
+
|
16
|
+
[**Glimmer**](https://rubygems.org/gems/glimmer) started out as [GUI Library](https://github.com/AndyObtiva/glimmer-dsl-swt) and grew into a full-fledged [DSL Framework](#multi-dsl-support). Glimmer's namesake is referring to the Glimmer of Ruby in Graphical User Interfaces (contrary to popular myth perpetrated by [Charles Nutter](http://blog.headius.com/2007/11/tab-sweep.html), Glimmer has nothing to do with the ill-fated Whitney Houston movie, which does not in fact share the same name)
|
17
|
+
|
18
|
+
[**Glimmer**](https://rubygems.org/gems/glimmer) supports the following DSLs:
|
13
19
|
- [glimmer-dsl-swt](https://github.com/AndyObtiva/glimmer-dsl-swt): Glimmer DSL for SWT (JRuby Desktop Development GUI Library)
|
14
20
|
- [glimmer-dsl-tk](https://github.com/AndyObtiva/glimmer-dsl-tk): Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
|
15
21
|
- [glimmer-dsl-opal](https://github.com/AndyObtiva/glimmer-dsl-opal): Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
|
@@ -18,12 +24,12 @@
|
|
18
24
|
|
19
25
|
[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.
|
20
26
|
|
21
|
-
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
27
|
+
[<img src="https://covers.oreillystatic.com/images/9780596519650/lrg.jpg" width=105 /><br />
|
22
28
|
Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.do)
|
23
29
|
|
24
30
|
## Table of contents
|
25
31
|
|
26
|
-
- [Glimmer 1.0.
|
32
|
+
- [Glimmer 1.0.5](#-glimmer-105)
|
27
33
|
- [Glimmer DSL for SWT (JRuby Desktop Development GUI Library)](#glimmer-dsl-for-swt-jruby-desktop-development-gui-library)
|
28
34
|
- [Glimmer DSL for SWT Samples](#glimmer-dsl-for-swt-samples)
|
29
35
|
- [Hello, World!](#hello-world)
|
@@ -38,8 +44,7 @@ Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.d
|
|
38
44
|
- [Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)](#glimmer-dsl-for-opal-web-gui-adapter-for-desktop-apps)
|
39
45
|
- [Glimmer DSL for Opal Samples](#glimmer-dsl-for-opal-samples)
|
40
46
|
- [Hello, Computed!](#hello-computed)
|
41
|
-
- [
|
42
|
-
- [Hello, List Multi Selection!](#hello-list-multi-selection)
|
47
|
+
- [Glimmer Calculator](#glimmer-calculator)
|
43
48
|
- [Glimmer DSL for XML (& HTML)](#glimmer-dsl-for-xml--html)
|
44
49
|
- [XML DSL](#xml-dsl)
|
45
50
|
- [Glimmer DSL for CSS](#glimmer-dsl-for-css)
|
@@ -62,6 +67,8 @@ Featured in<br />JRuby Cookbook](http://shop.oreilly.com/product/9780596519650.d
|
|
62
67
|
|
63
68
|
[Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) is a native-GUI cross-platform desktop development library written in [JRuby](https://www.jruby.org/), an OS-threaded faster version of [Ruby](https://www.ruby-lang.org/en/). [Glimmer](https://rubygems.org/gems/glimmer)'s main innovation is a declarative [Ruby DSL](https://github.com/AndyObtiva/glimmer-dsl-swt#glimmer-dsl-syntax) that enables productive and efficient authoring of desktop application user-interfaces while relying on the robust [Eclipse SWT library](https://www.eclipse.org/swt/). [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) additionally innovates by having built-in [data-binding](https://github.com/AndyObtiva/glimmer-dsl-swt#data-binding) support, which greatly facilitates synchronizing the GUI with domain models, thus achieving true decoupling of object oriented components and enabling developers to solve business problems (test-first) without worrying about GUI concerns. To get started quickly, [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) offers [scaffolding](https://github.com/AndyObtiva/glimmer-dsl-swt#scaffolding) options for [Apps](https://github.com/AndyObtiva/glimmer-dsl-swt#in-production), [Gems](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-shell-gem), and [Custom Widgets](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-widgets). [Glimmer DSL for SWT](https://github.com/AndyObtiva/glimmer-dsl-swt) also includes native-executable [packaging](https://github.com/AndyObtiva/glimmer-dsl-swt#packaging--distribution) support, sorely lacking in other libraries, thus enabling the delivery of desktop apps written in [Ruby](https://www.ruby-lang.org/en/) as truly native DMG/PKG/APP files on the [Mac](https://www.apple.com/ca/macos) + [App Store](https://developer.apple.com/macos/distribution/) and MSI/EXE files on [Windows](https://www.microsoft.com/en-ca/windows).
|
64
69
|
|
70
|
+
To get started, visit the [Glimmer DSL for SWT project page](https://github.com/AndyObtiva/glimmer-dsl-swt#pre-requisites) for instructions on installing the [glimmer-dsl-swt gem](https://rubygems.org/gems/glimmer-dsl-swt).
|
71
|
+
|
65
72
|
### Glimmer DSL for SWT Samples
|
66
73
|
|
67
74
|
#### Hello, World!
|
@@ -270,7 +277,7 @@ Glimmer App:
|
|
270
277
|
|
271
278
|
## Glimmer DSL for Tk (Ruby Desktop Development GUI Library)
|
272
279
|
|
273
|
-
[Tcl/Tk](https://www.tcl.tk/) has evolved into a practical desktop GUI toolkit due to gaining
|
280
|
+
[Tcl/Tk](https://www.tcl.tk/) has evolved into a practical desktop GUI toolkit due to gaining truely native looking widgets on Mac, Windows, and Linux in [Tk version 8.5](https://www.tcl.tk/software/tcltk/8.5.html#:~:text=Highlights%20of%20Tk%208.5&text=Font%20rendering%3A%20Now%20uses%20anti,and%20window%20layout%2C%20and%20more.).
|
274
281
|
|
275
282
|
Additionally, [Ruby](https://www.ruby-lang.org/en/) 3.0 Ractor (formerly known as [Guilds](https://olivierlacan.com/posts/concurrency-in-ruby-3-with-guilds/)) supports truly parallel multi-threading, making both [MRI](https://github.com/ruby/ruby) and [Tk](https://www.tcl.tk/) finally viable for support in [Glimmer](https://github.com/AndyObtiva/glimmer) (Ruby Desktop Development GUI Library) as an alternative to [JRuby on SWT](https://github.com/AndyObtiva/glimmer-dsl-swt).
|
276
283
|
|
@@ -285,6 +292,8 @@ The trade-off is that while [SWT](https://www.eclipse.org/swt/) provides a pleth
|
|
285
292
|
- Scaffolding for new custom widgets, apps, and gems
|
286
293
|
- Native-Executable packaging on Mac, Windows, and Linux
|
287
294
|
|
295
|
+
To get started, visit the [Glimmer DSL for Tk project page](https://github.com/AndyObtiva/glimmer-dsl-tk#pre-requisites) for instructions on installing the [glimmer-dsl-tk gem](https://rubygems.org/gems/glimmer-dsl-tk).
|
296
|
+
|
288
297
|
### Glimmer DSL for Tk Samples
|
289
298
|
|
290
299
|
#### Hello, World!
|
@@ -318,7 +327,7 @@ Glimmer code (from [samples/hello/hello_tab.rb](https://github.com/AndyObtiva/gl
|
|
318
327
|
```ruby
|
319
328
|
include Glimmer
|
320
329
|
|
321
|
-
root {
|
330
|
+
root {
|
322
331
|
title 'Hello, Tab!'
|
323
332
|
|
324
333
|
notebook {
|
@@ -358,7 +367,7 @@ root {
|
|
358
367
|
title 'Hello, Combo!'
|
359
368
|
|
360
369
|
combobox { |proxy|
|
361
|
-
state 'readonly'
|
370
|
+
state 'readonly'
|
362
371
|
text bind(person, :country)
|
363
372
|
}
|
364
373
|
|
@@ -385,10 +394,12 @@ Glimmer app:
|
|
385
394
|
|
386
395
|
## Glimmer DSL for Opal (Web GUI Adapter for Desktop Apps)
|
387
396
|
|
388
|
-
[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.
|
397
|
+
[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.
|
389
398
|
|
390
399
|
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.
|
391
400
|
|
401
|
+
To get started, visit the [Glimmer DSL for Opal project page](https://github.com/AndyObtiva/glimmer-dsl-opal) for instructions on installing the [glimmer-dsl-opal gem](https://rubygems.org/gems/glimmer-dsl-opal).
|
402
|
+
|
392
403
|
### Glimmer DSL for Opal Samples
|
393
404
|
|
394
405
|
#### Hello, Computed!
|
@@ -510,129 +521,63 @@ You should see "Hello, Computed!"
|
|
510
521
|
|
511
522
|
![Glimmer DSL for Opal Hello Computed](https://raw.githubusercontent.com/AndyObtiva/glimmer-dsl-opal/master/images/glimmer-dsl-opal-hello-computed.png)
|
512
523
|
|
513
|
-
####
|
514
|
-
|
515
|
-
Add the following require statement to `app/assets/javascripts/application.rb`
|
516
|
-
|
517
|
-
|
518
|
-
```ruby
|
519
|
-
require 'samples/hello/hello_list_single_selection'
|
520
|
-
```
|
521
|
-
|
522
|
-
Or add the Glimmer code directly if you prefer to play around with it:
|
523
|
-
|
524
|
-
```ruby
|
525
|
-
class Person
|
526
|
-
attr_accessor :country, :country_options
|
524
|
+
#### Glimmer Calculator
|
527
525
|
|
528
|
-
|
529
|
-
self.country_options=["", "Canada", "US", "Mexico"]
|
530
|
-
self.country = "Canada"
|
531
|
-
end
|
526
|
+
Add the [glimmer-cs-calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) gem to `Gemfile` (without requiring):
|
532
527
|
|
533
|
-
def reset_country
|
534
|
-
self.country = "Canada"
|
535
|
-
end
|
536
|
-
end
|
537
|
-
|
538
|
-
class HelloListSingleSelection
|
539
|
-
include Glimmer
|
540
|
-
def launch
|
541
|
-
person = Person.new
|
542
|
-
shell {
|
543
|
-
composite {
|
544
|
-
list {
|
545
|
-
selection bind(person, :country)
|
546
|
-
}
|
547
|
-
button {
|
548
|
-
text "Reset"
|
549
|
-
on_widget_selected do
|
550
|
-
person.reset_country
|
551
|
-
end
|
552
|
-
}
|
553
|
-
}
|
554
|
-
}.open
|
555
|
-
end
|
556
|
-
end
|
557
|
-
|
558
|
-
HelloListSingleSelection.new.launch
|
559
|
-
```
|
560
|
-
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
561
|
-
|
562
|
-
![Glimmer DSL for SWT Hello List Single Selection](https://github.com/AndyObtiva/glimmer/raw/master/images/glimmer-hello-list-single-selection.png)
|
563
|
-
|
564
|
-
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
565
|
-
|
566
|
-
Start the Rails server:
|
567
528
|
```
|
568
|
-
|
529
|
+
gem 'glimmer-cs-calculator', require: false
|
569
530
|
```
|
570
531
|
|
571
|
-
Visit `http://localhost:3000`
|
572
|
-
|
573
|
-
You should see "Hello, List Single Selection!"
|
574
|
-
|
575
|
-
![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)
|
576
|
-
|
577
|
-
#### Hello, List Multi Selection!
|
578
|
-
|
579
532
|
Add the following require statement to `app/assets/javascripts/application.rb`
|
580
533
|
|
581
534
|
```ruby
|
582
|
-
require '
|
535
|
+
require 'glimmer-cs-calculator/launch'
|
583
536
|
```
|
584
537
|
|
585
|
-
|
538
|
+
Sample GUI code (relies on custom widgets `command_button`, `operation_button`, and `number_button`):
|
586
539
|
|
587
540
|
```ruby
|
588
|
-
|
589
|
-
|
590
|
-
|
591
|
-
|
592
|
-
|
593
|
-
|
594
|
-
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
person.reset_provinces
|
624
|
-
end
|
625
|
-
}
|
626
|
-
}
|
627
|
-
}.open
|
628
|
-
end
|
629
|
-
end
|
630
|
-
|
631
|
-
HelloListMultiSelection.new.launch
|
541
|
+
shell {
|
542
|
+
minimum_size (OS.mac? ? 320 : (OS.windows? ? 390 : 520)), 240
|
543
|
+
image File.join(APP_ROOT, 'package', 'windows', "Glimmer Calculator.ico") if OS.windows?
|
544
|
+
text "Glimmer - Calculator"
|
545
|
+
grid_layout 4, true
|
546
|
+
# Setting styled_text to multi in order for alignment options to activate
|
547
|
+
styled_text(:multi, :wrap, :border) {
|
548
|
+
text bind(@presenter, :result)
|
549
|
+
alignment swt(:right)
|
550
|
+
right_margin 5
|
551
|
+
font height: 40
|
552
|
+
layout_data(:fill, :fill, true, true) {
|
553
|
+
horizontal_span 4
|
554
|
+
}
|
555
|
+
editable false
|
556
|
+
caret nil
|
557
|
+
}
|
558
|
+
command_button('AC')
|
559
|
+
operation_button('÷')
|
560
|
+
operation_button('×')
|
561
|
+
operation_button('−')
|
562
|
+
(7..9).each { |number|
|
563
|
+
number_button(number)
|
564
|
+
}
|
565
|
+
operation_button('+', font: @button_font_big, vertical_span: 2)
|
566
|
+
(4..6).each { |number|
|
567
|
+
number_button(number)
|
568
|
+
}
|
569
|
+
(1..3).each { |number|
|
570
|
+
number_button(number)
|
571
|
+
}
|
572
|
+
command_button('=', font: @button_font_big, vertical_span: 2)
|
573
|
+
number_button(0, horizontal_span: 2)
|
574
|
+
operation_button('.')
|
575
|
+
}
|
632
576
|
```
|
633
|
-
Glimmer app on the desktop (using [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
634
577
|
|
635
|
-
|
578
|
+
Glimmer app on the desktop (using the [`glimmer-dsl-swt`](https://github.com/AndyObtiva/glimmer-dsl-swt) gem):
|
579
|
+
|
580
|
+
![Glimmer Calculator Linux](https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot-linux.png)
|
636
581
|
|
637
582
|
Glimmer app on the web (using `glimmer-dsl-opal` gem):
|
638
583
|
|
@@ -642,10 +587,19 @@ rails s
|
|
642
587
|
```
|
643
588
|
|
644
589
|
Visit `http://localhost:3000`
|
590
|
+
(or visit: http://glimmer-cs-calculator-server.herokuapp.com)
|
591
|
+
|
592
|
+
You should see "Glimmer Calculator"
|
645
593
|
|
646
|
-
|
594
|
+
[![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)
|
647
595
|
|
648
|
-
|
596
|
+
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):
|
597
|
+
|
598
|
+
Visit http://glimmer-cs-calculator-server.herokuapp.com/welcomes/apple
|
599
|
+
|
600
|
+
You should see "Apple Calculator Theme"
|
601
|
+
|
602
|
+
[![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)
|
649
603
|
|
650
604
|
## Glimmer DSL for XML (& HTML)
|
651
605
|
|
@@ -726,6 +680,8 @@ body{font-size:1.1em;background:white}body > h1{background-color:red;font-size:2
|
|
726
680
|
|
727
681
|
## Multi-DSL Support
|
728
682
|
|
683
|
+
Glimmer official DSL gems always start with `glimmer-dsl-`. That said, other libraries may use the Glimmer DSL engine too not for building GUI apps (e.g. `bundler-download`)
|
684
|
+
|
729
685
|
Glimmer allows mixing DSLs, which comes in handy when doing things like using a desktop Browser widget with HTML and CSS.
|
730
686
|
|
731
687
|
Glimmer DSL syntax consists mainly of:
|
@@ -745,13 +701,14 @@ Here is a list of notable 3rd party gems used by Glimmer and Glimmer DSLs:
|
|
745
701
|
- [puts_debuggerer](https://github.com/AndyObtiva/puts_debuggerer): helps in troubleshooting when adding `require 'pd'` and using the `pd` command instead of `puts` or `p` (also `#pd_inspect` or `#pdi` instead of `#inspect`)
|
746
702
|
- [rake](https://github.com/ruby/rake): used to implement and execute `glimmer` commands
|
747
703
|
- [rake-tui](https://github.com/AndyObtiva/rake-tui): Rake Text-based User Interface. Allows navigating rake tasks with arrow keys and filtering task list by typing to quickly find an run a rake task.
|
704
|
+
- [rouge](https://github.com/rouge-ruby/rouge): Ruby syntax highlighter used in the `code_text` [Glimmer DSL for SWT custom widget](https://github.com/AndyObtiva/glimmer-dsl-swt#custom-widgets) leveraged by the [Glimmer Meta-Sample](https://github.com/AndyObtiva/glimmer-dsl-swt#samples)
|
748
705
|
- [super_module](https://github.com/AndyObtiva/super_module): used to cleanly write the Glimmer::UI:CustomWidget and Glimmer::UI::CustomShell modules
|
749
706
|
- [text-table](https://github.com/aptinio/text-table): renders textual data in a textual table for the command-line interface of Glimmer
|
750
707
|
- [warbler](https://github.com/jruby/warbler): converts a Glimmer app into a Java JAR file during packaging
|
751
708
|
|
752
709
|
## Glimmer Process
|
753
710
|
|
754
|
-
[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.
|
711
|
+
[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.
|
755
712
|
|
756
713
|
Learn more by reading the [GPG](PROCESS.md) (Glimmer Process Guidelines)
|
757
714
|
|
@@ -774,7 +731,7 @@ You may submit [issues](https://github.com/AndyObtiva/glimmer/issues) on [GitHub
|
|
774
731
|
|
775
732
|
### Chat
|
776
733
|
|
777
|
-
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)
|
734
|
+
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)
|
778
735
|
|
779
736
|
## Feature Suggestions
|
780
737
|
|
@@ -822,7 +779,7 @@ If your company would like to invest fulltime in further development of the Glim
|
|
822
779
|
|
823
780
|
[MIT](LICENSE.txt)
|
824
781
|
|
825
|
-
Copyright (c) 2007-2020 - Andy Maleh.
|
782
|
+
Copyright (c) 2007-2020 - Andy Maleh.
|
826
783
|
|
827
784
|
--
|
828
785
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.0.
|
1
|
+
1.0.5
|
data/glimmer.gemspec
ADDED
@@ -0,0 +1,83 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
# stub: glimmer 1.0.5 ruby lib
|
6
|
+
|
7
|
+
Gem::Specification.new do |s|
|
8
|
+
s.name = "glimmer".freeze
|
9
|
+
s.version = "1.0.5"
|
10
|
+
|
11
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
|
12
|
+
s.require_paths = ["lib".freeze]
|
13
|
+
s.authors = ["AndyMaleh".freeze]
|
14
|
+
s.date = "2020-12-02"
|
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 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
|
16
|
+
s.email = "andy.am@gmail.com".freeze
|
17
|
+
s.extra_rdoc_files = [
|
18
|
+
"CHANGELOG.md",
|
19
|
+
"LICENSE.txt",
|
20
|
+
"README.md"
|
21
|
+
]
|
22
|
+
s.files = [
|
23
|
+
"CHANGELOG.md",
|
24
|
+
"CONTRIBUTING.md",
|
25
|
+
"LICENSE.txt",
|
26
|
+
"PROCESS.md",
|
27
|
+
"README.md",
|
28
|
+
"VERSION",
|
29
|
+
"glimmer.gemspec",
|
30
|
+
"lib/glimmer.rb",
|
31
|
+
"lib/glimmer/config.rb",
|
32
|
+
"lib/glimmer/data_binding/model_binding.rb",
|
33
|
+
"lib/glimmer/data_binding/observable.rb",
|
34
|
+
"lib/glimmer/data_binding/observable_array.rb",
|
35
|
+
"lib/glimmer/data_binding/observable_model.rb",
|
36
|
+
"lib/glimmer/data_binding/observer.rb",
|
37
|
+
"lib/glimmer/dsl/engine.rb",
|
38
|
+
"lib/glimmer/dsl/expression.rb",
|
39
|
+
"lib/glimmer/dsl/expression_handler.rb",
|
40
|
+
"lib/glimmer/dsl/parent_expression.rb",
|
41
|
+
"lib/glimmer/dsl/static_expression.rb",
|
42
|
+
"lib/glimmer/dsl/top_level_expression.rb",
|
43
|
+
"lib/glimmer/error.rb",
|
44
|
+
"lib/glimmer/invalid_keyword_error.rb"
|
45
|
+
]
|
46
|
+
s.homepage = "http://github.com/AndyObtiva/glimmer".freeze
|
47
|
+
s.licenses = ["MIT".freeze]
|
48
|
+
s.rubygems_version = "3.1.4".freeze
|
49
|
+
s.summary = "Glimmer Ruby DSL Engine".freeze
|
50
|
+
|
51
|
+
if s.respond_to? :specification_version then
|
52
|
+
s.specification_version = 4
|
53
|
+
end
|
54
|
+
|
55
|
+
if s.respond_to? :add_runtime_dependency then
|
56
|
+
s.add_runtime_dependency(%q<array_include_methods>.freeze, [">= 1.0.4", "< 2.0.0"])
|
57
|
+
s.add_runtime_dependency(%q<facets>.freeze, [">= 3.1.0", "< 4.0.0"])
|
58
|
+
s.add_development_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
|
59
|
+
s.add_development_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
60
|
+
s.add_development_dependency(%q<puts_debuggerer>.freeze, ["~> 0.10.0"])
|
61
|
+
s.add_development_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
62
|
+
s.add_development_dependency(%q<jeweler>.freeze, [">= 2.0.0", "< 3.0.0"])
|
63
|
+
s.add_development_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
|
64
|
+
s.add_development_dependency(%q<coveralls>.freeze, ["= 0.8.23"])
|
65
|
+
s.add_development_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
|
66
|
+
s.add_development_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
|
67
|
+
s.add_development_dependency(%q<rake-tui>.freeze, [">= 0"])
|
68
|
+
else
|
69
|
+
s.add_dependency(%q<array_include_methods>.freeze, [">= 1.0.4", "< 2.0.0"])
|
70
|
+
s.add_dependency(%q<facets>.freeze, [">= 3.1.0", "< 4.0.0"])
|
71
|
+
s.add_dependency(%q<rspec-mocks>.freeze, ["~> 3.5.0"])
|
72
|
+
s.add_dependency(%q<rspec>.freeze, ["~> 3.5.0"])
|
73
|
+
s.add_dependency(%q<puts_debuggerer>.freeze, ["~> 0.10.0"])
|
74
|
+
s.add_dependency(%q<rake>.freeze, [">= 10.1.0", "< 14.0.0"])
|
75
|
+
s.add_dependency(%q<jeweler>.freeze, [">= 2.0.0", "< 3.0.0"])
|
76
|
+
s.add_dependency(%q<rdoc>.freeze, [">= 6.2.1", "< 7.0.0"])
|
77
|
+
s.add_dependency(%q<coveralls>.freeze, ["= 0.8.23"])
|
78
|
+
s.add_dependency(%q<simplecov>.freeze, ["~> 0.16.1"])
|
79
|
+
s.add_dependency(%q<simplecov-lcov>.freeze, ["~> 0.7.0"])
|
80
|
+
s.add_dependency(%q<rake-tui>.freeze, [">= 0"])
|
81
|
+
end
|
82
|
+
end
|
83
|
+
|
data/lib/glimmer.rb
CHANGED
@@ -55,22 +55,23 @@ module Glimmer
|
|
55
55
|
end
|
56
56
|
|
57
57
|
def method_missing(method_symbol, *args, &block)
|
58
|
-
new_loop_data = [method_symbol, args, block]
|
59
|
-
if new_loop_data == Glimmer.loop_last_data
|
60
|
-
Glimmer.loop_increment!
|
61
|
-
raise "Glimmer looped #{Config.loop_max_count} times with keyword '#{new_loop_data[0]}'! Check code for errors." if Glimmer.loop == Config.loop_max_count
|
62
|
-
else
|
63
|
-
Glimmer.loop_reset!
|
64
|
-
end
|
65
|
-
Glimmer.loop_last_data = new_loop_data
|
66
58
|
# This if statement speeds up Glimmer in girb or whenever directly including on main object
|
67
59
|
is_excluded = Config.excluded_keyword_checkers.reduce(false) {|result, checker| result || instance_exec(method_symbol, *args, &checker) }
|
68
60
|
if is_excluded
|
69
61
|
Glimmer::Config.logger.debug "Glimmer excluded keyword: #{method_symbol}" if Glimmer::Config.log_excluded_keywords?
|
70
62
|
super(method_symbol, *args, &block)
|
63
|
+
else
|
64
|
+
new_loop_data = [method_symbol, args, block]
|
65
|
+
if new_loop_data == Glimmer.loop_last_data
|
66
|
+
Glimmer.loop_increment!
|
67
|
+
raise "Glimmer looped #{Config.loop_max_count} times with keyword '#{new_loop_data[0]}'! Check code for errors." if Glimmer.loop == Config.loop_max_count
|
68
|
+
else
|
69
|
+
Glimmer.loop_reset!
|
70
|
+
end
|
71
|
+
Glimmer.loop_last_data = new_loop_data
|
72
|
+
Glimmer::Config.logger.info {"Interpreting keyword: #{method_symbol}"}
|
73
|
+
Glimmer::DSL::Engine.interpret(method_symbol, *args, &block)
|
71
74
|
end
|
72
|
-
Glimmer::Config.logger.info {"Interpreting keyword: #{method_symbol}"}
|
73
|
-
Glimmer::DSL::Engine.interpret(method_symbol, *args, &block)
|
74
75
|
rescue InvalidKeywordError => e
|
75
76
|
Glimmer::Config.logger.error {"Encountered an invalid keyword at this object: #{self}"}
|
76
77
|
Glimmer::Config.logger.error {e.full_message}
|
data/lib/glimmer/config.rb
CHANGED
@@ -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
|
@@ -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
|
-
|
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
|
-
|
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
|
@@ -99,13 +99,14 @@ module Glimmer
|
|
99
99
|
def unregister(observable, property = nil)
|
100
100
|
return unless observable.is_a?(Observable)
|
101
101
|
# TODO optimize performance in the future via indexing and/or making a registration official object/class
|
102
|
-
observable.remove_observer(*[self, property].compact)
|
103
102
|
registration = registration_for(observable, property)
|
104
103
|
dependents_for(registration).each do |dependent|
|
105
104
|
dependent.unregister
|
106
105
|
remove_dependent(registration => dependent)
|
107
106
|
end
|
108
|
-
registrations.delete(registration)
|
107
|
+
registrations.delete(registration).tap do |registration|
|
108
|
+
observable.remove_observer(*[self, property].compact)
|
109
|
+
end
|
109
110
|
end
|
110
111
|
alias unobserve unregister
|
111
112
|
|
@@ -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
|
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.
|
4
|
+
version: 1.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-12-02 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.
|
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.
|
29
|
+
version: 1.0.4
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: 2.0.0
|
@@ -118,7 +118,7 @@ dependencies:
|
|
118
118
|
requirements:
|
119
119
|
- - ">="
|
120
120
|
- !ruby/object:Gem::Version
|
121
|
-
version: 2.
|
121
|
+
version: 2.0.0
|
122
122
|
- - "<"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: 3.0.0
|
@@ -128,7 +128,7 @@ dependencies:
|
|
128
128
|
requirements:
|
129
129
|
- - ">="
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version: 2.
|
131
|
+
version: 2.0.0
|
132
132
|
- - "<"
|
133
133
|
- !ruby/object:Gem::Version
|
134
134
|
version: 3.0.0
|
@@ -194,10 +194,25 @@ dependencies:
|
|
194
194
|
- - "~>"
|
195
195
|
- !ruby/object:Gem::Version
|
196
196
|
version: 0.7.0
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
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 Library),
|
213
|
+
the Glimmer DSL for Tk (Ruby Desktop Development GUI Library), the Glimmer DSL for
|
214
|
+
Opal (Web GUI Adapter for Desktop Apps), the Glimmer DSL for XML (& HTML), and the
|
215
|
+
Glimmer DSL for CSS.
|
201
216
|
email: andy.am@gmail.com
|
202
217
|
executables: []
|
203
218
|
extensions: []
|
@@ -212,6 +227,7 @@ files:
|
|
212
227
|
- PROCESS.md
|
213
228
|
- README.md
|
214
229
|
- VERSION
|
230
|
+
- glimmer.gemspec
|
215
231
|
- lib/glimmer.rb
|
216
232
|
- lib/glimmer/config.rb
|
217
233
|
- lib/glimmer/data_binding/model_binding.rb
|
@@ -246,7 +262,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
246
262
|
- !ruby/object:Gem::Version
|
247
263
|
version: '0'
|
248
264
|
requirements: []
|
249
|
-
rubygems_version: 3.1.
|
265
|
+
rubygems_version: 3.1.4
|
250
266
|
signing_key:
|
251
267
|
specification_version: 4
|
252
268
|
summary: Glimmer Ruby DSL Engine
|