vedeu 0.4.58 → 0.4.59

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.rubocop.yml +0 -558
  3. data/README.md +2 -0
  4. data/docs/dsl.md +66 -54
  5. data/lib/vedeu/all.rb +44 -16
  6. data/lib/vedeu/api.rb +0 -2
  7. data/lib/vedeu/bindings/drb.rb +0 -1
  8. data/lib/vedeu/bindings/menus.rb +0 -1
  9. data/lib/vedeu/bindings/movement.rb +0 -1
  10. data/lib/vedeu/bindings/system.rb +0 -1
  11. data/lib/vedeu/bindings/visibility.rb +0 -1
  12. data/lib/vedeu/bootstrap.rb +2 -2
  13. data/lib/vedeu/buffers/buffers.rb +0 -4
  14. data/lib/vedeu/cli/generator/all.rb +0 -4
  15. data/lib/vedeu/cli/generator/helpers.rb +0 -2
  16. data/lib/vedeu/cli/generator/templates/application/application.erb +8 -5
  17. data/lib/vedeu/cli/generator/view.rb +4 -2
  18. data/lib/vedeu/cli/main.rb +0 -2
  19. data/lib/vedeu/colours/backgrounds.rb +0 -1
  20. data/lib/vedeu/colours/colours.rb +0 -1
  21. data/lib/vedeu/colours/foregrounds.rb +0 -1
  22. data/lib/vedeu/configuration/api.rb +19 -6
  23. data/lib/vedeu/configuration/cli.rb +9 -1
  24. data/lib/vedeu/configuration/configuration.rb +9 -0
  25. data/lib/vedeu/cursor/cursor.rb +0 -2
  26. data/lib/vedeu/cursor/cursors.rb +0 -3
  27. data/lib/vedeu/debug.rb +0 -1
  28. data/lib/vedeu/dsl.rb +0 -1
  29. data/lib/vedeu/dsl/border.rb +69 -106
  30. data/lib/vedeu/dsl/composition.rb +1 -2
  31. data/lib/vedeu/dsl/geometry.rb +102 -67
  32. data/lib/vedeu/dsl/group.rb +21 -9
  33. data/lib/vedeu/dsl/interface.rb +0 -1
  34. data/lib/vedeu/dsl/keymap.rb +26 -36
  35. data/lib/vedeu/dsl/line.rb +5 -10
  36. data/lib/vedeu/dsl/menu.rb +7 -13
  37. data/lib/vedeu/dsl/presentation.rb +0 -1
  38. data/lib/vedeu/dsl/stream.rb +0 -1
  39. data/lib/vedeu/dsl/text.rb +0 -1
  40. data/lib/vedeu/dsl/use.rb +0 -1
  41. data/lib/vedeu/dsl/view.rb +28 -31
  42. data/lib/vedeu/events/event.rb +0 -3
  43. data/lib/vedeu/events/events.rb +0 -1
  44. data/lib/vedeu/events/trigger.rb +0 -1
  45. data/lib/vedeu/geometry/geometries.rb +0 -4
  46. data/lib/vedeu/geometry/geometry.rb +0 -2
  47. data/lib/vedeu/geometry/grid.rb +2 -25
  48. data/lib/vedeu/input/keymap.rb +0 -3
  49. data/lib/vedeu/input/keymaps.rb +0 -3
  50. data/lib/vedeu/launcher.rb +0 -1
  51. data/lib/vedeu/log.rb +0 -1
  52. data/lib/vedeu/models/char.rb +0 -5
  53. data/lib/vedeu/models/group.rb +0 -2
  54. data/lib/vedeu/models/groups.rb +0 -3
  55. data/lib/vedeu/models/interface.rb +0 -19
  56. data/lib/vedeu/models/interfaces.rb +0 -4
  57. data/lib/vedeu/models/menus.rb +0 -3
  58. data/lib/vedeu/null/interface.rb +6 -7
  59. data/lib/vedeu/output/border.rb +0 -2
  60. data/lib/vedeu/output/borders.rb +0 -4
  61. data/lib/vedeu/output/esc.rb +0 -1
  62. data/lib/vedeu/output/html_char.rb +0 -2
  63. data/lib/vedeu/output/refresh.rb +0 -3
  64. data/lib/vedeu/output/refresh_group.rb +0 -2
  65. data/lib/vedeu/output/renderers.rb +0 -13
  66. data/lib/vedeu/repositories.rb +2 -15
  67. data/lib/vedeu/repositories/model.rb +0 -2
  68. data/lib/vedeu/repositories/repository.rb +0 -2
  69. data/lib/vedeu/templating/template.rb +0 -2
  70. data/lib/vedeu/terminal.rb +0 -3
  71. data/lib/vedeu/timer.rb +0 -1
  72. data/lib/vedeu/version.rb +1 -1
  73. data/test/lib/vedeu/bootstrap_test.rb +8 -1
  74. data/test/lib/vedeu/configuration/api_test.rb +14 -0
  75. data/test/lib/vedeu/configuration/cli_test.rb +15 -0
  76. data/test/lib/vedeu/cursor/cursor_test.rb +0 -1
  77. data/test/lib/vedeu/models/interface_test.rb +12 -4
  78. data/test/lib/vedeu/null/interface_test.rb +3 -12
  79. data/test/support/helpers/model_test_class.rb +0 -3
  80. data/test/test_helper.rb +0 -2
  81. data/vedeu.gemspec +1 -1
  82. metadata +4 -4
