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
@@ -4,7 +4,6 @@ module Vedeu
4
4
 
5
5
  # Provides methods to be used to define views.
6
6
  #
7
- # @example
8
7
  # Vedeu.renders do
9
8
  # view 'my_interface' do
10
9
  # lines do
@@ -31,7 +30,6 @@ module Vedeu
31
30
  # end
32
31
  # end
33
32
  #
34
- # @api public
35
33
  class Line
36
34
 
37
35
  include Vedeu::DSL
@@ -50,14 +48,13 @@ module Vedeu
50
48
 
51
49
  # Specify a single line in a view.
52
50
  #
53
- # @example
54
51
  # Vedeu.renders do
55
52
  # view 'my_interface' do
56
53
  # line 'some text...'
57
- # # ...
54
+ # # ... some code
58
55
  #
59
56
  # line do
60
- # # ...
57
+ # # ... some code
61
58
  # end
62
59
  # end
63
60
  # end
@@ -85,23 +82,21 @@ module Vedeu
85
82
  # Define multiple streams (a stream is a subset of a line).
86
83
  # Uses {Vedeu::DSL::Stream} for all directives within the required block.
87
84
  #
88
- # @param block [Proc]
89
- #
90
- # @example
91
85
  # Vedeu.renders do
92
86
  # view 'my_interface' do
93
87
  # line do
94
88
  # streams do
95
- # # ...
89
+ # # ... some code
96
90
  # end
97
91
  #
98
92
  # stream do
99
- # # ...
93
+ # # ... some code
100
94
  # end
101
95
  # end
102
96
  # end
103
97
  # end
104
98
  #
99
+ # @param block [Proc]
105
100
  # @raise [Vedeu::InvalidSyntax] The required block was not given.
106
101
  # @return [Vedeu::Streams<Vedeu::Stream>]
107
102
  # @see Vedeu::DSL::Stream for subdirectives.
@@ -5,7 +5,6 @@ module Vedeu
5
5
  # Provides the mechanism to create menus within client applications and use
6
6
  # events to drive them.
7
7
  #
8
- # @api public
9
8
  class Menu
10
9
 
11
10
  include Vedeu::DSL
@@ -24,8 +23,7 @@ module Vedeu
24
23
  #
25
24
  # @param element [Object] An object you wish to add to the collection.
26
25
  #
27
- # @example
28
- # menu 'my_menu' do
26
+ # Vedeu.menu 'my_menu' do
29
27
  # item SomeClass.new
30
28
  # item SomeClass.new
31
29
  # end
@@ -41,18 +39,16 @@ module Vedeu
41
39
  # In the 'my_playlist' example below, your `Track` model may return a
42
40
  # collection of tracks to populate the menu.
43
41
  #
44
- # @param collection [Array<Object>] A collection of objects which make up
45
- # the menu items.
46
- #
47
- # @example
48
- # menu 'my_menu' do
42
+ # Vedeu.menu 'my_menu' do
49
43
  # items [:item_1, :item_2, :item_3]
50
44
  # end
51
45
  #
52
- # menu 'my_playlist' do
46
+ # Vedeu.menu 'my_playlist' do
53
47
  # items Track.all_my_favourites
54
48
  # end
55
49
  #
50
+ # @param collection [Array<Object>] A collection of objects which make up
51
+ # the menu items.
56
52
  # @return [Array]
57
53
  def items(collection = [])
58
54
  model.collection = collection
@@ -61,14 +57,12 @@ module Vedeu
61
57
  # The name of the menu. Used to reference the menu throughout your
62
58
  # application's execution lifetime.
63
59
  #
64
- # @param value [String]
65
- #
66
- # @example
67
- # menu do
60
+ # Vedeu.menu do
68
61
  # name 'my_menu'
69
62
  # # ...
70
63
  # end
71
64
  #
65
+ # @param value [String]
72
66
  # @return [String]
73
67
  def name(value)
74
68
  model.name = value
