vedeu 0.6.25 → 0.6.26

Sign up to get free protection for your applications and to get access to all the features.
Files changed (75) hide show
  1. checksums.yaml +4 -4
  2. data/lib/vedeu/application/application_view.rb +2 -2
  3. data/lib/vedeu/bindings/drb.rb +1 -1
  4. data/lib/vedeu/bindings/movement.rb +4 -4
  5. data/lib/vedeu/borders/border.rb +5 -13
  6. data/lib/vedeu/borders/refresh.rb +4 -1
  7. data/lib/vedeu/buffers/buffer.rb +1 -1
  8. data/lib/vedeu/colours/background.rb +2 -2
  9. data/lib/vedeu/colours/foreground.rb +2 -2
  10. data/lib/vedeu/colours/translator.rb +4 -4
  11. data/lib/vedeu/configuration/api.rb +1 -1
  12. data/lib/vedeu/configuration/configuration.rb +1 -1
  13. data/lib/vedeu/cursors/cursor.rb +2 -2
  14. data/lib/vedeu/distributed/client.rb +3 -3
  15. data/lib/vedeu/distributed/server.rb +16 -15
  16. data/lib/vedeu/distributed/subprocess.rb +2 -2
  17. data/lib/vedeu/distributed/uri.rb +1 -1
  18. data/lib/vedeu/dsl/composition.rb +3 -2
  19. data/lib/vedeu/dsl/dsl.rb +2 -1
  20. data/lib/vedeu/dsl/interface.rb +1 -1
  21. data/lib/vedeu/dsl/keymap.rb +3 -3
  22. data/lib/vedeu/editor/cropper.rb +1 -1
  23. data/lib/vedeu/editor/cursor.rb +1 -1
  24. data/lib/vedeu/editor/line.rb +1 -1
  25. data/lib/vedeu/error.rb +2 -2
  26. data/lib/vedeu/esc/actions.rb +15 -15
  27. data/lib/vedeu/esc/borders.rb +12 -12
  28. data/lib/vedeu/esc/colours.rb +10 -8
  29. data/lib/vedeu/esc/esc.rb +10 -9
  30. data/lib/vedeu/events/aliases.rb +1 -4
  31. data/lib/vedeu/events/event.rb +5 -4
  32. data/lib/vedeu/geometry/generic_coordinate.rb +1 -1
  33. data/lib/vedeu/geometry/geometry.rb +2 -4
  34. data/lib/vedeu/geometry/position.rb +2 -2
  35. data/lib/vedeu/groups/refresh.rb +2 -2
  36. data/lib/vedeu/input/keymap.rb +3 -2
  37. data/lib/vedeu/input/mapper.rb +1 -1
  38. data/lib/vedeu/logging/lockless_log_device.rb +1 -1
  39. data/lib/vedeu/logging/log.rb +2 -2
  40. data/lib/vedeu/logging/mono_logger.rb +1 -1
  41. data/lib/vedeu/logging/timer.rb +2 -1
  42. data/lib/vedeu/models/escape.rb +2 -2
  43. data/lib/vedeu/models/focus.rb +5 -3
  44. data/lib/vedeu/models/page.rb +2 -2
  45. data/lib/vedeu/models/views/html_char.rb +15 -14
  46. data/lib/vedeu/models/views/view.rb +2 -1
  47. data/lib/vedeu/output/clear/interface.rb +4 -4
  48. data/lib/vedeu/output/compressor.rb +3 -3
  49. data/lib/vedeu/output/presentation/presentation.rb +2 -2
  50. data/lib/vedeu/output/presentation/style.rb +1 -1
  51. data/lib/vedeu/output/refresh/refresh.rb +1 -1
  52. data/lib/vedeu/output/renderers/all.rb +2 -0
  53. data/lib/vedeu/output/renderers/file.rb +1 -1
  54. data/lib/vedeu/output/viewport.rb +1 -1
  55. data/lib/vedeu/output/wordwrap.rb +4 -4
  56. data/lib/vedeu/plugins/plugin.rb +3 -3
  57. data/lib/vedeu/plugins/plugins.rb +4 -3
  58. data/lib/vedeu/repositories/model.rb +6 -6
  59. data/lib/vedeu/repositories/repositories.rb +1 -1
  60. data/lib/vedeu/repositories/repository.rb +11 -10
  61. data/lib/vedeu/repositories/store.rb +1 -1
  62. data/lib/vedeu/runtime/bootstrap.rb +8 -8
  63. data/lib/vedeu/runtime/launcher.rb +1 -1
  64. data/lib/vedeu/runtime/main_loop.rb +1 -1
  65. data/lib/vedeu/runtime/router.rb +10 -8
  66. data/lib/vedeu/templating/template.rb +2 -2
  67. data/lib/vedeu/terminal/buffer.rb +10 -11
  68. data/lib/vedeu/terminal/terminal.rb +2 -2
  69. data/lib/vedeu/version.rb +1 -1
  70. data/test/lib/vedeu/borders/border_test.rb +1 -11
  71. data/test/lib/vedeu/colours/repository_test.rb +2 -1
  72. data/test/lib/vedeu/esc/colours_test.rb +50 -0
  73. data/test/lib/vedeu/repositories/repository_test.rb +0 -2
  74. data/test/lib/vedeu/terminal/buffer_test.rb +0 -209
  75. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 815df61c875e913607ccedbc8d9851c4888b4a5b