@@ -1,11 +1,7 @@
1
- require 'vedeu/null/interface'
2
- require 'vedeu/models/interface'
3
-
4
1
  module Vedeu
5
2
 
6
3
  # Allows the storing of interfaces and views.
7
4
  #
8
- # @api public
9
5
  class Interfaces < Vedeu::Repository
10
6
 
11
7
  class << self
@@ -1,10 +1,7 @@
1
- require 'vedeu/models/menu'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Allows the storing of menus by name.
6
4
  #
7
- # @api public
8
5
  class Menus < Vedeu::Repository
9
6
 
10
7
  class << self
@@ -18,6 +18,11 @@ module Vedeu
18
18
  # @return [String]
19
19
  attr_reader :attributes
20
20
 
21
+ # @!attribute [rw] visible
22
+ # @return [String]
23
+ attr_accessor :visible
24
+ alias_method :visible?, :visible
25
+
21
26
  # Returns a new instance of Vedeu::Null::Interface.
22
27
  #
23
28
  # @param attributes [Hash<Symbol => void>]
@@ -26,6 +31,7 @@ module Vedeu
26
31
  def initialize(attributes = {})
27
32
  @attributes = attributes
28
33
  @name = @attributes[:name]
34
+ @visible = @attributes[:visible]
29
35
  end
30
36
 
31
37
  # @return [NilClass]
@@ -69,13 +75,6 @@ module Vedeu
69
75
  false
70
76
  end
71
77
 
72
- # Override the visible= setter usually found on a Vedeu::Interface.
73
- #
74
- # @return [FalseClass]
75
- def visible=(*)
76
- false
77
- end
78
-
79
78
  end # Interface
80
79
 
81
80
  end # Null
@@ -1,5 +1,3 @@
1
- require 'vedeu/output/render_border'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Provides the mechanism to decorate an interface with a border on all edges,
@@ -1,12 +1,8 @@
1
- require 'vedeu/null/border'
2
- require 'vedeu/output/border'
3
-
4
1
  module Vedeu
5
2
 
6
3
  # Allows the storing of interface/view borders independent of the interface
7
4
  # instance.
8
5
  #
9
- # @api public
10
6
  class Borders < Vedeu::Repository
11
7
 
12
8
  class << self
@@ -3,7 +3,6 @@ module Vedeu
3
3
  # Provides escape sequence strings for setting the cursor position and various
4
4
  # display related functions.
5
5
  #
6
- # @api public
7
6
  module Esc
8
7
 
9
8
  extend self
@@ -1,5 +1,3 @@
1
- require 'vedeu/common'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Represents a {Vedeu::Char} as a HTML tag with value. By default, a table
@@ -1,5 +1,3 @@
1
- require 'vedeu/output/refresh_group'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Refreshes the terminal.
@@ -9,7 +7,6 @@ module Vedeu
9
7
  # in z-index order, meaning that interfaces with a lower z-index will be
10
8
  # drawn first. This means overlapping interfaces will be drawn as specified.
11
9
  #
12
- # @api public
13
10
  module Refresh
14
11
 
15
12
  module_function
@@ -1,5 +1,3 @@
1
- require 'vedeu/output/refresh'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Refreshes the given named group of interfaces.
@@ -1,12 +1,3 @@
1
- require 'vedeu/output/renderers/renderer_options'
2
- require 'vedeu/output/renderers/escape_sequence'
3
- require 'vedeu/output/renderers/file'
4
- require 'vedeu/output/renderers/html'
5
- require 'vedeu/output/renderers/json'
6
- require 'vedeu/output/renderers/null'
7
- require 'vedeu/output/renderers/terminal'
8
- require 'vedeu/output/renderers/text'
9
-
10
1
  module Vedeu
11
2
 
12
3
  # Provides a single interface to all registered renderers.
@@ -21,7 +12,6 @@ module Vedeu
21
12
  # @example
22
13
  # Vedeu.renderers