@@ -5,7 +5,6 @@ module Vedeu
5
5
  # Provides colour and style helpers for use in the {Vedeu::DSL::Interface},
6
6
  # {Vedeu::DSL::Line} and {Vedeu::DSL::Stream} classes.
7
7
  #
8
- # @api public
9
8
  module Presentation
10
9
 
11
10
  # Define the background colour for an interface, line, or a stream. When
@@ -4,7 +4,6 @@ module Vedeu
4
4
 
5
5
  # Provides methods to be used to define views.
6
6
  #
7
- # @api public
8
7
  class Stream
9
8
 
10
9
  include Vedeu::DSL
@@ -4,7 +4,6 @@ module Vedeu
4
4
 
5
5
  # Provides helper methods for building views.
6
6
  #
7
- # @api public
8
7
  module Text
9
8
 
10
9
  # Specify the content for a view. Provides the means to align a string
data/lib/vedeu/dsl/use.rb CHANGED
@@ -4,7 +4,6 @@ module Vedeu
4
4
 
5
5
  # Provides helper methods for building views.
6
6
  #
7
- # @api public
8
7
  module Use
9
8
 
10
9
  # Duplicate a stored model.
@@ -4,7 +4,6 @@ module Vedeu
4
4
 
5
5
  # DSL for creating views.
6
6
  #
7
- # @api public
8
7
  class View
9
8
 
10
9
  class << self
@@ -13,25 +12,22 @@ module Vedeu
13
12
  # or command. This provides the means for you to define your the views
14
13
  # of your application without their content.
15
14
  #
16
- # @todo More documentation required.
17
- #
18
- # @param name [String] The name of the interface. Used to reference the
19
- # interface throughout your application's execution lifetime.
20
- # @param block [Proc] A set of attributes which define the features of
21
- # the interface.
22
- #
23
- # @example
24
15
  # Vedeu.interface 'my_interface' do
25
- # # ...
16
+ # # ... some code
26
17
  # end
27
18
  #
28
19
  # Vedeu.interface do
29
20
  # name 'interfaces_must_have_a_name'
30
- # # ...
21
+ # # ... some code
31
22
  # end
32
23
  #
24
+ # @param name [String] The name of the interface. Used to reference the
25
+ # interface throughout your application's execution lifetime.
26
+ # @param block [Proc] A set of attributes which define the features of
27
+ # the interface.
33
28
  # @raise [Vedeu::InvalidSyntax] The required block was not given.
34
29
  # @return [Vedeu::Interface]
30
+ # @todo More documentation required.
35
31
  def interface(name = '', &block)
36
32
  fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
37
33
 
@@ -40,22 +36,26 @@ module Vedeu
40
36
  Vedeu::Interface.build(attributes, &block).store
41
37
  end
42
38
 
43
- # Immediate render
44
- #
45
39
  # Directly write a view buffer to the terminal. Using this method means
46
40
  # that the refresh event does not need to be triggered after creating
47
41
  # the views, though can be later triggered if needed.
48
42
  #
49
- # @param block [Proc] The directives you wish to send to render.
50
- # Typically includes `view` with associated sub-directives.
51
- #
52
- # @example
53
43
  # Vedeu.renders do
54
44
  # view 'my_interface' do
55
- # # ...
45
+ # # ... some code
56
46
  # end
57
47
  # end
58
48
  #
49
+ # # or...
50
+ #
51
+ # Vedeu.render do
52
+ # view 'my_interface' do
53
+ # # ... some code
54
+ # end
55
+ # end
56
+ #
57
+ # @param block [Proc] The directives you wish to send to render.
58
+ # Typically includes `view` with associated sub-directives.
59
59
  # @raise [Vedeu::InvalidSyntax] The required block was not given.
60
60
  # @return [Array<Interface>]
61
61
  def render(&block)
@@ -65,20 +65,14 @@ module Vedeu
65
65
  end
66
66
  alias_method :renders, :render
67
67
 
68
- # Deferred view
69
- #
70
68
  # Define a view (content) for an interface.
71
69
  #
