vedeu 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +10 -15
  3. data/deps.md +93 -96
  4. data/lib/vedeu.rb +1 -6
  5. data/lib/vedeu/api/line.rb +0 -4
  6. data/lib/vedeu/api/view.rb +0 -1
  7. data/lib/vedeu/application.rb +1 -3
  8. data/lib/vedeu/instrumentation.rb +1 -1
  9. data/lib/vedeu/models/colour.rb +3 -2
  10. data/lib/vedeu/models/geometry.rb +16 -0
  11. data/lib/vedeu/models/interface.rb +9 -1
  12. data/lib/vedeu/output/render_interface.rb +3 -0
  13. data/lib/vedeu/output/text_adaptor.rb +2 -0
  14. data/lib/vedeu/output/view.rb +17 -24
  15. data/lib/vedeu/support/esc.rb +1 -21
  16. data/test/lib/vedeu/api/base_test.rb +0 -11
  17. data/test/lib/vedeu/api/grid_test.rb +10 -0
  18. data/test/lib/vedeu/api/line_test.rb +0 -11
  19. data/test/lib/vedeu/api/stream_test.rb +0 -11
  20. data/test/lib/vedeu/api/view_test.rb +1 -4
  21. data/test/lib/vedeu/models/composition_test.rb +3 -0
  22. data/test/lib/vedeu/output/view_test.rb +0 -27
  23. data/test/lib/vedeu/support/esc_test.rb +1 -21
  24. data/vedeu.gemspec +1 -1
  25. metadata +2 -20
  26. data/lib/vedeu/output/dsl_parser.rb +0 -19
  27. data/lib/vedeu/output/erb_parser.rb +0 -59
  28. data/lib/vedeu/output/json_parser.rb +0 -23
  29. data/lib/vedeu/output/menu_parser.rb +0 -51
  30. data/lib/vedeu/output/raw_parser.rb +0 -42
  31. data/lib/vedeu/support/helpers.rb +0 -66
  32. data/test/lib/vedeu/output/dsl_parser_test.rb +0 -19
  33. data/test/lib/vedeu/output/erb_parser_test.rb +0 -242
  34. data/test/lib/vedeu/output/json_parser_test.rb +0 -17
  35. data/test/lib/vedeu/output/menu_parser_test.rb +0 -46
  36. data/test/lib/vedeu/output/raw_parser_test.rb +0 -74
  37. data/test/lib/vedeu/support/helpers_test.rb +0 -71
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 19ee0e20e445eeee950b4aaf5be06d25b6e7f5ad
4
- data.tar.gz: f9dbeb37f02a0491376d1f1ad2e94abbf37c2548
3
+ metadata.gz: f08172957be2fc1e8da242d1e5169f2ef6f9f6c3
4
+ data.tar.gz: c6692d292848d90ee1544ef5c0ebf41086f66637
5
5
  SHA512:
6
- metadata.gz: f848ddbd4480fd75e76a8a6f4dcef666eaacd4b7de53e9dd8e4b76ce37ca51909436898d1c41d6e159d2c7afde9a4414d6b65dd1c10f57a3416a6fdf8e010814
7
- data.tar.gz: 96a133c336ccca5f5aa84414aa766f2c5b7666103feabe328de3c9166cda1cba7e13c4f92166025cd4ffa198d5fad9430c98c2bf7f11c161e37f6e29940e9a78
6
+ metadata.gz: 2e5009a40a5c90ca3b4bd2cb36481ae2dfa5af09df0146c29ce80cdcd6045ea81e905181576a5011986132ca72854323c55688a22c38a2622c6a52af729c5d9d
7
+ data.tar.gz: 7af3be17bd322e76965c62d13253e2f3044fe4f7145e82b38ea32993228f61b4c2596b78710606d15ac2656f542a2a1b44f09ca556b38ceca50852d546810eb7
data/README.md CHANGED
@@ -116,7 +116,9 @@ Note: not setting a width or height will set the values to the terminal's report
116
116
  event :event_name do |arg1, arg2|
117
117
  end
118
118
 
