glimmer 0.10.3 → 0.10.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +389 -32
- data/VERSION +1 -1
- data/lib/glimmer.rb +4 -4
- data/lib/glimmer/config.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4fbfd6caf79d10dbaeb2d737d68a8f028819d6172f45a8b494d1a88c34e3e04b
|
4
|
+
data.tar.gz: 9fcbc6d1948ced1b67192aeb22a25420b9a165930bc084e30534141c2f65a1fb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b5809d0f9a9ae9536dfaf0ff74612c44a74df732d3ea7db7a8102aec6e434373104f9fba13a1aa3c1109faad754cfa390c3ac57bbd5de379f31441d9d61357d0
|
7
|
+
data.tar.gz: 4d5d53bd6881b462b2aa2ca36ddcd2e41ab61862f5162e0a888288596609271fb5e8e3130a9c99647d7226ed1373ee1b2a6477d8e5660ec13bbb615f5a853b72
|
data/README.md
CHANGED
@@ -352,7 +352,7 @@ jgem install glimmer-dsl-swt
|
|
352
352
|
|
353
353
|
Or this command if you want a specific version:
|
354
354
|
```
|
355
|
-
jgem install glimmer-dsl-swt -v 0.6.
|
355
|
+
jgem install glimmer-dsl-swt -v 0.6.5
|
356
356
|
```
|
357
357
|
|
358
358
|
`jgem` is JRuby's version of `gem` command.
|
@@ -370,7 +370,7 @@ Note: if you're using activerecord or activesupport, keep in mind that Glimmer u
|
|
370
370
|
|
371
371
|
Add the following to `Gemfile`:
|
372
372
|
```
|
373
|
-
gem 'glimmer-dsl-swt', '~> 0.6.
|
373
|
+
gem 'glimmer-dsl-swt', '~> 0.6.5'
|
374
374
|
```
|
375
375
|
|
376
376
|
And, then run:
|
@@ -386,6 +386,16 @@ You may learn more about other Glimmer related gems ([`glimmer-dsl-opal`](https:
|
|
386
386
|
|
387
387
|
The `glimmer` command allows you to run, scaffold, package, and list Glimmer applications/gems.
|
388
388
|
|
389
|
+
You can bring up usage instructions by running the `glimmer` command without arguments:
|
390
|
+
|
391
|
+
```
|
392
|
+
glimmer
|
393
|
+
```
|
394
|
+
|
395
|
+
On Mac and Linux, it additionally brings up a TUI (Text-based User Interface) for interactive navigation and execution of Glimmer tasks (courtesy of [rake-tui](https://github.com/AndyObtiva/rake-tui)).
|
396
|
+
|
397
|
+
On Windows, it simply lists the available Glimmer tasks at the end (courtsey of [rake](https://github.com/ruby/rake)).
|
398
|
+
|
389
399
|
If you are new to Glimmer, you may read the Basic Usage section and skip the rest until you have gone through [Girb (Glimmer irb) Command](#girb-glimmer-irb-command), [Glimmer GUI DSL Syntax](#glimmer-gui-dsl-syntax), and [Samples](#samples).
|
390
400
|
|
391
401
|
### Basic Usage
|
@@ -415,43 +425,44 @@ bin/glimmer samples/hello/hello_world.rb
|
|
415
425
|
Below are the full usage instructions that come up when running `glimmer` without args.
|
416
426
|
|
417
427
|
```
|
428
|
+
Glimmer (Ruby Desktop Development GUI Library) - JRuby Gem: glimmer-dsl-swt v0.6.5
|
429
|
+
|
418
430
|
Usage: glimmer [--quiet] [--debug] [--log-level=VALUE] [[ENV_VAR=VALUE]...] [[-jruby-option]...] (application.rb or task[task_args]) [[application2.rb]...]
|
419
431
|
|
420
|
-
Runs Glimmer applications
|
421
|
-
|
422
|
-
Either a single task or one or more applications may be specified.
|
423
|
-
|
424
|
-
When a task is specified, it runs via rake. Some tasks take arguments in square brackets.
|
425
|
-
|
426
|
-
Available tasks are below (you may also lookup by adding `require 'glimmer/rake_task'` in Rakefile and running rake -T):
|
427
|
-
glimmer list:gems:customshell[query] # List Glimmer custom shell gems available at rubygems.org (query is optional) [alt: list:gems:cs]
|
428
|
-
glimmer list:gems:customwidget[query] # List Glimmer custom widget gems available at rubygems.org (query is optional) [alt: list:gems:cw]
|
429
|
-
glimmer list:gems:dsl[query] # List Glimmer DSL gems available at rubygems.org (query is optional)
|
430
|
-
glimmer package[type] # Package app for distribution (generating config, jar, and native files) (type is optional)
|
431
|
-
glimmer package:clean # Clean by removing "dist" and "packages" directories
|
432
|
-
glimmer package:config # Generate JAR config file
|
433
|
-
glimmer package:jar # Generate JAR file
|
434
|
-
glimmer package:lock_jars # Lock JARs
|
435
|
-
glimmer package:native[type] # Generate Native files (DMG/PKG/APP on the Mac, MSI/EXE/IMAGE on Windows, RPM/DEB on Linux) (type is optional)
|
436
|
-
glimmer scaffold[app_name] # Scaffold Glimmer application directory structure to build a new app
|
437
|
-
glimmer scaffold:customshell[name,namespace] # Scaffold Glimmer::UI::CustomShell subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cs]
|
438
|
-
glimmer scaffold:customwidget[name,namespace] # Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cw]
|
439
|
-
glimmer scaffold:gem:customshell[name,namespace] # Scaffold Glimmer::UI::CustomShell subclass (full window view) under its own Ruby gem + app project (namespace is required) [alt: scaffold:gem:cs]
|
440
|
-
glimmer scaffold:gem:customwidget[name,namespace] # Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cw]
|
432
|
+
Runs Glimmer applications and tasks.
|
441
433
|
|
442
434
|
When applications are specified, they are run using JRuby,
|
443
435
|
automatically preloading the glimmer Ruby gem and SWT jar dependency.
|
444
436
|
|
445
|
-
Optionally, extra Glimmer options, JRuby options and environment variables may be passed in.
|
437
|
+
Optionally, extra Glimmer options, JRuby options, and/or environment variables may be passed in.
|
446
438
|
|
447
439
|
Glimmer options:
|
448
440
|
- "--quiet" : Does not announce file path of Glimmer application being launched
|
449
441
|
- "--debug" : Displays extra debugging information, passes "--debug" to JRuby, and enables debug logging
|
450
442
|
- "--log-level=VALUE" : Sets Glimmer's Ruby logger level ("ERROR" / "WARN" / "INFO" / "DEBUG"; default is none)
|
451
443
|
|
452
|
-
|
453
|
-
|
454
|
-
|
444
|
+
Tasks are run via rake. Some tasks take arguments in square brackets.
|
445
|
+
|
446
|
+
Available tasks are below (if you do not see any, please add `require 'glimmer/rake_task'` to Rakefile and rerun or run rake -T):
|
447
|
+
|
448
|
+
Select a Glimmer task to run: (Press ↑/↓ arrow to move, Enter to select and letters to filter)
|
449
|
+
‣ glimmer list:gems:customshell[query] # List Glimmer custom shell gems available at rubygems.org (query is optional) [alt: list:gems:cs]
|
450
|
+
glimmer list:gems:customwidget[query] # List Glimmer custom widget gems available at rubygems.org (query is optional) [alt: list:gems:cw]
|
451
|
+
glimmer list:gems:dsl[query] # List Glimmer DSL gems available at rubygems.org (query is optional)
|
452
|
+
glimmer package[type] # Package app for distribution (generating config, jar, and native files) (type is optional)
|
453
|
+
glimmer package:clean # Clean by removing "dist" and "packages" directories
|
454
|
+
glimmer package:config # Generate JAR config file
|
455
|
+
glimmer package:jar # Generate JAR file
|
456
|
+
glimmer package:lock_jars # Lock JARs
|
457
|
+
glimmer package:native[type] # Generate Native files
|
458
|
+
glimmer sample:code[name] # Outputs code for a Glimmer internal sample [included in gem] (name is required)
|
459
|
+
glimmer sample:list[query] # Lists Glimmer internal samples [included in gem]. Filters by query if specified (query is optional)
|
460
|
+
glimmer sample:run[name] # Runs a Glimmer internal sample [included in gem]. If no name is supplied, it runs all samples
|
461
|
+
glimmer scaffold[app_name] # Scaffold Glimmer application directory structure to build a new app
|
462
|
+
glimmer scaffold:customshell[name,namespace] # Scaffold Glimmer::UI::CustomShell subclass (full window view) under app/views (namespace is optional) [alt: scaffold:cs]
|
463
|
+
glimmer scaffold:customwidget[name,namespace] # Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under app/views (namespace is optional) [alt: scaffold:cw]
|
464
|
+
glimmer scaffold:gem:customshell[name,namespace] # Scaffold Glimmer::UI::CustomShell subclass (full window view) under its own Ruby gem + app project (namespace is required) [alt: scaffold:ge...
|
465
|
+
glimmer scaffold:gem:customwidget[name,namespace] # Scaffold Glimmer::UI::CustomWidget subclass (part of a view) under its own Ruby gem project (namespace is required) [alt: scaffold:gem:cw]
|
455
466
|
```
|
456
467
|
|
457
468
|
Example (Glimmer/JRuby option specified):
|
@@ -468,10 +479,337 @@ glimmer samples/hello/hello_world.rb samples/hello_tab.rb
|
|
468
479
|
|
469
480
|
Launches samples/hello/hello_world.rb and samples/hello_tab.rb at the same time, each in a separate JRuby thread.
|
470
481
|
|
482
|
+
### Sample List/Run/Code
|
483
|
+
|
484
|
+
#### Sample List
|
485
|
+
|
486
|
+
You can list available Glimmer samples by running:
|
487
|
+
|
488
|
+
```
|
489
|
+
glimmer sample:list
|
490
|
+
```
|
491
|
+
|
492
|
+
This should output the following (providing the name of each sample, description, and command to run the sample and view its code):
|
493
|
+
|
494
|
+
```
|
495
|
+
$ glimmer sample:list
|
496
|
+
|
497
|
+
Glimmer Hello Samples (run all via: glimmer sample:run:hello):
|
498
|
+
|
499
|
+
Name Description Run
|
500
|
+
|
501
|
+
hello_browser Hello Browser glimmer sample:run[hello_browser]
|
502
|
+
hello_combo Hello Combo glimmer sample:run[hello_combo]
|
503
|
+
hello_computed Hello Computed glimmer sample:run[hello_computed]
|
504
|
+
hello_drag_and_drop Hello Drag And Drop glimmer sample:run[hello_drag_and_drop]
|
505
|
+
hello_list_multi_selection Hello List Multi Selection glimmer sample:run[hello_list_multi_selection]
|
506
|
+
hello_list_single_selection Hello List Single Selection glimmer sample:run[hello_list_single_selection]
|
507
|
+
hello_menu_bar Hello Menu Bar glimmer sample:run[hello_menu_bar]
|
508
|
+
hello_message_box Hello Message Box glimmer sample:run[hello_message_box]
|
509
|
+
hello_pop_up_context_menu Hello Pop Up Context Menu glimmer sample:run[hello_pop_up_context_menu]
|
510
|
+
hello_tab Hello Tab glimmer sample:run[hello_tab]
|
511
|
+
hello_world Hello World glimmer sample:run[hello_world]
|
512
|
+
|
513
|
+
|
514
|
+
Glimmer Elaborate Samples (run all via: glimmer sample:run:elaborate):
|
515
|
+
|
516
|
+
Name Description Run
|
517
|
+
|
518
|
+
contact_manager Contact Manager glimmer sample:run[contact_manager]
|
519
|
+
login Login glimmer sample:run[login]
|
520
|
+
tic_tac_toe Tic Tac Toe glimmer sample:run[tic_tac_toe]
|
521
|
+
```
|
522
|
+
|
523
|
+
#### Sample Run
|
524
|
+
|
525
|
+
A sample may be run via `glimmer sample:run[name]`. This also outputs the sample code so that you could take a look at it and compare to the GUI that launches.
|
526
|
+
|
527
|
+
If the sample name is left empty (e.g. `glimmer sample:run`), then all samples are run.
|
528
|
+
|
529
|
+
Example:
|
530
|
+
|
531
|
+
```
|
532
|
+
glimmer sample:run[hello_tab]
|
533
|
+
```
|
534
|
+
|
535
|
+
This will run the hello_tab sample and output its code:
|
536
|
+
|
537
|
+
```
|
538
|
+
$ glimmer sample:run[hello_tab]
|
539
|
+
|
540
|
+
# /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-0.6.5/samples/hello/hello_tab.rb
|
541
|
+
|
542
|
+
class HelloTab
|
543
|
+
include Glimmer
|
544
|
+
def launch
|
545
|
+
shell {
|
546
|
+
text "Hello, Tab!"
|
547
|
+
tab_folder {
|
548
|
+
tab_item {
|
549
|
+
text "English"
|
550
|
+
label {
|
551
|
+
text "Hello, World!"
|
552
|
+
}
|
553
|
+
}
|
554
|
+
tab_item {
|
555
|
+
text "French"
|
556
|
+
label {
|
557
|
+
text "Bonjour, Univers!"
|
558
|
+
}
|
559
|
+
}
|
560
|
+
}
|
561
|
+
}.open
|
562
|
+
end
|
563
|
+
end
|
564
|
+
|
565
|
+
HelloTab.new.launch
|
566
|
+
|
567
|
+
# # #
|
568
|
+
```
|
569
|
+
|
570
|
+
![Hello Tab English](images/glimmer-hello-tab-english.png)
|
571
|
+
|
572
|
+
#### Sample Code
|
573
|
+
|
574
|
+
You may output any sample code via this command: `glimmer sample:code[name]`
|
575
|
+
|
576
|
+
This is very similar to the sample run command, except the name is required.
|
577
|
+
|
578
|
+
It will not only output the main sample file, but any required supporting files as well.
|
579
|
+
|
580
|
+
Example:
|
581
|
+
|
582
|
+
```
|
583
|
+
$ glimmer sample:code[tic_tac_toe]
|
584
|
+
|
585
|
+
# /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-0.6.5/samples/elaborate/tic_tac_toe.rb
|
586
|
+
|
587
|
+
require_relative "tic_tac_toe/board"
|
588
|
+
|
589
|
+
class TicTacToe
|
590
|
+
include Glimmer
|
591
|
+
|
592
|
+
def initialize
|
593
|
+
@tic_tac_toe_board = Board.new
|
594
|
+
@shell = shell {
|
595
|
+
text "Tic-Tac-Toe"
|
596
|
+
minimum_size 150, 178
|
597
|
+
composite {
|
598
|
+
grid_layout 3, true
|
599
|
+
(1..3).each { |row|
|
600
|
+
(1..3).each { |column|
|
601
|
+
button {
|
602
|
+
layout_data :fill, :fill, true, true
|
603
|
+
text bind(@tic_tac_toe_board[row, column], :sign)
|
604
|
+
enabled bind(@tic_tac_toe_board[row, column], :empty)
|
605
|
+
font style: :bold, height: 20
|
606
|
+
on_widget_selected {
|
607
|
+
@tic_tac_toe_board.mark(row, column)
|
608
|
+
}
|
609
|
+
}
|
610
|
+
}
|
611
|
+
}
|
612
|
+
}
|
613
|
+
}
|
614
|
+
observe(@tic_tac_toe_board, :game_status) { |game_status|
|
615
|
+
display_win_message if game_status == Board::WIN
|
616
|
+
display_draw_message if game_status == Board::DRAW
|
617
|
+
}
|
618
|
+
end
|
619
|
+
|
620
|
+
def display_win_message
|
621
|
+
display_game_over_message("Player #{@tic_tac_toe_board.winning_sign} has won!")
|
622
|
+
end
|
623
|
+
|
624
|
+
def display_draw_message
|
625
|
+
display_game_over_message("Draw!")
|
626
|
+
end
|
627
|
+
|
628
|
+
def display_game_over_message(message_text)
|
629
|
+
message_box(@shell) {
|
630
|
+
text 'Game Over'
|
631
|
+
message message_text
|
632
|
+
}.open
|
633
|
+
@tic_tac_toe_board.reset
|
634
|
+
end
|
635
|
+
|
636
|
+
def open
|
637
|
+
@shell.open
|
638
|
+
end
|
639
|
+
end
|
640
|
+
|
641
|
+
TicTacToe.new.open
|
642
|
+
|
643
|
+
# # #
|
644
|
+
|
645
|
+
|
646
|
+
# /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-0.6.5/samples/elaborate/tic_tac_toe/cell.rb
|
647
|
+
|
648
|
+
class TicTacToe
|
649
|
+
class Cell
|
650
|
+
EMPTY = ""
|
651
|
+
attr_accessor :sign, :empty
|
652
|
+
|
653
|
+
def initialize
|
654
|
+
reset
|
655
|
+
end
|
656
|
+
|
657
|
+
def mark(sign)
|
658
|
+
self.sign = sign
|
659
|
+
end
|
660
|
+
|
661
|
+
def reset
|
662
|
+
self.sign = EMPTY
|
663
|
+
end
|
664
|
+
|
665
|
+
def sign=(sign_symbol)
|
666
|
+
@sign = sign_symbol
|
667
|
+
self.empty = sign == EMPTY
|
668
|
+
end
|
669
|
+
|
670
|
+
def marked
|
671
|
+
!empty
|
672
|
+
end
|
673
|
+
end
|
674
|
+
end
|
675
|
+
|
676
|
+
# # #
|
677
|
+
|
678
|
+
|
679
|
+
# /Users/User/.rvm/gems/jruby-9.2.13.0@glimmerapp/gems/glimmer-dsl-swt-0.6.5/samples/elaborate/tic_tac_toe/board.rb
|
680
|
+
|
681
|
+
require_relative 'cell'
|
682
|
+
|
683
|
+
class TicTacToe
|
684
|
+
class Board
|
685
|
+
DRAW = :draw
|
686
|
+
IN_PROGRESS = :in_progress
|
687
|
+
WIN = :win
|
688
|
+
attr :winning_sign
|
689
|
+
attr_accessor :game_status
|
690
|
+
|
691
|
+
def initialize
|
692
|
+
@sign_state_machine = {nil => "X", "X" => "O", "O" => "X"}
|
693
|
+
build_grid
|
694
|
+
@winning_sign = Cell::EMPTY
|
695
|
+
@game_status = IN_PROGRESS
|
696
|
+
end
|
697
|
+
|
698
|
+
#row and column numbers are 1-based
|
699
|
+
def mark(row, column)
|
700
|
+
self[row, column].mark(current_sign)
|
701
|
+
game_over? #updates winning sign
|
702
|
+
end
|
703
|
+
|
704
|
+
def current_sign
|
705
|
+
@current_sign = @sign_state_machine[@current_sign]
|
706
|
+
end
|
707
|
+
|
708
|
+
def [](row, column)
|
709
|
+
@grid[row-1][column-1]
|
710
|
+
end
|
711
|
+
|
712
|
+
def game_over?
|
713
|
+
win? or draw?
|
714
|
+
end
|
715
|
+
|
716
|
+
def win?
|
717
|
+
win = (row_win? or column_win? or diagonal_win?)
|
718
|
+
self.game_status=WIN if win
|
719
|
+
win
|
720
|
+
end
|
721
|
+
|
722
|
+
def reset
|
723
|
+
(1..3).each do |row|
|
724
|
+
(1..3).each do |column|
|
725
|
+
self[row, column].reset
|
726
|
+
end
|
727
|
+
end
|
728
|
+
@winning_sign = Cell::EMPTY
|
729
|
+
@current_sign = nil
|
730
|
+
self.game_status=IN_PROGRESS
|
731
|
+
end
|
732
|
+
|
733
|
+
private
|
734
|
+
|
735
|
+
def build_grid
|
736
|
+
@grid = []
|
737
|
+
3.times do |row_index| #0-based
|
738
|
+
@grid << []
|
739
|
+
3.times { @grid[row_index] << Cell.new }
|
740
|
+
end
|
741
|
+
end
|
742
|
+
|
743
|
+
def row_win?
|
744
|
+
(1..3).each do |row|
|
745
|
+
if row_has_same_sign(row)
|
746
|
+
@winning_sign = self[row, 1].sign
|
747
|
+
return true
|
748
|
+
end
|
749
|
+
end
|
750
|
+
false
|
751
|
+
end
|
752
|
+
|
753
|
+
def column_win?
|
754
|
+
(1..3).each do |column|
|
755
|
+
if column_has_same_sign(column)
|
756
|
+
@winning_sign = self[1, column].sign
|
757
|
+
return true
|
758
|
+
end
|
759
|
+
end
|
760
|
+
false
|
761
|
+
end
|
762
|
+
|
763
|
+
#needs refactoring if we ever decide to make the board size dynamic
|
764
|
+
def diagonal_win?
|
765
|
+
if (self[1, 1].sign == self[2, 2].sign) and (self[2, 2].sign == self[3, 3].sign) and self[1, 1].marked
|
766
|
+
@winning_sign = self[1, 1].sign
|
767
|
+
return true
|
768
|
+
end
|
769
|
+
if (self[3, 1].sign == self[2, 2].sign) and (self[2, 2].sign == self[1, 3].sign) and self[3, 1].marked
|
770
|
+
@winning_sign = self[3, 1].sign
|
771
|
+
return true
|
772
|
+
end
|
773
|
+
false
|
774
|
+
end
|
775
|
+
|
776
|
+
def draw?
|
777
|
+
@board_full = true
|
778
|
+
3.times do |x|
|
779
|
+
3.times do |y|
|
780
|
+
@board_full = false if self[x, y].empty
|
781
|
+
end
|
782
|
+
end
|
783
|
+
self.game_status = DRAW if @board_full
|
784
|
+
@board_full
|
785
|
+
end
|
786
|
+
|
787
|
+
def row_has_same_sign(number)
|
788
|
+
row_sign = self[number, 1].sign
|
789
|
+
[2, 3].each do |column|
|
790
|
+
return false unless row_sign == (self[number, column].sign)
|
791
|
+
end
|
792
|
+
true if self[number, 1].marked
|
793
|
+
end
|
794
|
+
|
795
|
+
def column_has_same_sign(number)
|
796
|
+
column_sign = self[1, number].sign
|
797
|
+
[2, 3].each do |row|
|
798
|
+
return false unless column_sign == (self[row, number].sign)
|
799
|
+
end
|
800
|
+
true if self[1, number].marked
|
801
|
+
end
|
802
|
+
|
803
|
+
end
|
804
|
+
end
|
805
|
+
|
806
|
+
# # #
|
807
|
+
```
|
808
|
+
|
471
809
|
### Scaffolding
|
472
810
|
|
473
811
|
Glimmer borrows from Rails the idea of Scaffolding, that is generating a structure for your app files that
|
474
|
-
helps you get started just like true
|
812
|
+
helps you get started just like true buildinThis g scaffolding helps construction workers, civil engineers, and architects.
|
475
813
|
|
476
814
|
Glimmer scaffolding goes beyond just scaffolding the app files that Rails does. It also packages it and launches it,
|
477
815
|
getting you to a running and delivered state of an advanced "Hello, World!" Glimmer application right off the bat.
|
@@ -541,7 +879,7 @@ Created greeter/spec/spec_helper.rb
|
|
541
879
|
...
|
542
880
|
```
|
543
881
|
|
544
|
-
Eventually, it will launch an advanced "Hello, World!" app window having the title of your application.
|
882
|
+
Eventually, it will launch an advanced "Hello, World!" app window having the title of your application ("Greeter").
|
545
883
|
|
546
884
|
![Glimmer Scaffold App](images/glimmer-scaffolding-app.png)
|
547
885
|
|
@@ -549,14 +887,19 @@ It also comes with a boilerplate Preferences dialog.
|
|
549
887
|
|
550
888
|
![Glimmer Scaffold App Preferences](images/glimmer-scaffolding-app-preferences.png)
|
551
889
|
|
552
|
-
Here is
|
890
|
+
Here is the Windows version of the scaffolded "Greeter" app:
|
553
891
|
|
554
892
|
![Glimmer Scaffold App Windows](images/glimmer-scaffolding-app-windows.png)
|
555
893
|
|
556
|
-
|
894
|
+
And, here is the Windows version of the boilerplate Preferences dialog.
|
557
895
|
|
558
896
|
![Glimmer Scaffold App Windows Preferences](images/glimmer-scaffolding-app-windows-preferences.png)
|
559
897
|
|
898
|
+
In order to run the app after making changes, you must run the `glimmer` command and pass it the generated script under the `bin` directory as an argument:
|
899
|
+
|
900
|
+
```
|
901
|
+
glimmer bin/greeter
|
902
|
+
```
|
560
903
|
|
561
904
|
#### Custom Shell
|
562
905
|
|
@@ -612,6 +955,10 @@ The Ruby gem name will follow the convention "glimmer-cs-customwidgetname-namesp
|
|
612
955
|
|
613
956
|
Only official Glimmer gems created by the Glimmer project committers will have no namespace (e.g. [glimmer-cs-gladiator](https://rubygems.org/gems/glimmer-cs-gladiator) Ruby gem)
|
614
957
|
|
958
|
+
Since custom shell gems are both an app and a gem, they provide two ways to run:
|
959
|
+
- Run the `glimmer` command and pass it the generated script under the `bin` directory that matches the gem name (e.g. run `glimmer bin/glimmer-cs-calculator`)
|
960
|
+
- Run the executable binary file that ships with the gem directly (without `glimmer`). It intentionally has a shorter name for convenience since it is meant to be used on the command line (not in a package), so you can leave out the `glimmer-cs-` prefix (e.g. run `bin/calculator` directly)
|
961
|
+
|
615
962
|
Examples:
|
616
963
|
|
617
964
|
- [glimmer-cs-gladiator](https://github.com/AndyObtiva/glimmer-cs-gladiator): Gladiator (Glimmer Editor)
|
@@ -739,7 +1086,7 @@ Output:
|
|
739
1086
|
|
740
1087
|
Css glimmer-dsl-css 0.2.0 AndyMaleh Glimmer DSL for CSS
|
741
1088
|
Opal glimmer-dsl-opal 0.1.0 AndyMaleh Glimmer DSL for Opal
|
742
|
-
Swt glimmer-dsl-swt 0.6.
|
1089
|
+
Swt glimmer-dsl-swt 0.6.5 AndyMaleh Glimmer DSL for SWT
|
743
1090
|
Xml glimmer-dsl-xml 0.2.0 AndyMaleh Glimmer DSL for XML
|
744
1091
|
|
745
1092
|
```
|
@@ -2901,6 +3248,10 @@ Glimmer::Config.excluded_keyword_checkers << lambda do |method_symbol, *args|
|
|
2901
3248
|
end
|
2902
3249
|
```
|
2903
3250
|
|
3251
|
+
### log_excluded_keywords
|
3252
|
+
|
3253
|
+
This just tells Glimmer whether to log excluded keywords or not (at the debug level). It is off by default.
|
3254
|
+
|
2904
3255
|
## Glimmer Style Guide
|
2905
3256
|
|
2906
3257
|
- Widgets are declared with underscored lowercase versions of their SWT names minus the SWT package name.
|
@@ -3327,6 +3678,7 @@ This will generate `config/warble.rb`, which you may configure and then run `gli
|
|
3327
3678
|
require_relative '../app/my_application.rb'
|
3328
3679
|
```
|
3329
3680
|
- Include Icon (Optional): If you'd like to include an icon for your app (.icns format on the Mac), place it under `package/macosx` matching the humanized application local directory name (e.g. 'Math Bowling.icns' [containing space] for MathBowling or math_bowling). You may generate your Mac icon easily using tools like Image2Icon (http://www.img2icnsapp.com/) or manually using the Mac terminal command `iconutil` (iconutil guide: https://applehelpwriter.com/tag/iconutil/)
|
3681
|
+
- Include DMG Background Icon (Optional): Simply place a .png file under `package/macosx/{HumanAppName}-background.png`
|
3330
3682
|
- Include Version (Optional): Create a `VERSION` file in your application and fill it your app version on one line (e.g. `1.1.0`)
|
3331
3683
|
- Include License (Optional): Create a `LICENSE.txt` file in your application and fill it up with your license (e.g. MIT). It will show up to people when installing your app. Note that, you may optionally also specify license type, but you'd have to do so manually via `-BlicenseType=MIT` shown in an [example below](#javapackager-extra-arguments).
|
3332
3684
|
- Extra args (Optional): You may optionally add the following to `Rakefile` to configure extra arguments for javapackager: `Glimmer::Packager.javapackager_extra_args = "..."` (Useful to avoid re-entering extra arguments on every run of rake task.). Read about them in [their section below](#javapackager-extra-arguments).
|
@@ -3364,6 +3716,10 @@ JAVAPACKAGER_EXTRA_ARGS='-Bmac.CFBundleName="Math Bowling Game"' glimmer package
|
|
3364
3716
|
|
3365
3717
|
That overrides the default application display name.
|
3366
3718
|
|
3719
|
+
### Verbose Mode
|
3720
|
+
|
3721
|
+
Pass `-v` to javapackager in `Glimmer::Package.javapackager_extra_args` or by running `glimmer package:native[type] -v` to learn more about further available customizations for the installer you are requesting to generate.
|
3722
|
+
|
3367
3723
|
### Windows Application Packaging
|
3368
3724
|
|
3369
3725
|
Windows offers two options for setup packaging:
|
@@ -3450,6 +3806,7 @@ Here is a list of notable 3rd party gems used by Glimmer:
|
|
3450
3806
|
- [os](https://github.com/rdp/os): provides OS detection capabilities (e.g. `OS.mac?` or `OS.windows?`) to write cross-platform code inexpensively
|
3451
3807
|
- [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`)
|
3452
3808
|
- [rake](https://github.com/ruby/rake): used to implement and execute `glimmer` commands
|
3809
|
+
- [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.
|
3453
3810
|
- [super_module](https://github.com/AndyObtiva/super_module): used to cleanly write the Glimmer::UI:CustomWidget and Glimmer::UI::CustomShell modules
|
3454
3811
|
- [text-table](https://github.com/aptinio/text-table): renders textual data in a textual table for the command-line interface of Glimmer
|
3455
3812
|
- [warbler](https://github.com/jruby/warbler): converts a Glimmer app into a Java JAR file during packaging
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.10.
|
1
|
+
0.10.4
|
data/lib/glimmer.rb
CHANGED
@@ -48,12 +48,12 @@ module Glimmer
|
|
48
48
|
Glimmer.loop_last_data = new_loop_data
|
49
49
|
# This if statement speeds up Glimmer in girb or whenever directly including on main object
|
50
50
|
is_excluded = Config.excluded_keyword_checkers.reduce(false) {|result, checker| result || instance_exec(method_symbol, *args, &checker) }
|
51
|
-
|
51
|
+
if is_excluded
|
52
|
+
Glimmer::Config.logger.debug "Glimmer excluded keyword: #{method_symbol}" if Glimmer::Config.log_excluded_keywords?
|
53
|
+
super(method_symbol, *args, &block)
|
54
|
+
end
|
52
55
|
Glimmer::Config.logger.info {"Interpreting keyword: #{method_symbol}"}
|
53
56
|
Glimmer::DSL::Engine.interpret(method_symbol, *args, &block)
|
54
|
-
rescue ExcludedKeywordError => e
|
55
|
-
# TODO add a feature to show excluded keywords optionally for debugging purposes
|
56
|
-
super(method_symbol, *args, &block)
|
57
57
|
rescue InvalidKeywordError => e
|
58
58
|
Glimmer::Config.logger.error {"Encountered an invalid keyword at this object: #{self}"}
|
59
59
|
Glimmer::Config.logger.error {e.full_message}
|
data/lib/glimmer/config.rb
CHANGED
@@ -5,6 +5,8 @@ module Glimmer
|
|
5
5
|
REGEX_METHODS_EXCLUDED = /^(to_|\[)/
|
6
6
|
|
7
7
|
attr_writer :loop_max_count
|
8
|
+
attr_accessor :log_excluded_keywords
|
9
|
+
alias log_excluded_keywords? log_excluded_keywords
|
8
10
|
|
9
11
|
def excluded_keyword_checkers
|
10
12
|
@excluded_keyword_checkers ||= reset_excluded_keyword_checkers!
|
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.10.
|
4
|
+
version: 0.10.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AndyMaleh
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
requirement: !ruby/object:Gem::Requirement
|