72
- # @note The views declared within this block are stored in their
73
- # respective interface back buffers until a refresh event occurs. When
74
- # the refresh event is triggered, the back buffers are swapped into
75
- # the front buffers and the content here will be rendered to
76
- # {Vedeu::Terminal.output}.
70
+ # The views declared within this block are stored in their respective
71
+ # interface back buffers until a refresh event occurs. When the refresh
72
+ # event is triggered, the back buffers are swapped into the front
73
+ # buffers and the content here will be rendered to
74
+ # {Vedeu::Terminal.output}.
77
75
  #
78
- # @param block [Proc] The directives you wish to send to render.
79
- # Typically includes `view` with associated sub-directives.
80
- #
81
- # @example
82
76
  # Vedeu.views do
83
77
  # view 'my_interface' do
84
78
  # # ... some attributes ...
@@ -86,16 +80,19 @@ module Vedeu
86
80
  # view 'my_other_interface' do
87
81
  # # ... some other attributes ...
88
82
  # end
89
- # # ...
83
+ # # ... some code
90
84
  # end
91
85
  #
86
+ # @param block [Proc] The directives you wish to send to render.
87
+ # Typically includes `view` with associated sub-directives.
92
88
  # @raise [Vedeu::InvalidSyntax] The required block was not given.
93
89
  # @return [Array<Interface>]
94
- def views(&block)
90
+ def view(&block)
95
91
  fail Vedeu::InvalidSyntax, 'block not given' unless block_given?
96
92
 
97
93
  store(:store_deferred, &block)
98
94
  end
95
+ alias_method :views, :view
99
96
 
100
97
  private
101
98
 
@@ -1,5 +1,3 @@
1
- require 'vedeu/events/trigger'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Contains all the logic of an event. Handles debouncing and throttling.
@@ -30,7 +28,6 @@ module Vedeu
30
28
  # :do_stuff
31
29
  # end
32
30
  #
33
- # @api public
34
31
  class Event
35
32
 
36
33
  include Vedeu::Model
@@ -2,7 +2,6 @@ module Vedeu
2
2
 
3
3
  # Allows the storing of events.
4
4
  #
5
- # @api public
6
5
  class Events < Vedeu::Repository
7
6
 
8
7
  class << self
@@ -8,7 +8,6 @@ module Vedeu
8
8
  # @example
9
9
  # Vedeu.trigger(:my_event, :oxidize, 'nitrogen')
10
10
  #
11
- # @api public
12
11
  class Trigger
13
12
 
14
13
  # @param name [Symbol] The name of the event you wish to trigger. The event
@@ -1,12 +1,8 @@
1
- require 'vedeu/null/geometry'
2
- require 'vedeu/geometry/geometry'
3
-
4
1
  module Vedeu
5
2
 
6
3
  # Allows the storing of interface/view geometry independent of the interface
7
4
  # instance.
8
5
  #
9
- # @api public
10
6
  class Geometries < Vedeu::Repository
11
7
 
12
8
  class << self
@@ -1,5 +1,3 @@
1
- require 'vedeu/repositories/model'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # @todo Consider storing the Terminal size at the time of first creation,
@@ -5,7 +5,6 @@ module Vedeu
5
5
  # width is not a multiple of 12, then Grid chooses the maximum value which
6
6
  # will fit.
7
7
  #
8
- # @api public
9
8
  class Grid
10
9
 
11
10
  # @see #initialize
@@ -28,18 +27,7 @@ module Vedeu
28
27
  @value = value
29
28
  end
30
29
 
31
- # Returns the width in characters for the number of columns specified.
32
- #
33
- # @example
34
- # Vedeu.geometry 'main_interface' do
35
- # width: columns(9) # Vedeu.width # => 92 (for example)
36
- # # 92 / 12 = 7
37
- # # 7 * 9 = 63
38
- # # Therefore, width is 63 characters.
39
- #
40
- # @raise [Vedeu::OutOfRange] When the value parameter is not between 1 and
41
- # 12 inclusive.
42
- # @return [Fixnum|Vedeu::OutOfRange]
30
+ # @see Vedeu::DSL::Geometry#columns
43
31
  def columns