4
- data.tar.gz: 31b4afe5a7789f707d7e17ae05127c8e66b34684
3
+ metadata.gz: d1887422f1850ce922c9ff7432e5f1d21c99082e
4
+ data.tar.gz: 81c7143285b7b0732f735e04443357587d5431b0
5
5
  SHA512:
6
- metadata.gz: cf4133bd63868341598ed14ca0b0086f45f8604f40bebe8013365ba36976fed7502755e93c09a968810db61cc07ae410089bfcb0b3f266c9ce27f9b38ec509a8
7
- data.tar.gz: 88c0bee0f579b4a8d75c693e78c3cd99d263f7f867601c3c69fd0d081ff387024f138a6dd1b7e97cc82379a8a88b1a7f4dd6229956dd27b7bd22ee019bd95b07
6
+ metadata.gz: 2d0f9447a963a1aaf8fa2cd3d3e1e22f3baaaaeb2627691789c4d6f2ba7620490c7abdfa503b3a218754a018b40ae7b4b49bfe8a494ddd76b4750ae88af7107c
7
+ data.tar.gz: 255837e17cb62a1b4cc45cb65742a5de5feaa4e7a94bb859ba06def48c13ed37cce6a74ecdf761367da17ef69b783aa9b58c1a8b3d1d369f46a498e0ba04dc3f
@@ -33,7 +33,7 @@ module Vedeu
33
33
  def render
34
34
  fail Vedeu::Error::NotImplemented,
35
35
  'The subclass of Vedeu::ApplicationView must implement the #render' \
36
- 'method.'
36
+ 'method.'.freeze
37
37
  end
38
38
 
39
39
  protected
@@ -51,7 +51,7 @@ module Vedeu
51
51
  # @return [String]
52
52
  def template(value)
53
53
  @template = Vedeu::Configuration.base_path +
54
- "/app/views/templates/#{value}.erb"
54
+ "/app/views/templates/#{value}.erb".freeze
55
55
  end
56
56
 
57
57
  end # ApplicationView
@@ -27,7 +27,7 @@ module Vedeu
27
27
  # See {file:docs/events/drb.md#\_drb_input_}
28
28
  def drb_input!
29
29
  Vedeu.bind(:_drb_input_) do |data, type|
30
- Vedeu.log(type: :drb, message: "Sending input (#{type})")
30
+ Vedeu.log(type: :drb, message: "Sending input (#{type})".freeze)
31
31
 
32
32
  case type
33
33
  when :command then Vedeu.trigger(:_command_, data)
