vedeu 0.4.44 → 0.4.45

Sign up to get free protection for your applications and to get access to all the features.
Files changed (58) hide show
  1. checksums.yaml +4 -4
  2. data/.ruby-version +1 -1
  3. data/README.md +3 -2
  4. data/Rakefile +0 -6
  5. data/docs/api.md +56 -53
  6. data/docs/applications.md +1 -1
  7. data/docs/dsl.md +2 -0
  8. data/docs/getting_started.md +1 -1
  9. data/docs/object_graph.md +1 -1
  10. data/docs/views.md +1 -1
  11. data/lib/vedeu.rb +4 -0
  12. data/lib/vedeu/api.rb +75 -13
  13. data/lib/vedeu/application/application_view.rb +3 -0
  14. data/lib/vedeu/application/controller.rb +13 -0
  15. data/lib/vedeu/bootstrap.rb +11 -0
  16. data/lib/vedeu/buffers/buffer.rb +2 -0
  17. data/lib/vedeu/configuration/api.rb +1 -15
  18. data/lib/vedeu/configuration/configuration.rb +1 -0
  19. data/lib/vedeu/cursor/cursor.rb +2 -0
  20. data/lib/vedeu/geometry/dimension.rb +2 -0
  21. data/lib/vedeu/geometry/geometry.rb +4 -0
  22. data/lib/vedeu/input/keymap.rb +2 -0
  23. data/lib/vedeu/launcher.rb +14 -0
  24. data/lib/vedeu/main_loop.rb +2 -0
  25. data/lib/vedeu/models/cell.rb +2 -0
  26. data/lib/vedeu/models/char.rb +2 -0
  27. data/lib/vedeu/models/escape_char.rb +2 -0
  28. data/lib/vedeu/models/group.rb +2 -0
  29. data/lib/vedeu/output/clear.rb +2 -0
  30. data/lib/vedeu/output/esc.rb +8 -16
  31. data/lib/vedeu/output/render_border.rb +43 -19
  32. data/lib/vedeu/output/renderers/file.rb +2 -0
  33. data/lib/vedeu/output/wordwrap.rb +2 -0
  34. data/lib/vedeu/repositories/repositories/backgrounds.rb +1 -3
  35. data/lib/vedeu/repositories/repositories/borders.rb +0 -4
  36. data/lib/vedeu/repositories/repositories/buffers.rb +0 -4
  37. data/lib/vedeu/repositories/repositories/cursors.rb +1 -7
  38. data/lib/vedeu/repositories/repositories/events.rb +0 -4
  39. data/lib/vedeu/repositories/repositories/foregrounds.rb +1 -3
  40. data/lib/vedeu/repositories/repositories/geometries.rb +0 -4
  41. data/lib/vedeu/repositories/repositories/groups.rb +0 -4
  42. data/lib/vedeu/repositories/repositories/interfaces.rb +0 -4
  43. data/lib/vedeu/repositories/repositories/keymaps.rb +0 -4
  44. data/lib/vedeu/repositories/repositories/menus.rb +0 -4
  45. data/lib/vedeu/repositories/repository.rb +6 -0
  46. data/lib/vedeu/templating/directive.rb +3 -0
  47. data/lib/vedeu/traps.rb +2 -0
  48. data/lib/vedeu/version.rb +1 -1
  49. data/test/lib/vedeu/cli/generator/helpers_test.rb +33 -1
  50. data/test/lib/vedeu/distributed/client_test.rb +10 -0
  51. data/test/lib/vedeu/output/text_test.rb +18 -12
  52. data/test/lib/vedeu/repositories/repository_test.rb +11 -2
  53. data/test/support/helpers/model_test_class.rb +2 -0
  54. data/test/test_helper.rb +7 -2
  55. data/vedeu.gemspec +2 -3
  56. metadata +5 -21
  57. data/inch.yml +0 -5
  58. data/logs/.gitkeep +0 -0
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0e923ab136ae9285466e5526700a91bd23b78f03
4
- data.tar.gz: 8af995c9b432d7ee21c51837bb6dd6a508b5e485
3
+ metadata.gz: 68ee4c2ed644e698df332ae110ee488fcb38251c
4
+ data.tar.gz: 5a542609da0c161347ec2cd3de1fada895995aef
5
5
  SHA512:
