glimmer 0.9.4 → 0.9.5

Sign up to get free protection for your applications and to get access to all the features.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +169 -17
  3. data/VERSION +1 -1
  4. data/lib/glimmer/dsl/engine.rb +33 -41
  5. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 11d28368bdf3ae26dcee4ddc661bdeee07fdf932f7c7c8fb45c27de98d4f43dc
4
- data.tar.gz: b30a42a8f18f74fca414937f068ebcaeee31ba4f76c3afb1be866b9958647426
3
+ metadata.gz: c22f962213e82b271d67b69d910604e73ab8a257e8a797fa58feb2d97d6c199e
4
+ data.tar.gz: eee60acdf118d572196ef4a2c1eca7705093ea9d3db2fcea1a05bb612710f05b
5
5
  SHA512:
6
- metadata.gz: 5f0728a1a263ff3c8c841a508d3b250910d2ddf548284029dcea23364522d436f408fe49b10683981241144d4e2bf6a20ab718ce75ed04244c6f9dc0ca51be07
7
- data.tar.gz: 411965a314069222d27aaddfdbcbe129665725e73d082d6c15805adb188e1a1fc89d62578dc2712972684d8f5f59313b6868667b245cfdfee66f06ad6ef521e9
6
+ metadata.gz: 360edce8ae04be32396a272ad947897d256c171759f3304ed4f3b521a208540a2834e05a3140fe61de166337858bbd85c13655d02b92b1cd13e60b44b78cb0d6
7
+ data.tar.gz: 482df9f676948f24f68e665899c15e7e14b78f40f100580771a4af943fd524b676ae140f19cf1d7b370d2ef1fb5e3c4bff9f0e2eb4a8cb1cb95884c74be6ef37
data/README.md CHANGED
@@ -118,6 +118,7 @@ NOTE: Glimmer is in beta mode. Please help make better by [contributing](#contri
118
118
  - [SWT Proxies](#swt-proxies)
119
119
  - [Dialog](#dialog)
120
120
  - [Menus](#menus)
121
+ - [ScrolledComposite](#scrolledcomposite)
121
122
  - [Widget Styles](#widget-styles)
122
123
  - [Explicit SWT Style Bit](#explicit-swt-style-bit)
123
124
  - [Negative SWT Style Bits](#negative-swt-style-bits)
@@ -143,6 +144,7 @@ NOTE: Glimmer is in beta mode. Please help make better by [contributing](#contri
143
144
  - [Content/Options Example](#contentoptions-example)
144
145
  - [Custom Widget Lifecycle Hooks](#custom-widget-lifecycle-hooks)
145
146
  - [Gotcha](#gotcha)
147
+ - [Final Notes](#final-notes)
146
148
  - [Custom Shells](#custom-shells)
147
149
  - [Drag and Drop](#drag-and-drop)
148
150
  - [Miscellaneous](#miscellaneous)
@@ -153,13 +155,13 @@ NOTE: Glimmer is in beta mode. Please help make better by [contributing](#contri
153
155
  - [Browser Widget](#browser-widget)
154
156
  - [Glimmer Configuration](#glimmer-configuration)
155
157
  - [logger](#logger)
156
- - [import_swt_packages](#import_swt_packages)
157
- - [loop_max_count](#loop_max_count)
158
+ - [import_swt_packages](#importswtpackages)
159
+ - [loop_max_count](#loopmaxcount)
158
160
  - [Glimmer Style Guide](#glimmer-style-guide)
159
161
  - [SWT Reference](#swt-reference)
160
162
  - [Samples](#samples)
161
163
  - [Hello Samples](#hello-samples)
162
- - [Hello, World!](#hello-world-sample)
164
+ - [Hello, World! Sample](#hello-world-sample)
163
165
  - [Hello, Tab!](#hello-tab)
164
166
  - [Hello, Combo!](#hello-combo)
165
167
  - [Hello, List Single Selection!](#hello-list-single-selection)
@@ -168,14 +170,18 @@ NOTE: Glimmer is in beta mode. Please help make better by [contributing](#contri
168
170
  - [Hello, Message Box!](#hello-message-box)
169
171
  - [Hello, Browser!](#hello-browser)
170
172
  - [Hello, Drag and Drop!](#hello-drag-and-drop)
173
+ - [Hello, Menu Bar!](#hello-menu-bar)
174
+ - [Hello, Pop Up Context Menu!](#hello-pop-up-context-menu)
171
175
  - [Elaborate Samples](#elaborate-samples)
172
176
  - [Login](#login)
173
- - [Tic Tac Toe](#tic-tac-toe-sample)
177
+ - [Tic Tac Toe Sample](#tic-tac-toe-sample)
174
178
  - [Contact Manager](#contact-manager)
175
179
  - [External Samples](#external-samples)
176
180
  - [Glimmer Calculator](#glimmer-calculator)
177
181
  - [Gladiator](#gladiator)
178
182
  - [In Production](#in-production)
183
+ - [Math Bowling](#math-bowling)
184
+ - [Are We There Yet?](#are-we-there-yet)
179
185
  - [Packaging & Distribution](#packaging--distribution)
180
186
  - [Packaging Defaults](#packaging-defaults)
181
187
  - [Packaging Configuration](#packaging-configuration)
@@ -191,6 +197,7 @@ NOTE: Glimmer is in beta mode. Please help make better by [contributing](#contri
191
197
  - [Change Log](#change-log)
192
198
  - [Contributing](#contributing)
193
199
  - [Contributors](#contributors)
200
+ - [Hire Me](#hire-me)
194
201
  - [License](#license)
195
202
 
196
203
  ## Background
@@ -244,7 +251,7 @@ Otherwise, Option 2 ([Bundler](#option-2-bundler)) is recommended for building G
244
251
 
245
252
  Run this command to install directly:
246
253
  ```
247
- jgem install glimmer-dsl-swt -v 0.2.2
254
+ jgem install glimmer-dsl-swt -v 0.3.0
248
255
  ```
249
256
 
250
257
  `jgem` is JRuby's version of `gem` command.
@@ -262,7 +269,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
262
269
 
263
270
  Add the following to `Gemfile`:
264
271
  ```
265
- gem 'glimmer-dsl-swt', '~> 0.2.2'
272
+ gem 'glimmer-dsl-swt', '~> 0.3.0'
266
273
  ```
267
274
 
268
275
  And, then run:
@@ -320,6 +327,7 @@ glimmer list:custom_shell_gems[query] # List Glimmer
320
327
  glimmer list:custom_widget_gems[query] # List Glimmer custom widget gems available at rubygems.org (query is optional)
321
328
  glimmer list:dsl_gems[query] # List Glimmer DSL gems available at rubygems.org (query is optional)
322
329
  glimmer package # Package app for distribution (generating config, jar, and native files)
330
+ glimmer package:clean # Clean by removing "dist" and "packages" directories
323
331
  glimmer package:config # Generate JAR config file
324
332
  glimmer package:jar # Generate JAR file
325
333
  glimmer package:native # Generate Native files (DMG/PKG/APP on the Mac)
@@ -561,7 +569,7 @@ Output:
561
569
 
562
570
  Css glimmer-dsl-css 0.1.0 AndyMaleh Glimmer DSL for CSS
563
571
  Opal glimmer-dsl-opal 0.0.9 AndyMaleh Glimmer DSL for Opal
564
- Swt glimmer-dsl-swt 0.2.2 AndyMaleh Glimmer DSL for SWT
572
+ Swt glimmer-dsl-swt 0.3.0 AndyMaleh Glimmer DSL for SWT
565
573
  Xml glimmer-dsl-xml 0.1.0 AndyMaleh Glimmer DSL for XML
566
574
 
567
575
  ```
@@ -935,7 +943,7 @@ shell { |shell_proxy|
935
943
  Example of a Pop Up Context Menu (you may copy/paste in [`girb`](#girb-glimmer-irb-command)):
936
944
 
937
945
  ```ruby
938
- shell { |shell_proxy|
946
+ shell { |shell_proxy|
939
947
  text 'Hello, Pop Up Context Menu!'
940
948
  grid_layout
941
949
  label {
@@ -971,6 +979,13 @@ Example of a Pop Up Context Menu (you may copy/paste in [`girb`](#girb-glimmer-i
971
979
  }.open
972
980
  ```
973
981
 
982
+ #### ScrolledComposite
983
+
984
+ Glimmer provides smart defaults for the `scrolled_composite` widget by:
985
+ - Automatically setting the nested widget as its content (meaning use can just like a plain old `composite` to add scrolling)
986
+ - Automatically setting the :h_scroll and :v_scroll SWT styles (can be set manually if only one of either :h_scroll or :v_scroll is desired )
987
+ - Automatically setting the expand horizontal and expand vertical SWT properties to `true`
988
+
974
989
  ### Widget Styles
975
990
 
976
991
  SWT widgets receive `SWT` styles in their constructor as per this guide:
@@ -1568,6 +1583,9 @@ shell {
1568
1583
  }
1569
1584
  items bind(group, :people), column_properties(:name, :age, :adult)
1570
1585
  selection bind(group, :selected_person)
1586
+ on_mouse_up { |event|
1587
+ @table.edit_table_item(event.table_item, event.column_index)
1588
+ }
1571
1589
  }
1572
1590
  }
1573
1591
  ```
@@ -1575,6 +1593,7 @@ shell {
1575
1593
  The code above includes two data-bindings:
1576
1594
  - Table `items`, which first bind to the model collection property (group.people), and then maps each column property (name, age, adult) for displaying each table item column.
1577
1595
  - Table `selection`, which binds the single table item selected by the user to the attribute denoted by the `bind` keyword (or binds multiple table items selected for a table with `:multi` SWT style)
1596
+ - The `on_mouse_up` event handler invokes `@table.edit_table_item(event.table_item, event.column_index)` to start edit mode on the clicked table item cell, and then saves or cancel depending on whether the user hits ENTER or ESC once done editing (or focus-out after either making a change or not making any changes.)
1578
1597
 
1579
1598
  Additionally, Table `items` data-binding automatically stores each node model unto the SWT TableItem object via `setData` method. This enables things like searchability.
1580
1599
 
@@ -1594,6 +1613,67 @@ This automatically leverages the SWT TableEditor custom class behind the scenes,
1594
1613
  passed table item text into something else.
1595
1614
  It automatically persists the change to `items` data-bound model on ENTER/FOCUS-OUT or cancels on ESC/NO-CHANGE.
1596
1615
 
1616
+ ##### Table Sorting
1617
+
1618
+ Glimmer automatically adds sorting support to the SWT `Table` widget.
1619
+
1620
+ Check out the [Contact Manager](#contact-manager) sample for an example.
1621
+ You may click on any column and it will sort by ascending order first and descending if you click again.
1622
+
1623
+ Glimmer automatic table sorting supports `String`, `Integer`, and `Float` columns out of the box as well as any column data that is comparable.
1624
+
1625
+ In cases where data is nil, depending on the data-type, it is automatically converted to `Float` with `to_f`, `Integer` with `to_i`, or `String` with `to_s`.
1626
+
1627
+ Should you have a special data type that could not be compared automatically, Glimmer offers the following 3 alternatives for custom sorting:
1628
+ - `sort_property`: this may be set to an alternative property to the one data-bound to the table column. For example, a table column called 'adult', which returns `true` or `false` may be sorted with `sort_property :dob` instead. This also support multi-property (aka multi-column) sorting (e.g. `sort_property :dob, :name`).
1629
+ - `sort_by(&block)`: this works just like Ruby `Enumerable` `sort_by`. The block receives the table column data as argument.
1630
+ - `sort(&comparator)`: this works just like Ruby `Enumerable` `sort`. The comparator block receives two objects from the table column data.
1631
+
1632
+ You may also set `additional_sort_properties` on the parent `table` widget to have secondary sorting applied. For example, if you set `additional_sort_properties :name, :project_name`, then whenever you sort by `:name`, it additionally sorts by `:project_name` afterwards, and vice versa. This only works for columns that either have no custom sort set or have a `sort_property` with one property only (but no sort or sort_by block)
1633
+
1634
+ Example:
1635
+
1636
+ ```ruby
1637
+ # ...
1638
+ table {
1639
+ table_column {
1640
+ text 'Task'
1641
+ width 120
1642
+ }
1643
+ table_column {
1644
+ text 'Project'
1645
+ width 120
1646
+ }
1647
+ table_column {
1648
+ text 'Duration (hours)'
1649
+ width 120
1650
+ sort_property :duration_in_hours
1651
+ }
1652
+ table_column {
1653
+ text 'Priority'
1654
+ width 120
1655
+ sort_by { |value| ['High', 'Medium', 'Low'].index(value) }
1656
+ }
1657
+ table_column {
1658
+ text 'Start Date'
1659
+ width 120
1660
+ sort { |d1, d2| d1.to_date <=> d2.to_date }
1661
+ }
1662
+ additional_sort_properties :project_name, :duration_in_hours, :name
1663
+ items bind(Task, :list), column_properties(:name, :project_name, :duration, :priority, :start_date)
1664
+ # ...
1665
+ }
1666
+ # ...
1667
+ ```
1668
+
1669
+ Here is an explanation of the example above:
1670
+ - Task and Project table columns are data-bound to the `:name` and `:project_name` properties and sorted through them automatically
1671
+ - Task Duration table column is data-bound to the `:duration` property, but sorted via the `:duration_in_hours` property instead
1672
+ - Task Priority table column has a custom sort_by block
1673
+ - Task Start Date table column has a custom sort comparator block
1674
+ - Additional (secondary) sort properties are applied when sorting by Task, Project, or Duration in the order specified
1675
+
1676
+
1597
1677
  #### Tree
1598
1678
 
1599
1679
  The SWT Tree widget visualizes a tree data-structure, such as an employment or composition hierarchy.
@@ -2521,6 +2601,10 @@ For hello-type simple samples, check the following.
2521
2601
 
2522
2602
  #### Hello, World! Sample
2523
2603
 
2604
+ Code:
2605
+
2606
+ [samples/hello/hello_world.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_world.rb)
2607
+
2524
2608
  Run:
2525
2609
 
2526
2610
  ```
@@ -2531,6 +2615,10 @@ glimmer samples/hello/hello_world.rb
2531
2615
 
2532
2616
  #### Hello, Tab!
2533
2617
 
2618
+ Code:
2619
+
2620
+ [samples/hello/hello_tab.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_tab.rb)
2621
+
2534
2622
  Run:
2535
2623
 
2536
2624
  ```
@@ -2544,6 +2632,10 @@ glimmer samples/hello/hello_tab.rb
2544
2632
 
2545
2633
  This sample demonstrates combo data-binding.
2546
2634
 
2635
+ Code:
2636
+
2637
+ [samples/hello/hello_combo.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_combo.rb)
2638
+
2547
2639
  Run:
2548
2640
 
2549
2641
  ```
@@ -2557,6 +2649,10 @@ glimmer samples/hello/hello_combo.rb
2557
2649
 
2558
2650
  This sample demonstrates list single-selection data-binding.
2559
2651
 
2652
+ Code:
2653
+
2654
+ [samples/hello/hello_list_single_selection.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_list_single_selection.rb)
2655
+
2560
2656
  Run:
2561
2657
 
2562
2658
  ```
@@ -2569,6 +2665,10 @@ glimmer samples/hello/hello_list_single_selection.rb
2569
2665
 
2570
2666
  This sample demonstrates list multi-selection data-binding.
2571
2667
 
2668
+ Code:
2669
+
2670
+ [samples/hello/hello_list_multi_selection.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_list_multi_selection.rb)
2671
+
2572
2672
  Run:
2573
2673
 
2574
2674
  ```
@@ -2581,6 +2681,10 @@ glimmer samples/hello/hello_list_multi_selection.rb
2581
2681
 
2582
2682
  This sample demonstrates computed data-binding.
2583
2683
 
2684
+ Code:
2685
+
2686
+ [samples/hello/hello_computed.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_computed.rb)
2687
+
2584
2688
  Run:
2585
2689
 
2586
2690
  ```
@@ -2593,6 +2697,10 @@ glimmer samples/hello/hello_computed.rb
2593
2697
 
2594
2698
  This sample demonstrates a `message_box` dialog.
2595
2699
 
2700
+ Code:
2701
+
2702
+ [samples/hello/hello_message_box.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_message_box.rb)
2703
+
2596
2704
  Run:
2597
2705
 
2598
2706
  ```
@@ -2606,6 +2714,10 @@ glimmer samples/hello/hello_message_box.rb
2606
2714
 
2607
2715
  This sample demonstrates the `browser` widget.
2608
2716
 
2717
+ Code:
2718
+
2719
+ [samples/hello/hello_browser.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_browser.rb)
2720
+
2609
2721
  Run:
2610
2722
 
2611
2723
  ```
@@ -2618,6 +2730,10 @@ glimmer samples/hello/hello_browser.rb
2618
2730
 
2619
2731
  This sample demonstrates drag and drop in Glimmer.
2620
2732
 
2733
+ Code:
2734
+
2735
+ [samples/hello/hello_drag_and_drop.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_drag_and_drop.rb)
2736
+
2621
2737
  Run:
2622
2738
 
2623
2739
  ```
@@ -2630,6 +2746,10 @@ glimmer samples/hello/hello_drag_and_drop.rb
2630
2746
 
2631
2747
  This sample demonstrates menus in Glimmer.
2632
2748
 
2749
+ Code:
2750
+
2751
+ [samples/hello/hello_menu_bar.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_menu_bar.rb)
2752
+
2633
2753
  Run:
2634
2754
 
2635
2755
  ```
@@ -2644,6 +2764,10 @@ glimmer samples/hello/hello_menu_bar.rb
2644
2764
 
2645
2765
  This sample demonstrates pop up context menus in Glimmer.
2646
2766
 
2767
+ Code:
2768
+
2769
+ [samples/hello/hello_pop_up_context_menu.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/hello/hello_pop_up_context_menu.rb)
2770
+
2647
2771
  Run:
2648
2772
 
2649
2773
  ```
@@ -2659,8 +2783,16 @@ For more elaborate samples, check the following:
2659
2783
 
2660
2784
  #### Login
2661
2785
 
2786
+ This sample demonstrates basic data-binding, password and text fields, and field enablement data-binding.
2787
+
2788
+ Code:
2789
+
2790
+ [samples/elaborate/login.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/login.rb)
2791
+
2792
+ Run:
2793
+
2662
2794
  ```
2663
- glimmer samples/elaborate/login.rb # demonstrates basic data-binding
2795
+ glimmer samples/elaborate/login.rb
2664
2796
  ```
2665
2797
 
2666
2798
  ![Login](images/glimmer-login.png)
@@ -2669,8 +2801,16 @@ glimmer samples/elaborate/login.rb # demonstrates basic data-binding
2669
2801
 
2670
2802
  #### Tic Tac Toe Sample
2671
2803
 
2804
+ This sample demonstrates a full MVC application, including GUI layout, text and enablement data-binding, and test-driven development (has [specs](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/spec/samples/elaborate/tic_tac_toe/board_spec.rb)).
2805
+
2806
+ Code:
2807
+
2808
+ [samples/elaborate/tic_tac_toe.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/tic_tac_toe.rb)
2809
+
2810
+ Run:
2811
+
2672
2812
  ```
2673
- glimmer samples/elaborate/tic_tac_toe.rb # demonstrates a full MVC application
2813
+ glimmer samples/elaborate/tic_tac_toe.rb
2674
2814
  ```
2675
2815
 
2676
2816
  ![Tic Tac Toe](images/glimmer-tic-tac-toe.png)
@@ -2679,8 +2819,16 @@ glimmer samples/elaborate/tic_tac_toe.rb # demonstrates a full MVC application
2679
2819
 
2680
2820
  #### Contact Manager
2681
2821
 
2822
+ This sample demonstrates table data-binding, sorting, filtering, GUI layout, MVP pattern, and test-driven development (has [specs](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/spec/samples/elaborate/contact_manager/contact_manager_presenter_spec.rb)).
2823
+
2824
+ Code:
2825
+
2826
+ [samples/elaborate/contact_manager.rb](https://github.com/AndyObtiva/glimmer-dsl-swt/blob/master/samples/elaborate/contact_manager.rb)
2827
+
2828
+ Run:
2829
+
2682
2830
  ```
2683
- glimmer samples/elaborate/contact_manager.rb # demonstrates table data-binding
2831
+ glimmer samples/elaborate/contact_manager.rb
2684
2832
  ```
2685
2833
 
2686
2834
  Contact Manager
@@ -2707,17 +2855,17 @@ Contact Manager - Edit Done
2707
2855
 
2708
2856
  #### Glimmer Calculator
2709
2857
 
2710
- [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/v1.0.0/glimmer-cs-calculator-screenshot.png" />](https://github.com/AndyObtiva/glimmer-cs-calculator)
2858
+ [<img alt="Glimmer Calculator Icon" src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-icon.png" height=40 /> Glimmer Calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) is a basic calculator sample project demonstrating data-binding and TDD (test-driven-development) with Glimmer following the MVP pattern (Model-View-Presenter).
2711
2859
 
2712
- [Glimmer Calculator](https://github.com/AndyObtiva/glimmer-cs-calculator) is a basic calculator sample project demonstrating data-binding and TDD (test-driven-development) with Glimmer following the MVP pattern (Model-View-Presenter).
2860
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-calculator/master/glimmer-cs-calculator-screenshot.png" />](https://github.com/AndyObtiva/glimmer-cs-calculator)
2713
2861
 
2714
2862
  #### Gladiator
2715
2863
 
2716
- [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-gladiator.png" />](https://github.com/AndyObtiva/glimmer-cs-gladiator)
2717
-
2718
- [Gladiator](https://github.com/AndyObtiva/glimmer-cs-gladiator) (short for Glimmer Editor) is a Glimmer sample project under on-going development.
2864
+ [<img src='https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-cs-gladiator-logo.svg' height=40 /> Gladiator](https://github.com/AndyObtiva/glimmer-cs-gladiator) (short for Glimmer Editor) is a Glimmer sample project under on-going development.
2719
2865
  You may check it out to learn how to build a Glimmer Custom Shell gem.
2720
2866
 
2867
+ [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer-cs-gladiator/master/images/glimmer-gladiator.png" />](https://github.com/AndyObtiva/glimmer-cs-gladiator)
2868
+
2721
2869
  Gladiator is a good demonstration of:
2722
2870
  - MVP Pattern
2723
2871
  - Tree data-binding
@@ -2730,10 +2878,14 @@ Gladiator is a good demonstration of:
2730
2878
 
2731
2879
  ## In Production
2732
2880
 
2733
- The following production apps have been built with Glimmer:
2881
+ The following production apps have been built with Glimmer.
2882
+
2883
+ ### Math Bowling
2734
2884
 
2735
2885
  [<img alt="Math Bowling Logo" src="https://raw.githubusercontent.com/AndyObtiva/MathBowling/master/images/math-bowling-logo.png" width="40" />Math Bowling](https://github.com/AndyObtiva/MathBowling): an educational math game for elementary level kids
2736
2886
 
2887
+ ### Are We There Yet?
2888
+
2737
2889
  [<img alt="Are We There Yet Logo" src="https://raw.githubusercontent.com/AndyObtiva/are-we-there-yet/master/are-we-there-yet-logo.svg" width="40" />Are We There Yet?](https://github.com/AndyObtiva/are-we-there-yet): A tool that helps you learn when your small projects will finish
2738
2890
 
2739
2891
  If you have a Glimmer app you would like referenced here, please mention in a Pull Request.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.4
1
+ 0.9.5
@@ -110,43 +110,36 @@ module Glimmer
110
110
  static_expressions[keyword] ||= {}
111
111
  static_expressions[keyword][static_expression_dsl] = static_expression
112
112
  Glimmer.send(:define_method, keyword) do |*args, &block|
113
- begin
114
- if Glimmer::DSL::Engine.no_dsls?
115
- puts Glimmer::DSL::Engine::MESSAGE_NO_DSLS
116
- else
117
- retrieved_static_expression = Glimmer::DSL::Engine.static_expressions[keyword][Glimmer::DSL::Engine.dsl]
118
- static_expression_dsl = (Glimmer::DSL::Engine.static_expressions[keyword].keys - Glimmer::DSL::Engine.disabled_dsls).first if retrieved_static_expression.nil?
119
- interpretation = nil
120
- if retrieved_static_expression.nil? && Glimmer::DSL::Engine.dsl && (static_expression_dsl.nil? || !Glimmer::DSL::Engine.static_expressions[keyword][static_expression_dsl].is_a?(TopLevelExpression))
121
- begin
122
- interpretation = Glimmer::DSL::Engine.interpret(keyword, *args, &block)
123
- rescue => e
124
- Glimmer::DSL::Engine.reset
125
- raise e if static_expression_dsl.nil? || !Glimmer::DSL::Engine.static_expressions[keyword][static_expression_dsl].is_a?(TopLevelExpression)
126
- end
113
+ if Glimmer::DSL::Engine.no_dsls?
114
+ puts Glimmer::DSL::Engine::MESSAGE_NO_DSLS
115
+ else
116
+ retrieved_static_expression = Glimmer::DSL::Engine.static_expressions[keyword][Glimmer::DSL::Engine.dsl]
117
+ static_expression_dsl = (Glimmer::DSL::Engine.static_expressions[keyword].keys - Glimmer::DSL::Engine.disabled_dsls).first if retrieved_static_expression.nil?
118
+ interpretation = nil
119
+ if retrieved_static_expression.nil? && Glimmer::DSL::Engine.dsl && (static_expression_dsl.nil? || !Glimmer::DSL::Engine.static_expressions[keyword][static_expression_dsl].is_a?(TopLevelExpression))
120
+ begin
121
+ interpretation = Glimmer::DSL::Engine.interpret(keyword, *args, &block)
122
+ rescue => e
123
+ raise e if static_expression_dsl.nil? || !Glimmer::DSL::Engine.static_expressions[keyword][static_expression_dsl].is_a?(TopLevelExpression)
127
124
  end
128
- if interpretation
129
- interpretation
130
- else
131
- raise Glimmer::Error, "Unsupported keyword: #{keyword}" unless static_expression_dsl || retrieved_static_expression
132
- Glimmer::DSL::Engine.dsl_stack.push(static_expression_dsl || Glimmer::DSL::Engine.dsl)
133
- static_expression = Glimmer::DSL::Engine.static_expressions[keyword][Glimmer::DSL::Engine.dsl]
134
- if !static_expression.can_interpret?(Glimmer::DSL::Engine.parent, keyword, *args, &block)
135
- raise Error, "Invalid use of Glimmer keyword #{keyword} with args #{args} under parent #{Glimmer::DSL::Engine.parent}"
136
- else
137
- Glimmer::Config.logger&.debug "#{static_expression.class.name} will handle expression keyword #{keyword}"
138
- static_expression.interpret(Glimmer::DSL::Engine.parent, keyword, *args, &block).tap do |ui_object|
139
- Glimmer::DSL::Engine.add_content(ui_object, static_expression, &block) unless block.nil?
140
- Glimmer::DSL::Engine.dsl_stack.pop
141
- end
125
+ end
126
+ if interpretation
127
+ interpretation
128
+ else
129
+ raise Glimmer::Error, "Unsupported keyword: #{keyword}" unless static_expression_dsl || retrieved_static_expression
130
+ Glimmer::DSL::Engine.dsl_stack.push(static_expression_dsl || Glimmer::DSL::Engine.dsl)
131
+ static_expression = Glimmer::DSL::Engine.static_expressions[keyword][Glimmer::DSL::Engine.dsl]
132
+ if !static_expression.can_interpret?(Glimmer::DSL::Engine.parent, keyword, *args, &block)
133
+ raise Error, "Invalid use of Glimmer keyword #{keyword} with args #{args} under parent #{Glimmer::DSL::Engine.parent}"
134
+ else
135
+ Glimmer::Config.logger&.debug "#{static_expression.class.name} will handle expression keyword #{keyword}"
136
+ static_expression.interpret(Glimmer::DSL::Engine.parent, keyword, *args, &block).tap do |ui_object|
137
+ Glimmer::DSL::Engine.add_content(ui_object, static_expression, &block) unless block.nil?
138
+ Glimmer::DSL::Engine.dsl_stack.pop
142
139
  end
143
140
  end
144
- end
145
- rescue StandardError => e
146
- # Glimmer::DSL::Engine.dsl_stack.pop
147
- Glimmer::DSL::Engine.reset
148
- raise e
149
- end
141
+ end
142
+ end
150
143
  end
151
144
  end
152
145
 
@@ -172,10 +165,6 @@ module Glimmer
172
165
  add_content(ui_object, expression, &block)
173
166
  dsl_stack.pop
174
167
  end
175
- rescue StandardError => e
176
- # dsl_stack.pop
177
- reset
178
- raise e
179
168
  end
180
169
 
181
170
  # Adds content block to parent UI object
@@ -187,9 +176,12 @@ module Glimmer
187
176
  if block_given? && expression.is_a?(ParentExpression)
188
177
  dsl_stack.push(expression.class.dsl)
189
178
  parent_stack.push(parent)
190
- expression.add_content(parent, &block)
191
- parent_stack.pop
192
- dsl_stack.pop
179
+ begin
180
+ expression.add_content(parent, &block)
181
+ ensure
182
+ parent_stack.pop
183
+ dsl_stack.pop
184
+ end
193
185
  end
194
186
  end
195
187
 
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: 0.9.4
4
+ version: 0.9.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-07-13 00:00:00.000000000 Z
11
+ date: 2020-07-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement