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
data/README.md CHANGED
@@ -41,6 +41,8 @@ to your project here.
41
41
  Vedeu is largely documented using Yard. I hope to produce more 'General Usage'
42
42
  documentation shortly. In the meantime, please browse the [RubyDoc](http://rubydoc.info/gems/vedeu).
43
43
 
44
+ - [The Vedeu DSL](http://rubydoc.info/gems/vedeu/file/docs/dsl.md)
45
+
44
46
 
45
47
  ## Development / Contributing
46
48
 
data/docs/dsl.md CHANGED
@@ -72,77 +72,89 @@ geometry 'main' do
72
72
  end
73
73
  ```
74
74
 
75
- ### Borders
75
+ ## Borders
76
76
 
77
- Borders are defined by name for each of the client application's interfaces or
78
- views. They can be enabled or disabled (which controls whether they are
79
- rendered or not), they have their own colours and styles, and each aspect of
80
- the border can be controlled. The RubyDoc contains information for
81
- configuring borders.
77
+ {include:Vedeu::DSL::Border}
82
78
 
83
- ### Geometry
79
+ ### Setting a title for the border
84
80
 
85
- Geometry allows the configuration of the position and size of an interface.
81
+ {include:Vedeu::DSL::Border#title}
86
82
 
87
- Here is an example of declarations for a `geometry` block:
83
+ ### Customising the appearance of the border
88
84
 
89
- ```ruby
90
- interface 'main' do
91
- geometry do
92
- height 5 # Sets the height of the view to 5
93
- width 20 # Sets the width of the view to 20
94
- x 3 # Start drawing 3 spaces from left
95
- y 10 # Start drawing 10 spaces from top
96
- xn 30 # Stop drawing 30 spaces from the left
97
- yn 20 # Stop drawing 20 spaces from top
98
- end
99
- end
100
- ```
85
+ {include:Vedeu::DSL::Border#bottom_left}
86
+ {include:Vedeu::DSL::Border#bottom_right}
87
+ {include:Vedeu::DSL::Border#horizontal}
88
+ {include:Vedeu::DSL::Border#top_left}
89
+ {include:Vedeu::DSL::Border#top_right}
90
+ {include:Vedeu::DSL::Border#vertical}
101
91
 
102
- If a declaration is omitted for `height` or `width` the full remaining space
103
- available in the terminal will be used. `x` and `y` both default to 0.
92
+ ### Enabling/disabling the border
104
93
 
105
- You can also make a geometry declaration dependent on another view:
94
+ {include:Vedeu::DSL::Border#enable!}
95
+ {include:Vedeu::DSL::Border#disable!}
106
96
 
107
- ```ruby
108
- interface 'other_panel' do
109
- # other code ...
110
- end
97
+ ### Enabling/disabling an aspect of the border
111
98
 
112
- interface 'main' do
113
- geometry do
114
- height 10
115
- y { use('other_panel').south }
116
- end
117
- end
118
- ```
99
+ {include:Vedeu::DSL::Border#bottom}
100
+ {include:Vedeu::DSL::Border#left}
101
+ {include:Vedeu::DSL::Border#right}
102
+ {include:Vedeu::DSL::Border#top}
103
+
104
+ ## Geometry
105
+
106
+ {include:Vedeu::DSL::Geometry}
107
+
108
+ ### Setting the interface dimensions
109
+
110
+ {include:Vedeu::DSL::Geometry#centred}
111
+ {include:Vedeu::DSL::Geometry#height}
112
+ {include:Vedeu::DSL::Geometry#width}
113
+ {include:Vedeu::DSL::Geometry#columns}
114
+ {include:Vedeu::DSL::Geometry#rows}
115
+ {include:Vedeu::DSL::Geometry#x}
116
+ {include:Vedeu::DSL::Geometry#xn}
117
+ {include:Vedeu::DSL::Geometry#y}
118
+ {include:Vedeu::DSL::Geometry#yn}
119
+
120
+ ## Groups
121
+
122
+ {include:Vedeu::DSL::Group}
123
+
124
+ ### Add interfaces to groups
125
+
126
+ {include:Vedeu::DSL::Group.group}
127
+
128
+ ## Keymaps
129
+
130
+ {include:Vedeu::DSL::Keymap}
131
+ {include:Vedeu::DSL::Keymap.keymap}
132
+ {include:Vedeu::DSL::Keymap#name}
133
+
134
+ ## Menus
119
135
 
120
- This view will begin just below "other\_panel".
136
+ {include:Vedeu::DSL::Menu}
137
+ {include:Vedeu::DSL::Menu#item}
138
+ {include:Vedeu::DSL::Menu#items}
139
+ {include:Vedeu::DSL::Menu#name}
121
140
 
122
- ### Groups
141
+ ## Views
123
142
 
124
- Interfaces can be configured to be part of a named group. Once an interface is a
125
- member of group, the group can be affected by other controls. For example,
126
- assuming the client application is a simple Git client, it may have a group
127
- called 'commit'. The 'commit' group will contain the interfaces 'diff' (to show
128
- the changes), 'staged' (to show which files are staged) and 'unstaged'. A
129
- refresh of the 'commit' group would cause all interfaces belonging to the group
130
- to refresh. Similarly, showing or hiding the group would of course, show or
131
- hide the interfaces of that group.
143
+ {include:Vedeu::DSL::View.interface}
132
144
 
133
- ### Keymaps
145
+ ### Immediate rendering
134
146
 
135
- You can define keymaps by name which matches a defined interface. When that
136
- interface is in focus, keys pressed as part of this definition will affect
137
- that interface. This allows you to form context driven behaviour for your
138
- application.
147
+ {include:Vedeu::DSL::View.render}
139
148
 
149
+ ### Deferred rendering
140
150
 
141
- ### Menus
151
+ {include:Vedeu::DSL::View.view}
142
152
 
143
- `@todo` Documentation coming soon!
153
+ ### Specifying view content
144
154
 
145
- ### Views
155
+ {include:Vedeu::DSL::Line}
156
+ {include:Vedeu::DSL::Line#line}
157
+ {include:Vedeu::DSL::Line#streams}
146
158
 
147
- @todo Documentation coming soon!
159
+ `@todo` More documentation coming soon.
148
160
 
data/lib/vedeu/all.rb CHANGED
@@ -7,12 +7,28 @@ require 'vedeu/debug'
7
7
  require 'vedeu/traps'
8
8
  require 'vedeu/common'
9
9
  require 'vedeu/terminal_mode'
10
+
11
+ require 'vedeu/configuration/cli'
12
+ require 'vedeu/configuration/api'
13
+ require 'vedeu/configuration/configuration'
14
+
10
15
  require 'vedeu/terminal'
11
16
  require 'vedeu/timer'
12
17
  require 'vedeu/main_loop'
13
18
  require 'vedeu/application'
19
+
20
+ require 'vedeu/models/toggleable'
21
+
22
+ require 'vedeu/repositories/collection'
23
+ require 'vedeu/input/keys'
24
+ require 'vedeu/events/event_collection'
14
25
  require 'vedeu/repositories'
15
26
 
27
+ require 'vedeu/repositories/model'
28
+ require 'vedeu/repositories/store'
29
+ require 'vedeu/repositories/registerable'
30
+ require 'vedeu/repositories/repository'
31
+
16
32
  require 'vedeu/null'
17
33
  require 'vedeu/null/border'
18
34
  require 'vedeu/null/buffer'
@@ -20,11 +36,6 @@ require 'vedeu/null/generic'
20
36
  require 'vedeu/null/geometry'
21
37
  require 'vedeu/null/interface'
22
38
 
23
- require 'vedeu/repositories/collection'
24
- require 'vedeu/repositories/store'
25
- require 'vedeu/repositories/registerable'
26
- require 'vedeu/repositories/repository'
27
-
28
39
  require 'vedeu/geometry/area'
29
40
  require 'vedeu/geometry/coordinate'
30
41
  require 'vedeu/geometry/dimension'
@@ -44,32 +55,48 @@ require 'vedeu/colours/background'
44
55
  require 'vedeu/colours/foreground'
45
56
  require 'vedeu/colours/colour'
46
57
 
47
- require 'vedeu/buffers/buffers'
48
58
  require 'vedeu/buffers/buffer'
59
+ require 'vedeu/buffers/buffers'
60
+
49
61
  require 'vedeu/buffers/display_buffer'
50
62
 
51
- require 'vedeu/cursor/cursors'
52
63
  require 'vedeu/cursor/cursor'
64
+ require 'vedeu/cursor/cursors'
53
65
  require 'vedeu/cursor/move'
54
66
  require 'vedeu/cursor/refresh_cursor'
55
67
  require 'vedeu/cursor/reposition'
56
68
 
69
+ require 'vedeu/output/renderers/renderer_options'
70
+ require 'vedeu/output/renderers/escape_sequence'
71
+ require 'vedeu/output/renderers/file'
72
+ require 'vedeu/output/renderers/html'
73
+ require 'vedeu/output/renderers/json'
74
+ require 'vedeu/output/renderers/null'
75
+ require 'vedeu/output/renderers/terminal'
76
+ require 'vedeu/output/renderers/text'
57
77
  require 'vedeu/output/renderers'
58
78
 
59
- require 'vedeu/events/event_collection'
79
+ require 'vedeu/events/trigger'
60
80
  require 'vedeu/events/events'
61
81
  require 'vedeu/events/event'
62
- require 'vedeu/events/trigger'
63
82
 
64
83
  require 'vedeu/models/cell'
65
84
  require 'vedeu/models/char'
85
+ require 'vedeu/models/chars'
66
86
  require 'vedeu/models/escape'
67
87
  require 'vedeu/models/stream'
88
+ require 'vedeu/models/streams'
89
+ require 'vedeu/models/lines'
90
+ require 'vedeu/models/line'
91
+ require 'vedeu/models/interface'
68
92
  require 'vedeu/models/interfaces'
93
+ require 'vedeu/models/interface_collection'
69
94
  require 'vedeu/models/composition'
70
95
  require 'vedeu/models/focus'
71
- require 'vedeu/models/groups'
72
96
  require 'vedeu/models/group'
97
+ require 'vedeu/models/groups'
98
+
99
+ require 'vedeu/models/menu'
73
100
  require 'vedeu/models/menus'
74
101
 
75
102
  require 'vedeu/templating/helpers'
@@ -84,12 +111,12 @@ require 'vedeu/application/application_controller'
84
111
  require 'vedeu/application/application_helper'
85
112
  require 'vedeu/application/application_view'
86
113
 
114
+ require 'vedeu/cli/generator/helpers'
115
+ require 'vedeu/cli/generator/application'
116
+ require 'vedeu/cli/generator/view'
87
117
  require 'vedeu/cli/generator/all'
88
- require 'vedeu/cli/main'
89
118
 
90
- require 'vedeu/configuration/cli'
91
- require 'vedeu/configuration/api'
92
- require 'vedeu/configuration/configuration'
119
+ require 'vedeu/cli/main'
93
120
 
94
121
  require 'vedeu/distributed/uri'
95
122
  require 'vedeu/distributed/server'
@@ -115,15 +142,16 @@ require 'vedeu/dsl/view'
115
142
  require 'vedeu/input/mapper'
116
143
  require 'vedeu/input/key'
117
144
  require 'vedeu/input/input'
118
- require 'vedeu/input/keymaps'
119
145
  require 'vedeu/input/keymap'
146
+ require 'vedeu/input/keymaps'
120
147
 
121
148
  require 'vedeu/output/clear/named_group'
122
149
  require 'vedeu/output/clear/named_interface'
123
150
  require 'vedeu/output/esc'
124
151
  require 'vedeu/output/presentation'
125
- require 'vedeu/output/borders'
152
+ require 'vedeu/output/render_border'
126
153
  require 'vedeu/output/border'
154
+ require 'vedeu/output/borders'
127
155
  require 'vedeu/output/compressor'
128
156
  require 'vedeu/output/style'
129
157
  require 'vedeu/output/text'
data/lib/vedeu/api.rb CHANGED
@@ -16,8 +16,6 @@ module Vedeu
16
16
  # # with other methods
17
17
  # Vedeu.method_name.other_method
18
18
  #
19
- # @api public
20
- #
21
19
  module API
22
20
 
23
21
  extend Forwardable
@@ -4,7 +4,6 @@ module Vedeu
4
4
 
5
5
  # System events relating to the DRb server implementation.
6
6
  #
7
- # @api public
8
7
  # :nocov:
9
8
  module DRB
10
9
 
@@ -5,7 +5,6 @@ module Vedeu
5
5
  # Each of the Bindings::Menus events require a target menu name as an
6
6
  # argument.
7
7
  #
8
- # @api public
9
8
  # :nocov:
10
9
  module Menus
11
10
 
@@ -4,7 +4,6 @@ module Vedeu
4
4
 
5
5
  # System events relating to movement of cursors or interfaces.
6
6
  #
7
- # @api public
8
7
  # :nocov:
9
8
  module Movement
10
9
 
@@ -10,7 +10,6 @@ module Vedeu
10
10
  # advise leaving them alone. A safe rule: if the name starts with an
11
11
  # underscore, it's probably used by Vedeu internally.
12
12
  #
13
- # @api public
14
13
  # :nocov:
15
14
  module System
16
15
 
@@ -4,7 +4,6 @@ module Vedeu
4
4
 
5
5
  # System events relating to the visibility of cursors or interfaces.
6
6
  #
7
- # @api public
8
7
  # :nocov:
9
8
  module Visibility
10
9
 
@@ -18,7 +18,7 @@ module Vedeu
18
18
  # @param argv [Array<String>]
19
19
  # @param entry_point [void]
20
20
  # @return [Vedeu::Bootstrap]
21
- def initialize(argv, entry_point)
21
+ def initialize(argv, entry_point = nil)
22
22
  @argv = argv
23
23
  @entry_point = entry_point
24
24
  end
@@ -48,7 +48,7 @@ module Vedeu
48
48
  'app/models/keymaps/**/*',
49
49
  ].each { |path| load(File.join(Vedeu::Configuration.base_path, path)) }
50
50
 
51
- entry_point
51
+ entry_point || eval(Vedeu::Configuration.root)
52
52
 
53
53
  Vedeu::Launcher.execute!(argv)
54
54
  end
@@ -1,11 +1,7 @@
1
- require 'vedeu/null/buffer'
2
- require 'vedeu/buffers/buffer'
3
-
4
1
  module Vedeu
5
2
 
6
3
  # Allows the storing of view buffers.
7
4
  #
8
- # @api public
9
5
  class Buffers < Vedeu::Repository
10
6
 
11
7
  class << self
@@ -1,7 +1,3 @@
1
- require 'vedeu/cli/generator/helpers'
2
- require 'vedeu/cli/generator/application'
3
- require 'vedeu/cli/generator/view'
4
-
5
1
  module Vedeu
6
2
 
7
3
  # Provides helper classes for the various rake tasks.
@@ -1,5 +1,3 @@
1
- require 'vedeu/common'
2
-
3
1
  module Vedeu
4
2
 
5
3
  module Generator
@@ -1,5 +1,6 @@
1
1
  require_relative 'config/configuration'
2
- require_relative 'app/controllers/some_controller'
2
+ # Uncomment this, if you are manually setting the entry point below
3
+ # require_relative 'app/controllers/some_controller'
3
4
 
4
5
  module <%= object.name_as_class %>
5
6
 
@@ -8,11 +9,13 @@ module <%= object.name_as_class %>
8
9
  # Change this to be the controller you would like to start the
9
10
  # application from.
10
11
  #
11
- def self.entry_point
12
- <%= object.name_as_class %>::SomeController.new
13
- end
12
+ # def self.entry_point
13
+ # <%= object.name_as_class %>::SomeController.new
14
+ # end
14
15
 
15
- Vedeu::Bootstrap.start(ARGV, entry_point)
16
+ # Vedeu::Bootstrap.start(ARGV, entry_point)
17
+
18
+ Vedeu::Bootstrap.start(ARGV)
16
19
 
17
20
  end
18
21
 
@@ -1,5 +1,3 @@
1
- require 'fileutils'
2
-
3
1
  module Vedeu
4
2
 
5
3
  module Generator
@@ -37,6 +35,10 @@ module Vedeu
37
35
  make_interface_file
38
36
  make_template_file
39
37
  make_view_class_file
38
+
39
+ output("Please update the 'root' setting in 'config/configuration.rb'" \
40
+ " to '#{app_name}::#{name_as_class}Controller.new' if you " \
41
+ 'would like to start Vedeu at this controller.')
40
42
  end
41
43
 
42
44
  private
@@ -2,12 +2,10 @@ module Vedeu
2
2
 
3
3
  # Provide a command line interface to Vedeu.
4
4
  #
5
- # @api public
6
5
  module CLI
7
6
 
8
7
  # The main command line interface commands.
9
8
  #
10
- # @api public
11
9
  class Main < Thor
12
10
 
13
11
  desc 'new <name>', 'Create a skeleton Vedeu client application.'
@@ -2,7 +2,6 @@ module Vedeu
2
2
 
3
3
  # Store background colour escape sequences by HTML/CSS code.
4
4
  #
5
- # @api public
6
5
  class Backgrounds < Colours
7
6
 
8
7
  # @return [Vedeu::Backgrounds]