@@ -22,8 +22,8 @@ module Vedeu
22
22
  # @return [TrueClass]
23
23
  def setup_aliases!
24
24
  %w(down left right up).each do |direction|
25
- Vedeu.bind_alias("_geometry_#{direction}_".to_sym,
26
- "_view_#{direction}_".to_sym)
25
+ Vedeu.bind_alias(:"_geometry_#{direction}_",
26
+ :"_view_#{direction}_")
27
27
  end
28
28
 
29
29
  Vedeu.bind_alias(:_cursor_reset_, :_cursor_origin_)
@@ -36,13 +36,13 @@ module Vedeu
36
36
  # See {file:docs/events/movement.md#\_cursor_up_down_left_right_}
37
37
  def directional!
38
38
  %w(down left right up).each do |direction|
39
- Vedeu.bind("_cursor_#{direction}_".to_sym) do |name|
39
+ Vedeu.bind(:"_cursor_#{direction}_") do |name|
40
40
  Vedeu.cursors.by_name(name).send("move_#{direction}")
41
41
 
42
42
  Vedeu.trigger(:_refresh_cursor_, name)
43
43
  end
44
44
 
45
- Vedeu.bind("_view_#{direction}_".to_sym) do |name|
45
+ Vedeu.bind(:"_view_#{direction}_") do |name|
46
46
  Vedeu.geometries.by_name(name).send("move_#{direction}")
47
47
 
48
48
  Vedeu.trigger(:_clear_)
@@ -25,8 +25,6 @@ module Vedeu
25
25
  :y,
26
26
  :yn
27
27
 
28
- def_delegators :interface, :visible?
29
-
30
28
  # @!attribute [rw] attributes
31
29
  # @return [Hash]
32
30
  attr_accessor :attributes
@@ -87,6 +85,10 @@ module Vedeu
87
85
  # @return [String]
88
86
  attr_reader :name
89
87
 
88
+ # @!attribute [r] parent
89
+ # @return [Vedeu::Models::Interface|NilClass]
90
+ attr_reader :parent
91
+
90
92
  # @!attribute [r] enabled
91
93
  # @return [Boolean]
92
94
  attr_accessor :enabled
@@ -170,11 +172,6 @@ module Vedeu
170
172
  (by..byn).size
171
173
  end
172
174
 
173
- # @return [Array<Array<Vedeu::Views::Char>>]
174
- def render
175
- Vedeu.trigger(:_refresh_border_, name)
176
- end
177
-
178
175
  private
179
176
 
180
177
  # @return [Vedeu::Geometry::Geometry]
@@ -182,12 +179,6 @@ module Vedeu
182
179
  Vedeu.geometries.by_name(name)
183
180
  end
184
181
 
185
- # @return [Vedeu::Models::Interface]
186
- def interface
187
- @interface ||= Vedeu.interfaces.by_name(name)
188
- end
189
- alias_method :parent, :interface
190
-
191
182
  # The default values for a new instance of this class.
192
183
  #
193
184
  # @return [Hash]
@@ -202,6 +193,7 @@ module Vedeu
202
193
  enabled: false,
203
194
  horizontal: Vedeu::EscapeSequences::Borders.horizontal,
204
195
  name: '',
196
+ parent: nil,
205
197
  repository: Vedeu.borders,
206
198
  show_bottom: true,
207
199
  show_left: true,
@@ -38,6 +38,9 @@ module Vedeu
38
38
  :y,
39
39
  :yn
40
40
 
41
+ def_delegators :interface,
42
+ :visible?
43
+
41
44
  # @example
42
45
  # Vedeu.trigger(:_refresh_border_, name)
43
46
  #
@@ -75,7 +78,7 @@ module Vedeu
75
78
 
76
79
  # @return [Array<Array<Vedeu::Views::Char>>]
77
80
  def output
78
- Vedeu.timer("Drawing border: '#{name}'") do
81
+ Vedeu.timer("Drawing border: '#{name}'".freeze) do
79
82
  out = [top, bottom]
80
83
 
