vedeu 0.4.49 → 0.4.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/vedeu/all.rb +1 -3
- data/lib/vedeu/api.rb +114 -3
- data/lib/vedeu/application/application_controller.rb +2 -1
- data/lib/vedeu/application/application_helper.rb +2 -1
- data/lib/vedeu/application/application_view.rb +4 -1
- data/lib/vedeu/bootstrap.rb +3 -1
- data/lib/vedeu/cli/generator/application.rb +14 -0
- data/lib/vedeu/cli/generator/helpers.rb +2 -0
- data/lib/vedeu/cli/generator/templates/application/Gemfile +1 -0
- data/lib/vedeu/cli/generator/templates/application/LICENSE.txt +24 -0
- data/lib/vedeu/cli/generator/templates/application/README.md +18 -0
- data/lib/vedeu/cli/generator/templates/application/app/controllers/name.erb +3 -0
- data/lib/vedeu/cli/generator/templates/application/app/views/name.erb +3 -0
- data/lib/vedeu/cli/generator/templates/application/config/configuration.erb +1 -1
- data/lib/vedeu/cli/generator/view.rb +2 -0
- data/lib/vedeu/configuration/configuration.rb +9 -2
- data/lib/vedeu/output/clear/all.rb +1 -0
- data/lib/vedeu/output/viewport.rb +1 -1
- data/lib/vedeu/support/log.rb +30 -4
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/api_test.rb +7 -0
- data/test/lib/vedeu/configuration/configuration_test.rb +41 -9
- metadata +4 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: a09d46830938e1cc8b738499f0473e18c03cfb9c
|
|
4
|
+
data.tar.gz: 391122a3f279aded058f010e67eefeb382385dff
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: bebff5ce0ae54c6880aeb8f6f229661007521a4a029b585f1a6bc0a3b027e548ba93136a5ab60e0570cf0075711c0689e52b263bb8e602ad06bda0e4e726c1fe
|
|
7
|
+
data.tar.gz: 4dc322f36187484f76665de2eab79f50d2b0ea14b32ca6eba943d6d12c7c87f7593ad37b0a34b014c3188a9a648c21985b7491ad5a6ff69d78427041e195a9e2
|
data/lib/vedeu/all.rb
CHANGED
|
@@ -11,9 +11,7 @@ require 'vedeu/geometry/all'
|
|
|
11
11
|
require 'vedeu/repositories/all'
|
|
12
12
|
|
|
13
13
|
require 'vedeu/api'
|
|
14
|
-
require 'vedeu/bindings/
|
|
15
|
-
require 'vedeu/bindings/menus'
|
|
16
|
-
require 'vedeu/bindings/bindings'
|
|
14
|
+
require 'vedeu/bindings/all'
|
|
17
15
|
|
|
18
16
|
require 'vedeu/cli/generator/all'
|
|
19
17
|
|
data/lib/vedeu/api.rb
CHANGED
|
@@ -87,22 +87,40 @@ module Vedeu
|
|
|
87
87
|
# @return [Vedeu::Cursors]
|
|
88
88
|
def_delegators Vedeu::Cursors, :cursors
|
|
89
89
|
|
|
90
|
+
# @example
|
|
91
|
+
# Vedeu.border
|
|
92
|
+
#
|
|
90
93
|
# @!method border
|
|
91
94
|
# @see Vedeu::DSL::Border.border
|
|
92
95
|
def_delegators Vedeu::DSL::Border, :border
|
|
93
96
|
|
|
97
|
+
# @example
|
|
98
|
+
# Vedeu.geometry
|
|
99
|
+
#
|
|
94
100
|
# @!method geometry
|
|
95
101
|
# @see Vedeu::DSL::Geometry.geometry
|
|
96
102
|
def_delegators Vedeu::DSL::Geometry, :geometry
|
|
97
103
|
|
|
104
|
+
# @example
|
|
105
|
+
# Vedeu.group
|
|
106
|
+
#
|
|
98
107
|
# @!method group
|
|
99
108
|
# @see Vedeu::DSL::Group.group
|
|
100
109
|
def_delegators Vedeu::DSL::Group, :group
|
|
101
110
|
|
|
111
|
+
# @example
|
|
112
|
+
# Vedeu.keymap
|
|
113
|
+
#
|
|
102
114
|
# @!method keymap
|
|
103
115
|
# @see Vedeu::DSL::Keymap.keymap
|
|
104
116
|
def_delegators Vedeu::DSL::Keymap, :keymap
|
|
105
117
|
|
|
118
|
+
# @example
|
|
119
|
+
# Vedeu.interface
|
|
120
|
+
# Vedeu.renders
|
|
121
|
+
# Vedeu.render
|
|
122
|
+
# Vedeu.views
|
|
123
|
+
#
|
|
106
124
|
# @!method interface
|
|
107
125
|
# @see Vedeu::DSL::View.interface
|
|
108
126
|
# @!method render
|
|
@@ -113,6 +131,11 @@ module Vedeu
|
|
|
113
131
|
# @see Vedeu::DSL::View.views
|
|
114
132
|
def_delegators Vedeu::DSL::View, :interface, :renders, :render, :views
|
|
115
133
|
|
|
134
|
+
# @example
|
|
135
|
+
# Vedeu.bind
|
|
136
|
+
# Vedeu.bound?
|
|
137
|
+
# Vedeu.unbind
|
|
138
|
+
#
|
|
116
139
|
# @!method bind
|
|
117
140
|
# @see Vedeu::Event.bind
|
|
118
141
|
# @!method bound?
|
|
@@ -130,6 +153,13 @@ module Vedeu
|
|
|
130
153
|
# @return [Vedeu::Events]
|
|
131
154
|
def_delegators Vedeu::Events, :events
|
|
132
155
|
|
|
156
|
+
# @example
|
|
157
|
+
# Vedeu.focus
|
|
158
|
+
# Vedeu.focus_by_name
|
|
159
|
+
# Vedeu.focussed?
|
|
160
|
+
# Vedeu.focus_next
|
|
161
|
+
# Vedeu.focus_previous
|
|
162
|
+
#
|
|
133
163
|
# @!method focus
|
|
134
164
|
# @see Vedeu::Focus#focus
|
|
135
165
|
# @!method focus_by_name
|
|
@@ -188,6 +218,11 @@ module Vedeu
|
|
|
188
218
|
# @return [Vedeu::Keymaps]
|
|
189
219
|
def_delegators Vedeu::Keymaps, :keymaps
|
|
190
220
|
|
|
221
|
+
# @example
|
|
222
|
+
# Vedeu.log
|
|
223
|
+
# Vedeu.log_stdout
|
|
224
|
+
# Vedeu.log_stderr
|
|
225
|
+
#
|
|
191
226
|
# @!method log
|
|
192
227
|
# @see Vedeu::Log.log
|
|
193
228
|
# @!method log_stdout
|
|
@@ -196,10 +231,16 @@ module Vedeu
|
|
|
196
231
|
# @see Vedeu::Log.log_stderr
|
|
197
232
|
def_delegators Vedeu::Log, :log, :log_stdout, :log_stderr
|
|
198
233
|
|
|
234
|
+
# @example
|
|
235
|
+
# Vedeu.keypress
|
|
236
|
+
#
|
|
199
237
|
# @!method keypress
|
|
200
238
|
# @see Vedeu::Mapper.keypress
|
|
201
239
|
def_delegators Vedeu::Mapper, :keypress
|
|
202
240
|
|
|
241
|
+
# @example
|
|
242
|
+
# Vedeu.menu
|
|
243
|
+
#
|
|
203
244
|
# @!method menu
|
|
204
245
|
# @see Vedeu::Menu.menu
|
|
205
246
|
def_delegators Vedeu::Menu, :menu
|
|
@@ -213,44 +254,114 @@ module Vedeu
|
|
|
213
254
|
# @return [Vedeu::Menus]
|
|
214
255
|
def_delegators Vedeu::Menus, :menus
|
|
215
256
|
|
|
257
|
+
# @example
|
|
258
|
+
# Vedeu.renderer
|
|
259
|
+
# Vedeu.renderers
|
|
260
|
+
#
|
|
216
261
|
# @!method renderer
|
|
217
262
|
# @see Vedeu::Renderers#renderer
|
|
218
263
|
# @!method renderers
|
|
219
264
|
# @see Vedeu::Renderers#renderers
|
|
220
265
|
def_delegators Vedeu::Renderers, :renderer, :renderers
|
|
221
266
|
|
|
267
|
+
# Return the height of the terminal running the client application.
|
|
268
|
+
#
|
|
269
|
+
# @example
|
|
270
|
+
# Vedeu.height
|
|
271
|
+
#
|
|
222
272
|
# @!method height
|
|
223
273
|
# @see Vedeu::Terminal#height
|
|
274
|
+
def_delegators Vedeu::Terminal, :height
|
|
275
|
+
|
|
276
|
+
# Return the width of the terminal running the client application.
|
|
277
|
+
#
|
|
278
|
+
# @example
|
|
279
|
+
# Vedeu.width
|
|
280
|
+
#
|
|
224
281
|
# @!method width
|
|
225
282
|
# @see Vedeu::Terminal#width
|
|
283
|
+
def_delegators Vedeu::Terminal, :width
|
|
284
|
+
|
|
285
|
+
# Instruct the terminal to resize. This will happen automatically as the
|
|
286
|
+
# terminal recieves SIGWINCH signals.
|
|
287
|
+
#
|
|
288
|
+
# @example
|
|
289
|
+
# Vedeu.resize
|
|
290
|
+
#
|
|
226
291
|
# @!method resize
|
|
227
292
|
# @see Vedeu::Terminal#resize
|
|
228
|
-
def_delegators Vedeu::Terminal, :
|
|
293
|
+
def_delegators Vedeu::Terminal, :resize
|
|
229
294
|
|
|
295
|
+
# Measure the execution time of the code in the given block.
|
|
296
|
+
#
|
|
297
|
+
# @example
|
|
298
|
+
# Vedeu.timer do
|
|
299
|
+
# # ... some code here ...
|
|
300
|
+
# end
|
|
301
|
+
#
|
|
230
302
|
# @!method timer
|
|
231
303
|
# @see Vedeu::Timer.timer
|
|
232
304
|
def_delegators Vedeu::Timer, :timer
|
|
233
305
|
|
|
306
|
+
# Trigger an event by name.
|
|
307
|
+
#
|
|
308
|
+
# @example
|
|
309
|
+
# Vedeu.trigger(:name)
|
|
310
|
+
#
|
|
234
311
|
# @!method trigger
|
|
235
312
|
# @see Vedeu::Trigger.trigger
|
|
236
313
|
def_delegators Vedeu::Trigger, :trigger
|
|
237
314
|
|
|
315
|
+
# Exit the client application using Vedeu.
|
|
316
|
+
#
|
|
317
|
+
# @example
|
|
318
|
+
# Vedeu.exit
|
|
319
|
+
#
|
|
238
320
|
# @!method exit
|
|
239
321
|
# @see Vedeu::Application.stop
|
|
240
322
|
def_delegators Vedeu::Application, :exit
|
|
241
323
|
|
|
324
|
+
# Clear the entire terminal.
|
|
325
|
+
#
|
|
326
|
+
# @example
|
|
327
|
+
# Vedeu.clear
|
|
328
|
+
#
|
|
329
|
+
# @!method clear
|
|
330
|
+
# @see Vedeu::Terminal.clear
|
|
331
|
+
def_delegators Vedeu::Terminal, :clear
|
|
332
|
+
|
|
333
|
+
# Clear the interface with the given name.
|
|
334
|
+
#
|
|
335
|
+
# @example
|
|
336
|
+
# Vedeu.clear_by_name(name)
|
|
337
|
+
#
|
|
242
338
|
# @!method clear_by_name
|
|
243
|
-
# @see Vedeu::Clear.
|
|
339
|
+
# @see Vedeu::Clear::NamedInterface.render
|
|
244
340
|
def_delegators Vedeu::Clear::NamedInterface, :clear_by_name
|
|
245
341
|
|
|
342
|
+
# Clears the group of interfaces belonging to the given name.
|
|
343
|
+
#
|
|
344
|
+
# @example
|
|
345
|
+
# Vedeu.clear_by_group(name)
|
|
346
|
+
#
|
|
246
347
|
# @!method clear_by_group
|
|
247
|
-
# @see Vedeu::Clear.
|
|
348
|
+
# @see Vedeu::Clear::NamedGroup.render
|
|
248
349
|
def_delegators Vedeu::Clear::NamedGroup, :clear_by_group
|
|
249
350
|
|
|
351
|
+
# Hide the cursor for the interface of the given name.
|
|
352
|
+
#
|
|
353
|
+
# @example
|
|
354
|
+
# Vedeu.hide_cursor(name)
|
|
355
|
+
#
|
|
250
356
|
# @!method hide_cursor
|
|
251
357
|
# @see Vedeu::Visibility.hide_cursor
|
|
252
358
|
def_delegators Vedeu::Visibility, :hide_cursor
|
|
253
359
|
|
|
360
|
+
# Shows the cursor for the interface of the given name.
|
|
361
|
+
#
|
|
362
|
+
# @example
|
|
363
|
+
# Vedeu.show_cursor(name)
|
|
364
|
+
#
|
|
254
365
|
# @!method show_cursor
|
|
255
366
|
# @see Vedeu::Visibility.show_cursor
|
|
256
367
|
def_delegators Vedeu::Visibility, :show_cursor
|
|
@@ -3,7 +3,8 @@ require_relative 'controller'
|
|
|
3
3
|
module Vedeu
|
|
4
4
|
|
|
5
5
|
# Provides methods which should be available to all client application
|
|
6
|
-
# controllers.
|
|
6
|
+
# controllers. The client application's ApplicationController will inherit
|
|
7
|
+
# from this class.
|
|
7
8
|
#
|
|
8
9
|
# @api private
|
|
9
10
|
class ApplicationController
|
|
@@ -2,7 +2,8 @@ require_relative 'view'
|
|
|
2
2
|
|
|
3
3
|
module Vedeu
|
|
4
4
|
|
|
5
|
-
# Provides the mechanism to render views for the client application.
|
|
5
|
+
# Provides the mechanism to render views for the client application. The
|
|
6
|
+
# client application's ApplicationView will inherit from this class.
|
|
6
7
|
#
|
|
7
8
|
# @api private
|
|
8
9
|
class ApplicationView
|
|
@@ -42,10 +43,12 @@ module Vedeu
|
|
|
42
43
|
#
|
|
43
44
|
# @param value [String]
|
|
44
45
|
# @return [String]
|
|
46
|
+
# :nocov:
|
|
45
47
|
def template(value)
|
|
46
48
|
@template = Vedeu::Configuration.base_path +
|
|
47
49
|
"/app/views/templates/#{value}.erb"
|
|
48
50
|
end
|
|
51
|
+
# :nocov:
|
|
49
52
|
|
|
50
53
|
end # ApplicationView
|
|
51
54
|
|
data/lib/vedeu/bootstrap.rb
CHANGED
|
@@ -31,7 +31,9 @@ module Vedeu
|
|
|
31
31
|
#
|
|
32
32
|
# @return [void]
|
|
33
33
|
def start
|
|
34
|
-
Vedeu.
|
|
34
|
+
unless Vedeu::Configuration.log?
|
|
35
|
+
Vedeu.configure { log('/tmp/vedeu_bootstrap.log') }
|
|
36
|
+
end
|
|
35
37
|
|
|
36
38
|
# config/configuration.rb is already loaded so don't load it twice
|
|
37
39
|
Dir[File.join(Vedeu::Configuration.base_path, 'config/**/*')].each do |f|
|
|
@@ -10,6 +10,7 @@ module Vedeu
|
|
|
10
10
|
# ```
|
|
11
11
|
#
|
|
12
12
|
# @api private
|
|
13
|
+
# :nocov:
|
|
13
14
|
class Application
|
|
14
15
|
|
|
15
16
|
include Vedeu::Generator::Helpers
|
|
@@ -33,6 +34,8 @@ module Vedeu
|
|
|
33
34
|
make_directory_structure
|
|
34
35
|
|
|
35
36
|
copy_gemfile
|
|
37
|
+
copy_license
|
|
38
|
+
copy_readme
|
|
36
39
|
copy_application_bootstrapper
|
|
37
40
|
copy_application_controller
|
|
38
41
|
copy_application_helper
|
|
@@ -89,6 +92,16 @@ module Vedeu
|
|
|
89
92
|
copy_file(source + '/Gemfile', "#{name}/Gemfile")
|
|
90
93
|
end
|
|
91
94
|
|
|
95
|
+
# @return [void]
|
|
96
|
+
def copy_license
|
|
97
|
+
copy_file(source + '/LICENSE.txt', "#{name}/LICENSE.txt")
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# @return [void]
|
|
101
|
+
def copy_readme
|
|
102
|
+
copy_file(source + '/README.md', "#{name}/README.md")
|
|
103
|
+
end
|
|
104
|
+
|
|
92
105
|
# @return [void]
|
|
93
106
|
def make_application_executable
|
|
94
107
|
FileUtils.chmod(0755, "#{name}/bin/#{name}")
|
|
@@ -117,6 +130,7 @@ module Vedeu
|
|
|
117
130
|
end
|
|
118
131
|
|
|
119
132
|
end # Application
|
|
133
|
+
# :nocov:
|
|
120
134
|
|
|
121
135
|
end # Generator
|
|
122
136
|
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
Copyright (c) 2014 Your Name Here
|
|
2
|
+
|
|
3
|
+
Note: You may wish to change this license to suit your legal needs.
|
|
4
|
+
|
|
5
|
+
MIT License
|
|
6
|
+
|
|
7
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
8
|
+
a copy of this software and associated documentation files (the
|
|
9
|
+
"Software"), to deal in the Software without restriction, including
|
|
10
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
|
11
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
|
12
|
+
permit persons to whom the Software is furnished to do so, subject to
|
|
13
|
+
the following conditions:
|
|
14
|
+
|
|
15
|
+
The above copyright notice and this permission notice shall be
|
|
16
|
+
included in all copies or substantial portions of the Software.
|
|
17
|
+
|
|
18
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
19
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
20
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
21
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
22
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
23
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
24
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# <%= object.name_as_class %>
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Dependencies
|
|
9
|
+
|
|
10
|
+
* Installation
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Runtime instructions
|
|
15
|
+
|
|
16
|
+
* How to contribute
|
|
17
|
+
|
|
18
|
+
* Author information
|
|
@@ -144,6 +144,13 @@ module Vedeu
|
|
|
144
144
|
instance.options[:log]
|
|
145
145
|
end
|
|
146
146
|
|
|
147
|
+
# Returns a boolean indicating whether the log has been configured.
|
|
148
|
+
#
|
|
149
|
+
# @return [Boolean]
|
|
150
|
+
def log?
|
|
151
|
+
log != nil
|
|
152
|
+
end
|
|
153
|
+
|
|
147
154
|
# Returns whether the application will run through its main loop once or
|
|
148
155
|
# not. Default is false; meaning the application will loop forever or
|
|
149
156
|
# until terminated by the user.
|
|
@@ -248,7 +255,7 @@ module Vedeu
|
|
|
248
255
|
# @return [Hash]
|
|
249
256
|
def defaults
|
|
250
257
|
{
|
|
251
|
-
base_path:
|
|
258
|
+
base_path: base_path,
|
|
252
259
|
colour_mode: detect_colour_mode,
|
|
253
260
|
debug: false,
|
|
254
261
|
drb: false,
|
|
@@ -281,7 +288,7 @@ module Vedeu
|
|
|
281
288
|
end
|
|
282
289
|
|
|
283
290
|
# @return [String]
|
|
284
|
-
def
|
|
291
|
+
def base_path
|
|
285
292
|
File.expand_path('.')
|
|
286
293
|
end
|
|
287
294
|
|
data/lib/vedeu/support/log.rb
CHANGED
|
@@ -86,14 +86,14 @@ module Vedeu
|
|
|
86
86
|
# Write a message to the Vedeu log file.
|
|
87
87
|
#
|
|
88
88
|
# @example
|
|
89
|
-
# Vedeu.log(message: 'A useful debugging message: Error!')
|
|
89
|
+
# Vedeu.log(type: :debug, message: 'A useful debugging message: Error!')
|
|
90
90
|
#
|
|
91
91
|
# @param message [String] The message you wish to emit to the log file,
|
|
92
92
|
# useful for debugging.
|
|
93
93
|
# @param force [Boolean] When evaluates to true will attempt to write to
|
|
94
94
|
# the log file regardless of the Configuration setting.
|
|
95
95
|
# @param type [Symbol] Colour code messages in the log file depending
|
|
96
|
-
# on their source.
|
|
96
|
+
# on their source. See {message_types}
|
|
97
97
|
#
|
|
98
98
|
# @return [TrueClass]
|
|
99
99
|
def log(message:, force: false, type: :info)
|
|
@@ -104,11 +104,15 @@ module Vedeu
|
|
|
104
104
|
output
|
|
105
105
|
end
|
|
106
106
|
|
|
107
|
+
# Write a message to STDOUT.
|
|
108
|
+
#
|
|
107
109
|
# @return [TrueClass]
|
|
108
110
|
def log_stdout(type: :info, message:)
|
|
109
111
|
$stdout.puts [message_type(type), message_body(type, message)].join
|
|
110
112
|
end
|
|
111
113
|
|
|
114
|
+
# Write a message to STDERR.
|
|
115
|
+
#
|
|
112
116
|
# @return [TrueClass]
|
|
113
117
|
def log_stderr(type: :info, message:)
|
|
114
118
|
$stderr.puts [message_type(type), message_body(type, message)].join
|
|
@@ -125,18 +129,28 @@ module Vedeu
|
|
|
125
129
|
end
|
|
126
130
|
end
|
|
127
131
|
|
|
128
|
-
#
|
|
132
|
+
# Returns the message with timestamp.
|
|
133
|
+
#
|
|
134
|
+
# [ 0.0987] [debug] Something happened.
|
|
135
|
+
#
|
|
136
|
+
# @param message [String] The message type and message coloured and
|
|
137
|
+
# combined.
|
|
129
138
|
# @return [String]
|
|
130
139
|
def formatted_message(message)
|
|
131
140
|
[timestamp, message, "\n"].join
|
|
132
141
|
end
|
|
133
142
|
|
|
143
|
+
# Fetches the filename from the configuration.
|
|
144
|
+
#
|
|
134
145
|
# @return [String]
|
|
135
146
|
def log_file
|
|
136
147
|
Vedeu::Configuration.log
|
|
137
148
|
end
|
|
138
149
|
alias_method :enabled?, :log_file
|
|
139
150
|
|
|
151
|
+
# Displays the message body using the colour specified in the last element
|
|
152
|
+
# of {message_types}.
|
|
153
|
+
#
|
|
140
154
|
# @param type [Symbol] The type of log message.
|
|
141
155
|
# @param body [String] The log message itself.
|
|
142
156
|
# @return [String]
|
|
@@ -146,6 +160,9 @@ module Vedeu
|
|
|
146
160
|
end
|
|
147
161
|
end
|
|
148
162
|
|
|
163
|
+
# Displays the message type using the colour specified in the first
|
|
164
|
+
# element of {message_types}.
|
|
165
|
+
#
|
|
149
166
|
# @param type [Symbol] The type of log message.
|
|
150
167
|
# @return [String]
|
|
151
168
|
def message_type(type)
|
|
@@ -154,7 +171,16 @@ module Vedeu
|
|
|
154
171
|
end
|
|
155
172
|
end
|
|
156
173
|
|
|
157
|
-
#
|
|
174
|
+
# The defined message types for Vedeu with their respective colours.
|
|
175
|
+
# When used, produces a log entry of the format:
|
|
176
|
+
#
|
|
177
|
+
# [type] message
|
|
178
|
+
#
|
|
179
|
+
# The 'type' will be shown as the first colour defined in the value
|
|
180
|
+
# array, whilst the 'message' will be shown using the last colour.
|
|
181
|
+
# Valid types are available by viewing the source for this method.
|
|
182
|
+
#
|
|
183
|
+
# @return [Hash<Symbol => Array<Symbol>>]
|
|
158
184
|
def message_types
|
|
159
185
|
{
|
|
160
186
|
config: [:light_yellow, :yellow],
|
data/lib/vedeu/version.rb
CHANGED
data/test/lib/vedeu/api_test.rb
CHANGED
|
@@ -17,6 +17,7 @@ module Vedeu
|
|
|
17
17
|
it { Vedeu.must_respond_to(:keymap) }
|
|
18
18
|
it { Vedeu.must_respond_to(:interface) }
|
|
19
19
|
it { Vedeu.must_respond_to(:renders) }
|
|
20
|
+
it { Vedeu.must_respond_to(:render) }
|
|
20
21
|
it { Vedeu.must_respond_to(:views) }
|
|
21
22
|
it { Vedeu.must_respond_to(:bind) }
|
|
22
23
|
it { Vedeu.must_respond_to(:bound?) }
|
|
@@ -45,6 +46,12 @@ module Vedeu
|
|
|
45
46
|
it { Vedeu.must_respond_to(:resize) }
|
|
46
47
|
it { Vedeu.must_respond_to(:timer) }
|
|
47
48
|
it { Vedeu.must_respond_to(:trigger) }
|
|
49
|
+
it { Vedeu.must_respond_to(:exit) }
|
|
50
|
+
it { Vedeu.must_respond_to(:clear) }
|
|
51
|
+
it { Vedeu.must_respond_to(:clear_by_name) }
|
|
52
|
+
it { Vedeu.must_respond_to(:clear_by_group) }
|
|
53
|
+
it { Vedeu.must_respond_to(:hide_cursor) }
|
|
54
|
+
it { Vedeu.must_respond_to(:show_cursor) }
|
|
48
55
|
|
|
49
56
|
end # API
|
|
50
57
|
|
|
@@ -9,7 +9,7 @@ module Vedeu
|
|
|
9
9
|
before { Configuration.reset! }
|
|
10
10
|
after { test_configuration }
|
|
11
11
|
|
|
12
|
-
describe '
|
|
12
|
+
describe '.base_path' do
|
|
13
13
|
it { described.must_respond_to(:base_path) }
|
|
14
14
|
|
|
15
15
|
it 'returns the value of the base_path option' do
|
|
@@ -17,7 +17,7 @@ module Vedeu
|
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
describe '
|
|
20
|
+
describe '.debug?' do
|
|
21
21
|
it { described.must_respond_to(:debug) }
|
|
22
22
|
|
|
23
23
|
it 'returns the value of the debug option' do
|
|
@@ -25,7 +25,7 @@ module Vedeu
|
|
|
25
25
|
end
|
|
26
26
|
end
|
|
27
27
|
|
|
28
|
-
describe '
|
|
28
|
+
describe '.drb?' do
|
|
29
29
|
it { described.must_respond_to(:drb) }
|
|
30
30
|
|
|
31
31
|
it 'returns the value of the drb option' do
|
|
@@ -33,7 +33,7 @@ module Vedeu
|
|
|
33
33
|
end
|
|
34
34
|
end
|
|
35
35
|
|
|
36
|
-
describe '
|
|
36
|
+
describe '.interactive?' do
|
|
37
37
|
it { described.must_respond_to(:interactive) }
|
|
38
38
|
|
|
39
39
|
it 'returns the value of the interactive option' do
|
|
@@ -41,7 +41,39 @@ module Vedeu
|
|
|
41
41
|
end
|
|
42
42
|
end
|
|
43
43
|
|
|
44
|
-
describe '
|
|
44
|
+
describe '.log' do
|
|
45
|
+
context 'when the log is not configured' do
|
|
46
|
+
it { described.log.must_equal(nil) }
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
context 'when the log is configured' do
|
|
50
|
+
before do
|
|
51
|
+
Vedeu.configure do
|
|
52
|
+
log '/tmp/vedeu.log'
|
|
53
|
+
end
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it { described.log.must_equal('/tmp/vedeu.log') }
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
describe '.log?' do
|
|
61
|
+
context 'when the log is not configured' do
|
|
62
|
+
it { described.log?.must_equal(false) }
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
context 'when the log is configured' do
|
|
66
|
+
before do
|
|
67
|
+
Vedeu.configure do
|
|
68
|
+
log '/tmp/vedeu.log'
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it { described.log?.must_equal(true) }
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
describe '.once?' do
|
|
45
77
|
it { described.must_respond_to(:once) }
|
|
46
78
|
|
|
47
79
|
it 'returns the value of the once option' do
|
|
@@ -49,25 +81,25 @@ module Vedeu
|
|
|
49
81
|
end
|
|
50
82
|
end
|
|
51
83
|
|
|
52
|
-
describe '
|
|
84
|
+
describe '.stdin' do
|
|
53
85
|
it 'returns the value of the redefined STDIN' do
|
|
54
86
|
Configuration.stdin.must_equal(nil)
|
|
55
87
|
end
|
|
56
88
|
end
|
|
57
89
|
|
|
58
|
-
describe '
|
|
90
|
+
describe '.stdout' do
|
|
59
91
|
it 'returns the value of the redefined STDOUT' do
|
|
60
92
|
Configuration.stdout.must_equal(nil)
|
|
61
93
|
end
|
|
62
94
|
end
|
|
63
95
|
|
|
64
|
-
describe '
|
|
96
|
+
describe '.stderr' do
|
|
65
97
|
it 'returns the value of the redefined STDERR' do
|
|
66
98
|
Configuration.stderr.must_equal(nil)
|
|
67
99
|
end
|
|
68
100
|
end
|
|
69
101
|
|
|
70
|
-
describe '
|
|
102
|
+
describe '.terminal_mode' do
|
|
71
103
|
it 'returns the value of the mode option' do
|
|
72
104
|
Configuration.terminal_mode.must_equal(:raw)
|
|
73
105
|
end
|
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.50
|
|
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-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: guard
|
|
@@ -318,6 +318,8 @@ files:
|
|
|
318
318
|
- lib/vedeu/cli/generator/application.rb
|
|
319
319
|
- lib/vedeu/cli/generator/helpers.rb
|
|
320
320
|
- lib/vedeu/cli/generator/templates/application/Gemfile
|
|
321
|
+
- lib/vedeu/cli/generator/templates/application/LICENSE.txt
|
|
322
|
+
- lib/vedeu/cli/generator/templates/application/README.md
|
|
321
323
|
- lib/vedeu/cli/generator/templates/application/app/controllers/application_controller.erb
|
|
322
324
|
- lib/vedeu/cli/generator/templates/application/app/controllers/name.erb
|
|
323
325
|
- lib/vedeu/cli/generator/templates/application/app/helpers/application_helper.erb
|