119
- One can define events which perform work or trigger other events. Vedeu has 3 built-in events which are namespaced with underscores as to hopefully not cause a collision with events you wish to create:
119
+ One can define events which perform work or trigger other events. Vedeu has built-in events which are namespaced with underscores as to hopefully not cause a collision with events you wish to create:
120
+
121
+ - `:_clear_` Clears the whole terminal space.
120
122
 
121
123
  - `:_exit_` when triggered, Vedeu will attempt to exit.
122
124
 
@@ -124,6 +126,12 @@ One can define events which perform work or trigger other events. Vedeu has 3 bu
124
126
 
125
127
  - `:_mode_switch_` when triggered (after the user presses `escape`), Vedeu switches from a "raw mode" terminal to a "cooked mode" terminal. The idea here being that the raw mode is for single keypress actions, whilst cooked mode allows the user to enter more elaborate commands- such as commands with arguments.
126
128
 
129
+ - `:_refresh_` triggering this event will cause all interfaces to refresh.
130
+
131
+ - `:_refresh_group_(group_name)_` will refresh all interfaces belonging to this group. E.g. `_refresh_group_home_` will refresh all interfaces with the group of `home`.
132
+
133
+ - `:_refresh_(interface_name)_` will refresh the interface with this name. E.g. `_refresh_widget_` will refresh the interface `widget`.
134
+
127
135
  Note: Overriding or adding additional events to the Vedeu event namespace may cause unpredictable results.
128
136
 
129
137
 
@@ -160,7 +168,7 @@ Like colours, they can be defined in either interfaces, for specific lines or wi
160
168
  | hide_cursor | `\e[?25l` |
161
169
  | negative | `\e[7m` |
162
170
  | positive | `\e[27m` |
163
- | reset | `\e[0m` |
171
+ | reset | `\e[0m` |
164
172
  | normal | `\e[24m\e[21m\e[27m` |
165
173
  | dim | `\e[2m` |
166
174
  | show_cursor | `\e[?25h` |
@@ -168,19 +176,6 @@ Like colours, they can be defined in either interfaces, for specific lines or wi
168
176
  | underline_off | `\e[24m` |
169
177
 
170
178
 
171
- ### Templates
172
-
173
- The following helpers are available in to the ERBParser.
174
-
175
- foreground (alias: `fg`)
176
-
177
- background (alias: `bg`)
178
-
179
- colour
180
-
181
- style
182
-
183
-
184
179
  ## Contributing
185
180
 