44
32
  fail Vedeu::OutOfRange,
45
33
  'Valid value between 1 and 12 inclusive.' if out_of_range?
@@ -47,18 +35,7 @@ module Vedeu
47
35
  column * value
48
36
  end
49
37
 
50
- # Returns the height in characters for the number of rows specified.
51
- #
52
- # @example
53
- # Vedeu.geometry 'main_interface' do
54
- # height: rows(3) # Vedeu.height # => 38 (for example)
55
- # # 38 / 12 = 3
56
- # # 3 * 3 = 9
57
- # # Therefore, height is 9 characters.
58
- #
59
- # @raise [Vedeu::OutOfRange] When the value parameter is not between 1 and
60
- # 12 inclusive.
61
- # @return [Fixnum|Vedeu::OutOfRange]
38
+ # @see Vedeu::DSL::Geometry#rows
62
39
  def rows
63
40
  fail Vedeu::OutOfRange,
64
41
  'Valid value between 1 and 12 inclusive.' if out_of_range?
@@ -1,6 +1,3 @@
1
- require 'vedeu/input/key'
2
- require 'vedeu/dsl/keymap'
3
-
4
1
  module Vedeu
5
2
 
6
3
  # A container class for keys associated with a particular interface.
@@ -1,10 +1,7 @@
1
- require 'vedeu/input/keymap'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Allows the storing of keymaps.
6
4
  #
7
- # @api public
8
5
  class Keymaps < Vedeu::Repository
9
6
 
10
7
  class << self
@@ -5,7 +5,6 @@ module Vedeu
5
5
  # the starting of the application, the handling of uncaught exceptions and
6
6
  # finally the exiting of the application with the correct exit code.
7
7
  #
8
- # @api public
9
8
  class Launcher
10
9
 
11
10
  # @!attribute [r] exit_code
data/lib/vedeu/log.rb CHANGED
@@ -77,7 +77,6 @@ module Vedeu
77
77
 
78
78
  # Provides the ability to log anything to the Vedeu log file.
79
79
  #
80
- # @api public
81
80
  class Log
82
81
 
83
82
  class << self
@@ -1,8 +1,3 @@
1
- require 'vedeu/geometry/position'
2
- require 'vedeu/output/esc'
3
- require 'vedeu/output/html_char'
4
- require 'vedeu/output/presentation'
5
-
6
1
  module Vedeu
7
2
 
8
3
  # A Char represents a single character of the terminal. It is a container for
@@ -1,5 +1,3 @@
1
- require 'vedeu/models/toggleable'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Interfaces can be associated with one another by being members of the same
@@ -1,10 +1,7 @@
1
- require 'vedeu/models/group'
2
-
3
1
  module Vedeu
4
2
 
5
3
  # Allows the storing of view groups.
6
4
  #
7
- # @api public
8
5
  class Groups < Vedeu::Repository
9
6
 
10
7
  class << self
@@ -1,9 +1,3 @@
1
- require 'vedeu/models/char'
2
- require 'vedeu/models/stream'
3
- require 'vedeu/models/line'
4
- require 'vedeu/buffers/display_buffer'
5
- require 'vedeu/models/toggleable'
6
-
7
1
  module Vedeu
8
2
 
9
3
  # An Interface represents a portion of the terminal defined by
@@ -165,19 +159,6 @@ module Vedeu
165
159
  store_group
166
160
  end
167
161
 
168
- # Toggle the named interface buffer, or without a name, the buffer of the
169
- # currently focussed interface.
170
- #
171
- # @example
172
- # Vedeu.toggle_interface(name)
173
- #
174
- # @return [void]
175
- def toggle
176
- super
177
-
178
- Vedeu.buffers.by_name(name).toggle
179
- end
180
-
181
162
  private
182
163
 
183
164
  # The default values for a new instance of this class.