vedeu 0.4.54 → 0.4.55
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/vedeu.rb +1 -1
- data/lib/vedeu/all.rb +5 -1
- data/lib/vedeu/api.rb +7 -3
- data/lib/vedeu/application/all.rb +6 -6
- data/lib/vedeu/application/application_controller.rb +1 -1
- data/lib/vedeu/application/application_helper.rb +1 -1
- data/lib/vedeu/application/application_view.rb +1 -1
- data/lib/vedeu/application/view.rb +10 -0
- data/lib/vedeu/bindings/all.rb +13 -5
- data/lib/vedeu/bootstrap.rb +0 -2
- data/lib/vedeu/buffers/all.rb +3 -2
- data/lib/vedeu/{repositories/repositories → buffers}/buffers.rb +1 -1
- data/lib/vedeu/cli/all.rb +1 -1
- data/lib/vedeu/cli/generator/helpers.rb +2 -2
- data/lib/vedeu/colours/all.rb +7 -0
- data/lib/vedeu/{output → colours}/background.rb +0 -0
- data/lib/vedeu/{repositories/repositories → colours}/backgrounds.rb +0 -0
- data/lib/vedeu/{output → colours}/colour.rb +0 -0
- data/lib/vedeu/{output → colours}/colour_translator.rb +0 -0
- data/lib/vedeu/{repositories/repositories → colours}/colours.rb +0 -0
- data/lib/vedeu/{output → colours}/foreground.rb +0 -0
- data/lib/vedeu/{repositories/repositories → colours}/foregrounds.rb +0 -0
- data/lib/vedeu/{support/common.rb → common.rb} +0 -0
- data/lib/vedeu/configuration/all.rb +3 -3
- data/lib/vedeu/cursor/all.rb +5 -4
- data/lib/vedeu/cursor/cursor.rb +1 -1
- data/lib/vedeu/{repositories/repositories → cursor}/cursors.rb +2 -19
- data/lib/vedeu/distributed/all.rb +5 -5
- data/lib/vedeu/distributed/test_application.rb +1 -1
- data/lib/vedeu/dsl/all.rb +1 -1
- data/lib/vedeu/dsl/composition.rb +1 -1
- data/lib/vedeu/dsl/use.rb +1 -1
- data/lib/vedeu/events/all.rb +4 -3
- data/lib/vedeu/{repositories/repositories → events}/events.rb +0 -0
- data/lib/vedeu/geometry/all.rb +14 -9
- data/lib/vedeu/{repositories/repositories → geometry}/geometries.rb +0 -0
- data/lib/vedeu/input/all.rb +5 -4
- data/lib/vedeu/{repositories/repositories → input}/keymaps.rb +0 -0
- data/lib/vedeu/{support/log.rb → log.rb} +0 -0
- data/lib/vedeu/models/all.rb +14 -10
- data/lib/vedeu/models/group.rb +3 -3
- data/lib/vedeu/{repositories/repositories → models}/groups.rb +2 -16
- data/lib/vedeu/models/interface.rb +1 -1
- data/lib/vedeu/{repositories/repositories → models}/interfaces.rb +1 -1
- data/lib/vedeu/{repositories/repositories → models}/menus.rb +0 -0
- data/lib/vedeu/{support → models}/toggleable.rb +4 -4
- data/lib/vedeu/null/all.rb +5 -5
- data/lib/vedeu/null/border.rb +5 -3
- data/lib/vedeu/null/buffer.rb +5 -3
- data/lib/vedeu/null/generic.rb +6 -1
- data/lib/vedeu/null/geometry.rb +6 -4
- data/lib/vedeu/null/interface.rb +9 -10
- data/lib/vedeu/output/all.rb +21 -21
- data/lib/vedeu/{repositories/repositories → output}/borders.rb +0 -0
- data/lib/vedeu/output/clear/all.rb +2 -2
- data/lib/vedeu/output/html_char.rb +1 -1
- data/lib/vedeu/output/presentation.rb +25 -0
- data/lib/vedeu/output/refresh.rb +1 -1
- data/lib/vedeu/output/refresh_group.rb +5 -3
- data/lib/vedeu/output/renderers/all.rb +8 -8
- data/lib/vedeu/output/renderers/html.rb +2 -2
- data/lib/vedeu/repositories/all.rb +5 -7
- data/lib/vedeu/repositories/collection.rb +42 -0
- data/lib/vedeu/repositories/model.rb +2 -2
- data/lib/vedeu/repositories/repository.rb +11 -2
- data/lib/vedeu/templating/all.rb +4 -3
- data/lib/vedeu/templating/template.rb +75 -0
- data/lib/vedeu/{support/terminal.rb → terminal.rb} +0 -0
- data/lib/vedeu/{support/timer.rb → timer.rb} +0 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/view_test.rb +11 -1
- data/test/lib/vedeu/bootstrap_test.rb +5 -5
- data/test/lib/vedeu/{repositories/repositories → buffers}/buffers_test.rb +0 -0
- data/test/lib/vedeu/cli/generator/helpers_test.rb +1 -1
- data/test/lib/vedeu/{output → colours}/background_test.rb +0 -0
- data/test/lib/vedeu/{repositories/repositories → colours}/backgrounds_test.rb +0 -0
- data/test/lib/vedeu/{output → colours}/colour_test.rb +0 -0
- data/test/lib/vedeu/{output → colours}/colour_translator_test.rb +0 -0
- data/test/lib/vedeu/{repositories/repositories → colours}/colours_test.rb +0 -0
- data/test/lib/vedeu/{output → colours}/foreground_test.rb +0 -0
- data/test/lib/vedeu/{repositories/repositories → colours}/foregrounds_test.rb +0 -0
- data/test/lib/vedeu/{support/common_test.rb → common_test.rb} +0 -0
- data/test/lib/vedeu/{repositories/repositories → cursor}/cursors_test.rb +0 -21
- data/test/lib/vedeu/dsl/composition_test.rb +1 -1
- data/test/lib/vedeu/dsl/use_test.rb +9 -0
- data/test/lib/vedeu/{repositories/repositories → events}/events_test.rb +0 -0
- data/test/lib/vedeu/{repositories/repositories → geometry}/geometries_test.rb +0 -0
- data/test/lib/vedeu/{repositories/repositories → input}/keymaps_test.rb +0 -0
- data/test/lib/vedeu/{support/log_test.rb → log_test.rb} +0 -0
- data/test/lib/vedeu/models/groups_test.rb +21 -0
- data/test/lib/vedeu/{repositories/repositories → models}/interfaces_test.rb +0 -0
- data/test/lib/vedeu/{repositories/repositories → models}/menus_test.rb +0 -0
- data/test/lib/vedeu/{support → models}/toggleable_test.rb +0 -0
- data/test/lib/vedeu/null/border_test.rb +9 -1
- data/test/lib/vedeu/null/buffer_test.rb +9 -1
- data/test/lib/vedeu/null/generic_test.rb +10 -1
- data/test/lib/vedeu/null/geometry_test.rb +9 -1
- data/test/lib/vedeu/null/interface_test.rb +11 -8
- data/test/lib/vedeu/{repositories/repositories → output}/borders_test.rb +0 -0
- data/test/lib/vedeu/output/compressor_test.rb +47 -2
- data/test/lib/vedeu/output/refresh_group_test.rb +5 -5
- data/test/lib/vedeu/output/refresh_test.rb +1 -1
- data/test/lib/vedeu/repositories/collection_test.rb +78 -0
- data/test/lib/vedeu/repositories/repository_test.rb +8 -3
- data/test/lib/vedeu/templating/template_test.rb +46 -0
- data/test/lib/vedeu/{support/terminal_test.rb → terminal_test.rb} +0 -0
- data/test/lib/vedeu/{support/timer_test.rb → timer_test.rb} +0 -0
- data/test/support/all_seeds.sh +9 -0
- data/test/support/templates/inline.erb +1 -0
- data/test/test_helper.rb +7 -1
- metadata +74 -78
- data/lib/vedeu/output/view_helpers/all.rb +0 -5
- data/lib/vedeu/output/view_helpers/view_helpers.rb +0 -21
- data/lib/vedeu/repositories/collections/all.rb +0 -47
- data/lib/vedeu/repositories/repositories/all.rb +0 -14
- data/lib/vedeu/support/all.rb +0 -5
- data/lib/vedeu/support/template.rb +0 -73
- data/test/lib/vedeu/output/view_helpers/view_helpers_test.rb +0 -30
- data/test/lib/vedeu/repositories/collections/all_test.rb +0 -83
- data/test/lib/vedeu/repositories/repositories/groups_test.rb +0 -35
- data/test/lib/vedeu/support/template_test.rb +0 -44
@@ -1,21 +0,0 @@
|
|
1
|
-
module Vedeu
|
2
|
-
|
3
|
-
# This module can be included client application classes to provide various
|
4
|
-
# further functionality and simplify Vedeu view construction.
|
5
|
-
#
|
6
|
-
# @api public
|
7
|
-
module ViewHelpers
|
8
|
-
|
9
|
-
# Returns the current local time.
|
10
|
-
#
|
11
|
-
# @example
|
12
|
-
# time_now # => Mon 29 Jun 19:26
|
13
|
-
#
|
14
|
-
# @return [String]
|
15
|
-
def time_now
|
16
|
-
Time.now.strftime('%a %e %b %k:%M')
|
17
|
-
end
|
18
|
-
|
19
|
-
end # ViewHelpers
|
20
|
-
|
21
|
-
end # Vedeu
|
@@ -1,47 +0,0 @@
|
|
1
|
-
require 'vedeu/repositories/collection'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
# A collection of {Vedeu::Char} instances.
|
6
|
-
#
|
7
|
-
# @api private
|
8
|
-
class Chars < Vedeu::Collection
|
9
|
-
|
10
|
-
end # Chars
|
11
|
-
|
12
|
-
# A collection of {Vedeu::Event} instances.
|
13
|
-
#
|
14
|
-
# @api private
|
15
|
-
class EventCollection < Vedeu::Collection
|
16
|
-
|
17
|
-
end # EventCollection
|
18
|
-
|
19
|
-
# A collection of {Vedeu::Interface} instances.
|
20
|
-
#
|
21
|
-
# @api private
|
22
|
-
class InterfaceCollection < Vedeu::Collection
|
23
|
-
|
24
|
-
end # InterfaceCollection
|
25
|
-
|
26
|
-
# A collection of {Vedeu::Key} instances.
|
27
|
-
#
|
28
|
-
# @api private
|
29
|
-
class Keys < Vedeu::Collection
|
30
|
-
|
31
|
-
end # Keys
|
32
|
-
|
33
|
-
# A collection of {Vedeu::Line} instances.
|
34
|
-
#
|
35
|
-
# @api private
|
36
|
-
class Lines < Vedeu::Collection
|
37
|
-
|
38
|
-
end # Lines
|
39
|
-
|
40
|
-
# A collection of {Vedeu::Stream} instances.
|
41
|
-
#
|
42
|
-
# @api private
|
43
|
-
class Streams < Vedeu::Collection
|
44
|
-
|
45
|
-
end # Streams
|
46
|
-
|
47
|
-
end
|
@@ -1,14 +0,0 @@
|
|
1
|
-
require 'vedeu/repositories/repository'
|
2
|
-
|
3
|
-
require_relative 'colours'
|
4
|
-
require_relative 'backgrounds'
|
5
|
-
require_relative 'foregrounds'
|
6
|
-
require_relative 'borders'
|
7
|
-
require_relative 'buffers'
|
8
|
-
require_relative 'cursors'
|
9
|
-
require_relative 'events'
|
10
|
-
require_relative 'geometries'
|
11
|
-
require_relative 'groups'
|
12
|
-
require_relative 'interfaces'
|
13
|
-
require_relative 'keymaps'
|
14
|
-
require_relative 'menus'
|
data/lib/vedeu/support/all.rb
DELETED
@@ -1,73 +0,0 @@
|
|
1
|
-
require 'vedeu/templating/preprocessor'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
# Generic class to loading a template and parsing it via ERb.
|
6
|
-
#
|
7
|
-
# @api private
|
8
|
-
class Template
|
9
|
-
|
10
|
-
include Vedeu::ViewHelpers
|
11
|
-
|
12
|
-
# @param (see Vedeu::Template#new)
|
13
|
-
# @return [void]
|
14
|
-
def self.parse(object, path, options = {})
|
15
|
-
new(object, path, options).parse
|
16
|
-
end
|
17
|
-
|
18
|
-
# Returns a new instance of Vedeu::Template.
|
19
|
-
#
|
20
|
-
# @param object [Class]
|
21
|
-
# @param path [String]
|
22
|
-
# @param options [Hash]
|
23
|
-
# @option options name [String] The name of an interface.
|
24
|
-
# @return [Template]
|
25
|
-
def initialize(object, path, options = {})
|
26
|
-
@object = object
|
27
|
-
@path = path.to_s
|
28
|
-
@options = options || {}
|
29
|
-
end
|
30
|
-
|
31
|
-
# @return [void]
|
32
|
-
def parse
|
33
|
-
ERB.new(load, nil, '-').result(binding)
|
34
|
-
end
|
35
|
-
|
36
|
-
protected
|
37
|
-
|
38
|
-
# @!attribute [r] object
|
39
|
-
# @return [Class]
|
40
|
-
attr_reader :object
|
41
|
-
|
42
|
-
# @!attribute [r] options
|
43
|
-
# @return [Hash]
|
44
|
-
attr_reader :options
|
45
|
-
|
46
|
-
private
|
47
|
-
|
48
|
-
# @return [String]
|
49
|
-
def preprocess
|
50
|
-
Vedeu::Templating::Preprocessor.process(load)
|
51
|
-
end
|
52
|
-
|
53
|
-
# @return [String]
|
54
|
-
def load
|
55
|
-
File.read(path)
|
56
|
-
end
|
57
|
-
|
58
|
-
# @raise [MissingRequired] when the path is empty.
|
59
|
-
# @raise [MissingRequired] when the path does not exist.
|
60
|
-
# @return [String]
|
61
|
-
def path
|
62
|
-
fail MissingRequired, 'No path to template specified.' if @path.empty?
|
63
|
-
|
64
|
-
unless File.exist?(@path)
|
65
|
-
fail MissingRequired, "Template file cannot be found. (#{@path})"
|
66
|
-
end
|
67
|
-
|
68
|
-
@path
|
69
|
-
end
|
70
|
-
|
71
|
-
end # Template
|
72
|
-
|
73
|
-
end # Vedeu
|
@@ -1,30 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
class ViewHelpersTestClass
|
6
|
-
|
7
|
-
include Vedeu::ViewHelpers
|
8
|
-
|
9
|
-
end
|
10
|
-
|
11
|
-
describe ViewHelpers do
|
12
|
-
|
13
|
-
let(:described) { ViewHelpers }
|
14
|
-
let(:instance) { ViewHelpersTestClass.new }
|
15
|
-
|
16
|
-
describe '#time_now' do
|
17
|
-
let(:_time) { Time.new(2015, 6, 23, 22, 25, 17) }
|
18
|
-
|
19
|
-
before { Time.stubs(:now).returns(_time) }
|
20
|
-
|
21
|
-
subject { instance.time_now }
|
22
|
-
|
23
|
-
it 'returns a formatted time' do
|
24
|
-
subject.must_equal('Tue 23 Jun 22:25')
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
end # ViewHelpers
|
29
|
-
|
30
|
-
end # Vedeu
|
@@ -1,83 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
describe Chars do
|
6
|
-
|
7
|
-
let(:described) { Vedeu::Chars }
|
8
|
-
let(:instance) { described.new }
|
9
|
-
|
10
|
-
it { described.superclass.must_equal(Vedeu::Collection) }
|
11
|
-
|
12
|
-
describe '#initialize' do
|
13
|
-
it { instance.must_be_instance_of(described) }
|
14
|
-
end
|
15
|
-
|
16
|
-
end # Chars
|
17
|
-
|
18
|
-
describe EventCollection do
|
19
|
-
|
20
|
-
let(:described) { Vedeu::EventCollection }
|
21
|
-
let(:instance) { described.new }
|
22
|
-
|
23
|
-
it { described.superclass.must_equal(Vedeu::Collection) }
|
24
|
-
|
25
|
-
describe '#initialize' do
|
26
|
-
it { instance.must_be_instance_of(described) }
|
27
|
-
end
|
28
|
-
|
29
|
-
end # EventCollection
|
30
|
-
|
31
|
-
describe InterfaceCollection do
|
32
|
-
|
33
|
-
let(:described) { Vedeu::InterfaceCollection }
|
34
|
-
let(:instance) { described.new }
|
35
|
-
|
36
|
-
it { described.superclass.must_equal(Vedeu::Collection) }
|
37
|
-
|
38
|
-
describe '#initialize' do
|
39
|
-
it { instance.must_be_instance_of(described) }
|
40
|
-
end
|
41
|
-
|
42
|
-
end # InterfaceCollection
|
43
|
-
|
44
|
-
describe Keys do
|
45
|
-
|
46
|
-
let(:described) { Vedeu::Keys }
|
47
|
-
let(:instance) { described.new }
|
48
|
-
|
49
|
-
it { described.superclass.must_equal(Vedeu::Collection) }
|
50
|
-
|
51
|
-
describe '#initialize' do
|
52
|
-
it { instance.must_be_instance_of(described) }
|
53
|
-
end
|
54
|
-
|
55
|
-
end # Keys
|
56
|
-
|
57
|
-
describe Lines do
|
58
|
-
|
59
|
-
let(:described) { Vedeu::Lines }
|
60
|
-
let(:instance) { described.new }
|
61
|
-
|
62
|
-
it { described.superclass.must_equal(Vedeu::Collection) }
|
63
|
-
|
64
|
-
describe '#initialize' do
|
65
|
-
it { instance.must_be_instance_of(described) }
|
66
|
-
end
|
67
|
-
|
68
|
-
end # Lines
|
69
|
-
|
70
|
-
describe Streams do
|
71
|
-
|
72
|
-
let(:described) { Vedeu::Streams }
|
73
|
-
let(:instance) { described.new }
|
74
|
-
|
75
|
-
it { described.superclass.must_equal(Vedeu::Collection) }
|
76
|
-
|
77
|
-
describe '#initialize' do
|
78
|
-
it { instance.must_be_instance_of(described) }
|
79
|
-
end
|
80
|
-
|
81
|
-
end # Streams
|
82
|
-
|
83
|
-
end # Vedeu
|
@@ -1,35 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
describe Groups do
|
6
|
-
|
7
|
-
let(:described) { Vedeu::Groups }
|
8
|
-
|
9
|
-
it { described.must_respond_to(:groups) }
|
10
|
-
|
11
|
-
describe '#by_name' do
|
12
|
-
let(:_name) { 'carbon' }
|
13
|
-
|
14
|
-
subject { described.groups.by_name(_name) }
|
15
|
-
|
16
|
-
context 'when the group exists' do
|
17
|
-
before do
|
18
|
-
Vedeu.group 'carbon' do
|
19
|
-
end
|
20
|
-
end
|
21
|
-
after { Vedeu.groups.reset }
|
22
|
-
|
23
|
-
it { subject.must_be_instance_of(Vedeu::Group) }
|
24
|
-
end
|
25
|
-
|
26
|
-
context 'when the group does not exist' do
|
27
|
-
let(:_name) { 'nitrogen' }
|
28
|
-
|
29
|
-
it { subject.must_be_instance_of(Vedeu::Group) }
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
end # Groups
|
34
|
-
|
35
|
-
end # Vedeu
|
@@ -1,44 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
describe Template do
|
6
|
-
|
7
|
-
let(:described) { Vedeu::Template }
|
8
|
-
let(:instance) { described.new(object, path) }
|
9
|
-
let(:object) {}
|
10
|
-
let(:path) {}
|
11
|
-
|
12
|
-
describe '#initialize' do
|
13
|
-
it { instance.must_be_instance_of(described) }
|
14
|
-
it { instance.instance_variable_get('@object').must_equal(object) }
|
15
|
-
it { instance.instance_variable_get('@path').must_equal('') }
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '.parse' do
|
19
|
-
subject { described.parse(object, path) }
|
20
|
-
|
21
|
-
before { File.stubs(:read).returns('') }
|
22
|
-
|
23
|
-
context 'when the path is empty' do
|
24
|
-
it { proc { subject }.must_raise(MissingRequired) }
|
25
|
-
end
|
26
|
-
|
27
|
-
context 'when the path is does not exist' do
|
28
|
-
let(:path) { '/tmp/vedeu_does_not_exist' }
|
29
|
-
|
30
|
-
it { proc { subject }.must_raise(MissingRequired) }
|
31
|
-
end
|
32
|
-
|
33
|
-
context 'when the path exists' do
|
34
|
-
let(:path) { '/tmp/vedeu_does_exist' }
|
35
|
-
|
36
|
-
before { File.stubs(:exist?).returns(true) }
|
37
|
-
|
38
|
-
it { subject.must_equal('') }
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
end # Template
|
43
|
-
|
44
|
-
end # Vedeu
|