23
14
  #
24
- # @api public
25
15
  # @return [Module]
26
16
  def renderers
27
17
  self
@@ -30,7 +20,6 @@ module Vedeu
30
20
  # @example
31
21
  # Vedeu.renderers.render(output)
32
22
  #
33
- # @api public
34
23
  # @param output [void]
35
24
  # @return [Array<void>]
36
25
  def render(output)
@@ -55,7 +44,6 @@ module Vedeu
55
44
  # @note
56
45
  # A renderer class must respond to the '.render' class method.
57
46
  #
58
- # @api public
59
47
  # @param renderers [Class]
60
48
  # @return [Set]
61
49
  def renderer(*renderers)
@@ -67,7 +55,6 @@ module Vedeu
67
55
  # @example
68
56
  # Vedeu.renderers.reset
69
57
  #
70
- # @api public
71
58
  # @return [Set]
72
59
  def reset
73
60
  @storage = Set.new
@@ -6,6 +6,8 @@ module Vedeu
6
6
 
7
7
  extend self
8
8
 
9
+ # Register a repository with the collection of Vedeu repositories.
10
+ #
9
11
  # @param klass [Class]
10
12
  # @return [Set]
11
13
  def register(klass)
@@ -55,18 +57,3 @@ module Vedeu
55
57
  end # Repositories
56
58
 
57
59
  end # Vedeu
58
-
59
- require 'vedeu/repositories/store'
60
- require 'vedeu/repositories/registerable'
61
- require 'vedeu/repositories/collection'
62
-
63
- require 'vedeu/events/event_collection'
64
- require 'vedeu/input/keys'
65
-
66
- require 'vedeu/models/chars'
67
- require 'vedeu/models/interface_collection'
68
- require 'vedeu/models/lines'
69
- require 'vedeu/models/streams'
70
-
71
- require 'vedeu/repositories/model'
72
- require 'vedeu/repositories/repository'
@@ -1,5 +1,3 @@
1
- require 'vedeu/common'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # When included into a class, provides the mechanism to store the class in a
@@ -1,5 +1,3 @@
1
- require 'vedeu/common'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Provides common methods for accessing the various repositories Vedeu uses.
@@ -1,5 +1,3 @@
1
- require 'vedeu/templating/preprocessor'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Provides means to use templates with Vedeu.
@@ -1,11 +1,8 @@
1
- require 'vedeu/configuration/configuration'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # This module is the direct interface between Vedeu and your terminal/
6
4
  # console, via Ruby's IO core library.
7
5
  #
8
- # @api public
9
6
  module Terminal
10
7
 
11
8
  include Vedeu::TerminalMode
data/lib/vedeu/timer.rb CHANGED
@@ -2,7 +2,6 @@ module Vedeu
2
2
 
3
3
  # Measure the duration. Used for debugging.
4
4
  #
5
- # @api public
6
5
  class Timer
7
6
 
8
7
  class << self
data/lib/vedeu/version.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  module Vedeu
2
2
 
3
3
  # The current version of Vedeu.
4
- VERSION = '0.4.58'
4
+ VERSION = '0.4.59'
5
5
 
6
6
  end
@@ -1,5 +1,12 @@
1
1
  require 'test_helper'
2
2
 
3
+ module YourApp
4
+
5
+ class SomeController
6
+ end # SomeController
7
+
8
+ end # YourApp
9
+
3
10
  module Vedeu
4
11
 
5
12
  describe Bootstrap do
@@ -7,7 +14,7 @@ module Vedeu
7
14
  let(:described) { Vedeu::Bootstrap }
8
15
  let(:instance) { described.new(argv, entry_point) }
9
16
  let(:argv) { [] }
10
- let(:entry_point) {}
17
+ let(:entry_point) { YourApp::SomeController.new }
11
18
 
12
19
  describe '#initialize' do
13
20
  it { instance.must_be_instance_of(described) }
@@ -1,5 +1,12 @@
1
1
  require 'test_helper'
2
2
 
3
+ module YourApp
4
+
5
+ class SomeController
6
+ end # SomeController
7
+
8
+ end # YourApp
9
+
3
10
  module Vedeu
4
11
 
5
12
  module Config
@@ -225,6 +232,13 @@ module Vedeu
225
232
  it { instance.must_respond_to(:renderers) }
226
233
  end
227
234
 
235
+ describe '#root' do
236
+ it 'sets the options to the desired value' do
237
+ configuration = Vedeu.configure { root(::YourApp::SomeController.new) }
238
+ configuration.root.must_be_instance_of(YourApp::SomeController)
239
+ end
240
+ end
241
+
228
242
  describe '#stdin' do
229
243
  let(:io) {}