186
181
  1. Fork it ( http://github.com/gavinlaking/vedeu/fork )
data/deps.md CHANGED
@@ -2,9 +2,42 @@
2
2
  By class
3
3
  ----------------------------------------------------------------------
4
4
 
5
+ StandardError
6
+ API::InterfaceNotSpecified
7
+ EntityNotFound
8
+ InvalidHeight
9
+ InvalidWidth
10
+ ModeSwitch
11
+ OutOfRange
12
+ XOutOfBounds
13
+ YOutOfBounds
14
+
15
+ API::Base
16
+ API::Stream
17
+
18
+ API::Grid
19
+ Terminal
20
+
21
+ API::Interface
22
+ API::Grid
23
+ Geometry
24
+ Interface
25
+ InterfaceStore
26
+ Terminal
27
+
28
+ API::Line
29
+ API::Base
30
+ API::Stream
31
+
32
+ API::Stream
33
+ API::Base
34
+
35
+ API::View
36
+ API::Line
37
+ InterfaceStore
38
+
5
39
  Application
6
40
  Input
7
- Process
8
41
  Terminal
9
42
 
10
43
  ClearInterface
@@ -12,31 +45,34 @@ ClearInterface
12
45
  Collection
13
46
 
14
47
  Colour
15
- Esc
48
+ Background
49
+ ColourTranslator
50
+ Foreground
51
+ ColourTranslator
16
52
 
17
53
  Composition
18
54
  InterfaceCollection
19
55
 
20
56
  Configuration
21
57
 
58
+ DSLParser
59
+
22
60
  Geometry
23
61
  Esc
24
62
  Terminal
25
63
 
26
- ERBParser
27
-
28
64
  Esc
29
- ColourTranslator
30
65
 
31
66
  Events
32
67
 
33
- RawParser
34
- TextAdaptor
35
-
36
68
  Input
37
- Queue
69
+ Events
38
70
  Terminal
39
71
 
72
+ Instrumentation
73
+ Log
74
+ Trace
75
+
40
76
  Interface
41
77
  ClearInterface
42
78
  Colour
@@ -50,13 +86,6 @@ Interface
50
86
  InterfaceCollection
51
87
  InterfaceStore
52
88
 
53
- API::Interface
54
- Geometry
55
- Interface
56
- InterfaceStore
57
-
58
- JSONParser
59
-
60
89
  Launcher
61
90
  Application
62
91
  Configuration
@@ -71,27 +100,16 @@ LineCollection
71
100
  Line
72
101
 
73
102
  Menu
74
-
75
- MenuParser
76
-
77
- Parser
78
- Composition
79
- ERBParser
80
- RawParser
81
- JSONParser
82
- MenuParser
103
+ Events
83
104
 
84
105
  InterfaceStore
85
106
  Interface
86
107
 
87
- Process
88
- Parser
89
- Queue
90
-
91
108
  Queue
92
109
 
93
110
  RenderInterface
94
- ClearInterface
111
+ Line
112
+ Stream
95
113
 
96
114
  Stream
97
115
  Colour
@@ -104,27 +122,21 @@ StreamCollection
104
122
  Style
105
123
  Esc
106
124
 
107
- Template
108
- Helpers
109
-
110
125
  Terminal
111
126
  Esc
112
127
  Application
113
128
 
114
129
  TextAdaptor
115
130
 
131
+ View
132
+ Composition
133
+ DSLParser
134
+
116
135
  ColourTranslator
117
136
 
118
137
  Wordwrap
119
138
 
120
139
 
121
- ----------------------------------------------------------------------
122
- Orphans
123
- ----------------------------------------------------------------------
124
-
125
- Wordwrap - orphaned
126
- Menu - orphaned
127
-
128
140
  ----------------------------------------------------------------------
129
141
  Grouped
130
142
  ----------------------------------------------------------------------
@@ -136,63 +148,48 @@ API::Interface
136
148
 
137
149
  Launcher
138
150
  Application
151
+ Events
139
152
  Input
140
- Queue
153
+ Events
141
154
  Terminal
142
155
  Esc
143
- ColourTranslator
144
- Process
145
- Parser
146
- Composition
147
- InterfaceCollection
148
- InterfaceStore
149
- Interface
150
- ClearInterface
151
- Colour
152
- Esc
153
- ColourTranslator
154
- Geometry
155
- Esc
156
- ColourTranslator
157
- Terminal
158
- Esc
159
- ColourTranslator
160
- LineCollection
161
- Collection
162
- Line
163
- Colour
164
- Esc
165
- ColourTranslator
166
- StreamCollection
167
- Collection
168
- Stream
169
- Colour
170
- Esc
171
- ColourTranslator
172
- Style
173
- Esc
174
- ColourTranslator
175
- Style
176
- Esc
177
- ColourTranslator
178
-
179
- Queue
180
- RenderInterface
181
- ClearInterface
182
- Style
183
- Esc
184
- ColourTranslator
185
- Terminal
186
- Esc
187
- ColourTranslator
188
- ERBParser
189
- Template
190
- RawParser
191
- TextAdaptor
192
- JSONParser
193
- MenuParser
194
- Queue
195
- Terminal
196
- Esc
197
- ColourTranslator
198
156
  Configuration
157
+
158
+ View
159
+ Composition
160
+ InterfaceCollection
161
+ InterfaceStore
162
+ Interface
163
+ ClearInterface
164
+ Colour
165
+ Background
166
+ Foreground
167
+ Geometry
168
+ Esc
169
+ Terminal
170
+ Esc
171
+ LineCollection
172
+ Collection
173
+ Line
174
+ Colour
175
+ Background
176
+ Foreground
177
+ StreamCollection
178
+ Collection
179
+ Stream
180
+ Colour
181
+ Background
182
+ Foreground
183
+ Style
184
+ Esc
185
+ Style
186
+ Esc
187
+ Queue
188
+ RenderInterface
189
+ Line
190
+ Stream
191
+ Style
192
+ Esc
193
+ Terminal
194
+ Esc
195
+ DSLParser
data/lib/vedeu.rb CHANGED
@@ -47,6 +47,7 @@ module Vedeu
47
47
  on(:_exit_) { fail StopIteration }
48
48
  on(:_log_) { |message| Vedeu.log(message) }
49
49
  on(:_mode_switch_) { fail ModeSwitch }
50
+ on(:_clear_) { Terminal.output(Esc.string('clear')) }
50
51
 
51
52
  on(:_keypress_) do |key|
52
53
  trigger(:key, key)
@@ -70,11 +71,5 @@ module Vedeu
70
71
  end
71
72
 
72
73
  extend API
73
-
74
- private
75
-
76
- def self.root_path
77
- File.expand_path('../..', __FILE__)
78
- end
79
74
  # :nocov:
80
75
  end
@@ -8,10 +8,6 @@ module Vedeu
8
8
  attributes
9
9
  end
10
10
 
11
- def align(value)
12
- attributes[:align] = value
13
- end
14
-
15
11
  def stream(&block)
16
12
  attributes[:streams] << API::Stream.build(&block)
17
13
  end
@@ -1,4 +1,3 @@
1
- require 'vedeu/api/base'
2
1
  require 'vedeu/api/line'
3
2
  require 'vedeu/support/interface_store'
4
3
 
@@ -18,7 +18,7 @@ module Vedeu
18
18
  Terminal.open(mode) do
19
19
  Terminal.set_cursor_mode
20
20
 
21
- Vedeu.events.trigger(:refresh)
21
+ Vedeu.events.trigger(:_clear_)
22
22
 
23
23
  runner { main_sequence }
24
24
  end
@@ -40,8 +40,6 @@ module Vedeu
40
40
 
41
41
  def main_sequence
42
42
  Input.capture
43
-
44
- Vedeu.events.trigger(:refresh)
45
43
  end
46
44
 
47
45
  def interactive?
@@ -25,7 +25,7 @@ module Vedeu
25
25
  private
26
26
 
27
27
  def self.filename
28
- Vedeu.root_path + '/logs/vedeu.log'
28
+ File.expand_path('../../..', __FILE__) + '/logs/vedeu.log'
29
29
  end
30
30
  end
31
31
 
@@ -1,5 +1,6 @@
1
1
  require 'virtus'
2
2
 
3
+ require 'vedeu/output/colour_translator'
3
4
  require 'vedeu/support/esc'
4
5
 
5
6
  module Vedeu
@@ -7,7 +8,7 @@ module Vedeu
7
8
  def coerce(value)
8
9
  return '' if value.nil? || value.empty?
9
10
 
10
- Esc.background_colour(value)
11
+ ["\e[48;5;", ColourTranslator.translate(value), 'm'].join
11
12
  end
12
13
  end
13
14
 
@@ -15,7 +16,7 @@ module Vedeu
15
16
  def coerce(value)
16
17
  return '' if value.nil? || value.empty?
17
18
 
18
- Esc.foreground_colour(value)
19
+ ["\e[38;5;", ColourTranslator.translate(value), 'm'].join
19
20
  end
20
21
  end
21
22
 
@@ -25,6 +25,10 @@ module Vedeu
25
25
  end
26
26
  end
27
27
 
28
+ def north(value = 1)
29
+ top - value
30
+ end
31
+
28
32
  def left
29
33
  if centred
30
34
  centre_x - (width / 2)
@@ -33,14 +37,26 @@ module Vedeu
33
37
  end
34
38
  end
35
39
 
40
+ def west(value = 1)
41
+ left - value
42
+ end
43
+
36
44
  def bottom
37
45
  top + height
38
46
  end
39
47
 
48
+ def south(value = 1)
49
+ bottom + value
50
+ end
51
+
40
52
  def right
41
53
  left + width
42
54
  end
43
55
 
56
+ def east(value = 1)
57
+ right + value
58
+ end
59
+
44
60
  def position
45
61
  {
46
62
  y: top,