vedeu 0.5.10 → 0.5.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +2 -1
- data/bin/vedeu +1 -4
- data/lib/vedeu/all.rb +8 -12
- data/lib/vedeu/bindings/drb.rb +2 -2
- data/lib/vedeu/bindings/system.rb +11 -7
- data/lib/vedeu/{output/virtual_terminal.rb → buffers/virtual_buffer.rb} +15 -8
- data/lib/vedeu/{output/virtual_buffer.rb → buffers/virtual_buffers.rb} +4 -4
- data/lib/vedeu/cursor/cursor.rb +2 -6
- data/lib/vedeu/cursor/reposition.rb +11 -6
- data/lib/vedeu/esc/esc.rb +4 -0
- data/lib/vedeu/models/views/view.rb +1 -1
- data/lib/vedeu/output/output.rb +1 -1
- data/lib/vedeu/plugins.rb +7 -3
- data/lib/vedeu/plugins/plugin.rb +4 -4
- data/lib/vedeu/refresh/refresh.rb +31 -0
- data/lib/vedeu/refresh/refresh_buffer.rb +53 -0
- data/lib/vedeu/{cursor → refresh}/refresh_cursor.rb +4 -4
- data/lib/vedeu/refresh/refresh_group.rb +59 -0
- data/lib/vedeu/terminal.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/{output/virtual_terminal_test.rb → buffers/virtual_buffer_test.rb} +16 -12
- data/test/lib/vedeu/{output/virtual_buffer_test.rb → buffers/virtual_buffers_test.rb} +3 -3
- data/test/lib/vedeu/cursor/cursors_test.rb +2 -0
- data/test/lib/vedeu/distributed/client_test.rb +13 -9
- data/test/lib/vedeu/distributed/server_test.rb +5 -0
- data/test/lib/vedeu/distributed/subprocess_test.rb +12 -1
- data/test/lib/vedeu/models/views/view_test.rb +41 -0
- data/test/lib/vedeu/output/output_test.rb +1 -1
- data/test/lib/vedeu/output/renderers/html_test.rb +1 -1
- data/test/lib/vedeu/output/viewport_test.rb +15 -16
- data/test/lib/vedeu/plugins_test.rb +7 -0
- data/test/lib/vedeu/refresh/refresh_buffer_test.rb +50 -0
- data/test/lib/vedeu/{cursor → refresh}/refresh_cursor_test.rb +8 -6
- data/test/lib/vedeu/{output → refresh}/refresh_group_test.rb +4 -2
- data/test/lib/vedeu/refresh/refresh_test.rb +44 -0
- data/test/test_helper.rb +1 -1
- data/vedeu.gemspec +3 -3
- metadata +24 -55
- data/lib/vedeu/cli/generator/all.rb +0 -9
- data/lib/vedeu/cli/generator/application.rb +0 -133
- data/lib/vedeu/cli/generator/helpers.rb +0 -139
- data/lib/vedeu/cli/generator/templates/application/.gitignore +0 -1
- data/lib/vedeu/cli/generator/templates/application/.ruby-version +0 -1
- data/lib/vedeu/cli/generator/templates/application/Gemfile +0 -4
- data/lib/vedeu/cli/generator/templates/application/LICENSE.txt +0 -24
- data/lib/vedeu/cli/generator/templates/application/README.md +0 -18
- data/lib/vedeu/cli/generator/templates/application/app/controllers/application_controller.erb +0 -7
- data/lib/vedeu/cli/generator/templates/application/app/controllers/name.erb +0 -22
- data/lib/vedeu/cli/generator/templates/application/app/helpers/application_helper.erb +0 -9
- data/lib/vedeu/cli/generator/templates/application/app/helpers/name.erb +0 -11
- data/lib/vedeu/cli/generator/templates/application/app/models/keymaps/_global_.rb +0 -8
- data/lib/vedeu/cli/generator/templates/application/app/models/keymaps/name.erb +0 -3
- data/lib/vedeu/cli/generator/templates/application/app/views/interfaces/name.erb +0 -67
- data/lib/vedeu/cli/generator/templates/application/app/views/name.erb +0 -36
- data/lib/vedeu/cli/generator/templates/application/app/views/templates/name.erb +0 -0
- data/lib/vedeu/cli/generator/templates/application/application.erb +0 -22
- data/lib/vedeu/cli/generator/templates/application/bin/name +0 -9
- data/lib/vedeu/cli/generator/templates/application/config/app_name.erb +0 -1
- data/lib/vedeu/cli/generator/templates/application/config/configuration.erb +0 -33
- data/lib/vedeu/cli/generator/templates/application/lib/.gitkeep +0 -0
- data/lib/vedeu/cli/generator/templates/application/test/.gitkeep +0 -0
- data/lib/vedeu/cli/generator/templates/application/vendor/.gitkeep +0 -0
- data/lib/vedeu/cli/generator/view.rb +0 -86
- data/lib/vedeu/cli/main.rb +0 -39
- data/lib/vedeu/output/refresh.rb +0 -69
- data/lib/vedeu/output/refresh_group.rb +0 -41
- data/test/lib/vedeu/cli/generator/application_test.rb +0 -37
- data/test/lib/vedeu/cli/generator/helpers_test.rb +0 -197
- data/test/lib/vedeu/cli/generator/view_test.rb +0 -38
- data/test/lib/vedeu/cli/main_test.rb +0 -59
- data/test/lib/vedeu/output/refresh_test.rb +0 -63
File without changes
|
File without changes
|
File without changes
|
@@ -1,86 +0,0 @@
|
|
1
|
-
module Vedeu
|
2
|
-
|
3
|
-
module Generator
|
4
|
-
|
5
|
-
# Generates a view for the client application.
|
6
|
-
#
|
7
|
-
# @example
|
8
|
-
# ```bash
|
9
|
-
# vedeu view main_screen
|
10
|
-
# ```
|
11
|
-
#
|
12
|
-
# :nocov:
|
13
|
-
class View
|
14
|
-
|
15
|
-
include Vedeu::Generator::Helpers
|
16
|
-
|
17
|
-
# @see Vedeu::Generator::View#initialize
|
18
|
-
def self.generate(name)
|
19
|
-
new(name).generate
|
20
|
-
end
|
21
|
-
|
22
|
-
# Returns a new instance of Vedeu::Generator::View.
|
23
|
-
#
|
24
|
-
# @param name [String] The name of the view.
|
25
|
-
# @return [Vedeu::Generator::View]
|
26
|
-
def initialize(name)
|
27
|
-
@name = name
|
28
|
-
end
|
29
|
-
|
30
|
-
# @return [void]
|
31
|
-
def generate
|
32
|
-
make_controller_file
|
33
|
-
make_helper_file
|
34
|
-
make_keymap_file
|
35
|
-
make_interface_file
|
36
|
-
make_template_file
|
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' to start " \
|
41
|
-
'Vedeu at this controller.')
|
42
|
-
end
|
43
|
-
|
44
|
-
private
|
45
|
-
|
46
|
-
# @return [void]
|
47
|
-
def make_controller_file
|
48
|
-
make_file(source + '/app/controllers/name.erb',
|
49
|
-
'.' + "/app/controllers/#{name}_controller.rb")
|
50
|
-
end
|
51
|
-
|
52
|
-
# @return [void]
|
53
|
-
def make_helper_file
|
54
|
-
make_file(source + '/app/helpers/name.erb',
|
55
|
-
'.' + "/app/helpers/#{name}_helper.rb")
|
56
|
-
end
|
57
|
-
|
58
|
-
# @return [void]
|
59
|
-
def make_keymap_file
|
60
|
-
make_file(source + '/app/models/keymaps/name.erb',
|
61
|
-
'.' + "/app/models/keymaps/#{name}.rb")
|
62
|
-
end
|
63
|
-
|
64
|
-
# @return [void]
|
65
|
-
def make_interface_file
|
66
|
-
make_file(source + '/app/views/interfaces/name.erb',
|
67
|
-
'.' + "/app/views/interfaces/#{name}.rb")
|
68
|
-
end
|
69
|
-
|
70
|
-
# @return [void]
|
71
|
-
def make_template_file
|
72
|
-
touch_file('.' + "/app/views/templates/#{name}.erb")
|
73
|
-
end
|
74
|
-
|
75
|
-
# @return [void]
|
76
|
-
def make_view_class_file
|
77
|
-
make_file(source + '/app/views/name.erb',
|
78
|
-
'.' + "/app/views/#{name}.rb")
|
79
|
-
end
|
80
|
-
|
81
|
-
end # View
|
82
|
-
# :nocov:
|
83
|
-
|
84
|
-
end # Generator
|
85
|
-
|
86
|
-
end # Vedeu
|
data/lib/vedeu/cli/main.rb
DELETED
@@ -1,39 +0,0 @@
|
|
1
|
-
module Vedeu
|
2
|
-
|
3
|
-
# Provide a command line interface to Vedeu.
|
4
|
-
#
|
5
|
-
module CLI
|
6
|
-
|
7
|
-
# The main command line interface commands.
|
8
|
-
#
|
9
|
-
class Main < Thor
|
10
|
-
|
11
|
-
desc 'new <name>', 'Create a skeleton Vedeu client application.'
|
12
|
-
# @param name [String]
|
13
|
-
# @return [String]
|
14
|
-
def new(name)
|
15
|
-
say Vedeu::Generator::Application.generate(name)
|
16
|
-
end
|
17
|
-
|
18
|
-
# 'Specify the interface name lowercase snakecase; e.g. main_interface'
|
19
|
-
|
20
|
-
desc 'view <name>',
|
21
|
-
'Create a new interface within the client application.'
|
22
|
-
# @param name [String]
|
23
|
-
# @return [String]
|
24
|
-
def view(name)
|
25
|
-
Vedeu::Generator::View.generate(name)
|
26
|
-
end
|
27
|
-
|
28
|
-
desc 'version',
|
29
|
-
'Print the version.'
|
30
|
-
# @return [String]
|
31
|
-
def version
|
32
|
-
say "vedeu #{Vedeu::VERSION}"
|
33
|
-
end
|
34
|
-
|
35
|
-
end # Main
|
36
|
-
|
37
|
-
end # CLI
|
38
|
-
|
39
|
-
end # Vedeu
|
data/lib/vedeu/output/refresh.rb
DELETED
@@ -1,69 +0,0 @@
|
|
1
|
-
module Vedeu
|
2
|
-
|
3
|
-
# Refreshes the terminal.
|
4
|
-
#
|
5
|
-
# @note
|
6
|
-
# In the cases of {#all} and {#by_group}, the interfaces will be refreshed
|
7
|
-
# in z-index order, meaning that interfaces with a lower z-index will be
|
8
|
-
# drawn first. This means overlapping interfaces will be drawn as specified.
|
9
|
-
#
|
10
|
-
module Refresh
|
11
|
-
|
12
|
-
module_function
|
13
|
-
|
14
|
-
# Refresh all registered interfaces.
|
15
|
-
#
|
16
|
-
# @example
|
17
|
-
# Vedeu.trigger(:_refresh_)
|
18
|
-
#
|
19
|
-
# Vedeu::Refresh.all
|
20
|
-
#
|
21
|
-
# @return [Array]
|
22
|
-
def all
|
23
|
-
Vedeu.timer('Refresh All') do
|
24
|
-
Vedeu.interfaces.zindexed.each { |model| by_name(model.name) }
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
# Refresh the interface which is currently focussed.
|
29
|
-
#
|
30
|
-
# @return [Array|Vedeu::ModelNotFound|NilClass]
|
31
|
-
def by_focus
|
32
|
-
by_name(Vedeu.focus) if Vedeu.focus
|
33
|
-
end
|
34
|
-
|
35
|
-
# Refresh an interface, or collection of interfaces belonging to a group.
|
36
|
-
#
|
37
|
-
# @example
|
38
|
-
# Vedeu.trigger(:_refresh_group_, group_name)
|
39
|
-
#
|
40
|
-
# Vedeu::Refresh.by_group(group_name)
|
41
|
-
#
|
42
|
-
# @param group_name [String] The name of the group to be refreshed.
|
43
|
-
# @return [Array|Vedeu::ModelNotFound] A collection of the names of
|
44
|
-
# interfaces refreshed, or an exception when the group was not found.
|
45
|
-
def by_group(group_name)
|
46
|
-
Vedeu.timer("Refresh Group: '#{group_name}'") do
|
47
|
-
Vedeu::RefreshGroup.by_name(group_name)
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
# Refresh an interface by name.
|
52
|
-
#
|
53
|
-
# @example
|
54
|
-
# Vedeu.trigger(:_refresh_, name)
|
55
|
-
#
|
56
|
-
# Vedeu::Refresh.by_name(name)
|
57
|
-
#
|
58
|
-
# @param name [String] The name of the interface to be refreshed using the
|
59
|
-
# named buffer.
|
60
|
-
# @return [Array|Vedeu::ModelNotFound]
|
61
|
-
def by_name(name)
|
62
|
-
Vedeu.timer("Refresh Interface: '#{name}'") do
|
63
|
-
Vedeu.buffers.by_name(name).render
|
64
|
-
end
|
65
|
-
end
|
66
|
-
|
67
|
-
end # Refresh
|
68
|
-
|
69
|
-
end # Vedeu
|
@@ -1,41 +0,0 @@
|
|
1
|
-
module Vedeu
|
2
|
-
|
3
|
-
# Refreshes the given named group of interfaces.
|
4
|
-
#
|
5
|
-
class RefreshGroup
|
6
|
-
|
7
|
-
include Vedeu::Common
|
8
|
-
|
9
|
-
# @param name [String]
|
10
|
-
# @return [void]
|
11
|
-
def self.by_name(name)
|
12
|
-
new(name).by_name
|
13
|
-
end
|
14
|
-
|
15
|
-
# @param name [String]
|
16
|
-
# @return [Vedeu::RefreshGroup]
|
17
|
-
def initialize(name)
|
18
|
-
@name = name
|
19
|
-
end
|
20
|
-
|
21
|
-
# @return [void]
|
22
|
-
def by_name
|
23
|
-
unless present?(name)
|
24
|
-
fail Vedeu::MissingRequired,
|
25
|
-
'Cannot refresh group with an empty group name.'
|
26
|
-
end
|
27
|
-
|
28
|
-
Vedeu.groups.by_name(name).by_zindex.each do |name|
|
29
|
-
Vedeu::Refresh.by_name(name)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
protected
|
34
|
-
|
35
|
-
# @!attribute [r] name
|
36
|
-
# @return [String]
|
37
|
-
attr_reader :name
|
38
|
-
|
39
|
-
end # RefreshGroup
|
40
|
-
|
41
|
-
end # Vedeu
|
@@ -1,37 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
module Generator
|
6
|
-
|
7
|
-
describe Application do
|
8
|
-
|
9
|
-
let(:described) { Vedeu::Generator::Application }
|
10
|
-
let(:instance) { described.new(_name) }
|
11
|
-
let(:_name) { 'my_first_app' }
|
12
|
-
|
13
|
-
describe '#initialize' do
|
14
|
-
it { instance.must_be_instance_of(described) }
|
15
|
-
it { instance.instance_variable_get('@name').must_equal(_name) }
|
16
|
-
end
|
17
|
-
|
18
|
-
describe '.generate' do
|
19
|
-
# before do
|
20
|
-
# FileUtils.stubs(:cp_r)
|
21
|
-
# FileUtils.stubs(:mkdir)
|
22
|
-
# end
|
23
|
-
|
24
|
-
subject { instance.generate(_name) }
|
25
|
-
|
26
|
-
# @todo Add more tests.
|
27
|
-
end
|
28
|
-
|
29
|
-
describe '#generate' do
|
30
|
-
it { instance.must_respond_to(:generate) }
|
31
|
-
end
|
32
|
-
|
33
|
-
end # Application
|
34
|
-
|
35
|
-
end # Generator
|
36
|
-
|
37
|
-
end # Vedeu
|
@@ -1,197 +0,0 @@
|
|
1
|
-
require 'test_helper'
|
2
|
-
|
3
|
-
module Vedeu
|
4
|
-
|
5
|
-
module Generator
|
6
|
-
|
7
|
-
class HelpersTestClass
|
8
|
-
|
9
|
-
include Vedeu::Generator::Helpers
|
10
|
-
|
11
|
-
def initialize(name)
|
12
|
-
@name = name
|
13
|
-
end
|
14
|
-
|
15
|
-
end # HelpersTestClass
|
16
|
-
|
17
|
-
describe Helpers do
|
18
|
-
|
19
|
-
let(:described) { Vedeu::Generator::Helpers }
|
20
|
-
let(:instance) { Vedeu::Generator::HelpersTestClass.new(_name) }
|
21
|
-
let(:_name) { 'my_first_app' }
|
22
|
-
|
23
|
-
describe '#app_name' do
|
24
|
-
before { File.stubs(:read).returns('MyFirstApp') }
|
25
|
-
|
26
|
-
subject { instance.app_name }
|
27
|
-
|
28
|
-
it { subject.must_equal('MyFirstApp') }
|
29
|
-
end
|
30
|
-
|
31
|
-
describe '#make_directory' do
|
32
|
-
let(:destination) {}
|
33
|
-
|
34
|
-
before { Vedeu.stubs(:log_stdout) }
|
35
|
-
|
36
|
-
subject { instance.make_directory(destination) }
|
37
|
-
|
38
|
-
it {
|
39
|
-
FileUtils.expects(:mkdir_p).with(destination)
|
40
|
-
subject
|
41
|
-
}
|
42
|
-
end
|
43
|
-
|
44
|
-
describe '#copy_file' do
|
45
|
-
let(:source) {}
|
46
|
-
let(:destination) {}
|
47
|
-
|
48
|
-
before {
|
49
|
-
File.stubs(:exist?).returns(false)
|
50
|
-
Vedeu.stubs(:log_stdout)
|
51
|
-
}
|
52
|
-
|
53
|
-
subject { instance.copy_file(source, destination) }
|
54
|
-
|
55
|
-
context 'when the file exists' do
|
56
|
-
before { File.stubs(:exist?).returns(true) }
|
57
|
-
|
58
|
-
it {
|
59
|
-
Vedeu.expects(:log_stdout)
|
60
|
-
subject
|
61
|
-
}
|
62
|
-
end
|
63
|
-
|
64
|
-
context 'when the file does not exist' do
|
65
|
-
it {
|
66
|
-
FileUtils.expects(:cp).with(source, destination)
|
67
|
-
subject
|
68
|
-
}
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
describe '#make_file' do
|
73
|
-
let(:source) {}
|
74
|
-
let(:destination) {}
|
75
|
-
|
76
|
-
before {
|
77
|
-
File.stubs(:exist?).returns(false)
|
78
|
-
Vedeu.stubs(:log_stdout)
|
79
|
-
}
|
80
|
-
|
81
|
-
subject { instance.make_file(source, destination) }
|
82
|
-
|
83
|
-
context 'when the file exists' do
|
84
|
-
before { File.stubs(:exist?).returns(true) }
|
85
|
-
|
86
|
-
it {
|
87
|
-
Vedeu.expects(:log_stdout)
|
88
|
-
subject
|
89
|
-
}
|
90
|
-
end
|
91
|
-
|
92
|
-
context 'when the file does not exist' do
|
93
|
-
# @todo Add more tests.
|
94
|
-
# it { skip }
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
describe '#skipped_file' do
|
99
|
-
let(:destination) { 'some_file.txt' }
|
100
|
-
|
101
|
-
before { Vedeu.stubs(:log_stdout) }
|
102
|
-
|
103
|
-
subject { instance.skipped_file(destination) }
|
104
|
-
|
105
|
-
it {
|
106
|
-
Vedeu.expects(:log_stdout).
|
107
|
-
with(type: :create,
|
108
|
-
message: "some_file.txt \e[31malready exists, skipped.\e[39m")
|
109
|
-
subject
|
110
|
-
}
|
111
|
-
end
|
112
|
-
|
113
|
-
describe '#touch_file' do
|
114
|
-
let(:destination) {}
|
115
|
-
|
116
|
-
before { Vedeu.stubs(:log_stdout) }
|
117
|
-
|
118
|
-
subject { instance.touch_file(destination) }
|
119
|
-
|
120
|
-
it {
|
121
|
-
FileUtils.expects(:touch).with(destination)
|
122
|
-
subject
|
123
|
-
}
|
124
|
-
end
|
125
|
-
|
126
|
-
describe '#name' do
|
127
|
-
let(:_name) { 'My_First_APP' }
|
128
|
-
|
129
|
-
subject { instance.name }
|
130
|
-
|
131
|
-
it { subject.must_be_instance_of(String) }
|
132
|
-
|
133
|
-
it { subject.must_equal('my_first_app') }
|
134
|
-
end
|
135
|
-
|
136
|
-
describe '#name_as_class' do
|
137
|
-
subject { instance.name_as_class }
|
138
|
-
|
139
|
-
context 'when the name is a single value' do
|
140
|
-
let(:_name) { 'VEDEU' }
|
141
|
-
|
142
|
-
it { subject.must_equal('Vedeu') }
|
143
|
-
end
|
144
|
-
|
145
|
-
context 'when the name is an underscored value' do
|
146
|
-
it { subject.must_equal('MyFirstApp') }
|
147
|
-
end
|
148
|
-
|
149
|
-
context 'when the name contains hyphens' do
|
150
|
-
let(:_name) { 'hyphenated-APP' }
|
151
|
-
|
152
|
-
it { subject.must_equal('HyphenatedApp')}
|
153
|
-
end
|
154
|
-
end
|
155
|
-
|
156
|
-
describe '#output' do
|
157
|
-
let(:_message) { 'This is a test message.' }
|
158
|
-
|
159
|
-
before { Vedeu.stubs(:log_stdout) }
|
160
|
-
|
161
|
-
subject { instance.output(_message) }
|
162
|
-
|
163
|
-
it { subject.must_be_instance_of(String) }
|
164
|
-
|
165
|
-
it {
|
166
|
-
Vedeu.expects(:log_stdout).
|
167
|
-
with(type: :info, message: _message)
|
168
|
-
subject
|
169
|
-
}
|
170
|
-
|
171
|
-
it { subject.must_equal(_message) }
|
172
|
-
end
|
173
|
-
|
174
|
-
describe '#parse' do
|
175
|
-
let(:source) {}
|
176
|
-
|
177
|
-
subject { instance.parse(source) }
|
178
|
-
|
179
|
-
it {
|
180
|
-
Vedeu::Templating::Template.expects(:parse).with(instance, source)
|
181
|
-
subject
|
182
|
-
}
|
183
|
-
end
|
184
|
-
|
185
|
-
describe '#source' do
|
186
|
-
subject { instance.source }
|
187
|
-
|
188
|
-
it { subject.must_be_instance_of(String) }
|
189
|
-
|
190
|
-
it { subject.must_match('vedeu/cli/generator/templates/application/.') }
|
191
|
-
end
|
192
|
-
|
193
|
-
end # Helpers
|
194
|
-
|
195
|
-
end # Generator
|
196
|
-
|
197
|
-
end # Vedeu
|