81
84
  height.times { |y| out << [left(y), right(y)] }
@@ -140,7 +140,7 @@ module Vedeu
140
140
  #
141
141
  # @return [Boolean]
142
142
  def swap
143
- Vedeu.log(type: :output, message: "Buffer swapping: '#{name}'")
143
+ Vedeu.log(type: :output, message: "Buffer swapping: '#{name}'".freeze)
144
144
 
145
145
  @previous = front
146
146
  @front = back
@@ -17,7 +17,7 @@ module Vedeu
17
17
 
18
18
  # @return [String]
19
19
  def numbered_prefix
20
- "\e[48;5;"
20
+ "\e[48;5;".freeze
21
21
  end
22
22
 
23
23
  # @return [Vedeu::Colours::Backgrounds]
@@ -27,7 +27,7 @@ module Vedeu
27
27
 
28
28
  # @return [String]
29
29
  def rgb_prefix
30
- "\e[48;2;%s;%s;%sm"
30
+ "\e[48;2;%s;%s;%sm".freeze
31
31
  end
32
32
 
33
33
  end # Background
@@ -17,7 +17,7 @@ module Vedeu
17
17
 
18
18
  # @return [String]
19
19
  def numbered_prefix
20
- "\e[38;5;"
20
+ "\e[38;5;".freeze
21
21
  end
22
22
 
23
23
  # @return [Vedeu::Colours::Foregrounds]
@@ -27,7 +27,7 @@ module Vedeu
27
27
 
28
28
  # @return [String]
29
29
  def rgb_prefix
30
- "\e[38;2;%s;%s;%sm"
30
+ "\e[38;2;%s;%s;%sm".freeze
31
31
  end
32
32
 
33
33
  end # Foreground
@@ -143,7 +143,7 @@ module Vedeu
143
143
  #
144
144
  # @return [String]
145
145
  def named
146
- "\e[#{named_codes}m"
146
+ "\e[#{named_codes}m".freeze
147
147
  end
148
148
 
149
149
  # Returns a boolean indicating whether the colour provided is a
@@ -166,7 +166,7 @@ module Vedeu
166
166
  #
167
167
  # @return [String]
168
168
  def numbered
169
- "#{numbered_prefix}#{css_to_numbered}m"
169
+ "#{numbered_prefix}#{css_to_numbered}m".freeze
170
170
  end
171
171
 
172
172
  # Returns a boolean indicated whether the colour is a valid
@@ -174,7 +174,7 @@ module Vedeu
174
174
  #
175
175
  # @return [Boolean]
176
176
  def rgb?
177
- return true if colour =~ /^#([A-Fa-f0-9]{6})$/
177
+ return true if colour =~ /^#([A-Fa-f0-9]{6})$/.freeze
178
178
 
179
179
  false
180
180
  end
@@ -255,7 +255,7 @@ module Vedeu
255
255
  # must implement this method.
256
256
  # @return [Vedeu::Error::NotImplemented]
257
257
  def not_implemented
258
- fail Vedeu::Error::NotImplemented, 'Subclasses implement this.'
258
+ fail Vedeu::Error::NotImplemented, 'Subclasses implement this.'.freeze
259
259
  end
260
260
  alias_method :named_codes, :not_implemented
261
261
  alias_method :numbered_prefix, :not_implemented
@@ -509,7 +509,7 @@ module Vedeu
509
509
  # @raise [Vedeu::Error::InvalidSyntax]
510
510
  def invalid_mode!
511
511
  fail Vedeu::Error::InvalidSyntax,
512
- 'Terminal mode can be set to either :cooked, :fake or :raw'
512
+ 'Terminal mode can be set to either :cooked, :fake or :raw'.freeze
513
513
  end
514
514
 
515
515
  # Returns the options set via the configuration API DSL or an
@@ -14,7 +14,7 @@ module Vedeu
14
14
  def log(from, options)
15
15
  options.each do |option, value|
16
16
  Vedeu.log(type: :config,
17
- message: "#{from} #{option}: #{value}")
17
+ message: "#{from} #{option}: #{value}".freeze)
18
18
  end
