vedeu 0.4.35 → 0.4.36
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/Dockerfile +56 -35
- data/bin/vedeu +54 -13
- data/docs/applications.md +92 -0
- data/features/cli_vedeu.feature +5 -0
- data/features/start_stop.feature +1 -1
- data/features/step_definitions/vedeu_steps.rb +0 -0
- data/features/support/env.rb +3 -2
- data/lib/vedeu.rb +1 -0
- data/lib/vedeu/all.rb +6 -0
- data/lib/vedeu/application/all.rb +2 -0
- data/lib/vedeu/application/application_controller.rb +7 -0
- data/lib/vedeu/application/application_helper.rb +7 -0
- data/lib/vedeu/bootstrap.rb +73 -0
- data/lib/vedeu/distributed/templates/default_configuration.vedeu +7 -14
- data/lib/vedeu/generator/all.rb +13 -0
- data/lib/vedeu/generator/application.rb +108 -0
- data/lib/vedeu/generator/helpers.rb +55 -0
- data/lib/vedeu/generator/templates/application/Gemfile +3 -0
- data/lib/vedeu/generator/templates/application/app/controllers/application_controller.erb +7 -0
- data/lib/vedeu/generator/templates/application/app/controllers/name.erb +10 -0
- data/lib/vedeu/generator/templates/application/app/helpers/application_helper.erb +9 -0
- data/lib/vedeu/generator/templates/application/app/helpers/name.erb +9 -0
- data/lib/vedeu/generator/templates/application/app/models/keymaps/_global_.rb +2 -0
- data/lib/vedeu/generator/templates/application/app/models/keymaps/_system_.rb +2 -0
- data/lib/vedeu/generator/templates/application/app/views/interfaces/name.erb +44 -0
- data/lib/vedeu/generator/templates/application/app/views/name.erb +0 -0
- data/lib/vedeu/generator/templates/application/app/views/templates/name.erb +0 -0
- data/lib/vedeu/generator/templates/application/application.rb +9 -0
- data/lib/vedeu/generator/templates/application/bin/name +7 -0
- data/lib/vedeu/generator/templates/application/config/app_name.erb +1 -0
- data/lib/vedeu/generator/templates/application/config/configuration.rb +22 -0
- data/lib/vedeu/generator/templates/application/lib/.gitkeep +0 -0
- data/lib/vedeu/generator/templates/application/test/.gitkeep +0 -0
- data/lib/vedeu/generator/templates/application/vendor/.gitkeep +0 -0
- data/lib/vedeu/generator/view.rb +71 -0
- data/lib/vedeu/geometry/area.rb +21 -21
- data/lib/vedeu/main_loop.rb +0 -1
- data/lib/vedeu/output/esc.rb +5 -4
- data/lib/vedeu/output/refresh.rb +9 -3
- data/lib/vedeu/output/view_helpers/all.rb +0 -2
- data/lib/vedeu/support/log.rb +1 -1
- data/lib/vedeu/support/template.rb +1 -1
- data/lib/vedeu/support/terminal.rb +10 -2
- data/lib/vedeu/tasks/application.rake +28 -0
- data/lib/vedeu/tasks/vedeu.rake +3 -0
- data/lib/vedeu/templating/directive.rb +1 -8
- data/lib/vedeu/traps.rb +2 -2
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/application/application_controller_test.rb +12 -0
- data/test/lib/vedeu/application/application_helper_test.rb +18 -0
- data/test/lib/vedeu/bootstrap_test.rb +30 -0
- data/test/lib/vedeu/buffers/buffer_test.rb +7 -0
- data/test/lib/vedeu/buffers/display_buffer_test.rb +2 -0
- data/test/lib/vedeu/configuration/api_test.rb +6 -0
- data/test/lib/vedeu/cursor/move_test.rb +7 -0
- data/test/lib/vedeu/distributed/client_test.rb +4 -0
- data/test/lib/vedeu/distributed/server_test.rb +9 -0
- data/test/lib/vedeu/dsl/use_test.rb +4 -0
- data/test/lib/vedeu/generator/application_test.rb +55 -0
- data/test/lib/vedeu/generator/helpers_test.rb +80 -0
- data/test/lib/vedeu/generator/view_test.rb +35 -0
- data/test/lib/vedeu/geometry/area_test.rb +8 -0
- data/test/lib/vedeu/launcher_test.rb +2 -0
- data/test/lib/vedeu/main_loop_test.rb +2 -0
- data/test/lib/vedeu/null/interface_test.rb +1 -0
- data/test/lib/vedeu/output/clear_test.rb +3 -0
- data/test/lib/vedeu/output/refresh_test.rb +1 -0
- data/test/lib/vedeu/output/renderers/file_test.rb +1 -0
- data/test/lib/vedeu/repositories/repositories/events_repository_test.rb +2 -0
- data/test/lib/vedeu/repositories/repositories/interfaces_repository_test.rb +3 -0
- data/test/lib/vedeu/repositories/repositories/keymaps_test.rb +2 -0
- data/test/lib/vedeu/repositories/repositories/menus_test.rb +2 -0
- data/test/lib/vedeu/repositories/repository_test.rb +1 -0
- data/test/lib/vedeu/support/log_test.rb +5 -0
- data/test/lib/vedeu/support/terminal_test.rb +1 -0
- data/test/lib/vedeu/traps_test.rb +1 -1
- data/test/lib/vedeu_test.rb +1 -0
- data/vedeu.gemspec +7 -4
- metadata +97 -25
@@ -1,12 +1,11 @@
|
|
1
1
|
Vedeu.configure do
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
drb_height 25
|
2
|
+
# log '/tmp/your_app.log'
|
3
|
+
# debug!
|
4
|
+
# drb!
|
5
|
+
# drb_host 'localhost'
|
6
|
+
# drb_port 21420
|
7
|
+
# drb_width 80
|
8
|
+
# drb_height 25
|
10
9
|
|
11
10
|
# cooked!
|
12
11
|
# raw!
|
@@ -16,12 +15,6 @@ Vedeu.configure do
|
|
16
15
|
# interactive!
|
17
16
|
# standalone!
|
18
17
|
|
19
|
-
# System keys can be redefined
|
20
|
-
# exit_key 'q'
|
21
|
-
# focus_next_key :tab
|
22
|
-
# focus_prev_key :shift_tab
|
23
|
-
# mode_switch_key :escape
|
24
|
-
|
25
18
|
# Not used yet
|
26
19
|
# stdin File.open("/dev/tty", "r")
|
27
20
|
# stdout File.open("/dev/tty", "w")
|
@@ -0,0 +1,108 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
module Generator
|
4
|
+
|
5
|
+
class Application
|
6
|
+
|
7
|
+
include Vedeu::Generator::Helpers
|
8
|
+
|
9
|
+
# @param name [String] The name of the application.
|
10
|
+
# @return [Vedeu::Generator::Application]
|
11
|
+
def self.generate(name)
|
12
|
+
new(name).generate
|
13
|
+
end
|
14
|
+
|
15
|
+
# @param name [String] The name of the application.
|
16
|
+
# @return [Vedeu::Generator::Application]
|
17
|
+
def initialize(name)
|
18
|
+
@name = name
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [void]
|
22
|
+
def generate
|
23
|
+
make_directory_structure
|
24
|
+
|
25
|
+
copy_gemfile
|
26
|
+
copy_application_controller
|
27
|
+
copy_application_helper
|
28
|
+
copy_global_keymap
|
29
|
+
copy_system_keymap
|
30
|
+
copy_application_executable
|
31
|
+
make_application_executable
|
32
|
+
copy_configuration
|
33
|
+
copy_app_name
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
# @return [void]
|
39
|
+
def make_directory_structure
|
40
|
+
FileUtils.mkdir_p(name + '/app/controllers')
|
41
|
+
FileUtils.mkdir_p(name + '/app/helpers')
|
42
|
+
FileUtils.mkdir_p(name + '/app/models/keymaps')
|
43
|
+
FileUtils.mkdir_p(name + '/app/views/interfaces')
|
44
|
+
FileUtils.mkdir_p(name + '/app/views/templates')
|
45
|
+
FileUtils.mkdir_p(name + '/bin')
|
46
|
+
FileUtils.mkdir_p(name + '/config')
|
47
|
+
FileUtils.mkdir_p(name + '/lib')
|
48
|
+
FileUtils.mkdir_p(name + '/test')
|
49
|
+
FileUtils.mkdir_p(name + '/vendor')
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [void]
|
53
|
+
def copy_application_controller
|
54
|
+
make_file(source + '/app/controllers/application_controller.erb',
|
55
|
+
name + '/app/controllers/application_controller.rb')
|
56
|
+
end
|
57
|
+
|
58
|
+
# @return [void]
|
59
|
+
def copy_application_helper
|
60
|
+
make_file(source + '/app/helpers/application_helper.erb',
|
61
|
+
name + '/app/helpers/application_helper.rb')
|
62
|
+
end
|
63
|
+
|
64
|
+
# @return [void]
|
65
|
+
def copy_application_executable
|
66
|
+
FileUtils.cp(source + '/bin/name',
|
67
|
+
"#{name}/bin/#{name}")
|
68
|
+
end
|
69
|
+
|
70
|
+
# @return [void]
|
71
|
+
def copy_configuration
|
72
|
+
FileUtils.cp(source + '/config/configuration.rb',
|
73
|
+
"#{name}/config/configuration.rb")
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return [void]
|
77
|
+
def copy_app_name
|
78
|
+
make_file(source + '/config/app_name.erb',
|
79
|
+
name + '/config/app_name')
|
80
|
+
end
|
81
|
+
|
82
|
+
# @return [void]
|
83
|
+
def copy_gemfile
|
84
|
+
FileUtils.cp(source + '/Gemfile', "#{name}/Gemfile")
|
85
|
+
end
|
86
|
+
|
87
|
+
# @return [void]
|
88
|
+
def make_application_executable
|
89
|
+
FileUtils.chmod(0755, "#{name}/bin/#{name}")
|
90
|
+
end
|
91
|
+
|
92
|
+
# @return [void]
|
93
|
+
def copy_global_keymap
|
94
|
+
FileUtils.cp(source + '/app/models/keymaps/_global_.rb',
|
95
|
+
"#{name}/app/models/keymaps/_global_.rb")
|
96
|
+
end
|
97
|
+
|
98
|
+
# @return [void]
|
99
|
+
def copy_system_keymap
|
100
|
+
FileUtils.cp(source + '/app/models/keymaps/_system_.rb',
|
101
|
+
"#{name}/app/models/keymaps/_system_.rb")
|
102
|
+
end
|
103
|
+
|
104
|
+
end # Application
|
105
|
+
|
106
|
+
end # Generator
|
107
|
+
|
108
|
+
end # Vedeu
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
module Generator
|
4
|
+
|
5
|
+
module Helpers
|
6
|
+
|
7
|
+
# @return [String]
|
8
|
+
def app_name
|
9
|
+
@app_name ||= File.read('./config/app_name')
|
10
|
+
end
|
11
|
+
|
12
|
+
# @param name [String]
|
13
|
+
# @return [String]
|
14
|
+
def app_name_as_snake_case(name = app_name)
|
15
|
+
name.gsub!(/::/, '/')
|
16
|
+
name.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
17
|
+
name.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
|
18
|
+
name.tr!('-', '_')
|
19
|
+
name.downcase!
|
20
|
+
name
|
21
|
+
end
|
22
|
+
|
23
|
+
# @param source [String]
|
24
|
+
# @param destination [String]
|
25
|
+
# @return [void]
|
26
|
+
def make_file(source, destination)
|
27
|
+
File.write(destination, parse(source))
|
28
|
+
end
|
29
|
+
|
30
|
+
# @return [String]
|
31
|
+
def name
|
32
|
+
@_name ||= @name.downcase
|
33
|
+
end
|
34
|
+
|
35
|
+
# @return [String]
|
36
|
+
def name_as_class
|
37
|
+
name.downcase.split(/_|-/).map(&:capitalize).join
|
38
|
+
end
|
39
|
+
|
40
|
+
# @param source [String]
|
41
|
+
# @return [String]
|
42
|
+
def parse(source)
|
43
|
+
Vedeu::Template.parse(self, source)
|
44
|
+
end
|
45
|
+
|
46
|
+
# @return [String]
|
47
|
+
def source
|
48
|
+
File.dirname(__FILE__) + '/templates/application/.'
|
49
|
+
end
|
50
|
+
|
51
|
+
end # Helpers
|
52
|
+
|
53
|
+
end # Generator
|
54
|
+
|
55
|
+
end # Vedeu
|
@@ -0,0 +1,44 @@
|
|
1
|
+
Vedeu.interface '<%= object.name %>' do
|
2
|
+
# border do
|
3
|
+
# Define colour and style of border
|
4
|
+
# colour foreground: '#ffffff', background: '#000000'
|
5
|
+
# style 'normal'
|
6
|
+
|
7
|
+
# Define visibility of border
|
8
|
+
# show_bottom!
|
9
|
+
# show_left!
|
10
|
+
# show_right!
|
11
|
+
# show_top!
|
12
|
+
|
13
|
+
# Define characters used to draw border
|
14
|
+
# bottom_right '+'
|
15
|
+
# bottom_left '+'
|
16
|
+
# horizontal '-'
|
17
|
+
# top_right '+'
|
18
|
+
# top_left '+'
|
19
|
+
# vertical '|'
|
20
|
+
|
21
|
+
# Define the title of the interface
|
22
|
+
# title '<%= object.name %>'
|
23
|
+
# end
|
24
|
+
|
25
|
+
# background
|
26
|
+
|
27
|
+
# cursor!
|
28
|
+
|
29
|
+
# foreground
|
30
|
+
|
31
|
+
# geometry do
|
32
|
+
# centred!
|
33
|
+
# x 1
|
34
|
+
# y 1
|
35
|
+
# xn 11
|
36
|
+
# yn 11
|
37
|
+
# height 10
|
38
|
+
# width 10
|
39
|
+
# end
|
40
|
+
|
41
|
+
# style
|
42
|
+
|
43
|
+
# zindex
|
44
|
+
end
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= object.name_as_class -%>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
Vedeu.configure do
|
2
|
+
# log '/tmp/your_app.log'
|
3
|
+
# debug!
|
4
|
+
# drb!
|
5
|
+
# drb_host 'localhost'
|
6
|
+
# drb_port 21420
|
7
|
+
# drb_width 80
|
8
|
+
# drb_height 25
|
9
|
+
|
10
|
+
# cooked!
|
11
|
+
# raw!
|
12
|
+
|
13
|
+
# run_once!
|
14
|
+
|
15
|
+
# interactive!
|
16
|
+
# standalone!
|
17
|
+
|
18
|
+
# Not used yet
|
19
|
+
# stdin File.open("/dev/tty", "r")
|
20
|
+
# stdout File.open("/dev/tty", "w")
|
21
|
+
# stderr File.open("/tmp/vedeu_error.log", "w+")
|
22
|
+
end
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1,71 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
|
3
|
+
module Vedeu
|
4
|
+
|
5
|
+
module Generator
|
6
|
+
|
7
|
+
class View
|
8
|
+
|
9
|
+
include Vedeu::Generator::Helpers
|
10
|
+
|
11
|
+
# @param name [String] The name of the view.
|
12
|
+
# @return [Vedeu::Generator::View]
|
13
|
+
def self.generate(name)
|
14
|
+
new(name).generate
|
15
|
+
end
|
16
|
+
|
17
|
+
# @param name [String] The name of the view.
|
18
|
+
# @return [Vedeu::Generator::View]
|
19
|
+
def initialize(name)
|
20
|
+
@name = name
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [void]
|
24
|
+
def generate
|
25
|
+
make_controller_file
|
26
|
+
|
27
|
+
make_helper_file
|
28
|
+
|
29
|
+
make_interface_file
|
30
|
+
|
31
|
+
make_template_file
|
32
|
+
|
33
|
+
make_view_class_file
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
# @return [void]
|
39
|
+
def make_controller_file
|
40
|
+
make_file(source + '/app/controllers/name.erb',
|
41
|
+
app_name + "/app/controllers/#{name}.rb")
|
42
|
+
end
|
43
|
+
|
44
|
+
# @return [void]
|
45
|
+
def make_helper_file
|
46
|
+
make_file(source + '/app/helpers/name.erb',
|
47
|
+
app_name + "/app/helpers/#{name}.rb")
|
48
|
+
end
|
49
|
+
|
50
|
+
# @return [void]
|
51
|
+
def make_interface_file
|
52
|
+
make_file(source + '/app/views/interfaces/name.erb',
|
53
|
+
app_name + "/app/views/interfaces/#{name}.rb")
|
54
|
+
end
|
55
|
+
|
56
|
+
# @return [void]
|
57
|
+
def make_template_file
|
58
|
+
FileUtils.touch(app_name + "/app/views/templates/#{name}.erb")
|
59
|
+
end
|
60
|
+
|
61
|
+
# @return [void]
|
62
|
+
def make_view_class_file
|
63
|
+
make_file(source + '/app/views/name.erb',
|
64
|
+
app_name + "/app/views/#{name}.rb")
|
65
|
+
end
|
66
|
+
|
67
|
+
end # View
|
68
|
+
|
69
|
+
end # Generator
|
70
|
+
|
71
|
+
end # Vedeu
|