vedeu 0.4.59 → 0.4.60
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +0 -2
- data/LICENSE.txt +4 -1
- data/README.md +12 -6
- data/Rakefile +0 -1
- data/docs/api.md +13 -13
- data/docs/dsl.md +10 -1
- data/docs/events.md +0 -1
- data/docs/getting_started.md +175 -17
- data/lib/vedeu/all.rb +5 -0
- data/lib/vedeu/api.rb +19 -0
- data/lib/vedeu/bindings/drb.rb +4 -0
- data/lib/vedeu/bindings/menus.rb +14 -10
- data/lib/vedeu/bootstrap.rb +44 -17
- data/lib/vedeu/colours/escape_sequences.rb +125 -0
- data/lib/vedeu/distributed/server.rb +43 -35
- data/lib/vedeu/dsl/view.rb +110 -7
- data/lib/vedeu/exceptions.rb +6 -0
- data/lib/vedeu/models/menus.rb +1 -0
- data/lib/vedeu/null/menu.rb +38 -0
- data/lib/vedeu/output/esc.rb +1 -96
- data/lib/vedeu/plugins.rb +82 -0
- data/lib/vedeu/plugins/plugin.rb +53 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/api_test.rb +4 -0
- data/test/lib/vedeu/colours/escape_sequences_test.rb +100 -0
- data/test/lib/vedeu/null/menu_test.rb +47 -0
- data/test/lib/vedeu/output/esc_test.rb +0 -87
- data/test/lib/vedeu/plugins/plugin_test.rb +32 -0
- data/test/lib/vedeu/plugins_test.rb +47 -0
- metadata +14 -4
- data/docs/applications.md +0 -167
- data/docs/views.md +0 -158
@@ -8,93 +8,6 @@ module Vedeu
|
|
8
8
|
|
9
9
|
before { Vedeu::Terminal.stubs(:size).returns([80, 25]) }
|
10
10
|
|
11
|
-
describe 'foreground colour methods' do
|
12
|
-
it { described.black.must_equal("\e[30m") }
|
13
|
-
it { described.red.must_equal("\e[31m") }
|
14
|
-
it { described.green.must_equal("\e[32m") }
|
15
|
-
it { described.yellow.must_equal("\e[33m") }
|
16
|
-
it { described.blue.must_equal("\e[34m") }
|
17
|
-
it { described.magenta.must_equal("\e[35m") }
|
18
|
-
it { described.cyan.must_equal("\e[36m") }
|
19
|
-
it { described.light_grey.must_equal("\e[37m") }
|
20
|
-
it { described.default.must_equal("\e[39m") }
|
21
|
-
it { described.dark_grey.must_equal("\e[90m") }
|
22
|
-
it { described.light_red.must_equal("\e[91m") }
|
23
|
-
it { described.light_green.must_equal("\e[92m") }
|
24
|
-
it { described.light_yellow.must_equal("\e[93m") }
|
25
|
-
it { described.light_blue.must_equal("\e[94m") }
|
26
|
-
it { described.light_magenta.must_equal("\e[95m") }
|
27
|
-
it { described.light_cyan.must_equal("\e[96m") }
|
28
|
-
it { described.white.must_equal("\e[97m") }
|
29
|
-
|
30
|
-
it 'returns an escape sequence for the foreground colour and resets ' \
|
31
|
-
'after calling the block' do
|
32
|
-
described.cyan do
|
33
|
-
'ununpentium'
|
34
|
-
end.must_equal("\e[36mununpentium\e[39m")
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
describe '.codes' do
|
39
|
-
it { described.codes.must_be_instance_of(Hash) }
|
40
|
-
it { described.must_respond_to(:foreground_codes) }
|
41
|
-
end
|
42
|
-
|
43
|
-
describe '.background_codes' do
|
44
|
-
it { described.background_codes.must_be_instance_of(Hash) }
|
45
|
-
end
|
46
|
-
|
47
|
-
describe 'background colour methods' do
|
48
|
-
it { described.on_black.must_equal("\e[40m") }
|
49
|
-
it { described.on_red.must_equal("\e[41m") }
|
50
|
-
it { described.on_green.must_equal("\e[42m") }
|
51
|
-
it { described.on_yellow.must_equal("\e[43m") }
|
52
|
-
it { described.on_blue.must_equal("\e[44m") }
|
53
|
-
it { described.on_magenta.must_equal("\e[45m") }
|
54
|
-
it { described.on_cyan.must_equal("\e[46m") }
|
55
|
-
it { described.on_light_grey.must_equal("\e[47m") }
|
56
|
-
it { described.on_default.must_equal("\e[49m") }
|
57
|
-
it { described.on_dark_grey.must_equal("\e[100m") }
|
58
|
-
it { described.on_light_red.must_equal("\e[101m") }
|
59
|
-
it { described.on_light_green.must_equal("\e[102m") }
|
60
|
-
it { described.on_light_yellow.must_equal("\e[103m") }
|
61
|
-
it { described.on_light_blue.must_equal("\e[104m") }
|
62
|
-
it { described.on_light_magenta.must_equal("\e[105m") }
|
63
|
-
it { described.on_light_cyan.must_equal("\e[106m") }
|
64
|
-
it { described.on_white.must_equal("\e[107m") }
|
65
|
-
|
66
|
-
it 'returns an escape sequence for the background colour and resets ' \
|
67
|
-
'after calling the block' do
|
68
|
-
described.on_red do
|
69
|
-
'livermorium'
|
70
|
-
end.must_equal("\e[41mlivermorium\e[49m")
|
71
|
-
end
|
72
|
-
end
|
73
|
-
|
74
|
-
describe 'action methods' do
|
75
|
-
it { described.hide_cursor.must_equal("\e[?25l") }
|
76
|
-
it { described.show_cursor.must_equal("\e[?25h") }
|
77
|
-
it { described.cursor_position.must_equal("\e[6n") }
|
78
|
-
it { described.bg_reset.must_equal("\e[49m") }
|
79
|
-
it { described.blink.must_equal("\e[5m") }
|
80
|
-
it { described.blink_off.must_equal("\e[25m") }
|
81
|
-
it { described.bold.must_equal("\e[1m") }
|
82
|
-
it { described.bold_off.must_equal("\e[22m") }
|
83
|
-
it { described.border_on.must_equal("\e(0") }
|
84
|
-
it { described.border_off.must_equal("\e(B") }
|
85
|
-
it { described.dim.must_equal("\e[2m") }
|
86
|
-
it { described.fg_reset.must_equal("\e[39m") }
|
87
|
-
it { described.negative.must_equal("\e[7m") }
|
88
|
-
it { described.positive.must_equal("\e[27m") }
|
89
|
-
it { described.reset.must_equal("\e[0m") }
|
90
|
-
it { described.underline.must_equal("\e[4m") }
|
91
|
-
it { described.underline_off.must_equal("\e[24m") }
|
92
|
-
end
|
93
|
-
|
94
|
-
describe '.actions' do
|
95
|
-
it { described.actions.must_be_instance_of(Hash) }
|
96
|
-
end
|
97
|
-
|
98
11
|
describe '.escape' do
|
99
12
|
let(:stream) { "\e[0m\e[38;2;39m\e[48;2;49m\e[2J\e[?25l" }
|
100
13
|
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Plugin do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::Plugin }
|
8
|
+
let(:instance) { described.new(_name, _gem) }
|
9
|
+
let(:_name) {}
|
10
|
+
let(:_gem) {}
|
11
|
+
|
12
|
+
describe '#initialize' do
|
13
|
+
it { instance.must_be_instance_of(described) }
|
14
|
+
it { instance.instance_variable_get('@name').must_equal(_name) }
|
15
|
+
it { instance.instance_variable_get('@gem').must_equal(_gem) }
|
16
|
+
it {
|
17
|
+
instance.instance_variable_get('@gem_name').
|
18
|
+
must_equal("vedeu-#{_name}")
|
19
|
+
}
|
20
|
+
it { instance.instance_variable_get('@enabled').must_equal(false) }
|
21
|
+
end
|
22
|
+
|
23
|
+
describe '#load!' do
|
24
|
+
subject { instance.load! }
|
25
|
+
|
26
|
+
# @todo
|
27
|
+
# it { skip }
|
28
|
+
end
|
29
|
+
|
30
|
+
end # Plugin
|
31
|
+
|
32
|
+
end # Vedeu
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe Plugins do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::Plugins }
|
8
|
+
let(:instance) { described.new }
|
9
|
+
|
10
|
+
describe '#initialize' do
|
11
|
+
it { instance.must_be_instance_of(described) }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe '#load' do
|
15
|
+
subject { instance.load }
|
16
|
+
|
17
|
+
# @todo
|
18
|
+
# it { skip }
|
19
|
+
end
|
20
|
+
|
21
|
+
describe '#register' do
|
22
|
+
let(:_name) {}
|
23
|
+
let(:plugin) { false }
|
24
|
+
|
25
|
+
subject { instance.register(_name, plugin) }
|
26
|
+
|
27
|
+
# @todo
|
28
|
+
# it { skip }
|
29
|
+
end
|
30
|
+
|
31
|
+
describe '#find' do
|
32
|
+
subject { instance.find }
|
33
|
+
|
34
|
+
# @todo
|
35
|
+
# it { skip }
|
36
|
+
end
|
37
|
+
|
38
|
+
describe '#names' do
|
39
|
+
subject { instance.names }
|
40
|
+
|
41
|
+
# @todo
|
42
|
+
# it { skip }
|
43
|
+
end
|
44
|
+
|
45
|
+
end # Plugins
|
46
|
+
|
47
|
+
end # Vedeu
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vedeu
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.60
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gavin Laking
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: guard
|
@@ -235,12 +235,10 @@ files:
|
|
235
235
|
- config/rubocop_disabled.yml
|
236
236
|
- config/rubocop_enabled.yml
|
237
237
|
- docs/api.md
|
238
|
-
- docs/applications.md
|
239
238
|
- docs/dsl.md
|
240
239
|
- docs/events.md
|
241
240
|
- docs/getting_started.md
|
242
241
|
- docs/object_graph.md
|
243
|
-
- docs/views.md
|
244
242
|
- examples/borders_app.rb
|
245
243
|
- examples/colour_support.sh
|
246
244
|
- examples/colours_app.rb
|
@@ -310,6 +308,7 @@ files:
|
|
310
308
|
- lib/vedeu/colours/colour.rb
|
311
309
|
- lib/vedeu/colours/colour_translator.rb
|
312
310
|
- lib/vedeu/colours/colours.rb
|
311
|
+
- lib/vedeu/colours/escape_sequences.rb
|
313
312
|
- lib/vedeu/colours/foreground.rb
|
314
313
|
- lib/vedeu/colours/foregrounds.rb
|
315
314
|
- lib/vedeu/common.rb
|
@@ -398,6 +397,7 @@ files:
|
|
398
397
|
- lib/vedeu/null/generic.rb
|
399
398
|
- lib/vedeu/null/geometry.rb
|
400
399
|
- lib/vedeu/null/interface.rb
|
400
|
+
- lib/vedeu/null/menu.rb
|
401
401
|
- lib/vedeu/output/border.rb
|
402
402
|
- lib/vedeu/output/borders.rb
|
403
403
|
- lib/vedeu/output/clear/named_group.rb
|
@@ -426,6 +426,8 @@ files:
|
|
426
426
|
- lib/vedeu/output/virtual_buffer.rb
|
427
427
|
- lib/vedeu/output/virtual_terminal.rb
|
428
428
|
- lib/vedeu/output/wordwrap.rb
|
429
|
+
- lib/vedeu/plugins.rb
|
430
|
+
- lib/vedeu/plugins/plugin.rb
|
429
431
|
- lib/vedeu/repositories.rb
|
430
432
|
- lib/vedeu/repositories/collection.rb
|
431
433
|
- lib/vedeu/repositories/model.rb
|
@@ -467,6 +469,7 @@ files:
|
|
467
469
|
- test/lib/vedeu/colours/colour_test.rb
|
468
470
|
- test/lib/vedeu/colours/colour_translator_test.rb
|
469
471
|
- test/lib/vedeu/colours/colours_test.rb
|
472
|
+
- test/lib/vedeu/colours/escape_sequences_test.rb
|
470
473
|
- test/lib/vedeu/colours/foreground_test.rb
|
471
474
|
- test/lib/vedeu/colours/foregrounds_test.rb
|
472
475
|
- test/lib/vedeu/common_test.rb
|
@@ -543,6 +546,7 @@ files:
|
|
543
546
|
- test/lib/vedeu/null/generic_test.rb
|
544
547
|
- test/lib/vedeu/null/geometry_test.rb
|
545
548
|
- test/lib/vedeu/null/interface_test.rb
|
549
|
+
- test/lib/vedeu/null/menu_test.rb
|
546
550
|
- test/lib/vedeu/output/border_test.rb
|
547
551
|
- test/lib/vedeu/output/borders_test.rb
|
548
552
|
- test/lib/vedeu/output/clear/named_group_test.rb
|
@@ -570,6 +574,8 @@ files:
|
|
570
574
|
- test/lib/vedeu/output/virtual_buffer_test.rb
|
571
575
|
- test/lib/vedeu/output/virtual_terminal_test.rb
|
572
576
|
- test/lib/vedeu/output/wordwrap_test.rb
|
577
|
+
- test/lib/vedeu/plugins/plugin_test.rb
|
578
|
+
- test/lib/vedeu/plugins_test.rb
|
573
579
|
- test/lib/vedeu/repositories/all_test.rb
|
574
580
|
- test/lib/vedeu/repositories/collection_test.rb
|
575
581
|
- test/lib/vedeu/repositories/model_test.rb
|
@@ -643,6 +649,7 @@ test_files:
|
|
643
649
|
- test/lib/vedeu/colours/colour_test.rb
|
644
650
|
- test/lib/vedeu/colours/colour_translator_test.rb
|
645
651
|
- test/lib/vedeu/colours/colours_test.rb
|
652
|
+
- test/lib/vedeu/colours/escape_sequences_test.rb
|
646
653
|
- test/lib/vedeu/colours/foreground_test.rb
|
647
654
|
- test/lib/vedeu/colours/foregrounds_test.rb
|
648
655
|
- test/lib/vedeu/common_test.rb
|
@@ -719,6 +726,7 @@ test_files:
|
|
719
726
|
- test/lib/vedeu/null/generic_test.rb
|
720
727
|
- test/lib/vedeu/null/geometry_test.rb
|
721
728
|
- test/lib/vedeu/null/interface_test.rb
|
729
|
+
- test/lib/vedeu/null/menu_test.rb
|
722
730
|
- test/lib/vedeu/output/border_test.rb
|
723
731
|
- test/lib/vedeu/output/borders_test.rb
|
724
732
|
- test/lib/vedeu/output/clear/named_group_test.rb
|
@@ -746,6 +754,8 @@ test_files:
|
|
746
754
|
- test/lib/vedeu/output/virtual_buffer_test.rb
|
747
755
|
- test/lib/vedeu/output/virtual_terminal_test.rb
|
748
756
|
- test/lib/vedeu/output/wordwrap_test.rb
|
757
|
+
- test/lib/vedeu/plugins/plugin_test.rb
|
758
|
+
- test/lib/vedeu/plugins_test.rb
|
749
759
|
- test/lib/vedeu/repositories/all_test.rb
|
750
760
|
- test/lib/vedeu/repositories/collection_test.rb
|
751
761
|
- test/lib/vedeu/repositories/model_test.rb
|
data/docs/applications.md
DELETED
@@ -1,167 +0,0 @@
|
|
1
|
-
# @title Vedeu Applications
|
2
|
-
|
3
|
-
Vedeu has basic tools to generate client application scaffolding, in a similar
|
4
|
-
way to Ruby on Rails. Although not nearly as advanced as the Rails equivalent,
|
5
|
-
hopefully these generators will get you off the ground.
|
6
|
-
|
7
|
-
### Installing Vedeu
|
8
|
-
|
9
|
-
To install Vedeu, simply:
|
10
|
-
|
11
|
-
gem install 'vedeu'
|
12
|
-
|
13
|
-
To use Vedeu's application scaffolding, see below:
|
14
|
-
|
15
|
-
### Generating a new application
|
16
|
-
|
17
|
-
```bash
|
18
|
-
|
|
19
|
-
|- app_name/
|
20
|
-
| |
|
21
|
-
|- app/
|
22
|
-
| |- controllers/
|
23
|
-
| | |- application_controller.rb
|
24
|
-
| |
|
25
|
-
| |- helpers/
|
26
|
-
| | |- application_helper.rb
|
27
|
-
| |
|
28
|
-
| |- models/
|
29
|
-
| | |- keymaps/
|
30
|
-
| | |- _global_.rb
|
31
|
-
| |
|
32
|
-
| |- views/
|
33
|
-
| |- interfaces/
|
34
|
-
| |- templates/
|
35
|
-
|
|
36
|
-
|- bin/
|
37
|
-
| |- app_name
|
38
|
-
|
|
39
|
-
|- config/
|
40
|
-
| |- add_name
|
41
|
-
| |- configuration.rb
|
42
|
-
|
|
43
|
-
|- lib/
|
44
|
-
|- test/
|
45
|
-
|- vendor/
|
46
|
-
|- application.rb
|
47
|
-
|- Gemfile
|
48
|
-
```
|
49
|
-
|
50
|
-
To create the application structure as shown above:
|
51
|
-
|
52
|
-
```bash
|
53
|
-
vedeu new app_name
|
54
|
-
```
|
55
|
-
|
56
|
-
Let's talk about each directory and its purpose.
|
57
|
-
|
58
|
-
#### app/controllers
|
59
|
-
|
60
|
-
The controllers directory is the place to store the events and behaviour logic
|
61
|
-
of your application. It will manage the choosing of views and models based on
|
62
|
-
previous choices. Think of them as the orchestrators of your application.
|
63
|
-
|
64
|
-
In web applications, the controller typically handles the routed request and
|
65
|
-
interacts with the models and sets up the views. In Vedeu, it does much the
|
66
|
-
same, minus the requests.
|
67
|
-
|
68
|
-
#### app/helpers
|
69
|
-
|
70
|
-
Ruby on Rails has a concept of helpers which are not very object-oriented, but
|
71
|
-
allow you to share functionality/behaviour across multiple views. Vedeu uses
|
72
|
-
this concept as it will be familiar to many Rails developers and might be
|
73
|
-
helpful to beginners.
|
74
|
-
|
75
|
-
#### app/models
|
76
|
-
|
77
|
-
Much like `lib`, this directory is for your application logic code. Some people
|
78
|
-
prefer to use `app/models`, others like to use `lib`. Some even use both!
|
79
|
-
|
80
|
-
#### app/models/keymaps
|
81
|
-
|
82
|
-
This will contain the global keymap (which affects all of your application)
|
83
|
-
plus any specific interface keymaps which only affect a certain interface when
|
84
|
-
in focus.
|
85
|
-
|
86
|
-
#### app/views
|
87
|
-
|
88
|
-
This will contain classes which produce the views needed by Vedeu to make your
|
89
|
-
application come alive!
|
90
|
-
|
91
|
-
#### app/views/interfaces
|
92
|
-
|
93
|
-
This will contain the information Vedeu needs to draw the various interfaces
|
94
|
-
and views of your application.
|
95
|
-
|
96
|
-
#### app/views/templates
|
97
|
-
|
98
|
-
This will house the templates your application will use to display views. You
|
99
|
-
can populate templates with generic view information and supplement it with
|
100
|
-
variable data from your application.
|
101
|
-
|
102
|
-
#### bin
|
103
|
-
|
104
|
-
This will contain executable Ruby scripts (or Bash, or shell language of your
|
105
|
-
choice) which will launch your application or provide command-line behaviours.
|
106
|
-
|
107
|
-
#### config
|
108
|
-
|
109
|
-
This will contain any configuration your application needs to run, plus the
|
110
|
-
configuration for Vedeu. This configuration affects the way Vedeu works with
|
111
|
-
your application.
|
112
|
-
|
113
|
-
#### lib
|
114
|
-
|
115
|
-
This is for code your application may use to support code you have in
|
116
|
-
`app/models`.
|
117
|
-
|
118
|
-
#### test
|
119
|
-
|
120
|
-
This is for the tests you might write to help ensure your application executes
|
121
|
-
in the way you expect.
|
122
|
-
|
123
|
-
#### vendor
|
124
|
-
|
125
|
-
This is for third-party code which your application might want to ship with.
|
126
|
-
Usually you will include various Ruby gems to provide functionality, but you
|
127
|
-
might want to do something special.
|
128
|
-
|
129
|
-
|
130
|
-
### Generating a new view
|
131
|
-
|
132
|
-
Vedeu also provides a generator to create the files needed for a view. To run
|
133
|
-
this, use the following from within the root of the application directory:
|
134
|
-
|
135
|
-
```bash
|
136
|
-
vedeu view view_name
|
137
|
-
```
|
138
|
-
|
139
|
-
Let's talk about the files it will create and populate:
|
140
|
-
|
141
|
-
```bash
|
142
|
-
|
|
143
|
-
|- app_name/
|
144
|
-
| |
|
145
|
-
|- app/
|
146
|
-
| |- controllers/
|
147
|
-
| | |- view_name_controller.rb
|
148
|
-
| |
|
149
|
-
| |- helpers/
|
150
|
-
| | |- view_name_helper.rb
|
151
|
-
| |
|
152
|
-
| |- models/
|
153
|
-
| | |- keymaps/
|
154
|
-
| | |- view_name.rb
|
155
|
-
| |
|
156
|
-
| |- views/
|
157
|
-
| |- interfaces/
|
158
|
-
| | |- view_name.rb
|
159
|
-
| |
|
160
|
-
| |- templates/
|
161
|
-
| | |- view_name.erb
|
162
|
-
| |
|
163
|
-
| |- view_name.rb
|
164
|
-
|...
|
165
|
-
```
|
166
|
-
|
167
|
-
####
|
data/docs/views.md
DELETED
@@ -1,158 +0,0 @@
|
|
1
|
-
# @title Views with Vedeu
|
2
|
-
|
3
|
-
There are two ways to construct views with Vedeu. You would like to draw the
|
4
|
-
view to the screen immediately (immediate render) or you want to save a view to
|
5
|
-
be drawn when you trigger a refresh event later (deferred view).
|
6
|
-
|
7
|
-
** LINK Both of these approaches require that you have defined an interface (or
|
8
|
-
'visible area') first. You can find out how to define an interface with Vedeu
|
9
|
-
here. The examples in 'Immediate Render' and 'Deferred View' use these
|
10
|
-
interface definitions: (Note: if you use these examples, ensure your terminal
|
11
|
-
is at least 70 characters in width and 5 lines in height.)
|
12
|
-
|
13
|
-
```ruby
|
14
|
-
Vedeu.interface 'main' do
|
15
|
-
geometry do
|
16
|
-
centred!
|
17
|
-
height 4
|
18
|
-
width 50
|
19
|
-
end
|
20
|
-
end
|
21
|
-
|
22
|
-
Vedeu.interface 'title' do
|
23
|
-
geometry do
|
24
|
-
height 1
|
25
|
-
width 50
|
26
|
-
x use('main').left
|
27
|
-
y use('main').north
|
28
|
-
end
|
29
|
-
end
|
30
|
-
```
|
31
|
-
|
32
|
-
Both of these approaches use a concept of Buffers in Vedeu. There are three
|
33
|
-
buffers for any defined interface. These are imaginatively called: 'back',
|
34
|
-
'front' and 'previous'.
|
35
|
-
|
36
|
-
The 'back' buffer is the content for an interface which will be shown next time
|
37
|
-
a refresh event is fired globally or for that interface. So, 'back' becomes
|
38
|
-
'front'.
|
39
|
-
|
40
|
-
The 'front' buffer is the content for an interface which is currently showing.
|
41
|
-
When a refresh event is fired, again, globally or for that interface
|
42
|
-
specifically, the content of this 'front' buffer is first copied to the
|
43
|
-
'previous' buffer, and then the current 'back' buffer overwrites this 'front'
|
44
|
-
buffer.
|
45
|
-
|
46
|
-
The 'previous' buffer contains what was shown on the 'front' before the current
|
47
|
-
'front'.
|
48
|
-
|
49
|
-
You can only write to either the 'front' (you want the content to be drawn
|
50
|
-
immediately (immediate render)) or the 'back' (you would like the content to be
|
51
|
-
drawn on the next refresh (deferred view)).
|
52
|
-
|
53
|
-
### Immediate Render
|
54
|
-
|
55
|
-
The immediate render DSL for Vedeu is accessed via `Vedeu.renders`. When this
|
56
|
-
approach is used, the content defined is written directly to the 'front'
|
57
|
-
buffer(s) for the interface(s) concerned. Take a glance at the example below:
|
58
|
-
|
59
|
-
```ruby
|
60
|
-
Vedeu.renders do
|
61
|
-
view 'title' do
|
62
|
-
line do
|
63
|
-
stream do
|
64
|
-
left 'Title goes here', width: 35
|
65
|
-
end
|
66
|
-
stream do
|
67
|
-
right Time.now.strftime('%H:%m'), width: 7
|
68
|
-
end
|
69
|
-
end
|
70
|
-
end
|
71
|
-
view 'main' do
|
72
|
-
lines do
|
73
|
-
line 'This is content for the main interface.'
|
74
|
-
line ''
|
75
|
-
line 'Pretty easy eh?'
|
76
|
-
end
|
77
|
-
end
|
78
|
-
end
|
79
|
-
```
|
80
|
-
|
81
|
-
### Deferred View
|
82
|
-
|
83
|
-
The deferred view DSL for Vedeu is accessed via `Vedeu.views`. This approach
|
84
|
-
writes the content defined to the 'back' buffer(s) for the interface(s)
|
85
|
-
concerned. It will become the front when your application triggers the refresh
|
86
|
-
event for the interface(s).
|
87
|
-
|
88
|
-
As you can see by comparing the examples above to these below, the immediate
|
89
|
-
render simply wraps what is already here in the deferred view. Again, more
|
90
|
-
specific information is available in the Rubydoc.
|
91
|
-
|
92
|
-
```ruby
|
93
|
-
Vedeu.views do
|
94
|
-
view 'title' do
|
95
|
-
line do
|
96
|
-
stream do
|
97
|
-
left 'Title goes here', width: 35
|
98
|
-
end
|
99
|
-
stream do
|
100
|
-
right Time.now.strftime('%H:%m'), width: 7
|
101
|
-
end
|
102
|
-
end
|
103
|
-
end
|
104
|
-
view 'main' do
|
105
|
-
lines do
|
106
|
-
line 'This is content for the main interface.'
|
107
|
-
line ''
|
108
|
-
line 'Pretty easy eh?'
|
109
|
-
end
|
110
|
-
end
|
111
|
-
end
|
112
|
-
```
|
113
|
-
|
114
|
-
### Notes on Geometry
|
115
|
-
|
116
|
-
... TODO
|
117
|
-
|
118
|
-
### Notes on Refresh
|
119
|
-
|
120
|
-
... TODO
|
121
|
-
|
122
|
-
### Notes on Building Views
|
123
|
-
|
124
|
-
The basic view DSL methods look like this:
|
125
|
-
|
126
|
-
renders/views
|
127
|
-
|-- view
|
128
|
-
|-- lines
|
129
|
-
| |-- line
|
130
|
-
| |-- streams
|
131
|
-
| | |-- stream
|
132
|
-
| | |-- char
|
133
|
-
| |
|
134
|
-
| |-- stream
|
135
|
-
| |-- char
|
136
|
-
|
|
137
|
-
|-- line
|
138
|
-
|-- streams
|
139
|
-
| |-- stream
|
140
|
-
| |-- char
|
141
|
-
|
|
142
|
-
|-- stream
|
143
|
-
|-- char
|
144
|
-
|
145
|
-
renders/views
|
146
|
-
|-- view
|
147
|
-
|-- lines/line
|
148
|
-
|-- streams/stream
|
149
|
-
|-- char
|
150
|
-
|
151
|
-
#### Authors Notes
|
152
|
-
|
153
|
-
The Rubydoc documentation has more specific information about the DSL methods
|
154
|
-
demonstrated above: [RubyDoc](http://rubydoc.info/gems/vedeu).
|
155
|
-
|
156
|
-
I've tried to write the DSL in a way which makes it read nice; believing that
|
157
|
-
this will make it easier to use. I hope this is the case for you.
|
158
|
-
|