vedeu 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (95) hide show
  1. checksums.yaml +4 -4
  2. data/LICENSE.txt +3 -0
  3. data/Rakefile +16 -7
  4. data/examples/borders_app.rb +58 -55
  5. data/lib/vedeu/api.rb +1 -1
  6. data/lib/vedeu/application.rb +25 -25
  7. data/lib/vedeu/bindings.rb +5 -7
  8. data/lib/vedeu/configuration/api.rb +0 -2
  9. data/lib/vedeu/configuration/cli.rb +0 -2
  10. data/lib/vedeu/configuration/configuration.rb +0 -2
  11. data/lib/vedeu/cursor/cursor.rb +0 -2
  12. data/lib/vedeu/debug.rb +2 -2
  13. data/lib/vedeu/distributed/server.rb +0 -2
  14. data/lib/vedeu/dsl/components/border.rb +15 -19
  15. data/lib/vedeu/dsl/components/geometry.rb +14 -18
  16. data/lib/vedeu/dsl/components/keymap.rb +28 -32
  17. data/lib/vedeu/dsl/composition.rb +27 -9
  18. data/lib/vedeu/events/all.rb +1 -0
  19. data/lib/vedeu/events/event.rb +6 -8
  20. data/lib/vedeu/events/events.rb +10 -0
  21. data/lib/vedeu/events/trigger.rb +6 -12
  22. data/lib/vedeu/geometry/grid.rb +0 -2
  23. data/lib/vedeu/geometry/position.rb +0 -2
  24. data/lib/vedeu/geometry/position_validator.rb +0 -14
  25. data/lib/vedeu/input/input.rb +0 -2
  26. data/lib/vedeu/models/collection.rb +0 -2
  27. data/lib/vedeu/models/focus.rb +0 -1
  28. data/lib/vedeu/models/geometry.rb +7 -3
  29. data/lib/vedeu/models/group.rb +0 -2
  30. data/lib/vedeu/models/menu.rb +23 -29
  31. data/lib/vedeu/models/model.rb +0 -2
  32. data/lib/vedeu/models/view/char.rb +14 -10
  33. data/lib/vedeu/models/view/composition.rb +7 -9
  34. data/lib/vedeu/models/view/interface.rb +0 -1
  35. data/lib/vedeu/models/view/line.rb +2 -3
  36. data/lib/vedeu/models/view/stream.rb +0 -3
  37. data/lib/vedeu/output/all.rb +1 -0
  38. data/lib/vedeu/output/background.rb +0 -2
  39. data/lib/vedeu/output/colour.rb +0 -2
  40. data/lib/vedeu/output/compositor.rb +0 -2
  41. data/lib/vedeu/output/foreground.rb +0 -2
  42. data/lib/vedeu/output/html_renderer.rb +6 -0
  43. data/lib/vedeu/output/index_position.rb +35 -0
  44. data/lib/vedeu/output/output.rb +3 -1
  45. data/lib/vedeu/output/position_index.rb +2 -2
  46. data/lib/vedeu/output/presentation.rb +0 -2
  47. data/lib/vedeu/output/style.rb +0 -1
  48. data/lib/vedeu/output/translator.rb +18 -20
  49. data/lib/vedeu/output/viewport.rb +76 -51
  50. data/lib/vedeu/output/virtual_terminal.rb +2 -1
  51. data/lib/vedeu/repositories/all.rb +4 -4
  52. data/lib/vedeu/repositories/repository.rb +0 -2
  53. data/lib/vedeu/support/coercions.rb +0 -2
  54. data/lib/vedeu/support/common.rb +0 -2
  55. data/lib/vedeu/support/esc.rb +0 -2
  56. data/lib/vedeu/support/log.rb +86 -3
  57. data/lib/vedeu/support/refresh.rb +0 -2
  58. data/lib/vedeu/support/sentence.rb +5 -9
  59. data/lib/vedeu/support/terminal.rb +0 -2
  60. data/lib/vedeu/support/trace.rb +0 -2
  61. data/lib/vedeu/support/visible.rb +1 -1
  62. data/test/lib/vedeu/configuration/api_test.rb +14 -0
  63. data/test/lib/vedeu/configuration/configuration_test.rb +10 -0
  64. data/test/lib/vedeu/distributed/server_test.rb +5 -0
  65. data/test/lib/vedeu/dsl/components/border_test.rb +7 -0
  66. data/test/lib/vedeu/dsl/components/geometry_test.rb +8 -3
  67. data/test/lib/vedeu/dsl/interface_test.rb +5 -0
  68. data/test/lib/vedeu/dsl/line_test.rb +4 -0
  69. data/test/lib/vedeu/dsl/shared/colour_test.rb +7 -7
  70. data/test/lib/vedeu/dsl/shared/style_test.rb +5 -2
  71. data/test/lib/vedeu/dsl/stream_test.rb +4 -1
  72. data/test/lib/vedeu/events/event_test.rb +6 -0
  73. data/test/lib/vedeu/geometry/bounding_area_test.rb +30 -30
  74. data/test/lib/vedeu/geometry/position_test.rb +5 -0
  75. data/test/lib/vedeu/models/view/char_test.rb +1 -14
  76. data/test/lib/vedeu/output/index_position_test.rb +64 -0
  77. data/test/lib/vedeu/output/style_test.rb +4 -0
  78. data/test/lib/vedeu/output/translator_test.rb +4 -0
  79. data/test/lib/vedeu/output/virtual_terminal_test.rb +2 -0
  80. data/test/lib/vedeu/output/wordwrap_test.rb +5 -0
  81. data/test/lib/vedeu/repositories/all_test.rb +3 -3
  82. data/test/lib/vedeu/repositories/repository_test.rb +8 -0
  83. data/test/lib/vedeu/support/console_test.rb +14 -0
  84. data/test/lib/vedeu/support/esc_test.rb +6 -0
  85. data/test/lib/vedeu/support/terminal_test.rb +13 -0
  86. data/vedeu.gemspec +4 -4
  87. metadata +12 -24
  88. data/test/integration/distributed_test.rb +0 -16
  89. data/test/integration/dsl/compositions_test.rb +0 -19
  90. data/test/integration/dsl/interfaces_test.rb +0 -193
  91. data/test/integration/dsl/keymaps_test.rb +0 -30
  92. data/test/integration/dsl/lines_test.rb +0 -104
  93. data/test/integration/dsl/menus_test.rb +0 -59
  94. data/test/integration/dsl/streams_test.rb +0 -103
  95. data/test/integration/dsl/views_test.rb +0 -45
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 194c0ec69e43bc4197b9cbd3be152b8be8c66ca5
4
- data.tar.gz: 58b06a162a3b038247f82d69714e0a8cc601a38d
3
+ metadata.gz: f37a301576d737c906c07425d431588426023bbe
4
+ data.tar.gz: a8ed33815c9a7343b85470d6f88130495e7d93be
5
5
  SHA512:
