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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8ccce2439bd00b49d1f30c708db9f3f80c9b423a
|
4
|
+
data.tar.gz: bf39e8c7e0c0deeba71d696ca8f71dd051dc6a4e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1881880f64dbde3efd8c923a23d8dc55020d93512cefbcc9aa104909d861e75f0fbce90c7610c84bd015825cf0184c2c71a019816ad2c2ea935a638a393eb137
|
7
|
+
data.tar.gz: 0a972640a9811013c39909df190d6965af0f1f21197658d9a64611ba53a811193cddf89d4d1ecf734cb919b989b0c74241311babac1aada03aac428085397ed6
|
data/.yardopts
CHANGED
data/LICENSE.txt
CHANGED
@@ -5,7 +5,10 @@ Copyright (c) 2013 Steve Klabnik - Monologger
|
|
5
5
|
Copyright (c) 2013 Michael Grosser - Ruco
|
6
6
|
(https://github.com/grosser/ruco)
|
7
7
|
Note: Code from ruco's Window class was used as basis of
|
8
|
-
|
8
|
+
Vedeu::Viewport.
|
9
|
+
Copyright (c) 2012 Piotr Murach - TTY
|
10
|
+
(https://github.com/peter-murach/tty)
|
11
|
+
Note: Code used from Plugins infrastructure.
|
9
12
|
|
10
13
|
MIT License
|
11
14
|
|
data/README.md
CHANGED
@@ -14,7 +14,8 @@ Vedeu was been built primarily with Ruby v2.1; however, the
|
|
14
14
|
[.ruby-version](https://github.com/gavinlaking/vedeu/blob/master/.ruby-version)
|
15
15
|
file will indicate the currently used Ruby version.
|
16
16
|
|
17
|
-
When Vedeu started I was a MacOSX user, I've since moved to Linux. You shouldn't
|
17
|
+
When Vedeu started I was a MacOSX user, I've since moved to Linux. You shouldn't
|
18
|
+
have any problems with either of these operating systems.
|
18
19
|
|
19
20
|
Note: You may have trouble running Vedeu with Windows installations. (Pull
|
20
21
|
requests welcome!)
|
@@ -26,23 +27,28 @@ To install Vedeu, simply:
|
|
26
27
|
|
27
28
|
gem install 'vedeu'
|
28
29
|
|
29
|
-
To use Vedeu's application scaffolding, see the
|
30
|
+
To use Vedeu's application scaffolding, see the
|
31
|
+
[RubyDoc](http://www.rubydoc.info/gems/vedeu/file/docs/getting_started.md)
|
30
32
|
|
31
33
|
## Example
|
32
34
|
|
33
|
-
Have a look at: [Playa](https://github.com/gavinlaking/playa). Please browse the
|
35
|
+
Have a look at: [Playa](https://github.com/gavinlaking/playa). Please browse the
|
36
|
+
source of Playa and Vedeu to get a feel for how it all works.
|
34
37
|
|
35
38
|
If you have produced software which uses Vedeu, please let me know, I'll link
|
36
39
|
to your project here.
|
37
40
|
|
38
|
-
|
39
41
|
## Documentation & Usage
|
40
42
|
|
41
43
|
Vedeu is largely documented using Yard. I hope to produce more 'General Usage'
|
42
|
-
documentation shortly. In the meantime, please browse the
|
44
|
+
documentation shortly. In the meantime, please browse the
|
45
|
+
[RubyDoc](http://rubydoc.info/gems/vedeu).
|
43
46
|
|
47
|
+
- [Getting Started](http://rubydoc.info/gems/vedeu/file/docs/getting_started.md)
|
44
48
|
- [The Vedeu DSL](http://rubydoc.info/gems/vedeu/file/docs/dsl.md)
|
45
|
-
|
49
|
+
- [The Vedeu API](http://rubydoc.info/gems/vedeu/file/docs/api.md)
|
50
|
+
- [Vedeu Events](http://rubydoc.info/gems/vedeu/file/docs/events.md)
|
51
|
+
- [Object Graphs](http://rubydoc.info/gems/vedeu/file/docs/object_graph.md)
|
46
52
|
|
47
53
|
## Development / Contributing
|
48
54
|
|
data/Rakefile
CHANGED
data/docs/api.md
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
# @title Vedeu API
|
2
|
+
# The Vedeu API
|
2
3
|
|
3
4
|
Vedeu provides a simple DSL for the creation of terminal/console based
|
4
5
|
applications. Below is a list of all the API methods:
|
@@ -16,30 +17,30 @@ class OtherClassInYourApplication
|
|
16
17
|
|
17
18
|
Note: Nesting indicates where an API method is allowed/supposed to be used.
|
18
19
|
|
19
|
-
|
20
|
+
### Borders
|
20
21
|
|
21
22
|
- Vedeu.border
|
22
23
|
|
23
|
-
|
24
|
+
### Configuration
|
24
25
|
|
25
26
|
- Vedeu.configure
|
26
27
|
- Vedeu.configuration
|
27
28
|
|
28
|
-
|
29
|
+
### Events
|
29
30
|
|
30
31
|
- Vedeu.bind
|
31
32
|
- Vedeu.trigger
|
32
33
|
- Vedeu.unbind
|
33
34
|
|
34
|
-
|
35
|
+
### Geometry
|
35
36
|
|
36
37
|
- Vedeu.geometry
|
37
38
|
|
38
|
-
|
39
|
+
### Groups
|
39
40
|
|
40
41
|
- Vedeu.group
|
41
42
|
|
42
|
-
|
43
|
+
### Input
|
43
44
|
|
44
45
|
- Vedeu.keypress
|
45
46
|
- Vedeu.keymap
|
@@ -47,7 +48,7 @@ Note: Nesting indicates where an API method is allowed/supposed to be used.
|
|
47
48
|
- name
|
48
49
|
- interface
|
49
50
|
|
50
|
-
|
51
|
+
### Interfaces
|
51
52
|
|
52
53
|
- Vedeu.interface
|
53
54
|
- background
|
@@ -73,7 +74,7 @@ Note: Nesting indicates where an API method is allowed/supposed to be used.
|
|
73
74
|
- style
|
74
75
|
- use
|
75
76
|
|
76
|
-
|
77
|
+
### Views
|
77
78
|
|
78
79
|
- Vedeu.renders
|
79
80
|
- Vedeu.render
|
@@ -109,18 +110,18 @@ Note: Nesting indicates where an API method is allowed/supposed to be used.
|
|
109
110
|
- Vedeu.views
|
110
111
|
- ... as #renders
|
111
112
|
|
112
|
-
|
113
|
+
### Menus
|
113
114
|
|
114
115
|
- Vedeu.menu
|
115
116
|
- items
|
116
117
|
- name
|
117
118
|
|
118
|
-
|
119
|
+
### Renderers
|
119
120
|
|
120
121
|
- Vedeu.renderer
|
121
122
|
- Vedeu.renderers
|
122
123
|
|
123
|
-
|
124
|
+
### Repositories
|
124
125
|
|
125
126
|
These are collections which you can access:
|
126
127
|
|
@@ -136,7 +137,7 @@ These are collections which you can access:
|
|
136
137
|
- Vedeu.keymaps
|
137
138
|
- Vedeu.menus
|
138
139
|
|
139
|
-
|
140
|
+
### Miscellany
|
140
141
|
|
141
142
|
- Vedeu.cursor
|
142
143
|
- Vedeu.focus
|
@@ -151,4 +152,3 @@ These are collections which you can access:
|
|
151
152
|
- Vedeu.resize
|
152
153
|
- Vedeu.timer
|
153
154
|
- Vedeu.width
|
154
|
-
|
data/docs/dsl.md
CHANGED
@@ -1,10 +1,11 @@
|
|
1
1
|
# @title The Vedeu DSL
|
2
|
+
# The Vedeu DSL
|
2
3
|
|
3
4
|
Coupled with the API (for interacting with the running client application), the
|
4
5
|
DSL provides the mechanism to configure aspects of your application whilst
|
5
6
|
using Vedeu.
|
6
7
|
|
7
|
-
|
8
|
+
## Interfaces
|
8
9
|
|
9
10
|
An Interface is a basic element in the GUI. It usually but does not necessarily
|
10
11
|
correspond to a region of the terminal screen (for example, an Interface might
|
@@ -140,6 +141,7 @@ end
|
|
140
141
|
|
141
142
|
## Views
|
142
143
|
|
144
|
+
{include:Vedeu::DSL::View}
|
143
145
|
{include:Vedeu::DSL::View.interface}
|
144
146
|
|
145
147
|
### Immediate rendering
|
@@ -158,3 +160,10 @@ end
|
|
158
160
|
|
159
161
|
`@todo` More documentation coming soon.
|
160
162
|
|
163
|
+
#### Authors Notes
|
164
|
+
|
165
|
+
The Rubydoc documentation has more specific information about the DSL methods
|
166
|
+
demonstrated above: [RubyDoc](http://rubydoc.info/gems/vedeu).
|
167
|
+
|
168
|
+
I've tried to write the DSL in a way which makes it read nice; believing that
|
169
|
+
this will make it easier to use. I hope this is the case for you.
|
data/docs/events.md
CHANGED
data/docs/getting_started.md
CHANGED
@@ -1,27 +1,185 @@
|
|
1
1
|
# @title Getting Started with Vedeu
|
2
|
+
# Getting Started with Vedeu
|
2
3
|
|
3
|
-
|
4
|
-
- Define your interfaces.
|
5
|
-
- Define the border.
|
6
|
-
- Define the geometry.
|
7
|
-
- Define the keymap.
|
8
|
-
- Define the global keymap, this will be used irrespective of the interface
|
9
|
-
currently in focus.
|
4
|
+
## Installation
|
10
5
|
|
6
|
+
First, install the gem locally:
|
11
7
|
|
12
|
-
|
8
|
+
gem install vedeu
|
13
9
|
|
14
|
-
|
10
|
+
This will provide a new command to help build your client application. Similar
|
11
|
+
to Ruby on Rails, although not nearly as advanced as the Rails equivalent,
|
12
|
+
hopefully the `vedeu` command generators will get you off the ground:
|
15
13
|
|
16
|
-
|
17
|
-
requests the application stops. This triggers the event :cleanup which
|
18
|
-
the client application can bind to and perform any tidying up it wishes
|
19
|
-
to perform before exiting.
|
14
|
+
vedeu
|
20
15
|
|
21
|
-
|
16
|
+
## Generating a new application
|
22
17
|
|
23
|
-
|
18
|
+
The following command will build a new application. Substitute `your_app_name`
|
19
|
+
for your desired application name.
|
24
20
|
|
25
|
-
|
26
|
-
list.
|
21
|
+
vedeu new your_app_name
|
27
22
|
|
23
|
+
The generated files are a skeleton Vedeu client application. Let's take a look
|
24
|
+
at these files individually.
|
25
|
+
|
26
|
+
```bash
|
27
|
+
|
|
28
|
+
|- app_name/
|
29
|
+
| |
|
30
|
+
|- app/
|
31
|
+
| |- controllers/
|
32
|
+
| | |- application_controller.rb
|
33
|
+
| |
|
34
|
+
| |- helpers/
|
35
|
+
| | |- application_helper.rb
|
36
|
+
| |
|
37
|
+
| |- models/
|
38
|
+
| | |- keymaps/
|
39
|
+
| | |- _global_.rb
|
40
|
+
| |
|
41
|
+
| |- views/
|
42
|
+
| |- interfaces/
|
43
|
+
| |- templates/
|
44
|
+
|
|
45
|
+
|- bin/
|
46
|
+
| |- app_name
|
47
|
+
|
|
48
|
+
|- config/
|
49
|
+
| |- add_name
|
50
|
+
| |- configuration.rb
|
51
|
+
|
|
52
|
+
|- lib/
|
53
|
+
|- test/
|
54
|
+
|- vendor/
|
55
|
+
|- application.rb
|
56
|
+
|- Gemfile
|
57
|
+
```
|
58
|
+
|
59
|
+
### app/controllers/
|
60
|
+
|
61
|
+
The controllers directory is the place to store the events and behaviour logic
|
62
|
+
of your application. It will manage the choosing of views and models based on
|
63
|
+
previous choices. Think of them as the orchestrators of your application.
|
64
|
+
|
65
|
+
In web applications, the controller typically handles the routed request and
|
66
|
+
interacts with the models and sets up the views. In Vedeu, it does much the
|
67
|
+
same, minus the requests.
|
68
|
+
|
69
|
+
### app/helpers/
|
70
|
+
|
71
|
+
Ruby on Rails has a concept of helpers which are not very object-oriented, but
|
72
|
+
allow you to share functionality/behaviour across multiple views. Vedeu uses
|
73
|
+
this concept as it will be familiar to many Rails developers and might be
|
74
|
+
helpful to beginners.
|
75
|
+
|
76
|
+
### app/models/
|
77
|
+
|
78
|
+
Much like `lib`, this directory is for your application logic code. Some people
|
79
|
+
prefer to use `app/models`, others like to use `lib`. Some even use both!
|
80
|
+
|
81
|
+
### app/models/keymaps/
|
82
|
+
|
83
|
+
This will contain the global keymap (which affects all of your application)
|
84
|
+
plus any specific interface keymaps which only affect a certain interface when
|
85
|
+
in focus. By default the global keymap contains a few simple definitions:
|
86
|
+
|
87
|
+
- **`q`**
|
88
|
+
|
89
|
+
**Quit**. Internally triggers the :_exit_ system event which in turn requests
|
90
|
+
the application stops. This triggers the event :cleanup which the client
|
91
|
+
application can bind to and perform any tidying up it wishes to perform
|
92
|
+
before exiting.
|
93
|
+
|
94
|
+
- **`<esc>`**
|
95
|
+
|
96
|
+
**Mode Switch**. Toggle between cooked and raw terminal modes.
|
97
|
+
|
98
|
+
- **`<tab>`**
|
99
|
+
|
100
|
+
**Focus Next**. Focus the next interface in the focus list.
|
101
|
+
|
102
|
+
- **`<shift+tab>`**
|
103
|
+
|
104
|
+
**Focus Previous**. Focus the previous interface in the focus list.
|
105
|
+
|
106
|
+
### app/views/
|
107
|
+
|
108
|
+
This will contain classes which produce the views needed by Vedeu to make your
|
109
|
+
application come alive!
|
110
|
+
|
111
|
+
### app/views/interfaces/
|
112
|
+
|
113
|
+
This will contain the information Vedeu needs to draw the various interfaces
|
114
|
+
and views of your application.
|
115
|
+
|
116
|
+
### app/views/templates/
|
117
|
+
|
118
|
+
This will house the templates your application will use to display views. You
|
119
|
+
can populate templates with generic view information and supplement it with
|
120
|
+
variable data from your application.
|
121
|
+
|
122
|
+
### bin/
|
123
|
+
|
124
|
+
This will contain executable Ruby scripts (or Bash, or shell language of your
|
125
|
+
choice) which will launch your application or provide command-line behaviours.
|
126
|
+
|
127
|
+
### config/
|
128
|
+
|
129
|
+
This will contain any configuration your application needs to run, plus the
|
130
|
+
configuration for Vedeu. This configuration affects the way Vedeu works with
|
131
|
+
your application.
|
132
|
+
|
133
|
+
### lib/
|
134
|
+
|
135
|
+
This is for code your application may use to support code you have in
|
136
|
+
`app/models`.
|
137
|
+
|
138
|
+
### test/
|
139
|
+
|
140
|
+
This is for the tests you might write to help ensure your application executes
|
141
|
+
in the way you expect.
|
142
|
+
|
143
|
+
### vendor/
|
144
|
+
|
145
|
+
This is for third-party code which your application might want to ship with.
|
146
|
+
Usually you will include various Ruby gems to provide functionality, but you
|
147
|
+
might want to do something special.
|
148
|
+
|
149
|
+
|
150
|
+
## Adding a new view to your application
|
151
|
+
|
152
|
+
The following command will build a new view within your application.
|
153
|
+
Substitute `some_view_name` for your desired application name.
|
154
|
+
|
155
|
+
cd your_app_name
|
156
|
+
vedeu view some_view_name
|
157
|
+
|
158
|
+
The generated files are skeleton Vedeu view files. Let's talk about the files it
|
159
|
+
will create and populate:
|
160
|
+
|
161
|
+
```bash
|
162
|
+
|
|
163
|
+
|- app_name/
|
164
|
+
| |
|
165
|
+
|- app/
|
166
|
+
| |- controllers/
|
167
|
+
| | |- view_name_controller.rb
|
168
|
+
| |
|
169
|
+
| |- helpers/
|
170
|
+
| | |- view_name_helper.rb
|
171
|
+
| |
|
172
|
+
| |- models/
|
173
|
+
| | |- keymaps/
|
174
|
+
| | |- view_name.rb
|
175
|
+
| |
|
176
|
+
| |- views/
|
177
|
+
| |- interfaces/
|
178
|
+
| | |- view_name.rb
|
179
|
+
| |
|
180
|
+
| |- templates/
|
181
|
+
| | |- view_name.erb
|
182
|
+
| |
|
183
|
+
| |- view_name.rb
|
184
|
+
|...
|
185
|
+
```
|
data/lib/vedeu/all.rb
CHANGED
@@ -35,6 +35,7 @@ require 'vedeu/null/buffer'
|
|
35
35
|
require 'vedeu/null/generic'
|
36
36
|
require 'vedeu/null/geometry'
|
37
37
|
require 'vedeu/null/interface'
|
38
|
+
require 'vedeu/null/menu'
|
38
39
|
|
39
40
|
require 'vedeu/geometry/area'
|
40
41
|
require 'vedeu/geometry/coordinate'
|
@@ -47,6 +48,7 @@ require 'vedeu/geometry/position_index'
|
|
47
48
|
require 'vedeu/geometry/position'
|
48
49
|
require 'vedeu/geometry/position_validator'
|
49
50
|
|
51
|
+
require 'vedeu/colours/escape_sequences'
|
50
52
|
require 'vedeu/colours/colours'
|
51
53
|
require 'vedeu/colours/backgrounds'
|
52
54
|
require 'vedeu/colours/foregrounds'
|
@@ -173,3 +175,6 @@ require 'vedeu/bindings/system'
|
|
173
175
|
require 'vedeu/bindings/visibility'
|
174
176
|
|
175
177
|
require 'vedeu/bindings'
|
178
|
+
|
179
|
+
require 'vedeu/plugins'
|
180
|
+
require 'vedeu/plugins/plugin'
|
data/lib/vedeu/api.rb
CHANGED
@@ -73,6 +73,25 @@ module Vedeu
|
|
73
73
|
# @return [Vedeu::Cursors]
|
74
74
|
def_delegators Vedeu::Cursors, :cursors
|
75
75
|
|
76
|
+
# Manipulate the DRb server implementation.
|
77
|
+
#
|
78
|
+
# @example
|
79
|
+
# Vedeu.drb_restart
|
80
|
+
# Vedeu.drb_start
|
81
|
+
# Vedeu.drb_status
|
82
|
+
# Vedeu.drb_stop
|
83
|
+
#
|
84
|
+
# @!method drb_restart
|
85
|
+
# @see Vedeu::Distributed::Server#restart
|
86
|
+
# @!method drb_start
|
87
|
+
# @see Vedeu::Distributed::Server#start
|
88
|
+
# @!method drb_status
|
89
|
+
# @see Vedeu::Distributed::Server#status
|
90
|
+
# @!method drb_stop
|
91
|
+
# @see Vedeu::Distributed::Server#stop
|
92
|
+
def_delegators Vedeu::Distributed::Server, :drb_restart, :drb_start,
|
93
|
+
:drb_status, :drb_stop
|
94
|
+
|
76
95
|
# @example
|
77
96
|
# Vedeu.border
|
78
97
|
#
|