vedeu 0.4.38 → 0.4.39
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +4 -0
- data/Dockerfile +2 -1
- data/docs/applications.md +21 -10
- data/docs/dsl.md +67 -4
- data/lib/vedeu/application/all.rb +1 -0
- data/lib/vedeu/application/application_controller.rb +4 -0
- data/lib/vedeu/application/application_helper.rb +4 -0
- data/lib/vedeu/application/application_view.rb +42 -0
- data/lib/vedeu/bindings.rb +0 -2
- data/lib/vedeu/bootstrap.rb +23 -27
- data/lib/vedeu/cursor/reposition.rb +3 -1
- data/lib/vedeu/generator/application.rb +10 -1
- data/lib/vedeu/generator/helpers.rb +11 -0
- data/lib/vedeu/generator/templates/application/Gemfile +1 -1
- data/lib/vedeu/generator/templates/application/app/controllers/name.erb +11 -1
- data/lib/vedeu/generator/templates/application/app/helpers/name.erb +1 -1
- data/lib/vedeu/generator/templates/application/app/models/keymaps/_system_.rb +4 -0
- data/lib/vedeu/generator/templates/application/app/views/name.erb +33 -0
- data/lib/vedeu/generator/templates/application/application.erb +10 -1
- data/lib/vedeu/generator/templates/application/bin/name +2 -0
- data/lib/vedeu/generator/templates/application/config/{configuration.rb → configuration.erb} +1 -1
- data/lib/vedeu/generator/view.rb +8 -0
- data/lib/vedeu/geometry/position.rb +1 -1
- data/lib/vedeu/models/interface.rb +0 -5
- data/lib/vedeu/output/presentation.rb +4 -14
- data/lib/vedeu/output/view_helpers/view_helpers.rb +7 -0
- data/lib/vedeu/output/wordwrap.rb +4 -1
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/application_view_test.rb +24 -0
- data/test/lib/vedeu/bootstrap_test.rb +7 -3
- data/test/lib/vedeu/buffers/buffer_test.rb +40 -8
- data/test/lib/vedeu/cursor/reposition_test.rb +22 -0
- data/test/lib/vedeu/generator/helpers_test.rb +18 -0
- data/test/lib/vedeu/output/renderers/file_test.rb +6 -2
- data/test/lib/vedeu/output/renderers/html_test.rb +15 -3
- data/test/test_helper.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a3d34a0019ef70ca1ee81a8bf5176d18783c8853
|
4
|
+
data.tar.gz: 1e0080a183723d3dbf646e5b85017dc097c4725f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfef5bc83a89b03ee28dc0fd45ed56fdc271d772eb8656f991a2f4859890dbe64fca1c5b21fac4bd275c05a0b78aef1e3c36a32d82d23e39b1d478ea39279774
|
7
|
+
data.tar.gz: 2209ded0225a88a1a71ef126a89362e6d99ec781d1b97ef662d6e4765a6758ae4445f5ffb95f127e0ace5eea7ce4b7c93a84e93a06b87c9faaa653aa3a826e37
|
data/.yardopts
CHANGED
data/Dockerfile
CHANGED
@@ -20,6 +20,7 @@ RUN apt-get update && apt-get install -y --force-yes \
|
|
20
20
|
pkg-config \
|
21
21
|
curl \
|
22
22
|
wget \
|
23
|
+
vim \
|
23
24
|
libxslt-dev \
|
24
25
|
libxml2-dev \
|
25
26
|
libffi-dev \
|
@@ -58,6 +59,7 @@ RUN usr/sbin/useradd --create-home --home-dir /home/vedeu --shell /bin/bash vede
|
|
58
59
|
# Make files
|
59
60
|
RUN mkdir /home/vedeu/gem
|
60
61
|
RUN chown -R vedeu:vedeu /home/vedeu
|
62
|
+
RUN chown -R vedeu:vedeu /opt/rubies
|
61
63
|
RUN gem install bundler
|
62
64
|
|
63
65
|
# VOLUME .:/home/vedeu/gem
|
@@ -77,4 +79,3 @@ USER vedeu
|
|
77
79
|
# sudo docker run -it -v $PWD:/home/vedeu/gem:rw vedeu/my_first_app /bin/bash
|
78
80
|
#
|
79
81
|
#
|
80
|
-
|
data/docs/applications.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
## Vedeu Applications
|
2
2
|
|
3
|
-
Vedeu has basic tools to generate client application scaffolding, in a similar
|
3
|
+
Vedeu has basic tools to generate client application scaffolding, in a similar
|
4
|
+
way to Ruby on Rails. Although not nearly as advanced as the Rails equivalent,
|
4
5
|
hopefully these generators will get you off the ground.
|
5
6
|
|
6
7
|
### Application Structure
|
@@ -25,7 +26,7 @@ hopefully these generators will get you off the ground.
|
|
25
26
|
|
|
26
27
|
|
27
28
|
To create the application structure as shown above:
|
28
|
-
|
29
|
+
|
29
30
|
vedeu new app_name
|
30
31
|
|
31
32
|
Let's talk about each directory and its purpose.
|
@@ -36,12 +37,16 @@ The controllers directory is the place to store the events and behaviour logic
|
|
36
37
|
of your application. It will manage the choosing of views and models based on
|
37
38
|
previous choices. Think of them as the orchestrators of your application.
|
38
39
|
|
39
|
-
In web applications, the controller typically handles the routed request and
|
40
|
+
In web applications, the controller typically handles the routed request and
|
41
|
+
interacts with the models and sets up the views. In Vedeu, it does much the
|
42
|
+
same, minus the requests.
|
40
43
|
|
41
44
|
#### app/helpers
|
42
45
|
|
43
46
|
Ruby on Rails has a concept of helpers which are not very object-oriented, but
|
44
|
-
allow you to share functionality/behaviour across multiple views. Vedeu uses
|
47
|
+
allow you to share functionality/behaviour across multiple views. Vedeu uses
|
48
|
+
this concept as it will be familiar to many Rails developers and might be
|
49
|
+
helpful to beginners.
|
45
50
|
|
46
51
|
#### app/models
|
47
52
|
|
@@ -50,7 +55,8 @@ prefer to use `app/models`, others like to use `lib`. Some even use both!
|
|
50
55
|
|
51
56
|
#### app/models/keymaps
|
52
57
|
|
53
|
-
This will contain the global keymap (which affects all of your application)
|
58
|
+
This will contain the global keymap (which affects all of your application)
|
59
|
+
plus any specific interface keymaps which only affect a certain interface when
|
54
60
|
in focus.
|
55
61
|
|
56
62
|
#### app/views
|
@@ -60,16 +66,19 @@ application come alive!
|
|
60
66
|
|
61
67
|
#### app/views/interfaces
|
62
68
|
|
63
|
-
This will contain the information Vedeu needs to draw the various interfaces
|
69
|
+
This will contain the information Vedeu needs to draw the various interfaces
|
70
|
+
and views of your application.
|
64
71
|
|
65
72
|
#### app/views/templates
|
66
73
|
|
67
|
-
This will house the templates your application will use to display views. You
|
74
|
+
This will house the templates your application will use to display views. You
|
75
|
+
can populate templates with generic view information and supplement it with
|
68
76
|
variable data from your application.
|
69
77
|
|
70
78
|
#### bin
|
71
79
|
|
72
|
-
This will contain executable Ruby scripts (or Bash, or shell language of your
|
80
|
+
This will contain executable Ruby scripts (or Bash, or shell language of your
|
81
|
+
choice) which will launch your application or provide command-line behaviours.
|
73
82
|
|
74
83
|
#### config
|
75
84
|
|
@@ -79,7 +88,8 @@ your application.
|
|
79
88
|
|
80
89
|
#### lib
|
81
90
|
|
82
|
-
This is for code your application may use to support code you have in
|
91
|
+
This is for code your application may use to support code you have in
|
92
|
+
`app/models`.
|
83
93
|
|
84
94
|
#### test
|
85
95
|
|
@@ -88,5 +98,6 @@ in the way you expect.
|
|
88
98
|
|
89
99
|
#### vendor
|
90
100
|
|
91
|
-
This is for third-party code which your application might want to ship with.
|
101
|
+
This is for third-party code which your application might want to ship with.
|
102
|
+
Usually you will include various Ruby gems to provide functionality, but you
|
92
103
|
might want to do something special.
|
data/docs/dsl.md
CHANGED
@@ -2,6 +2,73 @@ Coupled with the API (for interacting with the running client application), the
|
|
2
2
|
DSL provides the mechanism to configure aspects of your application whilst
|
3
3
|
using Vedeu.
|
4
4
|
|
5
|
+
### Interfaces
|
6
|
+
|
7
|
+
An Interface is a basic element in the GUI. It usually but does not necessarily
|
8
|
+
correspond to a region of the terminal screen (for example, an Interface might
|
9
|
+
not be displayed at certain points in an application life cycle).
|
10
|
+
|
11
|
+
Much of the behavior of an Interface comes from child objects that are defined
|
12
|
+
under the Interface. These objects are described in more detail in their
|
13
|
+
respective sections below.
|
14
|
+
|
15
|
+
Here is an example of declarations for an `interface` block:
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
interface 'main' do
|
19
|
+
visible true # whether to show the interface
|
20
|
+
focus! # focus this interface
|
21
|
+
cursor true # Show the cursor when this section is focused
|
22
|
+
colour foreground: '#ffffff', # set interface foreground
|
23
|
+
background: '#000033' # and background colors
|
24
|
+
group 'general' # set interface group
|
25
|
+
|
26
|
+
geometry do
|
27
|
+
# size and position details
|
28
|
+
end
|
29
|
+
border do
|
30
|
+
# border properties
|
31
|
+
end
|
32
|
+
keymap do
|
33
|
+
# keymap that is in effect when this interface is focused
|
34
|
+
end
|
35
|
+
views do
|
36
|
+
# details about how to render the interface
|
37
|
+
end
|
38
|
+
end
|
39
|
+
```
|
40
|
+
|
41
|
+
### Declaring interface sub-objects
|
42
|
+
|
43
|
+
Every object in the DSL besides interface itself is defined for a particular
|
44
|
+
interface. This can either be declared implicitly by defining the object inside
|
45
|
+
an `interface` block or explicitly, by passing the interface name as a first
|
46
|
+
argument to the declaration.
|
47
|
+
|
48
|
+
That is, these are equivalent ways to declare a Geometry for an existing
|
49
|
+
interface
|
50
|
+
|
51
|
+
```ruby
|
52
|
+
interface 'main' do
|
53
|
+
geometry do
|
54
|
+
# some geometry
|
55
|
+
end
|
56
|
+
|
57
|
+
# some other declarations
|
58
|
+
end
|
59
|
+
```
|
60
|
+
|
61
|
+
or you can say
|
62
|
+
|
63
|
+
```ruby
|
64
|
+
interface 'main' do
|
65
|
+
# some other declarations
|
66
|
+
end
|
67
|
+
|
68
|
+
geometry 'main' do
|
69
|
+
# some geometry
|
70
|
+
end
|
71
|
+
```
|
5
72
|
|
6
73
|
### Borders
|
7
74
|
|
@@ -61,10 +128,6 @@ Interfaces can be configured to be part of a named group. Once an interface is a
|
|
61
128
|
to refresh. Similarly, showing or hiding the group would of course, show or
|
62
129
|
hide the interfaces of that group.
|
63
130
|
|
64
|
-
### Interfaces
|
65
|
-
|
66
|
-
|
67
|
-
|
68
131
|
### Keymaps
|
69
132
|
|
70
133
|
There are two built in keymaps with Vedeu, 'system' (keys needed by Vedeu to
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# Provides the mechanism to render views for the client application.
|
4
|
+
#
|
5
|
+
# @api private
|
6
|
+
class ApplicationView
|
7
|
+
|
8
|
+
# Renders the view.
|
9
|
+
#
|
10
|
+
# @param object [void]
|
11
|
+
# @return [void]
|
12
|
+
def self.render(object = nil)
|
13
|
+
new(object).render
|
14
|
+
end
|
15
|
+
|
16
|
+
# @param object [void]
|
17
|
+
# @return [Vedeu::ApplicationView]
|
18
|
+
def initialize(object = nil)
|
19
|
+
@object = object
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
# @!attribute [r] object
|
25
|
+
# @return [void]
|
26
|
+
attr_reader :object
|
27
|
+
|
28
|
+
# # @!attribute [r] template
|
29
|
+
# # @return [void]
|
30
|
+
# attr_reader :template
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
# @param value [String]
|
35
|
+
# @return [String]
|
36
|
+
def template(value)
|
37
|
+
@template = File.expand_path("./app/views/templates/#{value}.erb")
|
38
|
+
end
|
39
|
+
|
40
|
+
end # ApplicationView
|
41
|
+
|
42
|
+
end # Vedeu
|
data/lib/vedeu/bindings.rb
CHANGED
data/lib/vedeu/bootstrap.rb
CHANGED
@@ -7,24 +7,33 @@ module Vedeu
|
|
7
7
|
class Bootstrap
|
8
8
|
|
9
9
|
# @param argv [Array<String>]
|
10
|
+
# @param entry_point [void]
|
10
11
|
# @return [void]
|
11
|
-
def self.start(argv = ARGV)
|
12
|
-
new(argv).start
|
12
|
+
def self.start(argv = ARGV, entry_point = nil)
|
13
|
+
new(argv, entry_point).start
|
13
14
|
end
|
14
15
|
|
15
16
|
# @param argv [Array<String>]
|
17
|
+
# @param entry_point [void]
|
16
18
|
# @return [Vedeu::Bootstrap]
|
17
|
-
def initialize(argv)
|
18
|
-
@argv
|
19
|
+
def initialize(argv, entry_point)
|
20
|
+
@argv = argv
|
21
|
+
@entry_point = entry_point
|
19
22
|
end
|
20
23
|
|
21
24
|
# @return [void]
|
22
25
|
def start
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
26
|
+
Vedeu.configure { log('/tmp/vedeu_bootstrap.log') }
|
27
|
+
|
28
|
+
[
|
29
|
+
'./config/**/*',
|
30
|
+
'./app/controllers/**/*',
|
31
|
+
'./app/helpers/**/*',
|
32
|
+
'./app/views/**/*',
|
33
|
+
'./app/models/keymaps/**/*',
|
34
|
+
].each { |path| load(path) }
|
35
|
+
|
36
|
+
entry_point
|
28
37
|
|
29
38
|
Vedeu::Launcher.execute!(argv)
|
30
39
|
end
|
@@ -35,22 +44,11 @@ module Vedeu
|
|
35
44
|
# @return [Array<String>]
|
36
45
|
attr_reader :argv
|
37
46
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
def configuration_path
|
42
|
-
File.dirname(__FILE__) + '/config/**/*'
|
43
|
-
end
|
44
|
-
|
45
|
-
# @return [String]
|
46
|
-
def interface_path
|
47
|
-
File.dirname(__FILE__) + '/app/views/interfaces/**/*'
|
48
|
-
end
|
47
|
+
# @!attribute [r] entry_point
|
48
|
+
# @return [void]
|
49
|
+
attr_reader :entry_point
|
49
50
|
|
50
|
-
|
51
|
-
def keymap_path
|
52
|
-
File.dirname(__FILE__) + '/app/models/keymaps/**/*'
|
53
|
-
end
|
51
|
+
private
|
54
52
|
|
55
53
|
# @param path [String]
|
56
54
|
# @return [String]
|
@@ -63,9 +61,7 @@ module Vedeu
|
|
63
61
|
# @param path [String]
|
64
62
|
# @return [Array<String>]
|
65
63
|
def loadables(path)
|
66
|
-
|
67
|
-
|
68
|
-
Dir.glob(files).select do |file|
|
64
|
+
Dir.glob(path).select do |file|
|
69
65
|
File.file?(file) && File.extname(file) == '.rb'
|
70
66
|
end
|
71
67
|
end
|
@@ -1,5 +1,7 @@
|
|
1
1
|
module Vedeu
|
2
2
|
|
3
|
+
# Provides the mechanism to arbitrarily move a cursor to a given position.
|
4
|
+
#
|
3
5
|
# @api private
|
4
6
|
class Reposition
|
5
7
|
|
@@ -10,7 +12,7 @@ module Vedeu
|
|
10
12
|
end
|
11
13
|
|
12
14
|
# @param entity []
|
13
|
-
# @param name [String]
|
15
|
+
# @param name [String]
|
14
16
|
# @param y [Fixnum]
|
15
17
|
# @param x [Fixnum]
|
16
18
|
# @return [Vedeu::Reposition]
|
@@ -2,6 +2,14 @@ module Vedeu
|
|
2
2
|
|
3
3
|
module Generator
|
4
4
|
|
5
|
+
# Generates the client application directory and file structure.
|
6
|
+
#
|
7
|
+
# @example
|
8
|
+
# ```bash
|
9
|
+
# vedeu new your_app_name_here
|
10
|
+
# ```
|
11
|
+
#
|
12
|
+
# @api private
|
5
13
|
class Application
|
6
14
|
|
7
15
|
include Vedeu::Generator::Helpers
|
@@ -41,6 +49,7 @@ module Vedeu
|
|
41
49
|
directories.each { |directory| make_directory(name + directory) }
|
42
50
|
end
|
43
51
|
|
52
|
+
# @return [void]
|
44
53
|
def copy_application_bootstrapper
|
45
54
|
make_file(source + '/application.erb', "#{name}/application.rb")
|
46
55
|
end
|
@@ -64,7 +73,7 @@ module Vedeu
|
|
64
73
|
|
65
74
|
# @return [void]
|
66
75
|
def copy_configuration
|
67
|
-
|
76
|
+
make_file(source + '/config/configuration.erb',
|
68
77
|
"#{name}/config/configuration.rb")
|
69
78
|
end
|
70
79
|
|
@@ -2,6 +2,10 @@ module Vedeu
|
|
2
2
|
|
3
3
|
module Generator
|
4
4
|
|
5
|
+
# Provides functionality used by the generators to build the client
|
6
|
+
# application.
|
7
|
+
#
|
8
|
+
# @api private
|
5
9
|
module Helpers
|
6
10
|
|
7
11
|
# @return [String]
|
@@ -64,6 +68,13 @@ module Vedeu
|
|
64
68
|
name.downcase.split(/_|-/).map(&:capitalize).join
|
65
69
|
end
|
66
70
|
|
71
|
+
# @return [String]
|
72
|
+
def output(message = '')
|
73
|
+
Vedeu.log_stdout(type: :info, message: message)
|
74
|
+
|
75
|
+
message
|
76
|
+
end
|
77
|
+
|
67
78
|
# @param source [String]
|
68
79
|
# @return [String]
|
69
80
|
def parse(source)
|
@@ -1,8 +1,18 @@
|
|
1
|
+
require_relative 'application_controller'
|
2
|
+
require_relative '../views/<%= object.name %>'
|
3
|
+
|
1
4
|
module <%= object.app_name %>
|
2
5
|
|
3
|
-
class <%= object.name_as_class %> < <%= object.app_name -%>::ApplicationController
|
6
|
+
class <%= object.name_as_class %>Controller < <%= object.app_name -%>::ApplicationController
|
4
7
|
|
5
8
|
def initialize
|
9
|
+
<%= object.app_name %>::<%= object.name_as_class %>View.render(object)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def object
|
15
|
+
nil
|
6
16
|
end
|
7
17
|
|
8
18
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module <%= object.app_name %>
|
2
|
+
|
3
|
+
class <%= object.name_as_class %>View < Vedeu::ApplicationView
|
4
|
+
|
5
|
+
def render
|
6
|
+
Vedeu.renders do
|
7
|
+
|
8
|
+
# Build up the view programmatically...
|
9
|
+
#
|
10
|
+
# view '<%= object.name %>' do
|
11
|
+
# lines do
|
12
|
+
# line 'some content...'
|
13
|
+
# end
|
14
|
+
# end
|
15
|
+
|
16
|
+
# ...or use the template in 'app/views/templates/<%= object.name %>'
|
17
|
+
#
|
18
|
+
template_for('<%= object.name %>',
|
19
|
+
template('<%= object.name %>'),
|
20
|
+
object,
|
21
|
+
options)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
private
|
26
|
+
|
27
|
+
def options
|
28
|
+
{}
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
@@ -1,8 +1,17 @@
|
|
1
|
+
require_relative 'app/controllers/some_controller'
|
2
|
+
|
1
3
|
module <%= object.name_as_class %>
|
2
4
|
|
3
5
|
class Application
|
4
6
|
|
5
|
-
|
7
|
+
# Change this to be the controller you would like to start the
|
8
|
+
# application from.
|
9
|
+
#
|
10
|
+
def self.entry_point
|
11
|
+
<%= object.name_as_class %>::SomeController.new
|
12
|
+
end
|
13
|
+
|
14
|
+
Vedeu::Bootstrap.start(ARGV, entry_point)
|
6
15
|
|
7
16
|
end
|
8
17
|
|
data/lib/vedeu/generator/view.rb
CHANGED
@@ -107,13 +107,8 @@ module Vedeu
|
|
107
107
|
|
108
108
|
# @return [void]
|
109
109
|
def _colour
|
110
|
-
if attributes[:colour]
|
111
|
-
|
112
|
-
|
113
|
-
elsif parent && parent_colour
|
114
|
-
parent_colour
|
115
|
-
|
116
|
-
end
|
110
|
+
return attributes[:colour] if attributes[:colour]
|
111
|
+
return parent_colour if parent && parent_colour
|
117
112
|
end
|
118
113
|
|
119
114
|
# Renders the colour attributes of the receiver and yields (to then render
|
@@ -145,13 +140,8 @@ module Vedeu
|
|
145
140
|
|
146
141
|
# @return [void]
|
147
142
|
def _style
|
148
|
-
if attributes[:style]
|
149
|
-
|
150
|
-
|
151
|
-
elsif parent && parent_style
|
152
|
-
parent_style
|
153
|
-
|
154
|
-
end
|
143
|
+
return attributes[:style] if attributes[:style]
|
144
|
+
return parent_style if parent && parent_style
|
155
145
|
end
|
156
146
|
|
157
147
|
end # Presentation
|
@@ -3,8 +3,15 @@ module Vedeu
|
|
3
3
|
# This module can be included client application classes to provide various
|
4
4
|
# further functionality and simplify Vedeu view construction.
|
5
5
|
#
|
6
|
+
# @api public
|
6
7
|
module ViewHelpers
|
7
8
|
|
9
|
+
# Returns the current local time.
|
10
|
+
#
|
11
|
+
# @example
|
12
|
+
# time_now # => Mon 29 Jun 19:26
|
13
|
+
#
|
14
|
+
# @return [String]
|
8
15
|
def time_now
|
9
16
|
Time.now.strftime('%a %e %b %k:%M')
|
10
17
|
end
|
@@ -15,7 +15,10 @@ module Vedeu
|
|
15
15
|
# @param text [String]
|
16
16
|
# @param options [Hash]
|
17
17
|
# @option options ellipsis [String] For when using mode `:prune`.
|
18
|
-
# @option options mode [Symbol] One of :default, :prune
|
18
|
+
# @option options mode [Symbol] One of :default, :prune or :wrap;
|
19
|
+
# :default = Renders the content as is.
|
20
|
+
# :prune = Discards the remainder of the content line after width.
|
21
|
+
# :wrap = Forces the content on to a new line after width.
|
19
22
|
# @option options width [Fixnum] The width to prune or wrap to.
|
20
23
|
# @return [Vedeu::Wordwrap]
|
21
24
|
def initialize(text, options = {})
|
data/lib/vedeu/version.rb
CHANGED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
describe ApplicationView do
|
6
|
+
|
7
|
+
let(:described) { Vedeu::ApplicationView }
|
8
|
+
let(:instance) { described.new(object) }
|
9
|
+
let(:object) {}
|
10
|
+
|
11
|
+
describe '#initialize' do
|
12
|
+
subject { instance }
|
13
|
+
|
14
|
+
it { subject.must_be_instance_of(Vedeu::ApplicationView) }
|
15
|
+
it { subject.instance_variable_get('@object').must_equal(object) }
|
16
|
+
end
|
17
|
+
|
18
|
+
describe '.render' do
|
19
|
+
it { described.must_respond_to(:render) }
|
20
|
+
end
|
21
|
+
|
22
|
+
end # ApplicationView
|
23
|
+
|
24
|
+
end # Vedeu
|
@@ -4,15 +4,19 @@ module Vedeu
|
|
4
4
|
|
5
5
|
describe Bootstrap do
|
6
6
|
|
7
|
-
let(:described)
|
8
|
-
let(:instance)
|
9
|
-
let(:argv)
|
7
|
+
let(:described) { Vedeu::Bootstrap }
|
8
|
+
let(:instance) { described.new(argv, entry_point) }
|
9
|
+
let(:argv) { [] }
|
10
|
+
let(:entry_point) {}
|
10
11
|
|
11
12
|
describe '#initialize' do
|
12
13
|
subject { instance }
|
13
14
|
|
14
15
|
it { subject.must_be_instance_of(described) }
|
15
16
|
it { subject.instance_variable_get('@argv').must_equal(argv) }
|
17
|
+
it do
|
18
|
+
subject.instance_variable_get('@entry_point').must_equal(entry_point)
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
22
|
describe '.start' do
|
@@ -98,8 +98,15 @@ module Vedeu
|
|
98
98
|
subject { instance.back? }
|
99
99
|
|
100
100
|
context 'with content' do
|
101
|
-
|
102
|
-
|
101
|
+
let(:back) {
|
102
|
+
Vedeu.interface 'back' do
|
103
|
+
lines do
|
104
|
+
line 'back content'
|
105
|
+
end
|
106
|
+
end
|
107
|
+
}
|
108
|
+
|
109
|
+
it { subject.must_equal(true) }
|
103
110
|
end
|
104
111
|
|
105
112
|
context 'without content' do
|
@@ -117,8 +124,14 @@ module Vedeu
|
|
117
124
|
subject { instance.front? }
|
118
125
|
|
119
126
|
context 'with content' do
|
120
|
-
|
121
|
-
|
127
|
+
let(:front) {
|
128
|
+
Vedeu.interface 'front' do
|
129
|
+
lines do
|
130
|
+
line 'front content'
|
131
|
+
end
|
132
|
+
end
|
133
|
+
}
|
134
|
+
it { subject.must_equal(true) }
|
122
135
|
end
|
123
136
|
|
124
137
|
context 'without content' do
|
@@ -130,8 +143,15 @@ module Vedeu
|
|
130
143
|
subject { instance.previous? }
|
131
144
|
|
132
145
|
context 'with content' do
|
133
|
-
|
134
|
-
|
146
|
+
let(:previous) {
|
147
|
+
Vedeu.interface 'previous' do
|
148
|
+
lines do
|
149
|
+
line 'previous content'
|
150
|
+
end
|
151
|
+
end
|
152
|
+
}
|
153
|
+
|
154
|
+
it { subject.must_equal(true) }
|
135
155
|
end
|
136
156
|
|
137
157
|
context 'without content' do
|
@@ -143,7 +163,13 @@ module Vedeu
|
|
143
163
|
subject { instance.hide }
|
144
164
|
|
145
165
|
context 'when the interface is visible' do
|
146
|
-
#
|
166
|
+
# let(:_name) { 'Buffer#hide' }
|
167
|
+
# let(:interface) { Vedeu.interface('Buffer#hide') {} }
|
168
|
+
|
169
|
+
# it {
|
170
|
+
# Vedeu::Visibility.expects(:hide).with(interface)
|
171
|
+
# subject
|
172
|
+
# }
|
147
173
|
end
|
148
174
|
|
149
175
|
context 'when the interface is not visible' do
|
@@ -160,7 +186,13 @@ module Vedeu
|
|
160
186
|
end
|
161
187
|
|
162
188
|
context 'when the interface is not visible' do
|
163
|
-
#
|
189
|
+
# let(:_name) { 'Buffer#show' }
|
190
|
+
# let(:interface) { Vedeu.interface('Buffer#show') {} }
|
191
|
+
|
192
|
+
# it {
|
193
|
+
# Vedeu::Visibility.expects(:show).with(interface)
|
194
|
+
# subject
|
195
|
+
# }
|
164
196
|
end
|
165
197
|
end
|
166
198
|
|
@@ -33,9 +33,31 @@ module Vedeu
|
|
33
33
|
end
|
34
34
|
|
35
35
|
describe '#to' do
|
36
|
+
# let(:new_entity) { Vedeu::Cursor.new(name: _name, y: 8, x: 5, oy: 7, ox: 4) }
|
37
|
+
|
38
|
+
# before do
|
39
|
+
# entity.stubs(:new).returns(new_entity)
|
40
|
+
# end
|
41
|
+
|
36
42
|
subject { instance.to }
|
37
43
|
|
38
44
|
it { subject.must_be_instance_of(entity) }
|
45
|
+
|
46
|
+
# it 'creates and stores a new entity' do
|
47
|
+
# entity.expects(:new).
|
48
|
+
# with(name: _name, y: 8, x: 5, oy: 7, ox: 4)
|
49
|
+
|
50
|
+
# subject
|
51
|
+
# end
|
52
|
+
|
53
|
+
# it 'refreshes the named interface to reflect the new position' do
|
54
|
+
# Vedeu.expects(:trigger).with(:_clear_, _name)
|
55
|
+
# Vedeu.expects(:trigger).with(:_refresh_, _name)
|
56
|
+
# Vedeu.expects(:trigger).with(:_refresh_cursor_, _name)
|
57
|
+
|
58
|
+
# subject
|
59
|
+
# end
|
60
|
+
|
39
61
|
it { subject.x.must_equal(5) }
|
40
62
|
it { subject.y.must_equal(8) }
|
41
63
|
it { subject.ox.must_equal(4) }
|
@@ -90,6 +90,24 @@ module Vedeu
|
|
90
90
|
end
|
91
91
|
end
|
92
92
|
|
93
|
+
describe '#output' do
|
94
|
+
let(:_message) { 'This is a test message.' }
|
95
|
+
|
96
|
+
before { Vedeu.stubs(:log_stdout) }
|
97
|
+
|
98
|
+
subject { instance.output(_message) }
|
99
|
+
|
100
|
+
it { subject.must_be_instance_of(String) }
|
101
|
+
|
102
|
+
it {
|
103
|
+
Vedeu.expects(:log_stdout).
|
104
|
+
with(type: :info, message: _message)
|
105
|
+
subject
|
106
|
+
}
|
107
|
+
|
108
|
+
it { subject.must_equal(_message) }
|
109
|
+
end
|
110
|
+
|
93
111
|
describe '#parse' do
|
94
112
|
let(:source) {}
|
95
113
|
|
@@ -23,13 +23,17 @@ module Vedeu
|
|
23
23
|
end
|
24
24
|
|
25
25
|
describe '.render' do
|
26
|
+
it { described.must_respond_to(:render) }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#render' do
|
26
30
|
let(:_time) { Time.new(2015, 4, 12, 20, 05) }
|
27
31
|
|
28
32
|
before { File.stubs(:open) }
|
29
33
|
|
30
|
-
subject {
|
34
|
+
subject { instance.render }
|
31
35
|
|
32
|
-
it { subject.must_be_instance_of(String) }
|
36
|
+
# it { subject.must_be_instance_of(String) }
|
33
37
|
|
34
38
|
# it { skip }
|
35
39
|
# context 'when the timestamp option is true' do
|
@@ -10,23 +10,35 @@ module Vedeu
|
|
10
10
|
let(:instance) { described.new(output) }
|
11
11
|
let(:output) {}
|
12
12
|
|
13
|
+
before do
|
14
|
+
::File.stubs(:open)
|
15
|
+
end
|
16
|
+
|
13
17
|
describe '#initialize' do
|
14
18
|
it { instance.must_be_instance_of(described) }
|
15
19
|
it { instance.instance_variable_get('@output').must_equal(output) }
|
16
20
|
end
|
17
21
|
|
18
22
|
describe '.render' do
|
23
|
+
it { described.must_respond_to(:render) }
|
24
|
+
end
|
25
|
+
|
26
|
+
describe '.to_file' do
|
27
|
+
it { described.must_respond_to(:to_file) }
|
28
|
+
end
|
29
|
+
|
30
|
+
describe '#render' do
|
19
31
|
before { ::File.stubs(:open) }
|
20
32
|
|
21
|
-
subject {
|
33
|
+
subject { instance.render }
|
22
34
|
|
23
35
|
it { subject.must_be_instance_of(String) }
|
24
36
|
end
|
25
37
|
|
26
|
-
describe '
|
38
|
+
describe '#to_file' do
|
27
39
|
before { ::File.stubs(:open) }
|
28
40
|
|
29
|
-
subject {
|
41
|
+
subject { instance.to_file(path) }
|
30
42
|
|
31
43
|
context 'when a path is given' do
|
32
44
|
let(:path) { '/tmp/test_vedeu_html_renderer.html' }
|
data/test/test_helper.rb
CHANGED
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.
|
4
|
+
version: 0.4.39
|
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-06-
|
11
|
+
date: 2015-06-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aruba
|
@@ -327,6 +327,7 @@ files:
|
|
327
327
|
- lib/vedeu/application/all.rb
|
328
328
|
- lib/vedeu/application/application_controller.rb
|
329
329
|
- lib/vedeu/application/application_helper.rb
|
330
|
+
- lib/vedeu/application/application_view.rb
|
330
331
|
- lib/vedeu/bindings.rb
|
331
332
|
- lib/vedeu/bootstrap.rb
|
332
333
|
- lib/vedeu/buffers/all.rb
|
@@ -390,7 +391,7 @@ files:
|
|
390
391
|
- lib/vedeu/generator/templates/application/application.erb
|
391
392
|
- lib/vedeu/generator/templates/application/bin/name
|
392
393
|
- lib/vedeu/generator/templates/application/config/app_name.erb
|
393
|
-
- lib/vedeu/generator/templates/application/config/configuration.
|
394
|
+
- lib/vedeu/generator/templates/application/config/configuration.erb
|
394
395
|
- lib/vedeu/generator/templates/application/lib/.gitkeep
|
395
396
|
- lib/vedeu/generator/templates/application/test/.gitkeep
|
396
397
|
- lib/vedeu/generator/templates/application/vendor/.gitkeep
|
@@ -504,6 +505,7 @@ files:
|
|
504
505
|
- test/lib/vedeu/api_test.rb
|
505
506
|
- test/lib/vedeu/application/application_controller_test.rb
|
506
507
|
- test/lib/vedeu/application/application_helper_test.rb
|
508
|
+
- test/lib/vedeu/application/application_view_test.rb
|
507
509
|
- test/lib/vedeu/application_test.rb
|
508
510
|
- test/lib/vedeu/bindings_test.rb
|
509
511
|
- test/lib/vedeu/bootstrap_test.rb
|
@@ -668,6 +670,7 @@ test_files:
|
|
668
670
|
- test/lib/vedeu/api_test.rb
|
669
671
|
- test/lib/vedeu/application/application_controller_test.rb
|
670
672
|
- test/lib/vedeu/application/application_helper_test.rb
|
673
|
+
- test/lib/vedeu/application/application_view_test.rb
|
671
674
|
- test/lib/vedeu/application_test.rb
|
672
675
|
- test/lib/vedeu/bindings_test.rb
|
673
676
|
- test/lib/vedeu/bootstrap_test.rb
|