6
- metadata.gz: b907622dd0291801638870f6456ecf0876c1e66395e3b87a75d433c5ba4449ca9ce23ad27c1520832d0843e7067dcd4969dd7a5b35735dadead4ff2365881f7e
7
- data.tar.gz: 1533041a4c03464a27846e11bca3b6f4a4e948fcd8f95f5bfb6a33c8cae92e0a6e398e545785e78101888a59d96c25547c806f5d5d6e38026f5a75425202cbfa
6
+ metadata.gz: 32a29cc71db5d5e1347b6fa9fe5a0d424c4bac02dedf1eb61e325650f386d01dcaee72c4fc890cd6eba16b50f10353ec2cda4a4f75064e156ae61be003217193
7
+ data.tar.gz: 42a71d09b9aa1dfed20b9b60f1dc92a1967fd134d2b27f3b028d3d59bd6070ec9eb8c5606b924ab4a8c3a26fd43d68c7f74085ef6a584bcf43fbb73b30d9bdfa
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.1
1
+ 2.2.2
data/README.md CHANGED
@@ -1,6 +1,5 @@
1
1
  [![Code Climate](https://codeclimate.com/github/gavinlaking/vedeu.png)](https://codeclimate.com/github/gavinlaking/vedeu)
2
2
  [![Build Status](https://travis-ci.org/gavinlaking/vedeu.svg?branch=master)](https://travis-ci.org/gavinlaking/vedeu)
3
- [![Inline docs](http://inch-ci.org/github/gavinlaking/vedeu.svg?branch=master)](http://inch-ci.org/github/gavinlaking/vedeu)
4
3
 
5
4
  # Vedeu
6
5
 
@@ -11,7 +10,9 @@ Vedeu (vee-dee-you; aka VDU) is my attempt at creating a terminal based
11
10
 
12
11
  ## Requirements
13
12
 
14
- Vedeu was been built primarily with Ruby v2.1.
13
+ Vedeu was been built primarily with Ruby v2.1; however, the
14
+ [.ruby-version](https://github.com/gavinlaking/vedeu/blob/master/.ruby-version)
15
+ file will indicate the currently used Ruby version.
15
16
 
16
17
  When Vedeu started I was a MacOSX user, I've since moved to Linux. You shouldn't have any problems with either of these operating systems.
17
18
 
data/Rakefile CHANGED
@@ -1,6 +1,5 @@
1
1
  require 'bundler/gem_tasks'
2
2
  require 'rake/testtask'
3
- require 'inch/rake'
4
3
  require 'yard'
5
4
  require 'rubocop/rake_task'
6
5
 
@@ -22,11 +21,6 @@ YARD::Rake::YardocTask.new(:yard) do |t|
22
21
  ]
23
22
  end
24
23
 
25
- Inch::Rake::Suggest.new(:inch) do |suggest|
26
- suggest.args << '--pedantic'
27
- suggest.args << '--all'
28
- end
29
-
30
24
  RuboCop::RakeTask.new(:rubocop) do |task|
31
25
  task.patterns = ['lib/**/*.rb']
32
26
  task.formatters = ['progress']
data/docs/api.md CHANGED
@@ -1,27 +1,7 @@
1
- ## Vedeu API
1
+ # @title Vedeu API
2
2
 
3
3
  Vedeu provides a simple DSL for the creation of terminal/console based
4
- applications.
5
-
6
- Below is a list of all the API methods. These can be accessed in your
7
- application by including Vedeu in your class or module or by calling them directly.
8
-
9
-
10
- ### API 'include' example
11
-
12
- Doing it this way will mean you can use any API method without the `Vedeu.` prefix.
13
-
14
- ```ruby
15
- class SomeClassInYourApplication
16
- include Vedeu
17
-
18
- # ...
19
- ```
20
-
21
-
22
- ### API direct example
23
-
24
- Doing it this way means you need to use the `Vedeu.` prefix.
4
+ applications. Below is a list of all the API methods:
25
5
 
26
6
  ```ruby
27
7
  class OtherClassInYourApplication
@@ -34,32 +14,42 @@ class OtherClassInYourApplication
34
14
  # ...
35
15
  ```
36
16
 
37
- ... TODO ...
17
+ Note: Nesting indicates where an API method is allowed/supposed to be used.
38
18
 
19
+ #### Borders
39
20
 
40
- ### API DSL methods
21
+ - Vedeu.border
41
22
 
42
- Note: Nesting indicates where an API method is allowed/supposed to be used.
23
+ #### Configuration
24
+
25
+ - Vedeu.configure
26
+ - Vedeu.configuration
43
27
 
44
28
  #### Events
45
29
 
46
- - bind
47
- - trigger
48
- - unbind
30
+ - Vedeu.bind
31
+ - Vedeu.trigger
32
+ - Vedeu.unbind
33
+
34
+ #### Geometry
35
+
36
+ - Vedeu.geometry
37
+
38
+ #### Groups
49
39
 
40
+ - Vedeu.group
50
41
 
51
42
  #### Input
52
43
 
53
- - keypress
54
- - keymap
44
+ - Vedeu.keypress
45
+ - Vedeu.keymap
55
46
  - key
56
47
  - name
57
48
  - interface
58
49
 
59
-
60
50
  #### Interfaces
61
51
 
62
- - interface
52
+ - Vedeu.interface
63
53
  - background
64
54
  - border
65
55
  - cursor
@@ -83,10 +73,10 @@ Note: Nesting indicates where an API method is allowed/supposed to be used.
83
73
  - style
84
74
  - use
85
75
 
86
-
87
76
  #### Views
88
77
 
89
- - renders
78
+ - Vedeu.renders
79
+ - Vedeu.render
90
80
  - view
91
81
  - colour
92
82
  - cursor
@@ -116,36 +106,49 @@ Note: Nesting indicates where an API method is allowed/supposed to be used.
116
106
  - name
117
107
  - style
118
108
  - use
119
- - views
109
+ - Vedeu.views
120
110
  - ... as #renders
121
111
 
122
-
123
112
  #### Menus
124
113
 
125
- - menu
114
+ - Vedeu.menu
126
115
  - items
127
116
  - name
128
117
 
118
+ #### Renderers
129
119
 
130
- #### Miscellany
120
+ - Vedeu.renderer
121
+ - Vedeu.renderers
131
122
 
132
- - configure
133
- - focus
134
- - focus_by_name
135
- - focussed?
136
- - focus_next
137
- - focus_previous
123
+ #### Repositories
138
124
 
139
- - height
140
- Usage: Vedeu.height
141
- Returns the height (in lines) for the current terminal.
125
+ These are collections which you can access:
142
126
 
143
- - log
144
- - resize
145
- Usage: Vedeu.resize
127
+ - Vedeu.background_colours
128
+ - Vedeu.foreground_colours
129
+ - Vedeu.borders
130
+ - Vedeu.buffers
131
+ - Vedeu.cursors
132
+ - Vedeu.events
133
+ - Vedeu.geometries
134
+ - Vedeu.groups
135
+ - Vedeu.interfaces
136
+ - Vedeu.keymaps
137
+ - Vedeu.menus
146
138
 
139
+ #### Miscellany
147
140
 
148
- - width
149
- Usage: Vedeu.width
150
- Returns the width (in characters) for the current terminal.
141
+ - Vedeu.cursor
142
+ - Vedeu.focus
143
+ - Vedeu.focus_by_name
144
+ - Vedeu.focussed?
145
+ - Vedeu.focus_next
146
+ - Vedeu.focus_previous
147
+ - Vedeu.height
148
+ - Vedeu.log
149
+ - Vedeu.log_stdout
150
+ - Vedeu.log_stderr
151
+ - Vedeu.resize
152
+ - Vedeu.timer
153
+ - Vedeu.width
151
154
 
data/docs/applications.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Vedeu Applications
1
+ # @title Vedeu Applications
2
2
 
3
3
  Vedeu has basic tools to generate client application scaffolding, in a similar
4
4
  way to Ruby on Rails. Although not nearly as advanced as the Rails equivalent,
data/docs/dsl.md CHANGED
@@ -1,3 +1,5 @@
1
+ # @title The Vedeu DSL
2
+
1
3
  Coupled with the API (for interacting with the running client application), the
2
4
  DSL provides the mechanism to configure aspects of your application whilst
3
5
  using Vedeu.
@@ -1,4 +1,4 @@
1
- ## Getting Started with Vedeu
1
+ # @title Getting Started with Vedeu
2
2
 
3
3
  - Set your configuration.
4
4
  - Define your interfaces.
data/docs/object_graph.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Producing an object graph of Vedeu
1
+ # @title Producing an object graph of Vedeu
2
2
 
3
3
  Sometimes I find looking at the project as a graph helps me to understand the
4
4
  relationship between the various objects. To achieve this, I use Yard's graph
data/docs/views.md CHANGED
@@ -1,4 +1,4 @@
1
- ## Views with Vedeu
1
+ # @title Views with Vedeu
2
2
 
3
3
  There are two ways to construct views with Vedeu. You would like to draw the
4
4
  view to the screen immediately (immediate render) or you want to save a view to
data/lib/vedeu.rb CHANGED
@@ -27,11 +27,14 @@ module Vedeu
27
27
 
28
28
  def_delegators Vedeu::Log, :log
29
29
 
30
+ # Return the name of currently focussed interface.
31
+ #
30
32
  # @return [Vedeu::Focus]
31
33
  def self.focusable
32
34
  @focusable ||= Vedeu::Focus
33
35
  end
34
36
 
37
+ # :nocov:
35
38
  # When Vedeu is included within one of your classes, you should have all
36
39
  # API methods at your disposal.
37
40
  #
@@ -48,6 +51,7 @@ module Vedeu
48
51
  receiver.send(:include, API)
49
52
  receiver.extend(API)
50
53
  end
54
+ # :nocov:
51
55
 
52
56
  end # Vedeu
53
57
 
data/lib/vedeu/api.rb CHANGED
@@ -33,16 +33,31 @@ module Vedeu
33
33
 
34
34
  module_function
35
35
 
36
+ # Manipulate the repository of background colours.
37
+ #
38
+ # @example
39
+ # Vedeu.background_colours
40
+ #
36
41
  # @!method background_colours
37
- # @see Vedeu::Backgrounds.background_colours
42
+ # @return [Vedeu::Backgrounds]
38
43
  def_delegators Vedeu::Backgrounds, :background_colours
39
44
 
45
+ # Manipulate the repository of borders.
46
+ #
47
+ # @example
48
+ # Vedeu.borders
49
+ #
40
50
  # @!method borders
41
- # @see Vedeu::Borders.borders
51
+ # @return [Vedeu::Borders]
42
52
  def_delegators Vedeu::Borders, :borders
43
53
 
54
+ # Manipulate the repository of buffers.
55
+ #
56
+ # @example
57
+ # Vedeu.buffers
58
+ #
44
59
  # @!method buffers
45
- # @see Vedeu::Buffers.buffers
60
+ # @return [Vedeu::Buffers]
46
61
  def_delegators Vedeu::Buffers, :buffers
47
62
 
48
63
  # @!method configure
@@ -51,11 +66,23 @@ module Vedeu
51
66
  # @see Vedeu::Configuration.configuration
52
67
  def_delegators Vedeu::Configuration, :configure, :configuration
53
68
 
69
+ # Manipulate the currently focussed cursor.
70
+ #
71
+ # @example
72
+ # Vedeu.cursor
73
+ #
54
74
  # @!method cursor
55
- # @see Vedeu::Cursors.cursor
75
+ # @return [Vedeu::Cursor]
76
+ def_delegators Vedeu::Cursors, :cursor
77
+
78
+ # Manipulate the repository of cursors.
79
+ #
80
+ # @example
81
+ # Vedeu.cursors
82
+ #
56
83
  # @!method cursors
57
- # @see Vedeu::Cursors.cursors
58
- def_delegators Vedeu::Cursors, :cursor, :cursors
84
+ # @return [Vedeu::Cursors]
85
+ def_delegators Vedeu::Cursors, :cursors
59
86
 
60
87
  # @!method border
61
88
  # @see Vedeu::DSL::Border.border
@@ -89,8 +116,13 @@ module Vedeu
89
116
  # @see Vedeu::Event.unbind
90
117
  def_delegators Vedeu::Event, :bind, :unbind
91
118
 
119
+ # Manipulate the repository of events.
120
+ #
121
+ # @example
122
+ # Vedeu.events
123
+ #
92
124
  # @!method events
93
- # @see Vedeu::Events.events
125
+ # @return [Vedeu::Events]
94
126
  def_delegators Vedeu::Events, :events
95
127
 
96
128
  # @!method focus
@@ -106,24 +138,49 @@ module Vedeu
106
138
  def_delegators Vedeu::Focus, :focus, :focus_by_name, :focussed?,
107
139
  :focus_next, :focus_previous
108
140
 
141
+ # Manipulate the repository of foreground colours.
142
+ #
143
+ # @example
144
+ # Vedeu.foreground_colours
145
+ #
109
146
  # @!method foreground_colours
110
- # @see Vedeu::Foregrounds.foreground_colours
147
+ # @return [Vedeu::Foregrounds]
111
148
  def_delegators Vedeu::Foregrounds, :foreground_colours
112
149
 
150
+ # Manipulate the repository of geometries.
151
+ #
152
+ # @example
153
+ # Vedeu.geometries
154
+ #
113
155
  # @!method geometries
114
- # @see Vedeu::Geometries.geometries
156
+ # @return [Vedeu::Geometries]
115
157
  def_delegators Vedeu::Geometries, :geometries
116
158
 
159
+ # Manipulate the repository of groups.
160
+ #
161
+ # @example
162
+ # Vedeu.groups
163
+ #
117
164
  # @!method groups
118
- # @see Vedeu::Groups.groups
165
+ # @return [Vedeu::Groups]
119
166
  def_delegators Vedeu::Groups, :groups
120
167
 
168
+ # Manipulate the repository of interfaces.
169
+ #
170
+ # @example
171
+ # Vedeu.interfaces
172
+ #
121
173
  # @!method interfaces
122
- # @see Vedeu::Interfaces.interfaces
174
+ # @return [Vedeu::Interfaces]
123
175
  def_delegators Vedeu::Interfaces, :interfaces
124
176
 
177
+ # Manipulate the repository of keymaps.
178
+ #
179
+ # @example
180
+ # Vedeu.keymaps
181
+ #
125
182
  # @!method keymaps
126
- # @see Vedeu::Keymaps.keymaps
183
+ # @return [Vedeu::Keymaps]
127
184
  def_delegators Vedeu::Keymaps, :keymaps
128
185
 
129
186
  # @!method log
@@ -142,8 +199,13 @@ module Vedeu
142
199
  # @see Vedeu::Menu.menu
143
200
  def_delegators Vedeu::Menu, :menu
144
201
 
202
+ # Manipulate the repository of menus.
203
+ #
204
+ # @example
205
+ # Vedeu.menus
206
+ #
145
207
  # @!method menus
146
- # @see Vedeu::Menus.menus
208
+ # @return [Vedeu::Menus]
147
209
  def_delegators Vedeu::Menus, :menus
148
210
 
149
211
  # @!method renderer
@@ -37,6 +37,9 @@ module Vedeu
37
37
 
38
38
  private
39
39
 
40
+ # Provides the path to the template file using the base_path configuration
41
+ # option.
42
+ #
40
43
  # @param value [String]
41
44
  # @return [String]
42
45
  def template(value)
@@ -8,7 +8,20 @@ module Vedeu
8
8
  # When included, provide these methods as class methods.
9
9
  module ClassMethods
10
10
 
11
+ # Specifying the controller name in your controller provides a Vedeu event
12
+ # which will trigger the loading of the controller.
13
+ #
14
+ # @example
15
+ # class YourController
16
+ # controller_name :your_controller
17
+ # # ...
18
+ # end
19
+ #
20
+ # Vedeu.trigger(:show_your_controller) # this event is now available to
21
+ # # trigger.
22
+ #
11
23
  # @param name [Symbol] The name of the controller.
24
+ # @return [void]
12
25
  def controller_name(name)
13
26
  Vedeu.bind("show_#{name}".to_sym) { new }
14
27
  end