glimmer-dsl-libui 0.9.5 → 0.9.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 722844f182b70508ed2e98484db762ea72297e7e9634042b2d888ca5b8c65f99
4
- data.tar.gz: 88e9f08337452b1d59b90a54f30f489c0acc02154f2b57991de7c5d08c1347fa
3
+ metadata.gz: 06c9ed7f6b104ec0f5a034ee6f74fa2398de9b1d11ffea2e2d1448f07e2c7e43
4
+ data.tar.gz: 48591881860e3317e2e79a88840fcb0b51d093ba017e0b74dc45e8382ead00b3
5
5
  SHA512:
6
- metadata.gz: cad7f6be9a53386679ff80bfbb0c763428e003dcbf07f812c3d76b4f0dc581239d6e376b2e70bef030bbe1ff64554dae4fc3be55e9618c8dda6bf8a72da51752
7
- data.tar.gz: 34a2ef4fa8f372dd69e9de1f768197118a5c30fcc140f178d39285fd75326db7f2f8b76fe9faf8812c3f862d8652d931580124fd252147466f4c5fb3600e8c3f
6
+ metadata.gz: d17b5b51140d69186f2237efffdce6a9e65ec675e568fcb96c911593cb934392ad423da0ea64e75573ef5d657f3690b87a3bca9723e04ca103922b98204e24a1
7
+ data.tar.gz: 658eb9d2fa4b00a7c4edbb85ef42dbbb3b81f04e4c16e3ccd93715e252a726317bd6fec59081047d6b6698bfb38ab8594413afee6638eccc2373ccb0a8830fcd
data/CHANGELOG.md CHANGED
@@ -1,12 +1,18 @@
1
1
  # Change Log
2
2
 
3
+ ## 0.9.6
4
+
5
+ - Scaffold Custom Window Gem via `glimmer scaffold:gem:customwindow[name,namespace]` (or alias: `glimmer scaffold:gem:cw[name,namespace]`)
6
+ - List Custom Window Gems (expected name format: `glimmer-libui-cw-gemname-namespace`) via `glimmer list:gems:customwindow[query]` (or alias: `glimmer list:gems:cw[query]`)
7
+ - List Glimmer DSLs via `glimmer list:gems:dsl[query]`
8
+
3
9
  ## 0.9.5
4
10
 
5
- - Scaffold Custom Control via `glimmer scaffold:customcontrol[name,namespace]`
11
+ - Scaffold Custom Control via `glimmer scaffold:customcontrol[name,namespace]` (or alias: `glimmer scaffold:cc[name,namespace]`)
6
12
 
7
13
  ## 0.9.4
8
14
 
9
- - Scaffold Custom Window via `glimmer scaffold:customwindow[name,namespace]`
15
+ - Scaffold Custom Window via `glimmer scaffold:customwindow[name,namespace]` (or alias: `glimmer scaffold:cw[name,namespace]`)
10
16
 
11
17
  ## 0.9.3
12
18
 
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 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.9.5
1
+ # [<img src="https://raw.githubusercontent.com/AndyObtiva/glimmer/master/images/glimmer-logo-hi-res.png" height=85 />](https://github.com/AndyObtiva/glimmer) Glimmer DSL for LibUI 0.9.6
2
2
  ## Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library ([Fukuoka Award Winning](http://www.digitalfukuoka.jp/topics/187?locale=ja))
3
3
  ### The Quickest Way From Zero To GUI