6
- metadata.gz: 6438bc4ad946856c2a3f552e8256c9aeb05413d3f8d5d1a055a27fc7d7b88c08eeb1dbbf4d30c7aebd59852cb70b524d868dbbf89742eb64b3694acf41eb34c2
7
- data.tar.gz: 8ff06714885c53271469daaa1a0b09825ad2aa1829090e66100c3820f03a7d7d3cca1a72d851f4512f57ea11217401389ecb1b2c9cf02cd586a1dfde18cf6673
6
+ metadata.gz: 1b2a87c244d2b5e3e2bd6d39f8eb6f72184065794e9897fa5bd39c0af08b2ac9add00ed93538d5685f9188c450994fa2b60d96f95ff7564cdf8dad8693a9edcf
7
+ data.tar.gz: 680a31c67bb5f046b09f52e8709e2ee8fa5a9e5f4cc63fc387d67608cab30ba364419c1beb0db343f753af216b34593934326e3549c9da6899718d0b07777fe9
data/LICENSE.txt CHANGED
@@ -1,4 +1,7 @@
1
1
  Copyright (c) 2014 Gavin Laking
2
+ Copyright (c) 2013 Steve Klabnik - Monologger
3
+ (https://github.com/steveklabnik/mono_logger)
4
+ Note: Code used inline in Vedeu::Log.
2
5
  Copyright (c) 2013 Michael Grosser - Ruco
3
6
  (https://github.com/grosser/ruco)
4
7
  Note: Code from ruco's Window class was used as basis of
data/Rakefile CHANGED
@@ -3,21 +3,30 @@ require 'rake/testtask'
3
3
  require 'cucumber'
4
4
  require 'cucumber/rake/task'
5
5
  require 'inch/rake'
6
+ require 'yard'
6
7
 
7
- # Don't run cukes for the time being.
8
- # Cucumber::Rake::Task.new(:cucumber) do |t|
9
- # t.cucumber_opts = "features --format progress"
10
- # end
11
- # Rake::Task['cucumber'].execute
8
+ Cucumber::Rake::Task.new(:cucumber) do |t|
9
+ t.cucumber_opts = "features --format progress"
10
+ end
12
11
 
13
- Rake::TestTask.new do |t|
12
+ Rake::TestTask.new(:test) do |t|
14
13
  t.libs.push 'lib'
15
14
  t.libs.push 'test'
16
15
  t.pattern = 'test/**/*_test.rb'
17
16
  t.verbose = false
18
17
  end
19
18
 
20
- Inch::Rake::Suggest.new do |suggest|
19
+ YARD::Rake::YardocTask.new(:yard) do |t|
20
+ t.files = [
21
+ 'lib/**/*.rb',
22
+ '-',
23
+ 'docs/api.md',
24
+ 'docs/getting_started.md',
25
+ 'docs/views.md'
26
+ ]
27
+ end
28
+
29
+ Inch::Rake::Suggest.new(:inch) do |suggest|
21
30
  suggest.args << "--pedantic"
22
31
  suggest.args << "--all"
23
32
  end
@@ -23,58 +23,58 @@ class VedeuBordersApp
23
23
  geometry do
24
24
  x 2
25
25
  y 2
26
- height 3
27
- width 7
26
+ height 4
27
+ width 10
28
28
  end
29
29
  colour foreground: '#ffffff', background: '#ff0000'
30
30
  end
31
31
 
32
32
  interface 'border_off' do
33
33
  geometry do
34
- x 11
34
+ x 13
35
35
  y 2
36
- height 3
37
- width 7
36
+ height 4
37
+ width 10
38
38
  end
39
39
  colour foreground: '#ffffff', background: '#ff0000'
40
40
  end
41
41
 
42
42
  interface 'no_top' do
43
43
  geometry do
44
- x 20
44
+ x 24
45
45
  y 2
46
- height 3
47
- width 7
46
+ height 4
47
+ width 10
48
48
  end
49
49
  colour foreground: '#000000', background: '#ff5500'
50
50
  end
51
51
 
52
52
  interface 'no_bottom' do
53
53
  geometry do
54
- x 29
54
+ x 35
55
55
  y 2
56
- height 3
57
- width 7
56
+ height 4
57
+ width 10
58
58
  end
59
59
  colour foreground: '#000000', background: '#ff5500'
60
60
  end
61
61
 
62
62
  interface 'no_left' do
63
63
  geometry do
64
- x 38
64
+ x 46
65
65
  y 2
66
- height 3
67
- width 7
66
+ height 4
67
+ width 10
68
68
  end
69
69
  colour foreground: '#000000', background: '#ff5500'
70
70
  end
71
71
 
72
72
  interface 'no_right' do
73
73
  geometry do
74
- x 47
74
+ x 57
75
75
  y 2
76
- height 3
77
- width 7
76
+ height 4
77
+ width 10
78
78
  end
79
79
  colour foreground: '#000000', background: '#ff5500'
80
80
  end
@@ -83,58 +83,58 @@ class VedeuBordersApp
83
83
  geometry do
84
84
  x 2
85
85
  y 7
86
- height 3
87
- width 7
86
+ height 4
87
+ width 10
88
88
  end
89
89
  colour foreground: '#ffffff', background: '#ff0000'
90
90
  end
91
91
 
92
- interface 'custom_horizontal_and_vertical' do
92
+ interface 'custom_sides' do
93
93
  geometry do
94
- x 11
94
+ x 13
95
95
  y 7
96
- height 3
97
- width 7
96
+ height 4
97
+ width 10
98
98
  end
99
99
  colour foreground: '#ffffff', background: '#ff0000'
100
100
  end
101
101
 
102
102
  interface 'only_top' do
103
103
  geometry do
104
- x 20
104
+ x 24
105
105
  y 7
106
- height 3
107
- width 7
106
+ height 4
107
+ width 10
108
108
  end
109
109
  colour foreground: '#ffffff', background: '#0000ff'
110
110
  end
111
111
 
112
112
  interface 'only_bottom' do
113
113
  geometry do
114
- x 29
114
+ x 35
115
115
  y 7
116
- height 3
117
- width 7
116
+ height 4
117
+ width 10
118
118
  end
119
119
  colour foreground: '#ffffff', background: '#0000ff'
120
120
  end
121
121
 
122
122
  interface 'only_left' do
123
123
  geometry do
124
- x 38
124
+ x 46
125
125
  y 7
126
- height 3
127
- width 7
126
+ height 4
127
+ width 10
128
128
  end
129
129
  colour foreground: '#ffffff', background: '#0000ff'
130
130
  end
131
131
 
132
132
  interface 'only_right' do
133
133
  geometry do
134
- x 47
134
+ x 57
135
135
  y 7
136
- height 3
137
- width 7
136
+ height 4
137
+ width 10
138
138
  end
139
139
  colour foreground: '#ffffff', background: '#0000ff'
140
140
  end
@@ -143,18 +143,18 @@ class VedeuBordersApp
143
143
  geometry do
144
144
  x 2
145
145
  y 12
146
- height 3
147
- width 7
146
+ height 4
147
+ width 10
148
148
  end
149
149
  colour foreground: '#ffffff', background: '#ff0000'
150
150
  end
151
151
 
152
152
  interface 'negative' do
153
153
  geometry do
154
- x 11
154
+ x 13
155
155
  y 12
156
- height 3
157
- width 7
156
+ height 4
157
+ width 10
158
158
  end
159
159
  colour foreground: '#000000', background: '#00ff00'
160
160
  style 'normal'
@@ -188,32 +188,33 @@ class VedeuBordersApp
188
188
  foreground '#ffffff'
189
189
  end
190
190
  lines do
191
- line 'on'
191
+ line 'all on'
192
192
  end
193
193
  end
194
194
  view('border_off') do
195
195
  lines do
196
- line 'off'
196
+ line 'all off'
197
197
  end
198
198
  end
199
199
  view('no_top') do
200
200
  lines do
201
- line 'no t'
201
+ line 'no top'
202
202
  end
203
203
  end
204
204
  view('no_bottom') do
205
205
  lines do
206
- line 'no b'
206
+ line 'no'
207
+ line 'bottom'
207
208
  end
208
209
  end
209
210
  view('no_left') do
210
211
  lines do
211
- line 'no l'
212
+ line 'no left'
212
213
  end
213
214
  end
214
215
  view('no_right') do
215
216
  lines do
216
- line 'no r'
217
+ line 'no right'
217
218
  end
218
219
  end
219
220
  view('custom_corners') do
@@ -224,18 +225,18 @@ class VedeuBordersApp
224
225
  bottom_left 'C'
225
226
  end
226
227
  lines do
227
- line 'chars'
228
- line '1'
228
+ line 'custom'
229
+ line 'corners'
229
230
  end
230
231
  end
231
- view('custom_horizontal_and_vertical') do
232
+ view('custom_sides') do
232
233
  border do
233
234
  horizontal '*'
234
235
  vertical '$'
235
236
  end
236
237
  lines do
237
- line 'chars'
238
- line '2'
238
+ line 'custom'
239
+ line 'sides'
239
240
  end
240
241
  end
241
242
  view('only_top') do
@@ -247,7 +248,7 @@ class VedeuBordersApp
247
248
  end
248
249
  lines do
249
250
  line 'only'
250
- line 't'
251
+ line 'top'
251
252
  end
252
253
  end
253
254
  view('only_bottom') do
@@ -259,7 +260,7 @@ class VedeuBordersApp
259
260
  end
260
261
  lines do
261
262
  line 'only'
262
- line 'b'
263
+ line 'bottom'
263
264
  end
264
265
  end
265
266
  view('only_left') do
@@ -271,7 +272,7 @@ class VedeuBordersApp
271
272
  end
272
273
  lines do
273
274
  line 'only'
274
- line 'l'
275
+ line 'left'
275
276
  end
276
277
  end
277
278
  view('only_right') do
@@ -283,7 +284,7 @@ class VedeuBordersApp
283
284
  end
284
285
  lines do
285
286
  line 'only'
286
- line 'r'
287
+ line 'right'
287
288
  end
288
289
  end
289
290
  view('custom_colour') do
@@ -291,6 +292,7 @@ class VedeuBordersApp
291
292
  colour foreground: '#ff5500', background: '#0000ff'
292
293
  end
293
294
  lines do
295
+ line 'custom'
294
296
  line 'color'
295
297
  end
296
298
  end
@@ -299,6 +301,7 @@ class VedeuBordersApp
299
301
  style 'negative'
300
302
  end
301
303
  lines do
304
+ line 'custom'
302
305
  line 'style'
303
306
  end
304
307
  end
data/lib/vedeu/api.rb CHANGED
@@ -24,7 +24,7 @@ module Vedeu
24
24
  def_delegators Vedeu::Buffers, :buffers
25
25
  def_delegators Vedeu::Cursors, :cursors
26
26
  def_delegators Vedeu::Cursors, :cursor
27
- def_delegators Vedeu::Events, :events
27
+ def_delegators Vedeu::EventsRepository, :events
28
28
  def_delegators Vedeu::Geometries, :geometries
29
29
  def_delegators Vedeu::Groups, :groups
30
30
  def_delegators Vedeu::InterfacesRepository, :interfaces
@@ -2,36 +2,36 @@ module Vedeu
2
2
 
3
3
  # Orchestrates the running of the main application loop.
4
4
  #
5
- # @api private
6
- #
7
5
  class Application
8
6
 
9
- class << self
7
+ # @param configuration [Vedeu::Configuration]
8
+ # @return [void]
9
+ def self.start(configuration)
10
+ new(configuration).start
11
+ end
10
12
 
11
- # @return [void]
12
- def start(configuration)
13
- new(configuration).start
14
- end
15
- alias_method :restart, :start
16
-
17
- # Stops the application!
18
- # - The `:_cleanup_` event is triggered, which in turn triggers the client
19
- # event `:cleanup`; the client application may treat this event as Vedeu
20
- # signalling that it is about to terminate. Client applications are
21
- # encouraged to use this event to close any open buffers, save files,
22
- # empty trash, etc.
23
- #
24
- # @return [void]
25
- def stop
26
- Vedeu.trigger(:_cleanup_)
27
-
28
- Vedeu::MainLoop.stop!
29
- end
13
+ # @param configuration [Vedeu::Configuration]
14
+ # @return [void]
15
+ def self.restart(configuration)
16
+ new(configuration).start
17
+ end
18
+
19
+ # Stops the application!
20
+ # - The `:_cleanup_` event is triggered, which in turn triggers the client
21
+ # event `:cleanup`; the client application may treat this event as Vedeu
22
+ # signalling that it is about to terminate. Client applications are
23
+ # encouraged to use this event to close any open buffers, save files,
24
+ # empty trash, etc.
25
+ #
26
+ # @return [void]
27
+ def self.stop
28
+ Vedeu.trigger(:_cleanup_)
30
29
 
31
- end # Application eigenclass
30
+ Vedeu::MainLoop.stop!
31
+ end
32
32
 
33
33
  # :nocov:
34
-
34
+ # @param configuration [Vedeu::Configuration]
35
35
  # @return [Application]
36
36
  def initialize(configuration)
37
37
  @configuration = configuration
@@ -113,7 +113,7 @@ module Vedeu
113
113
 
114
114
  Vedeu.trigger(:_drb_restart_)
115
115
 
116
- Application.restart
116
+ Application.restart(configuration)
117
117
 
118
118
  end
119
119
 
@@ -2,12 +2,6 @@ require 'vedeu/events/event'
2
2
 
3
3
  module Vedeu
4
4
 
5
- module API
6
-
7
- def_delegators Vedeu::Event, :bind, :trigger, :unbind
8
-
9
- end
10
-
11
5
  # Creates system events which when called provide a variety of core functions
12
6
  # and behaviours. They are soft-namespaced using underscores.
13
7
  #
@@ -21,7 +15,11 @@ module Vedeu
21
15
  module Bindings
22
16
 
23
17
  # Clears the whole terminal space.
24
- Vedeu.bind(:_clear_) { Vedeu::Terminal.clear }
18
+ Vedeu.bind(:_clear_) do
19
+ Vedeu::Terminal.virtual.clear if Vedeu::Configuration.drb?
20
+
21
+ Vedeu::Terminal.clear
22
+ end
25
23
 
26
24
  # Vedeu triggers this event when `:_exit_` is triggered. You can hook into
27
25
  # this to perform a special action before the application terminates. Saving