230
244
 
@@ -1,5 +1,13 @@
1
1
  require 'test_helper'
2
2
 
3
+ module YourApp
4
+
5
+ class SomeController
6
+
7
+ end # SomeController
8
+
9
+ end # YourApp
10
+
3
11
  module Vedeu
4
12
 
5
13
  module Config
@@ -119,6 +127,13 @@ module Vedeu
119
127
  end
120
128
  end
121
129
 
130
+ describe '#root' do
131
+ it '--root' do
132
+ Configuration.configure(['--root', 'YourApp::SomeController.new'])
133
+ Configuration.root.must_equal('YourApp::SomeController.new')
134
+ end
135
+ end
136
+
122
137
  describe '#terminal_mode' do
123
138
  it '--cooked' do
124
139
  Configuration.configure(['--cooked'])
@@ -1,5 +1,4 @@
1
1
  require 'test_helper'
2
- require 'vedeu/cursor/cursor'
3
2
 
4
3
  module Vedeu
5
4
 
@@ -74,10 +74,14 @@ module Vedeu
74
74
  end
75
75
 
76
76
  describe '#hide' do
77
+ before { Vedeu::Output.stubs(:render) }
78
+
77
79
  subject { instance.hide }
78
80
 
79
- # @todo
80
- # it { skip }
81
+ it {
82
+ Vedeu::Output.expects(:render)
83
+ subject
84
+ }
81
85
  end
82
86
 
83
87
  describe '#inspect' do
@@ -161,10 +165,14 @@ module Vedeu
161
165
  end
162
166
 
163
167
  describe '#show' do
168
+ before { Vedeu::Output.stubs(:render) }
169
+
164
170
  subject { instance.show }
165
171
 
166
- # @todo
167
- # it { skip }
172
+ it {
173
+ Vedeu::Output.expects(:render)
174
+ subject
175
+ }
168
176
  end
169
177
 
170
178
  describe '#store' do
@@ -26,6 +26,9 @@ module Vedeu
26
26
  describe 'accessors' do
27
27
  it { instance.must_respond_to(:name) }
28
28
  it { instance.must_respond_to(:attributes) }
29
+ it { instance.must_respond_to(:visible) }
30
+ it { instance.must_respond_to(:visible=) }
31
+ it { instance.must_respond_to(:visible?) }
29
32
  end
30
33
 
31
34
  describe '#hide' do
@@ -52,18 +55,6 @@ module Vedeu
52
55
  it { instance.toggle.must_be_instance_of(NilClass) }
53
56
  end
54
57
 
55
- describe '#visible?' do
56
- it { instance.visible?.must_be_instance_of(FalseClass) }
57
- end
58
-
59
- describe '#visible=' do
60
- subject { instance.visible=(:irrelevant) }
61
-
62
- # @todo
63
- # it { skip }
64
- # it { subject.must_be_instance_of(FalseClass) }
65
- end
66
-
67
58
  end # Interface
68
59
 
69
60
  end # Null
@@ -1,6 +1,3 @@
1
- require 'vedeu/repositories/model'
2
- require 'vedeu/output/presentation'
3
-
4
1
  module Vedeu
5
2
 
6
3
  module RepositoryTestModule
data/test/test_helper.rb CHANGED
@@ -32,8 +32,6 @@ SimpleCov.start do
32
32
  add_group 'null', 'vedeu/null'
33
33
  add_group 'output', 'vedeu/output'
34
34
  add_group 'repositories', 'vedeu/repositories'
35
- add_group 'storage', 'vedeu/storage'
36
- add_group 'support', 'vedeu/support'
37
35
  add_group 'templating', 'vedeu/templating'
38
36
  end unless ENV['NO_SIMPLECOV']
39
37
 
data/vedeu.gemspec CHANGED
@@ -20,7 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
21
21
  spec.require_paths = ['lib']
22
22
 
23
- spec.add_development_dependency 'guard', '2.12.8'
23
+ spec.add_development_dependency 'guard', '2.12.9'
24
24
  spec.add_development_dependency 'guard-minitest', '2.4.4'
25
25
  spec.add_development_dependency 'minitest', '5.7.0'
26
26
  spec.add_development_dependency 'minitest-reporters', '1.0.19'
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.58
4
+ version: 0.4.59
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-22 00:00:00.000000000 Z
11
+ date: 2015-07-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: guard
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - '='
18
18
  - !ruby/object:Gem::Version
19
- version: 2.12.8
19
+ version: 2.12.9
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - '='
25
25
  - !ruby/object:Gem::Version
26
- version: 2.12.8
26
+ version: 2.12.9
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: guard-minitest
29
29
  requirement: !ruby/object:Gem::Requirement