4
4
  [![Gem Version](https://badge.fury.io/rb/glimmer-dsl-libui.svg)](http://badge.fury.io/rb/glimmer-dsl-libui)
@@ -353,6 +353,9 @@ Learn more about the differences between various [Glimmer](https://github.com/An
353
353
  - [Scaffold Application](#scaffold-application)
354
354
  - [Scaffold Custom Window](#scaffold-custom-window)
355
355
  - [Scaffold Custom Control](#scaffold-custom-control)
356
+ - [Scaffold Custom Window Gem](#scaffold-custom-window-gem)
357
+ - [List Custom Window Gems](#list-custom-window-gems)
358
+ - [List Glimmer DSLs](#list-glimmer-dsls)
356
359
  - [Girb (Glimmer IRB)](#girb-glimmer-irb)
357
360
  - [Glimmer GUI DSL Concepts](#glimmer-gui-dsl-concepts)
358
361
  - [API](#api)
@@ -423,7 +426,7 @@ gem install glimmer-dsl-libui
423
426
  Or install via Bundler `Gemfile`:
424
427
 
425
428
  ```ruby
426
- gem 'glimmer-dsl-libui', '~> 0.9.5'
429
+ gem 'glimmer-dsl-libui', '~> 0.9.6'
427
430
  ```
428
431
 
429
432
  Test that installation worked by running the [Glimmer Meta-Example](#examples):
@@ -739,9 +742,9 @@ When you are in a scaffolded application, you can scaffold a new custom window (
739
742
  glimmer scaffold:customwindow[name,namespace]
740
743
  ```
741
744
 
742
- The name represents the custom window view class name (it can be underscored, and Glimmer will automatically classify it).
745
+ The `name` represents the custom window view class name (it can be underscored, and Glimmer will automatically classify it).
743
746
 
744
- The namespace is optional and represents the module that the custom window view class will live under. If left off, the main application class namespace is used (e.g. the top-level `HelloWorld` class namespace for a `hello_world` application).
747
+ The `namespace` is optional and represents the module that the custom window view class will live under. If left off, the main application class namespace is used (e.g. the top-level `HelloWorld` class namespace for a `hello_world` application).
745
748
 
746
749
  You can also use the shorter `cw` alias for `customwindow`:
747
750
 
@@ -891,9 +894,9 @@ When you are in a scaffolded application, you can scaffold a new custom control
891
894
  glimmer scaffold:customcontrol[name,namespace]
892
895
  ```
893
896
 
894
- The name represents the custom control view class name (it can be underscored, and Glimmer will automatically classify it).
897
+ The `name` represents the custom control view class name (it can be underscored, and Glimmer will automatically classify it).
895
898
 
896
- The namespace is optional and represents the module that the custom control view class will live under. If left off, the main application class namespace is used (e.g. the top-level `HelloWorld` class namespace for a `hello_world` application).
899
+ The `namespace` is optional and represents the module that the custom control view class will live under. If left off, the main application class namespace is used (e.g. the top-level `HelloWorld` class namespace for a `hello_world` application).
897
900
 
898
901
  You can also use the shorter `cc` alias for `customcontrol`:
899
902
 
@@ -1071,6 +1074,94 @@ window {
1071
1074
  }
1072
1075
  ```
1073
1076
 
1077
+ ### Scaffold Custom Window Gem
1078
+
1079
+ You can scaffold a Ruby gem around a reusable Custom Window by running this command:
1080
+
1081
+ ```
1082
+ glimmer scaffold:gem:customwindow[name,namespace]
1083
+ ```
1084
+
1085
+ That will generate a custom window gem project under the naming convention: `glimmer-libui-cw-name-namespace`
1086
+
1087
+ The naming convention helps with discoverability of Ruby gems using the command `glimmer list:gems:customwindow[query]` (or alias: `glimmer list:gems:cw[query]`) where filtering `query` is optional.
1088
+
1089
+ The `name` is the custom window class name, which must not contain dashes by convention (multiple words can be concatenated or can use underscores between them).
1090
+
1091
+ The `namespace` is needed to avoid clashing with other custom window gems that other software engineers might have thought of. It is recommended not to include dashes between words in it by convention yet concatenated words or underscores between them.
1092
+
1093
+ Here is a shorter alias for the custom window gem scaffolding command:
1094
+
1095
+ ```
1096
+ glimmer scaffold:gem:cw[name,namespace]
1097
+ ```
1098
+
1099
+ You can package the newly scaffolded project as a Ruby gem by running this command:
1100
+
1101
+ ```
1102
+ glimmer package:gem
1103
+ ```
1104
+
1105
+ Or by using the raw rake command:
1106
+
1107
+ ```
1108
+ rake build
1109
+ ```
1110
+
1111
+ You can generate the application gemspec explicitly if needed with this command (though it is not needed to build the gem):
1112
+
1113
+ ```
1114
+ glimmer package:gemspec
1115
+ ```
1116
+
1117
+ Or by using the raw rake command:
1118
+
1119
+ ```
1120
+ rake gemspec:generate
1121
+ ```
1122
+
1123
+ The project optionally allows you to run the custom window as its own separate app with a binary script (`bin/gem_name`) to see it, which helps with prototyping it.
1124
+
1125
+ But, typically consumers of the gem would include it in their own project, which makes the gem keyword available in the Glimmer GUI DSL where `Glimmer`. `Glimmer::LibUI::Application`, `Glimmer::LibUI::CustomWindow`, or `Glimmer::LibUI::CustomControl` is mixed.
1126
+
1127
+ For example:
1128
+
1129
+ ```ruby
1130
+ require 'glimmer-libui-cw-greeter-acme'
1131
+
1132
+ ...
1133
+ greeter.show
1134
+ ...
1135
+ ```
1136
+
1137
+ ### List Custom Window Gems
1138
+
1139
+ Custom window gems are scaffolded to follow the naming convention: `glimmer-libui-cw-name-namespace`
1140
+
1141
+ The naming convention helps with discoverability of Ruby gems using the command:
1142
+
1143
+ ```
1144
+ glimmer list:gems:customwindow[query]
1145
+ ```
1146
+
1147
+ Or by using the shorter alias:
1148
+
1149
+ ```
1150
+ glimmer list:gems:cw[query]
1151
+ ```
1152
+
1153
+ The filtering `query` is optional.
1154
+
1155
+ ### List Glimmer DSLs
1156
+
1157
+ Glimmer DSLs can be listed with this command:
1158
+
1159
+ ```
1160
+ glimmer list:gems:dsl[query]
1161
+ ```
1162
+
1163
+ The filtering `query` is optional.
1164
+
1074
1165
  ## Girb (Glimmer IRB)
1075
1166
 
1076
1167
  You can run the `girb` command (`bin/girb` if you cloned the project locally) to do some quick and dirty experimentation and learning:
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.9.5
1
+ 0.9.6
Binary file
@@ -30,25 +30,25 @@ module Glimmer
30
30
  REGEX_GEM_LINE = /^([^\(]+) \(([^\)]+)\)$/
31
31
 
32
32
  def custom_control_gems(query=nil)
33
- list_gems('glimmer-cw-', query) do |result|
33
+ list_gems('glimmer-libui-cc-', query) do |result|
34
34
  puts
35
- puts " Glimmer Custom Control Gems#{" matching [#{query}]" if query} at rubygems.org:"
35
+ puts " Glimmer DSL for LibUI Custom Control Gems#{" matching [#{query}]" if query} at rubygems.org:"
36
36
  puts result
37
37
  end
38
38
  end
39
39
 
40
40
  def custom_window_gems(query=nil)
41
- list_gems('glimmer-cs-', query) do |result|
41
+ list_gems('glimmer-libui-cw-', query) do |result|
42
42
  puts
43
- puts " Glimmer Custom Window Gems#{" matching [#{query}]" if query} at rubygems.org:"
43
+ puts " Glimmer DSL for LibUI Custom Window Gems#{" matching [#{query}]" if query} at rubygems.org:"
44
44
  puts result
45
45
  end
46
46
  end
47
47
 
48
48
  def custom_shape_gems(query=nil)
49
- list_gems('glimmer-cp-', query) do |result|
49
+ list_gems('glimmer-libui-cs-', query) do |result|
50
50
  puts
51
- puts " Glimmer Custom Shape Gems#{" matching [#{query}]" if query} at rubygems.org:"
51
+ puts " Glimmer DSL for LibUI Custom Shape Gems#{" matching [#{query}]" if query} at rubygems.org:"
52
52
  puts result
53
53
  end
54
54
  end
@@ -219,7 +219,7 @@ module Glimmer
219
219
  end
220
220
 
221
221
  def custom_window_gem(custom_window_name, namespace)
222
- gem_name = "glimmer-cs-#{compact_name(custom_window_name)}"
222
+ gem_name = "glimmer-libui-cw-#{compact_name(custom_window_name)}"
223
223
  gem_summary = "#{human_name(custom_window_name)} - Glimmer Custom Window"
224
224
  begin
225
225
  custom_window_keyword = dsl_control_name(custom_window_name)
@@ -249,6 +249,7 @@ module Glimmer
249
249
  write 'Rakefile', gem_rakefile(custom_window_name, namespace, gem_name)
250
250
  append "lib/#{gem_name}.rb", gem_main_file(custom_window_name, namespace)
251
251
  custom_window(custom_window_name, namespace, :gem)
252
+ app_model(current_dir_name, namespace)
252
253
 
253
254
  mkdir_p "lib/#{gem_name}"
254
255
  write "lib/#{gem_name}/launch.rb", gem_launch_file(gem_name, custom_window_name, namespace)
@@ -291,7 +292,7 @@ module Glimmer
291
292
  end
292
293
 
293
294
  def custom_control_gem(custom_control_name, namespace)
294
- gem_name = "glimmer-cw-#{compact_name(custom_control_name)}"
295
+ gem_name = "glimmer-libui-cc-#{compact_name(custom_control_name)}"
295
296
  gem_summary = "#{human_name(custom_control_name)} - Glimmer Custom Control"
296
297
  if namespace
297
298
  gem_name += "-#{compact_name(namespace)}"
@@ -330,7 +331,7 @@ module Glimmer
330
331
  end
331
332
 
332
333
  def custom_shape_gem(custom_shape_name, namespace)
333
- gem_name = "glimmer-cp-#{compact_name(custom_shape_name)}"
334
+ gem_name = "glimmer-libui-cs-#{compact_name(custom_shape_name)}"
334
335
  gem_summary = "#{human_name(custom_shape_name)} - Glimmer Custom Shape"
335
336
  if namespace
336
337
  gem_name += "-#{compact_name(namespace)}"
@@ -368,7 +369,7 @@ module Glimmer
368
369
  puts 'Run `rake release` to release into rubygems.org once ready.'
369
370
  end
370
371
 
371
- def app_model(current_dir_name)
372
+ def app_model(current_dir_name, namespace = nil)
372
373
  model_name = 'Greeting'
373
374
  namespace ||= current_dir_name
374
375
  root_dir = File.exist?('app') ? 'app' : 'lib'
@@ -542,7 +543,7 @@ module Glimmer
542
543
 
543
544
  if %i[gem app].include?(window_type)
544
545
  custom_window_file_content += <<-MULTI_LINE_STRING
545
- require '#{current_dir_name}/model/greeting'
546
+ require '#{window_type == :app ? current_dir_name : namespace}/model/greeting'
546
547
 
547
548
  MULTI_LINE_STRING
548
549
  end
@@ -579,7 +580,7 @@ require '#{current_dir_name}/model/greeting'
579
580
  #
580
581
  MULTI_LINE_STRING
581
582
 
582
- if %i[gem app].include?(window_type)
583
+ if window_type == :app
583
584
  custom_window_file_content += <<-MULTI_LINE_STRING
584
585
  before_body do
585
586
  @greeting = Model::Greeting.new
@@ -609,6 +610,12 @@ require '#{current_dir_name}/model/greeting'
609
610
  end
610
611
  }
611
612
  }
613
+ end
614
+ MULTI_LINE_STRING
615
+ elsif window_type == :gem
616
+ custom_window_file_content += <<-MULTI_LINE_STRING
617
+ before_body do
618
+ @greeting = Model::Greeting.new
612
619
  end
613
620
  MULTI_LINE_STRING
614
621
  else
@@ -638,12 +645,30 @@ require '#{current_dir_name}/model/greeting'
638
645
 
639
646
  margined true
640
647
 
641
- label {
642
- #{%i[gem app].include?(window_type) ? "text <= [@greeting, :text]" : "text '#{human_name(custom_window_name)}'"}
648
+ vertical_box {
649
+ MULTI_LINE_STRING
650
+
651
+ if window_type == :gem
652
+ custom_window_file_content += <<-MULTI_LINE_STRING
653
+
654
+ button('Preferences...') {
655
+ stretchy false
656
+
657
+ on_clicked do
658
+ display_preferences_dialog
659
+ end
660
+ }
661
+ MULTI_LINE_STRING
662
+ end
663
+
664
+ custom_window_file_content += <<-MULTI_LINE_STRING
665
+ label {
666
+ #{%i[gem app].include?(window_type) ? "text <= [@greeting, :text]" : "text '#{human_name(custom_window_name)}'"}
667
+ }
643
668
  }
644
669
  }
645
670
  }
646
- MULTI_LINE_STRING
671
+ MULTI_LINE_STRING
647
672
 
648
673
  if %i[gem app].include?(window_type)
649
674
  custom_window_file_content += <<-MULTI_LINE_STRING
@@ -124,16 +124,16 @@ namespace :glimmer do
124
124
  # task :custom_shape, [:name, :namespace] => :customshape
125
125
  # task :"custom-shape", [:name, :namespace] => :customshape
126
126
  #
127
- # namespace :gem do
128
- # desc 'Scaffold Glimmer::UI::CustomWindow subclass (full window view) under its own Ruby gem + app project (namespace is required) [alt: scaffold:gem:cw]'
129
- # task :customwindow, [:name, :namespace] do |t, args|
130
- # require_relative 'rake_task/scaffold'
131
- # Glimmer::RakeTask::Scaffold.custom_window_gem(args[:name], args[:namespace])
132
- # end
133
- #
134
- # task :cw, [:name, :namespace] => :customwindow
135
- # task :custom_window, [:name, :namespace] => :customwindow
136
- # task :"custom-window", [:name, :namespace] => :customwindow
127
+ namespace :gem do
128
+ desc 'Scaffold Glimmer::UI::CustomWindow subclass (full window view) under its own Ruby gem + app project (namespace is required) [alt: scaffold:gem:cw]'
129
+ task :customwindow, [:name, :namespace] do |t, args|
130
+ require_relative 'rake_task/scaffold'
131
+ Glimmer::RakeTask::Scaffold.custom_window_gem(args[:name], args[:namespace])
132
+ end
133
+
134
+ task :cw, [:name, :namespace] => :customwindow
135
+ task :custom_window, [:name, :namespace] => :customwindow
136
+ task :"custom-window", [:name, :namespace] => :customwindow
137
137
  #
138
138
  # desc 'Scaffold Glimmer::UI::CustomControl subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cc]'
139
139
  # task :customcontrol, [:name, :namespace] do |t, args|
@@ -154,11 +154,7 @@ namespace :glimmer do
154
154
  # task :cs, [:name, :namespace] => :customshape
155
155
  # task :custom_shape, [:name, :namespace] => :customshape
156
156
  # task :"custom-shape", [:name, :namespace] => :customshape
157
- # end
158
- #
159
- # task :custom_window_gem, [:name, :namespace] => 'gem:customwindow'
160
- # task :custom_control_gem, [:name, :namespace] => 'gem:customcontrol'
161
- # task :custom_shape_gem, [:name, :namespace] => 'gem:customshape'
157
+ end
162
158
  end
163
159
 
164
160
  namespace :list do
@@ -198,13 +194,6 @@ namespace :glimmer do
198
194
  task :dsl, [:query] => :list_require do |t, args|
199
195
  Glimmer::RakeTask::List.dsl_gems(args[:query])
200
196
  end
201
-
202
197
  end
203
-
204
- # legacy support
205
-
206
- task :custom_window_gems, [:name, :namespace] => 'gems:customwindow'
207
- task :custom_control_gems, [:name, :namespace] => 'gems:customcontrol'
208
-
209
198
  end
210
199
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glimmer-dsl-libui
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.5
4
+ version: 0.9.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Maleh