19
19
  end
20
20
 
@@ -132,7 +132,7 @@ module Vedeu
132
132
  #
133
133
  # @return [Array<Vedeu::Models::Escape>]
134
134
  def render
135
- Vedeu.log(type: :info, message: "Refreshing cursor: '#{name}'")
135
+ Vedeu.log(type: :info, message: "Refreshing cursor: '#{name}'".freeze)
136
136
 
137
137
  Vedeu.render_output(escape_sequence)
138
138
  end
@@ -158,7 +158,7 @@ module Vedeu
158
158
  def to_s
159
159
  return escape_sequence.to_s unless block_given?
160
160
 
161
- "#{position}#{yield}#{escape_sequence}"
161
+ "#{position}#{yield}#{escape_sequence}".freeze
162
162
  end
163
163
  alias_method :to_str, :to_s
164
164
 
@@ -40,7 +40,7 @@ module Vedeu
40
40
 
41
41
  rescue DRb::DRbBadURI
42
42
  Vedeu.log_stdout(message: 'Could not connect to DRb server, URI may ' \
43
- 'be bad.')
43
+ 'be bad.'.freeze)
44
44
 
45
45
  :drb_bad_uri
46
46
  end
@@ -85,7 +85,7 @@ module Vedeu
85
85
  drb_connection_error
86
86
 
87
87
  rescue Interrupt
88
- Vedeu.log_stdout(message: 'Client application exited.')
88
+ Vedeu.log_stdout(message: 'Client application exited.'.freeze)
89
89
 
90
90
  ensure
91
91
  :shutdown
@@ -106,7 +106,7 @@ module Vedeu
106
106
 
107
107
  # @return [Symbol]
108
108
  def drb_connection_error
109
- Vedeu.log_stdout(message: 'Could not connect to DRb server.')
109
+ Vedeu.log_stdout(message: 'Could not connect to DRb server.'.freeze)
110
110
 
111
111
  :drb_connection_error
112
112
  end
@@ -92,19 +92,19 @@ module Vedeu
92
92
  #
93
93
  # @return [void]
94
94
  def restart
95
- log('Attempting to restart')
95
+ log('Attempting to restart'.freeze)
96
96
 
97
97
  return not_enabled unless Vedeu::Configuration.drb?
98
98
 
99
99
  if drb_running?
100
- log('Restarting')
100
+ log('Restarting'.freeze)
101
101
 
102
102
  stop
103
103
 
104
104
  start
105
105
 
106
106
  else
107
- log('Not running')
107
+ log('Not running'.freeze)
108
108
 
109
109
  start
110
110
 
@@ -136,15 +136,15 @@ module Vedeu
136
136
  #
137
137
  # @return [Vedeu::Distributed::Server]
138
138
  def start
139
- log('Attempting to start')
139
+ log('Attempting to start'.freeze)
140
140
 
141
141
  return not_enabled unless Vedeu::Configuration.drb?
142
142
 
143
143
  if drb_running?
144
- log('Already started')
144
+ log('Already started'.freeze)
145
145
 
146
146
  else
147
- log('Starting')
147
+ log('Starting'.freeze)
148
148
 
149
149
  DRb.start_service(uri, self)
150
150
 
@@ -159,17 +159,17 @@ module Vedeu
159
159
  #
160
160
  # @return [Symbol]
161
161
  def status
162
- log('Fetching status')
162
+ log('Fetching status'.freeze)
163
163
 
164
164
  return not_enabled unless Vedeu::Configuration.drb?
165
165
 
166
166
  if drb_running?
167
- log('Running')
167
+ log('Running'.freeze)
168
168
 
169
169
  :running
170
170
 
171
171
  else
172
- log('Stopped')
172
+ log('Stopped'.freeze)
173
173
 
174
174
  :stopped
175
175
 
@@ -183,23 +183,24 @@ module Vedeu
183
183
  #
184
184
  # @return [void]
185
185
  def stop
