glimmer 2.7.0 → 2.7.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +6 -3
- data/VERSION +1 -1
- data/glimmer.gemspec +5 -5
- data/lib/glimmer/data_binding/observable_array.rb +1 -2
- data/lib/glimmer/dsl/engine.rb +23 -2
- data/lib/glimmer/dsl/static_expression.rb +28 -2
- metadata +9 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b7e7983379ea9281e26719f66718fb706d475d3dd9904e20cfd51237625d9322
|
4
|
+
data.tar.gz: '08fa76d4f37a422a8d6b68845f22ce3a8f41f1b53c8a6d9dced1044c55a14aa6'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc96cb57a317ebce264b45c916dd6f3d66ecafade85d95dcb357a45ee4a33aed8285f07a2168fd3dbf179d379170645ed7c07b9731a53293ad5817ce3056c875
|
7
|
+
data.tar.gz: 4d48a96a17918d61527e77a771755a7ffd6c08e365a0d128b51c047e33a57e03fbdfc3b92a45bcab32f7b9a6139140f3ad2eec90b987ed029cf6784aa4163414
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,10 @@
|
|
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
|
+
### 2.7.1
|
7
|
+
|
8
|
+
- Support upcased static expressions (in addition to default downcased ones)
|
9
|
+
|
6
10
|
### 2.7.0
|
7
11
|
|
8
12
|
- Support Hash keyed properties via `ModelBinding` (e.g. property as `some_hash_attribute[:some_key]`, `some_hash_attribute['some_key']`, `some_hash_attribute["some_key"]`)
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
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 2.7.
|
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 2.7.1
|
2
2
|
## DSL Framework for Ruby GUI and More
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/glimmer.svg)](http://badge.fury.io/rb/glimmer)
|
4
4
|
[![rspec](https://github.com/AndyObtiva/glimmer/workflows/rspec/badge.svg)](https://github.com/AndyObtiva/glimmer/actions?query=workflow%3Arspec)
|
@@ -34,7 +34,7 @@ DSL | Platforms | Native? | Vector Graphics? | Pros | Cons | Prereqs
|
|
34
34
|
[Glimmer DSL for SWT (JRuby Desktop Development GUI Framework)](https://github.com/AndyObtiva/glimmer-dsl-swt) | Mac / Windows / Linux | Yes | Yes (Canvas Shape DSL) | Very Mature / Scaffolding / Native Executable Packaging / Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint | Java / JRuby
|
35
35
|
[Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps)](https://github.com/AndyObtiva/glimmer-dsl-opal) | All Web Browsers | No | Yes (Canvas Shape DSL) | Simpler than All JavaScript Technologies / Auto-Webify Desktop Apps | Setup Process / Incomplete Alpha | Rails
|
36
36
|
[Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-libui) | Mac / Windows / Linux | Yes | Yes (Area API) | Very Simple Setup / Fast Startup Time / Light Memory Footprint | LibUI is an Incomplete Mid-Alpha Only | None Other Than MRI Ruby
|
37
|
-
[Glimmer DSL for Tk (
|
37
|
+
[Glimmer DSL for Tk (Ruby Tk Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-tk) | Mac / Windows / Linux | Some Native-Themed Widgets (Not Truly Native) | Yes (Canvas) | Fast Startup Time / Light Memory Footprint | Complicated setup / Widgets Do Not Look Truly Native, Espcially on Linux | ActiveTcl / MRI Ruby
|
38
38
|
[Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-gtk) | Mac / Windows / Linux | Only on Linux | Yes (Cairo) | Complete Access to GNOME Features on Linux | Not Native on Mac and Windows | None Other Than MRI Ruby on Linux / Brew Packages on Mac / MSYS & MING Toolchains on Windows / MRI Ruby
|
39
39
|
[Glimmer DSL for FX (FOX Toolkit Ruby Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-fx) | Mac (requires XQuartz) / Windows / Linux | No | Yes (Canvas) | No Prerequisites on Windows | Widgets Do Not Look Native / Mac Usage Obtrusively Starts XQuartz | None Other Than MRI Ruby on Windows / XQuarts on Mac / MRI Ruby
|
40
40
|
[Glimmer DSL for JFX (JRuby JavaFX Desktop Development GUI Library)](https://github.com/AndyObtiva/glimmer-dsl-jfx) | Mac / Windows / Linux | No | Yes (javafx.scene.shape and javafx.scene.canvas) | Rich in Custom Widgets | Slow JRuby Startup Time / Heavy Memory Footprint / Widgets Do Not Look Native | Java / JRuby / JavaFX SDK
|
@@ -127,6 +127,9 @@ Every `Expression` sublcass must specify two methods at least:
|
|
127
127
|
- `interpret(parent, keyword, *args, &block)`: to go ahead and interpret a DSL expression that qualified for interpretation
|
128
128
|
|
129
129
|
`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.
|
130
|
+
`StaticExpression` may declare the following class method options (if any other than `downcased` (default) is set, then `downcased` must be set explicitly if needed):
|
131
|
+
- `downcased true` (default): indicates that the StaticExpression expects downcased keywords (e.g. `COLOR {}`)
|
132
|
+
- `upcased true`: indicates that the StaticExpression expects upcased keywords (e.g. `COLOR {}`). Note that upcased static expressions always expect either arguments parentheses or block curly braces to be invoked as a static expression method instead of a constant.
|
130
133
|
|
131
134
|
`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:
|
132
135
|
- `add_content(parent, keyword, *args, &block)`
|
@@ -241,7 +244,7 @@ end
|
|
241
244
|
### Setup
|
242
245
|
|
243
246
|
Follow these steps to author a [Glimmer](https://rubygems.org/gems/glimmer) DSL:
|
244
|
-
- Add `gem 'glimmer', '~> 2.7.
|
247
|
+
- Add `gem 'glimmer', '~> 2.7.1'` to `Gemfile` and run `bundle` or run `gem install glimmer -v2.7.1` and add `require 'glimmer'`
|
245
248
|
- Create `glimmer/dsl/[dsl_name]/dsl.rb`, which requires and adds all dynamic expressions for the [dsl_name] Glimmer DSL module as per the code shown in the previous section (or [Official DSLs](#official-dsls) as examples)
|
246
249
|
- Create `glimmer/dsl/[dsl_name]/[expresion_name]_expresion.rb` for every [expresion_name] expression needed, whether dynamic or static
|
247
250
|
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
2.7.
|
1
|
+
2.7.1
|
data/glimmer.gemspec
CHANGED
@@ -2,17 +2,17 @@
|
|
2
2
|
# DO NOT EDIT THIS FILE DIRECTLY
|
3
3
|
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
4
|
# -*- encoding: utf-8 -*-
|
5
|
-
# stub: glimmer 2.7.
|
5
|
+
# stub: glimmer 2.7.1 ruby lib
|
6
6
|
|
7
7
|
Gem::Specification.new do |s|
|
8
8
|
s.name = "glimmer".freeze
|
9
|
-
s.version = "2.7.
|
9
|
+
s.version = "2.7.1"
|
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 = "2022-02-
|
15
|
-
s.description = "Glimmer is a Ruby DSL Framework for Ruby GUI and More, consisting of a DSL Engine and an Observable / Observer / Data-Binding Library (including Observable Model, Observable Array, and Observable Hash). Used in Glimmer DSL for SWT (JRuby Desktop Development GUI Framework), Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), Glimmer DSL for
|
14
|
+
s.date = "2022-02-26"
|
15
|
+
s.description = "Glimmer is a Ruby DSL Framework for Ruby GUI and More, consisting of a DSL Engine and an Observable / Observer / Data-Binding Library (including Observable Model, Observable Array, and Observable Hash). Used in Glimmer DSL for SWT (JRuby Desktop Development GUI Framework), Glimmer DSL for Opal (Pure Ruby Web GUI and Auto-Webifier of Desktop Apps), Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop Development GUI Library), Glimmer DSL for Tk (Ruby Tk Desktop Development GUI Library), Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library), Glimmer DSL for FX (FOX Toolkit Ruby Desktop Development GUI Library), Glimmer DSL for Swing (JRuby Swing Desktop Development GUI Library), Glimmer DSL for JFX (JRuby JavaFX Desktop Development GUI Library), Glimmer DSL for XML (& HTML), and Glimmer DSL for CSS.".freeze
|
16
16
|
s.email = "andy.am@gmail.com".freeze
|
17
17
|
s.extra_rdoc_files = [
|
18
18
|
"CHANGELOG.md",
|
@@ -54,7 +54,7 @@ Gem::Specification.new do |s|
|
|
54
54
|
s.homepage = "http://github.com/AndyObtiva/glimmer".freeze
|
55
55
|
s.licenses = ["MIT".freeze]
|
56
56
|
s.rubygems_version = "3.3.1".freeze
|
57
|
-
s.summary = "Glimmer - DSL
|
57
|
+
s.summary = "Glimmer - DSL Framework for Ruby GUI and More".freeze
|
58
58
|
|
59
59
|
if s.respond_to? :specification_version then
|
60
60
|
s.specification_version = 4
|
@@ -47,8 +47,7 @@ module Glimmer
|
|
47
47
|
|
48
48
|
def add_observer(observer, *args)
|
49
49
|
options = args.last.is_a?(Hash) ? args.pop : {}
|
50
|
-
element_properties = args
|
51
|
-
element_properties = element_properties.flatten.compact.uniq
|
50
|
+
element_properties = args.flatten.compact.uniq
|
52
51
|
return observer if has_observer?(observer) && has_observer_element_properties?(observer, element_properties)
|
53
52
|
property_observer_list[observer] = options
|
54
53
|
observer_element_properties[observer] = Concurrent::Set.new(Concurrent::Array.new(element_properties_for(observer).to_a) + Concurrent::Array.new(element_properties)) # converting to Array as a workaround to jruby-9.3.2.0 issue TODO remove this workaround when no longer needed
|
data/lib/glimmer/dsl/engine.rb
CHANGED
@@ -150,14 +150,35 @@ module Glimmer
|
|
150
150
|
end
|
151
151
|
end
|
152
152
|
|
153
|
-
def
|
153
|
+
def add_downcased_static_expression(static_expression)
|
154
154
|
Glimmer::Config.logger.info {"Adding static expression: #{static_expression.class.name}"}
|
155
155
|
keyword = static_expression.class.keyword
|
156
|
-
static_expression_dsl = static_expression.class.dsl
|
157
156
|
static_expressions[keyword] ||= Concurrent::Hash.new
|
157
|
+
static_expression_dsl = static_expression.class.dsl
|
158
158
|
static_expressions[keyword][static_expression_dsl] = static_expression
|
159
159
|
Glimmer.send(:define_method, keyword, &STATIC_EXPRESSION_METHOD_FACTORY.call(keyword))
|
160
160
|
end
|
161
|
+
alias add_static_expression add_downcased_static_expression
|
162
|
+
|
163
|
+
def remove_downcased_static_expression(static_expression)
|
164
|
+
if !static_expression.class.downcased?
|
165
|
+
keyword = static_expression.class.keyword
|
166
|
+
static_expressions[keyword].delete(static_expression_dsl) if static_expressions[keyword]
|
167
|
+
static_expressions.delete(keyword) if static_expressions[keyword].empty?
|
168
|
+
Glimmer.send(:undef_method, keyword) if (Glimmer.method(keyword) rescue nil)
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
def add_upcased_static_expression(static_expression)
|
173
|
+
if static_expression.class.upcased?
|
174
|
+
Glimmer::Config.logger.info {"Adding upcased static expression: #{static_expression.class.name}"}
|
175
|
+
keyword = static_expression.class.keyword
|
176
|
+
static_expression_dsl = static_expression.class.dsl
|
177
|
+
static_expressions[keyword.upcase] ||= Concurrent::Hash.new
|
178
|
+
static_expressions[keyword.upcase][static_expression_dsl] = static_expression
|
179
|
+
Glimmer.send(:define_method, keyword.upcase, &STATIC_EXPRESSION_METHOD_FACTORY.call(keyword.upcase))
|
180
|
+
end
|
181
|
+
end
|
161
182
|
|
162
183
|
def expression_class(dsl_namespace, expression_name)
|
163
184
|
dsl_namespace.const_get(expression_class_name(expression_name).to_sym)
|
@@ -44,16 +44,42 @@ module Glimmer
|
|
44
44
|
Glimmer::DSL::Engine.add_static_expression(base.new)
|
45
45
|
super
|
46
46
|
end
|
47
|
-
|
47
|
+
|
48
48
|
def keyword
|
49
49
|
@keyword ||= name.split(/::/).last.sub(/Expression$/, '').underscore
|
50
50
|
end
|
51
|
+
|
52
|
+
def downcased(value)
|
53
|
+
@downcased = value
|
54
|
+
Glimmer::DSL::Engine.add_downcased_static_expression(new) if @downcased
|
55
|
+
end
|
56
|
+
alias downcase downcased
|
57
|
+
|
58
|
+
def downcased?
|
59
|
+
# default is true when no attributes are set
|
60
|
+
@downcased.nil? && @upcased.nil? ? true : @downcased
|
61
|
+
end
|
62
|
+
alias downcase? downcased?
|
63
|
+
|
64
|
+
def upcased(value)
|
65
|
+
@upcased = value
|
66
|
+
Glimmer::DSL::Engine.add_upcased_static_expression(new) if @upcased
|
67
|
+
end
|
68
|
+
alias upcase upcased
|
69
|
+
|
70
|
+
def upcased?
|
71
|
+
@upcased
|
72
|
+
end
|
73
|
+
alias upcase? upcased?
|
51
74
|
end
|
52
75
|
|
53
76
|
# Subclasses may optionally implement, but by default it only ensures that
|
54
77
|
# the keyword matches lower case static expression class name minus `Expression`
|
55
78
|
def can_interpret?(parent, keyword, *args, &block)
|
56
|
-
|
79
|
+
result = false
|
80
|
+
result ||= keyword.downcase == keyword if self.class.downcased?
|
81
|
+
result ||= keyword.upcase == keyword if self.class.upcased?
|
82
|
+
result
|
57
83
|
end
|
58
84
|
end
|
59
85
|
end
|
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: 2.7.
|
4
|
+
version: 2.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-02-
|
11
|
+
date: 2022-02-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: array_include_methods
|
@@ -206,10 +206,12 @@ description: Glimmer is a Ruby DSL Framework for Ruby GUI and More, consisting o
|
|
206
206
|
a DSL Engine and an Observable / Observer / Data-Binding Library (including Observable
|
207
207
|
Model, Observable Array, and Observable Hash). Used in Glimmer DSL for SWT (JRuby
|
208
208
|
Desktop Development GUI Framework), Glimmer DSL for Opal (Pure Ruby Web GUI and
|
209
|
-
Auto-Webifier of Desktop Apps), Glimmer DSL for
|
210
|
-
Library), Glimmer DSL for
|
211
|
-
|
212
|
-
|
209
|
+
Auto-Webifier of Desktop Apps), Glimmer DSL for LibUI (Prerequisite-Free Ruby Desktop
|
210
|
+
Development GUI Library), Glimmer DSL for Tk (Ruby Tk Desktop Development GUI Library),
|
211
|
+
Glimmer DSL for GTK (Ruby-GNOME Desktop Development GUI Library), Glimmer DSL for
|
212
|
+
FX (FOX Toolkit Ruby Desktop Development GUI Library), Glimmer DSL for Swing (JRuby
|
213
|
+
Swing Desktop Development GUI Library), Glimmer DSL for JFX (JRuby JavaFX Desktop
|
214
|
+
Development GUI Library), Glimmer DSL for XML (& HTML), and Glimmer DSL for CSS.
|
213
215
|
email: andy.am@gmail.com
|
214
216
|
executables: []
|
215
217
|
extensions: []
|
@@ -270,5 +272,5 @@ requirements: []
|
|
270
272
|
rubygems_version: 3.3.1
|
271
273
|
signing_key:
|
272
274
|
specification_version: 4
|
273
|
-
summary: Glimmer - DSL
|
275
|
+
summary: Glimmer - DSL Framework for Ruby GUI and More
|
274
276
|
test_files: []
|