glimmer-dsl-libui 0.9.1 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +8 -0
- data/README.md +20 -4
- data/VERSION +1 -1
- data/glimmer-dsl-libui.gemspec +0 -0
- data/lib/glimmer/rake_task/package.rb +43 -0
- data/lib/glimmer/rake_task/scaffold.rb +57 -25
- data/lib/glimmer/rake_task.rb +21 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f0fd65bf048edb4ec2556097bcbbe82b2dd2c1411e6a2c81d592901a40fdcf0f
|
4
|
+
data.tar.gz: 4e48a01e498afdf21fc72a82891106e8198360eeea971f98663e585b6c2ba6d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45492206e1c62e3daf5199a6551029300a8f73a8fdf1cf40b38a3efdaddc49f8b123c18ae61c2b233ed2c19272aa9661c35043b2adccc2cc4f487f004486e8a1
|
7
|
+
data.tar.gz: 0c2b32d5c933da94e99f07926491d1423b29e36b91ad8e2a207472d5235d199a7761f9d768ce7a4eea02287515837aa4c35c0aeb6ed9b1d5c21d387fd796e9c6
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,13 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 0.9.3
|
4
|
+
|
5
|
+
- Application Scaffolding via `glimmer scaffold[app_name]` includes a Model layer
|
6
|
+
|
7
|
+
## 0.9.2
|
8
|
+
|
9
|
+
- Add `glimmer` commands `glimmer package:gem`, `glimmer package:gemspec`, and `glimmer package:clean`
|
10
|
+
|
3
11
|
## 0.9.1
|
4
12
|
|
5
13
|
- Scaffold an application via Glimmer Command: `glimmer scaffold[app_name]`
|
data/README.md
CHANGED
@@ -1,5 +1,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
|
2
|
-
## Prerequisite-Free Ruby Desktop Development Cross-Platform Native GUI Library
|
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.3
|
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)
|
5
5
|
[![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)
|
@@ -421,7 +421,7 @@ gem install glimmer-dsl-libui
|
|
421
421
|
Or install via Bundler `Gemfile`:
|
422
422
|
|
423
423
|
```ruby
|
424
|
-
gem 'glimmer-dsl-libui', '~> 0.9.
|
424
|
+
gem 'glimmer-dsl-libui', '~> 0.9.3'
|
425
425
|
```
|
426
426
|
|
427
427
|
Test that installation worked by running the [Glimmer Meta-Example](#examples):
|
@@ -645,6 +645,7 @@ Created hello_world/Gemfile
|
|
645
645
|
Created hello_world/Rakefile
|
646
646
|
Created hello_world/app/hello_world.rb
|
647
647
|
Created hello_world/app/hello_world/view/hello_world.rb
|
648
|
+
Created hello_world/app/hello_world/model/greeting.rb
|
648
649
|
Created hello_world/icons/windows/Hello World.ico
|
649
650
|
Created hello_world/icons/macosx/Hello World.icns
|
650
651
|
Created hello_world/icons/linux/Hello World.png
|
@@ -655,6 +656,7 @@ Created hello_world/bin/hello_world
|
|
655
656
|
They include a basic Hello, World! application with menus and about/preferences dialogs.
|
656
657
|
|
657
658
|
Views live under `app/app_name/view` (e.g. `app/hello_world/view`)
|
659
|
+
|
658
660
|
Models live under `app/app_name/model` (e.g. `app/hello_world/model`)
|
659
661
|
|
660
662
|
Once you step into the application directory, you can run it in one of multiple ways:
|
@@ -681,16 +683,30 @@ glimmer run
|
|
681
683
|
|
682
684
|
![glimmer-dsl-libui-mac-scaffold-app-changed-greeting.png](images/glimmer-dsl-libui-mac-scaffold-app-changed-greeting.png)
|
683
685
|
|
684
|
-
|
686
|
+
![glimmer-dsl-libui-mac-scaffold-app-about.png](images/glimmer-dsl-libui-mac-scaffold-app-about.png)
|
687
|
+
|
688
|
+
The application comes with the [juwelier](https://rubygems.org/gems/juwelier) gem for auto-generating an application gem from the app `Rakefile` and `Gemfile` configuration (no need to manually declare gems in a gemspec... just use `Gemfile` normally and [juwelier](https://rubygems.org/gems/juwelier) takes care of the rest by generating an app gemspec automatically from `Gemfile`).
|
685
689
|
|
686
690
|
You can package the newly scaffolded app as a Ruby gem by running this command:
|
687
691
|
|
692
|
+
```
|
693
|
+
glimmer package:gem
|
694
|
+
```
|
695
|
+
|
696
|
+
Or by using the raw rake command:
|
697
|
+
|
688
698
|
```
|
689
699
|
rake build
|
690
700
|
```
|
691
701
|
|
692
702
|
You can generate the application gemspec explicitly if needed with this command (though it is not needed to build the gem):
|
693
703
|
|
704
|
+
```
|
705
|
+
glimmer package:gemspec
|
706
|
+
```
|
707
|
+
|
708
|
+
Or by using the raw rake command:
|
709
|
+
|
694
710
|
```
|
695
711
|
rake gemspec:generate
|
696
712
|
```
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.9.
|
1
|
+
0.9.3
|
data/glimmer-dsl-libui.gemspec
CHANGED
Binary file
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# Copyright (c) 2021-2023 Andy Maleh
|
2
|
+
#
|
3
|
+
# Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
# a copy of this software and associated documentation files (the
|
5
|
+
# "Software"), to deal in the Software without restriction, including
|
6
|
+
# without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
# distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
# permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
# the following conditions:
|
10
|
+
#
|
11
|
+
# The above copyright notice and this permission notice shall be
|
12
|
+
# included in all copies or substantial portions of the Software.
|
13
|
+
#
|
14
|
+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
21
|
+
|
22
|
+
require 'os'
|
23
|
+
|
24
|
+
module Glimmer
|
25
|
+
module RakeTask
|
26
|
+
module Package
|
27
|
+
class << self
|
28
|
+
def clean
|
29
|
+
require 'fileutils'
|
30
|
+
FileUtils.rm_rf('pkg')
|
31
|
+
end
|
32
|
+
|
33
|
+
def gemspec
|
34
|
+
system 'rake gemspec:generate'
|
35
|
+
end
|
36
|
+
|
37
|
+
def gem
|
38
|
+
system 'rake build'
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -155,6 +155,7 @@ module Glimmer
|
|
155
155
|
mkdir_p "app/#{file_name(app_name)}/model"
|
156
156
|
mkdir_p "app/#{file_name(app_name)}/view"
|
157
157
|
custom_window(class_name(app_name), current_dir_name, window_type, custom_window_class_name: 'Application')
|
158
|
+
application_model(current_dir_name)
|
158
159
|
|
159
160
|
mkdir_p 'icons/windows'
|
160
161
|
icon_file = "icons/windows/#{human_name(app_name)}.ico"
|
@@ -366,6 +367,16 @@ module Glimmer
|
|
366
367
|
puts 'Run `rake build` to build gem.'
|
367
368
|
puts 'Run `rake release` to release into rubygems.org once ready.'
|
368
369
|
end
|
370
|
+
|
371
|
+
def application_model(current_dir_name)
|
372
|
+
model_name = 'Greeting'
|
373
|
+
namespace ||= current_dir_name
|
374
|
+
root_dir = File.exist?('app') ? 'app' : 'lib'
|
375
|
+
parent_dir = "#{root_dir}/#{file_name(namespace)}/model"
|
376
|
+
return puts("The file '#{parent_dir}/#{file_name(model_name)}.rb' already exists. Please either remove or pick a different name.") if File.exist?("#{parent_dir}/#{file_name(model_name)}.rb")
|
377
|
+
mkdir_p parent_dir unless File.exist?(parent_dir)
|
378
|
+
write "#{parent_dir}/#{file_name(model_name)}.rb", model_file(model_name, namespace)
|
379
|
+
end
|
369
380
|
|
370
381
|
private
|
371
382
|
|
@@ -527,7 +538,16 @@ module Glimmer
|
|
527
538
|
window_options[:custom_window_class_name] ||= 'CustomWindow'
|
528
539
|
namespace_type = class_name(namespace) == class_name(current_dir_name) ? 'class' : 'module'
|
529
540
|
|
530
|
-
custom_window_file_content =
|
541
|
+
custom_window_file_content = ''
|
542
|
+
|
543
|
+
if %i[gem app].include?(window_type)
|
544
|
+
custom_window_file_content += <<-MULTI_LINE_STRING
|
545
|
+
require '#{current_dir_name}/model/greeting'
|
546
|
+
|
547
|
+
MULTI_LINE_STRING
|
548
|
+
end
|
549
|
+
|
550
|
+
custom_window_file_content += <<-MULTI_LINE_STRING
|
531
551
|
#{namespace_type} #{class_name(namespace)}
|
532
552
|
module View
|
533
553
|
class #{class_name(custom_window_name)}
|
@@ -543,15 +563,6 @@ module Glimmer
|
|
543
563
|
MULTI_LINE_STRING
|
544
564
|
end
|
545
565
|
|
546
|
-
if %i[gem app].include?(window_type)
|
547
|
-
custom_window_file_content += <<-MULTI_LINE_STRING
|
548
|
-
GREETINGS = [
|
549
|
-
'Hello, World!',
|
550
|
-
'Howdy, Partner!'
|
551
|
-
]
|
552
|
-
MULTI_LINE_STRING
|
553
|
-
end
|
554
|
-
|
555
566
|
custom_window_file_content += <<-MULTI_LINE_STRING
|
556
567
|
|
557
568
|
## Add options like the following to configure CustomWindow by outside consumers
|
@@ -561,14 +572,6 @@ module Glimmer
|
|
561
572
|
# option :height, default: 240
|
562
573
|
MULTI_LINE_STRING
|
563
574
|
|
564
|
-
if %i[gem app].include?(window_type)
|
565
|
-
custom_window_file_content += <<-MULTI_LINE_STRING
|
566
|
-
|
567
|
-
# GREETING Array selected index
|
568
|
-
option :greeting_index, default: 0
|
569
|
-
MULTI_LINE_STRING
|
570
|
-
end
|
571
|
-
|
572
575
|
custom_window_file_content += <<-MULTI_LINE_STRING
|
573
576
|
|
574
577
|
## Use before_body block to pre-initialize variables to use in body and
|
@@ -579,6 +582,8 @@ module Glimmer
|
|
579
582
|
if %i[gem app].include?(window_type)
|
580
583
|
custom_window_file_content += <<-MULTI_LINE_STRING
|
581
584
|
before_body do
|
585
|
+
@greeting = Model::Greeting.new
|
586
|
+
|
582
587
|
menu('File') {
|
583
588
|
menu_item('Preferences...') {
|
584
589
|
on_clicked do
|
@@ -634,7 +639,7 @@ module Glimmer
|
|
634
639
|
margined true
|
635
640
|
|
636
641
|
label {
|
637
|
-
text <= [
|
642
|
+
text <= [@greeting, :text]
|
638
643
|
}
|
639
644
|
}
|
640
645
|
}
|
@@ -643,10 +648,6 @@ module Glimmer
|
|
643
648
|
if %i[gem app].include?(window_type)
|
644
649
|
custom_window_file_content += <<-MULTI_LINE_STRING
|
645
650
|
|
646
|
-
def greeting
|
647
|
-
GREETINGS[greeting_index]
|
648
|
-
end
|
649
|
-
|
650
651
|
def display_about_dialog
|
651
652
|
message = "#{human_name(namespace)}#{" - #{human_name(custom_window_name)}" if window_type == :gem} \#{VERSION}\\n\\n\#{LICENSE}"
|
652
653
|
msg_box('About', message)
|
@@ -674,8 +675,8 @@ module Glimmer
|
|
674
675
|
radio_buttons {
|
675
676
|
stretchy false
|
676
677
|
|
677
|
-
items GREETINGS
|
678
|
-
selected <=> [
|
678
|
+
items Model::Greeting::GREETINGS
|
679
|
+
selected <=> [@greeting, :text_index]
|
679
680
|
}
|
680
681
|
}
|
681
682
|
}.show
|
@@ -790,6 +791,37 @@ end
|
|
790
791
|
MULTI_LINE_STRING
|
791
792
|
end
|
792
793
|
|
794
|
+
def model_file(model_name, namespace)
|
795
|
+
namespace_type = class_name(namespace) == class_name(current_dir_name) ? 'class' : 'module'
|
796
|
+
|
797
|
+
<<-MULTI_LINE_STRING
|
798
|
+
#{namespace_type} #{class_name(namespace)}
|
799
|
+
module Model
|
800
|
+
class #{class_name(model_name)}
|
801
|
+
GREETINGS = [
|
802
|
+
'Hello, World!',
|
803
|
+
'Howdy, Partner!'
|
804
|
+
]
|
805
|
+
|
806
|
+
attr_accessor :text
|
807
|
+
|
808
|
+
def initialize
|
809
|
+
@text = GREETINGS.first
|
810
|
+
end
|
811
|
+
|
812
|
+
def text_index=(new_text_index)
|
813
|
+
self.text = GREETINGS[new_text_index]
|
814
|
+
end
|
815
|
+
|
816
|
+
def text_index
|
817
|
+
GREETINGS.index(text)
|
818
|
+
end
|
819
|
+
end
|
820
|
+
end
|
821
|
+
end
|
822
|
+
MULTI_LINE_STRING
|
823
|
+
end
|
824
|
+
|
793
825
|
end
|
794
826
|
|
795
827
|
end
|
data/lib/glimmer/rake_task.rb
CHANGED
@@ -66,6 +66,27 @@ namespace :glimmer do
|
|
66
66
|
Glimmer::Launcher.new([File.expand_path('../../../examples/meta_example.rb', __FILE__)]).launch
|
67
67
|
end
|
68
68
|
|
69
|
+
namespace :package do
|
70
|
+
task :package_dependencies do
|
71
|
+
require_relative 'rake_task/package'
|
72
|
+
end
|
73
|
+
|
74
|
+
desc 'Clean by removing "pkg" directory'
|
75
|
+
task :clean => :package_dependencies do
|
76
|
+
Glimmer::RakeTask::Package.clean
|
77
|
+
end
|
78
|
+
|
79
|
+
desc 'Generate gemspec'
|
80
|
+
task :gemspec => :package_dependencies do
|
81
|
+
Glimmer::RakeTask::Package.gemspec
|
82
|
+
end
|
83
|
+
|
84
|
+
desc 'Generate gem under "pkg" directory'
|
85
|
+
task :gem => :package_dependencies do
|
86
|
+
Glimmer::RakeTask::Package.gem
|
87
|
+
end
|
88
|
+
end
|
89
|
+
|
69
90
|
desc 'Scaffold Glimmer application directory structure to build a new app'
|
70
91
|
task :scaffold, [:app_name] do |t, args|
|
71
92
|
require_relative 'rake_task/scaffold'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: glimmer-dsl-libui
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.9.
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Maleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-10-
|
11
|
+
date: 2023-10-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: glimmer
|
@@ -606,6 +606,7 @@ files:
|
|
606
606
|
- lib/glimmer/proc_tracker.rb
|
607
607
|
- lib/glimmer/rake_task.rb
|
608
608
|
- lib/glimmer/rake_task/list.rb
|
609
|
+
- lib/glimmer/rake_task/package.rb
|
609
610
|
- lib/glimmer/rake_task/scaffold.rb
|
610
611
|
- sounds/AlanWalker-Faded.mid
|
611
612
|
- sounds/AlanWalker-SingMeToSleep.mid
|