vedeu 0.5.8 → 0.5.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Dockerfile +3 -1
- data/docs/getting_started.md +6 -3
- data/lib/vedeu/all.rb +6 -3
- data/lib/vedeu/borders/border.rb +7 -10
- data/lib/vedeu/cli/generator/application.rb +19 -34
- data/lib/vedeu/cli/generator/helpers.rb +58 -4
- data/lib/vedeu/colours/colour_translator.rb +2 -6
- data/lib/vedeu/esc/actions.rb +52 -0
- data/lib/vedeu/esc/borders.rb +70 -0
- data/lib/vedeu/esc/colours.rb +104 -0
- data/lib/vedeu/{output → esc}/esc.rb +3 -1
- data/lib/vedeu/models/cell.rb +1 -2
- data/lib/vedeu/{null.rb → null/null.rb} +0 -0
- data/lib/vedeu/output/html_char.rb +12 -10
- data/lib/vedeu/templating/view_template.rb +15 -0
- data/lib/vedeu/version.rb +1 -1
- data/test/lib/vedeu/cli/generator/helpers_test.rb +51 -8
- data/test/lib/vedeu/esc/actions_test.rb +39 -0
- data/test/lib/vedeu/esc/borders_test.rb +37 -0
- data/test/lib/vedeu/esc/colours_test.rb +80 -0
- data/test/lib/vedeu/models/cell_test.rb +2 -2
- data/test/test_helper.rb +1 -0
- data/vedeu.gemspec +2 -2
- metadata +17 -11
- data/lib/vedeu/colours/escape_sequences.rb +0 -125
- data/test/lib/vedeu/colours/escape_sequences_test.rb +0 -100
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d9f471ab14ab7f5b69de2e0b0c250002f3f1775a
|
4
|
+
data.tar.gz: 471ca4b7ef85a507cf71c0fa64e11844e464f7b0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e68cd9602da230d9b4c38efabaa2c8368d0e2659b6e3d1cbdf2a64522d81d5b5373b48c92ab9e9a86e6631b5fffedadaf1fecc7e3d8f5fc7795b98c4bd9f9db
|
7
|
+
data.tar.gz: d7981f0948f3d7b0521d5cac304deee8f7282601a4c5d71961cd76381e5be7e2c569499292872d5fd94c2c45013c939871584f5e017c6667c8fbed5d2409dc1b
|
data/Dockerfile
CHANGED
@@ -60,8 +60,10 @@ ENV PATH /opt/rubies/ruby-2.2.2/bin/:/usr/local/sbin:/usr/local/bin:/usr/sbin:/u
|
|
60
60
|
RUN gem install bundler
|
61
61
|
|
62
62
|
ADD . /home/vedeu/gem/
|
63
|
-
WORKDIR /home/vedeu
|
63
|
+
WORKDIR /home/vedeu/gem
|
64
64
|
USER vedeu
|
65
|
+
RUN bundle
|
66
|
+
WORKDIR /home/vedeu
|
65
67
|
|
66
68
|
# To build this file:
|
67
69
|
#
|
data/docs/getting_started.md
CHANGED
@@ -20,8 +20,9 @@ for your desired application name.
|
|
20
20
|
|
21
21
|
vedeu new your_app_name
|
22
22
|
|
23
|
-
|
24
|
-
at
|
23
|
+
If `your_app_name` already exists, Vedeu will only write new files that do not
|
24
|
+
exist at the file path. The generated files are a skeleton Vedeu client
|
25
|
+
application. Let's take a look at these files individually.
|
25
26
|
|
26
27
|
```bash
|
27
28
|
|
|
@@ -150,7 +151,9 @@ might want to do something special.
|
|
150
151
|
## Adding a new view to your application
|
151
152
|
|
152
153
|
The following command will build a new view within your application.
|
153
|
-
Substitute `some_view_name` for your desired application name.
|
154
|
+
Substitute `some_view_name` for your desired application name. As with
|
155
|
+
generating a new application, If `some_view_name` already exists, Vedeu will
|
156
|
+
only write new files that do not exist at the file path.
|
154
157
|
|
155
158
|
cd your_app_name
|
156
159
|
vedeu view some_view_name
|
data/lib/vedeu/all.rb
CHANGED
@@ -31,7 +31,7 @@ require 'vedeu/repositories/store'
|
|
31
31
|
require 'vedeu/repositories/registerable'
|
32
32
|
require 'vedeu/repositories/repository'
|
33
33
|
|
34
|
-
require 'vedeu/null'
|
34
|
+
require 'vedeu/null/null'
|
35
35
|
require 'vedeu/null/border'
|
36
36
|
require 'vedeu/null/buffer'
|
37
37
|
require 'vedeu/null/generic'
|
@@ -48,7 +48,6 @@ require 'vedeu/geometry/geometries'
|
|
48
48
|
require 'vedeu/geometry/grid'
|
49
49
|
require 'vedeu/geometry/position'
|
50
50
|
|
51
|
-
require 'vedeu/colours/escape_sequences'
|
52
51
|
require 'vedeu/colours/colours'
|
53
52
|
require 'vedeu/colours/backgrounds'
|
54
53
|
require 'vedeu/colours/foregrounds'
|
@@ -66,6 +65,11 @@ require 'vedeu/cursor/move'
|
|
66
65
|
require 'vedeu/cursor/refresh_cursor'
|
67
66
|
require 'vedeu/cursor/reposition'
|
68
67
|
|
68
|
+
require 'vedeu/esc/actions'
|
69
|
+
require 'vedeu/esc/borders'
|
70
|
+
require 'vedeu/esc/colours'
|
71
|
+
require 'vedeu/esc/esc'
|
72
|
+
|
69
73
|
require 'vedeu/output/renderers/renderer_options'
|
70
74
|
require 'vedeu/output/renderers/escape_sequence'
|
71
75
|
require 'vedeu/output/renderers/file'
|
@@ -146,7 +150,6 @@ require 'vedeu/borders/borders'
|
|
146
150
|
|
147
151
|
require 'vedeu/output/clear/named_group'
|
148
152
|
require 'vedeu/output/clear/named_interface'
|
149
|
-
require 'vedeu/output/esc'
|
150
153
|
require 'vedeu/output/presentation'
|
151
154
|
require 'vedeu/output/compressor'
|
152
155
|
require 'vedeu/output/style'
|
data/lib/vedeu/borders/border.rb
CHANGED
@@ -173,19 +173,16 @@ module Vedeu
|
|
173
173
|
|
174
174
|
# The default values for a new instance of this class.
|
175
175
|
#
|
176
|
-
# @note
|
177
|
-
# Using the '\uXXXX' variant produces gaps in the border, whilst the
|
178
|
-
# '\xXX' renders 'nicely'.
|
179
|
-
#
|
180
176
|
# @return [Hash]
|
177
|
+
# @see Vedeu::EscapeSequences::Borders
|
181
178
|
def defaults
|
182
179
|
{
|
183
|
-
bottom_left:
|
184
|
-
bottom_right:
|
180
|
+
bottom_left: Vedeu::EscapeSequences::Borders.bottom_left,
|
181
|
+
bottom_right: Vedeu::EscapeSequences::Borders.bottom_right,
|
185
182
|
client: nil,
|
186
183
|
colour: nil,
|
187
184
|
enabled: false,
|
188
|
-
horizontal:
|
185
|
+
horizontal: Vedeu::EscapeSequences::Borders.horizontal,
|
189
186
|
name: '',
|
190
187
|
repository: Vedeu.borders,
|
191
188
|
show_bottom: true,
|
@@ -194,9 +191,9 @@ module Vedeu
|
|
194
191
|
show_top: true,
|
195
192
|
style: nil,
|
196
193
|
title: '',
|
197
|
-
top_left:
|
198
|
-
top_right:
|
199
|
-
vertical:
|
194
|
+
top_left: Vedeu::EscapeSequences::Borders.top_left,
|
195
|
+
top_right: Vedeu::EscapeSequences::Borders.top_right,
|
196
|
+
vertical: Vedeu::EscapeSequences::Borders.vertical,
|
200
197
|
}
|
201
198
|
end
|
202
199
|
|
@@ -32,11 +32,7 @@ module Vedeu
|
|
32
32
|
def generate
|
33
33
|
make_directory_structure
|
34
34
|
|
35
|
-
|
36
|
-
copy_gitignore
|
37
|
-
copy_license
|
38
|
-
copy_readme
|
39
|
-
copy_ruby_version
|
35
|
+
copy_app_root_files
|
40
36
|
copy_application_bootstrapper
|
41
37
|
copy_application_controller
|
42
38
|
copy_application_helper
|
@@ -56,61 +52,50 @@ module Vedeu
|
|
56
52
|
|
57
53
|
# @return [void]
|
58
54
|
def copy_application_bootstrapper
|
59
|
-
make_file(source + '/application.erb',
|
55
|
+
make_file(source + '/application.erb',
|
56
|
+
app_root_path + '/application.rb')
|
60
57
|
end
|
61
58
|
|
62
59
|
# @return [void]
|
63
60
|
def copy_application_controller
|
64
61
|
make_file(source + '/app/controllers/application_controller.erb',
|
65
|
-
|
62
|
+
app_controllers_path + 'application_controller.rb')
|
66
63
|
end
|
67
64
|
|
68
65
|
# @return [void]
|
69
66
|
def copy_application_executable
|
70
|
-
copy_file(source + '/bin/name', "#{name}
|
67
|
+
copy_file(source + '/bin/name', app_bin_path + "#{name}")
|
71
68
|
end
|
72
69
|
|
73
70
|
# @return [void]
|
74
71
|
def copy_application_helper
|
75
72
|
make_file(source + '/app/helpers/application_helper.erb',
|
76
|
-
|
73
|
+
app_helpers_path + 'application_helper.rb')
|
77
74
|
end
|
78
75
|
|
79
76
|
# @return [void]
|
80
77
|
def copy_configuration
|
81
78
|
make_file(source + '/config/configuration.erb',
|
82
|
-
|
79
|
+
app_config_path + 'configuration.rb')
|
83
80
|
end
|
84
81
|
|
85
82
|
# @return [void]
|
86
83
|
def copy_app_name
|
87
84
|
make_file(source + '/config/app_name.erb',
|
88
|
-
|
85
|
+
app_config_path + 'app_name')
|
89
86
|
end
|
90
87
|
|
91
88
|
# @return [void]
|
92
|
-
def
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
def copy_license
|
103
|
-
copy_file(source + '/LICENSE.txt', "#{name}/LICENSE.txt")
|
104
|
-
end
|
105
|
-
|
106
|
-
# @return [void]
|
107
|
-
def copy_readme
|
108
|
-
copy_file(source + '/README.md', "#{name}/README.md")
|
109
|
-
end
|
110
|
-
|
111
|
-
# @return [void]
|
112
|
-
def copy_ruby_version
|
113
|
-
copy_file(source + '/.ruby-version', "#{name}/.ruby-version")
|
89
|
+
def copy_app_root_files
|
90
|
+
[
|
91
|
+
'/Gemfile',
|
92
|
+
'/.gitignore',
|
93
|
+
'/LICENSE.txt',
|
94
|
+
'/README.md',
|
95
|
+
'/.ruby-version',
|
96
|
+
].each do |file|
|
97
|
+
copy_file((source + file), (app_root_path + file))
|
98
|
+
end
|
114
99
|
end
|
115
100
|
|
116
101
|
# @return [void]
|
@@ -121,7 +106,7 @@ module Vedeu
|
|
121
106
|
# @return [void]
|
122
107
|
def copy_global_keymap
|
123
108
|
copy_file(source + '/app/models/keymaps/_global_.rb',
|
124
|
-
|
109
|
+
app_keymaps_path + '_global_.rb')
|
125
110
|
end
|
126
111
|
|
127
112
|
# @return [Array<String>]
|
@@ -15,6 +15,41 @@ module Vedeu
|
|
15
15
|
@app_name ||= File.read('./config/app_name')
|
16
16
|
end
|
17
17
|
|
18
|
+
# @return [String]
|
19
|
+
def app_bin_path
|
20
|
+
name + '/bin/'
|
21
|
+
end
|
22
|
+
|
23
|
+
# @return [String]
|
24
|
+
def app_config_path
|
25
|
+
name + '/config/'
|
26
|
+
end
|
27
|
+
|
28
|
+
# @return [String]
|
29
|
+
def app_controllers_path
|
30
|
+
name + '/app/controllers/'
|
31
|
+
end
|
32
|
+
|
33
|
+
# @return [String]
|
34
|
+
def app_helpers_path
|
35
|
+
name + '/app/helpers/'
|
36
|
+
end
|
37
|
+
|
38
|
+
# @return [String]
|
39
|
+
def app_models_path
|
40
|
+
name + '/app/models/'
|
41
|
+
end
|
42
|
+
|
43
|
+
# @return [String]
|
44
|
+
def app_keymaps_path
|
45
|
+
name + '/app/models/keymaps/'
|
46
|
+
end
|
47
|
+
|
48
|
+
# @return [String]
|
49
|
+
def app_views_path
|
50
|
+
name + '/app/views/'
|
51
|
+
end
|
52
|
+
|
18
53
|
# @param destination [String]
|
19
54
|
# @return [void]
|
20
55
|
def make_directory(destination)
|
@@ -27,18 +62,36 @@ module Vedeu
|
|
27
62
|
# @param destination [String]
|
28
63
|
# @return [void]
|
29
64
|
def copy_file(source, destination)
|
30
|
-
|
65
|
+
if File.exist?(destination)
|
66
|
+
skipped_file(destination)
|
31
67
|
|
32
|
-
|
68
|
+
else
|
69
|
+
Vedeu.log_stdout(type: :create, message: "#{destination}")
|
70
|
+
|
71
|
+
FileUtils.cp(source, destination)
|
72
|
+
end
|
33
73
|
end
|
34
74
|
|
35
75
|
# @param source [String]
|
36
76
|
# @param destination [String]
|
37
77
|
# @return [void]
|
38
78
|
def make_file(source, destination)
|
39
|
-
|
79
|
+
if File.exist?(destination)
|
80
|
+
skipped_file(destination)
|
40
81
|
|
41
|
-
|
82
|
+
else
|
83
|
+
Vedeu.log_stdout(type: :create, message: "#{destination}")
|
84
|
+
|
85
|
+
File.write(destination, parse(source))
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
# @param destination [String]
|
90
|
+
# @return [void]
|
91
|
+
def skipped_file(destination)
|
92
|
+
Vedeu.log_stdout(type: :create,
|
93
|
+
message: "#{destination} " +
|
94
|
+
Esc.red { 'already exists, skipped.' })
|
42
95
|
end
|
43
96
|
|
44
97
|
# @param destination [String]
|
@@ -53,6 +106,7 @@ module Vedeu
|
|
53
106
|
def name
|
54
107
|
@_name ||= @name.downcase
|
55
108
|
end
|
109
|
+
alias_method :app_root_path, :name
|
56
110
|
|
57
111
|
# @return [String]
|
58
112
|
def name_as_class
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# Provides escape sequence strings.
|
4
|
+
#
|
5
|
+
module EscapeSequences
|
6
|
+
|
7
|
+
# Provides action related escape sequences.
|
8
|
+
#
|
9
|
+
module Actions
|
10
|
+
|
11
|
+
extend self
|
12
|
+
|
13
|
+
# @return [Hash<Symbol => String>]
|
14
|
+
def characters
|
15
|
+
{
|
16
|
+
hide_cursor: "\e[?25l",
|
17
|
+
show_cursor: "\e[?25h",
|
18
|
+
cursor_position: "\e[6n",
|
19
|
+
bg_reset: "\e[49m",
|
20
|
+
blink: "\e[5m",
|
21
|
+
blink_off: "\e[25m",
|
22
|
+
bold: "\e[1m",
|
23
|
+
bold_off: "\e[22m",
|
24
|
+
dim: "\e[2m",
|
25
|
+
fg_reset: "\e[39m",
|
26
|
+
negative: "\e[7m",
|
27
|
+
positive: "\e[27m",
|
28
|
+
reset: "\e[0m",
|
29
|
+
underline: "\e[4m",
|
30
|
+
underline_off: "\e[24m",
|
31
|
+
}
|
32
|
+
end
|
33
|
+
|
34
|
+
# @return [void]
|
35
|
+
def setup!
|
36
|
+
define_actions!
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
# @return [void]
|
42
|
+
def define_actions!
|
43
|
+
characters.each { |key, code| define_method(key) { code } }
|
44
|
+
end
|
45
|
+
|
46
|
+
end # Actions
|
47
|
+
|
48
|
+
end # EscapeSequences
|
49
|
+
|
50
|
+
Vedeu::EscapeSequences::Actions.setup!
|
51
|
+
|
52
|
+
end # Vedeu
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module Vedeu
|
2
|
+
|
3
|
+
# Provides escape sequence strings.
|
4
|
+
#
|
5
|
+
module EscapeSequences
|
6
|
+
|
7
|
+
# Provides border/box related escape sequences.
|
8
|
+
#
|
9
|
+
# @note
|
10
|
+
# Refer to UTF-8 U+2500 to U+257F for border characters. More details can
|
11
|
+
# be found at: http://en.wikipedia.org/wiki/Box-drawing_character
|
12
|
+
#
|
13
|
+
# Using the '\uXXXX' variant produces gaps in the border, whilst the
|
14
|
+
# '\xXX' renders 'nicely'.
|
15
|
+
#
|
16
|
+
module Borders
|
17
|
+
|
18
|
+
extend self
|
19
|
+
|
20
|
+
# @return [String]
|
21
|
+
def border_on
|
22
|
+
"\e(0"
|
23
|
+
end
|
24
|
+
|
25
|
+
# @return [String]
|
26
|
+
def border_off
|
27
|
+
"\e(B"
|
28
|
+
end
|
29
|
+
|
30
|
+
# Provides all the semigraphic characters.
|
31
|
+
#
|
32
|
+
# # 0 1 2 3 4 5 6 7 8 9 A B C D E F
|
33
|
+
# 6 ┘ ┐ ┌ └ ┼
|
34
|
+
# 7 ─ ├ ┤ ┴ ┬ │
|
35
|
+
#
|
36
|
+
# @return [Hash<Symbol => String>]
|
37
|
+
def characters
|
38
|
+
{
|
39
|
+
bottom_right: "\x6A", # ┘ # \u2518
|
40
|
+
top_right: "\x6B", # ┐ # \u2510
|
41
|
+
top_left: "\x6C", # ┌ # \u250C
|
42
|
+
bottom_left: "\x6D", # └ # \u2514
|
43
|
+
horizontal: "\x71", # ─ # \u2500
|
44
|
+
vertical_left: "\x74", # ├ # \u251C
|
45
|
+
vertical_right: "\x75", # ┤ # \u2524
|
46
|
+
horizontal_bottom: "\x76", # ┴ # \u2534
|
47
|
+
horizontal_top: "\x77", # ┬ # \u252C
|
48
|
+
vertical: "\x78", # │ # \u2502
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [void]
|
53
|
+
def setup!
|
54
|
+
define_borders!
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
# @return [void]
|
60
|
+
def define_borders!
|
61
|
+
characters.each { |key, code| define_method(key) { code } }
|
62
|
+
end
|
63
|
+
|
64
|
+
end # Borders
|
65
|
+
|
66
|
+
end # EscapeSequences
|
67
|
+
|
68
|
+
Vedeu::EscapeSequences::Borders.setup!
|
69
|
+
|
70
|
+
end # Vedeu
|