186
- log('Attempting to stop')
186
+ log('Attempting to stop'.freeze)
187
187
 
188
188
  return not_enabled unless Vedeu::Configuration.drb?
189
189
 
190
190
  if drb_running?
191
- log('Stopping')
191
+ log('Stopping'.freeze)
192
192
 
193
193
  DRb.stop_service
194
194
 
195
195
  DRb.thread.join
196
196
 
197
197
  else
198
- log('Already stopped')
198
+ log('Already stopped'.freeze)
199
199
 
200
200
  end
201
201
  rescue NoMethodError # raised when #join is called on NilClass.
202
- Vedeu.log(type: :drb, message: 'Attempted to #join on DRb.thread.')
202
+ Vedeu.log(type: :drb,
203
+ message: 'Attempted to #join on DRb.thread.'.freeze)
203
204
  end
204
205
 
205
206
  protected
@@ -217,12 +218,12 @@ module Vedeu
217
218
 
218
219
  # @return [void]
219
220
  def log(message)
220
- Vedeu.log(type: :drb, message: "#{message}: '#{uri}'")
221
+ Vedeu.log(type: :drb, message: "#{message}: '#{uri}'".freeze)
221
222
  end
222
223
 
223
224
  # @return [Symbol]
224
225
  def not_enabled
225
- log('Not enabled')
226
+ log('Not enabled'.freeze)
226
227
 
227
228
  :drb_not_enabled
228
229
  end
@@ -59,7 +59,7 @@ module Vedeu
59
59
 
60
60
  # @return [String]
61
61
  def command
62
- "ruby #{file_path}"
62
+ "ruby #{file_path}".freeze
63
63
  end
64
64
 
65
65
  # @return [Fixnum] The number of bytes written.
@@ -74,7 +74,7 @@ module Vedeu
74
74
 
75
75
  # @return [Fixnum] The number of files removed; 1.
76
76
  def file_unlink
77
- File.unlink("/tmp/foo_#{timestamp}")
77
+ File.unlink("/tmp/foo_#{timestamp}".freeze)
78
78
  end
79
79
 
80
80
  # return [String]
@@ -33,7 +33,7 @@ module Vedeu
33
33
  #
34
34
  # @return [String] The host and port as a single value.
35
35
  def to_s
36
- "druby://#{host}:#{port}"
36
+ "druby://#{host}:#{port}".freeze
37
37
  end
38
38
  alias_method :to_str, :to_s
39
39
 
@@ -94,9 +94,10 @@ module Vedeu
94
94
  # @return [Vedeu::Views::Views<Vedeu::Views::View>]
95
95
  def template_for(name, filename, object = nil, options = {})
96
96
  fail Vedeu::Error::MissingRequired,
97
- 'Cannot render template without the name of the view.' unless name
97
+ 'Cannot render template without the name of the ' \
98
+ 'view.'.freeze unless name
98
99
  fail Vedeu::Error::MissingRequired,
99
- 'Cannot render template without a filename.' unless filename
100
+ 'Cannot render template without a filename.'.freeze unless filename
100
101
 
101
102
  options.merge!(name: name)
102
103
 
@@ -54,7 +54,8 @@ module Vedeu
54
54
  # @return [void]
55
55
  def method_missing(method, *args, &block)
56
56
  Vedeu.log(type: :debug,
57
- message: "!!!method_missing '#{method}' (#{client.inspect})")
57
+ message: "!!!method_missing '#{method}' " \
58
+ "(#{client.inspect})".freeze)
58
59
 
59
60
  client.send(method, *args, &block) if client
60
61
  end
@@ -37,7 +37,7 @@ module Vedeu
37
37
  def interface(name, &block)
38
38
  fail Vedeu::Error::RequiresBlock unless block_given?
39
39
  fail Vedeu::Error::MissingRequired,
40
- 'name not given' unless present?(name)
40
+ 'name not given'.freeze unless present?(name)
41
41
 
42
42
  add_buffers!(name)
43
43
  add_cursor!(name)