muwu 3.0.0.alpha → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/{muwu_loader.rb → loader.rb} +2 -2
- data/lib/muwu.rb +3 -3
- data/lib/muwu/cli/cli.rb +33 -22
- data/lib/muwu/cli/help/compile +4 -4
- data/lib/muwu/cli/help/publish +19 -6
- data/lib/muwu/cli/help/reset +5 -2
- data/lib/muwu/cli/help/summary +4 -4
- data/lib/muwu/cli/help/sync +23 -15
- data/lib/muwu/cli/help/view +3 -0
- data/lib/muwu/controller/controller.rb +65 -30
- data/lib/muwu/controller/controller_interaction.rb +66 -44
- data/lib/muwu/default/default.rb +12 -9
- data/lib/muwu/destination/destination.rb +61 -57
- data/lib/muwu/destination_builder/destination_builder.rb +31 -33
- data/lib/muwu/manifest_task_builder/text_item_builder.rb +1 -8
- data/lib/muwu/project/project.rb +146 -127
- data/lib/muwu/project_builder/assets/config/css/base/html_elements.scss +19 -15
- data/lib/muwu/project_builder/assets/config/css/base/mixin_text_section_heading.scss +12 -11
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_contents.scss +5 -5
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_metadata.scss +2 -4
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_navigator.scss +3 -4
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_subcontents.scss +5 -5
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_text.scss +16 -15
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_title.scss +9 -6
- data/lib/muwu/project_builder/project_reader.rb +1 -0
- data/lib/muwu/project_builder/project_reset_compiled.rb +31 -0
- data/lib/muwu/project_builder/project_reset_css.rb +30 -30
- data/lib/muwu/project_builder/project_starter.rb +7 -7
- data/lib/muwu/project_builder/project_validator.rb +14 -4
- data/lib/muwu/project_builder/project_writer.rb +12 -11
- data/lib/muwu/project_exception/compiled_folder_not_found.rb +23 -0
- data/lib/muwu/project_exception/lynx_not_available.rb +23 -0
- data/lib/muwu/project_exception_handler/fatal.rb +10 -9
- data/lib/muwu/project_options/project_options.rb +9 -8
- data/lib/muwu/project_options_builder/project_option_validator.rb +12 -12
- data/lib/muwu/project_options_builder/project_option_validator_value.rb +78 -82
- data/lib/muwu/publish/publish.rb +42 -34
- data/lib/muwu/render_concat/render_concat.rb +26 -27
- data/lib/muwu/render_html/render_html.rb +27 -24
- data/lib/muwu/render_html_partial/render_document_html.rb +64 -64
- data/lib/muwu/render_html_partial/render_text_item.rb +16 -16
- data/lib/muwu/sync/sync.rb +40 -36
- data/lib/muwu/var/deflistdiv.rb +0 -0
- data/lib/muwu/viewer/viewer.rb +25 -0
- data/test/what_no_tests.md +1 -3
- metadata +16 -11
data/lib/muwu/publish/publish.rb
CHANGED
@@ -1,47 +1,55 @@
|
|
1
1
|
module Muwu
|
2
2
|
class Publish
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
|
5
5
|
include Muwu
|
6
|
-
|
7
|
-
|
8
|
-
def initialize(project)
|
9
|
-
@
|
10
|
-
@
|
11
|
-
@documents_js = project.manifest.documents_js
|
12
|
-
@local = project.working_directory
|
6
|
+
|
7
|
+
|
8
|
+
def initialize(project, args: [])
|
9
|
+
@path_local = project.path_compiled + File::SEPARATOR
|
10
|
+
@path_remote = project.options.remote_publish
|
13
11
|
@project = project
|
14
|
-
@
|
15
|
-
|
12
|
+
@switches = args.push(project.options.rsync_options).flatten.sort.join(' ')
|
16
13
|
end
|
17
|
-
|
18
|
-
|
14
|
+
|
15
|
+
|
19
16
|
def up
|
20
17
|
if @project.exceptions_include?(ProjectException::OptionRemotePublishValueNil)
|
21
18
|
raise ProjectExceptionHandler::Fatal.new(ProjectException::OptionRemotePublishValueNil.new)
|
22
|
-
else
|
23
|
-
|
24
|
-
filenames << @documents_css.map { |d| d.filename }
|
25
|
-
filenames << @documents_html.map { |d| d.filename }
|
26
|
-
filenames << @documents_js.map { |d| d.filename }
|
27
|
-
filenames.flatten.each { |f| scp f }
|
19
|
+
else
|
20
|
+
exec_rsync(source: @path_local, target: @path_remote)
|
28
21
|
end
|
29
22
|
end
|
30
|
-
|
31
|
-
|
23
|
+
|
24
|
+
|
25
|
+
|
32
26
|
private
|
33
|
-
|
34
|
-
|
35
|
-
def
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
27
|
+
|
28
|
+
|
29
|
+
def exec_rsync(source: nil, target: nil)
|
30
|
+
if source && target
|
31
|
+
puts "source: #{source.inspect}"
|
32
|
+
puts "target: #{target.inspect}"
|
33
|
+
puts "switches: #{@switches}"
|
34
|
+
begin
|
35
|
+
system "rsync #{@switches} #{source} #{target}", exception: true
|
36
|
+
rescue Errno::ENOENT
|
37
|
+
raise ProjectExceptionHandler::Fatal.new(ProjectException::RsyncNotAvailable.new)
|
38
|
+
end
|
42
39
|
end
|
43
|
-
end
|
44
|
-
|
45
|
-
|
40
|
+
end
|
41
|
+
|
42
|
+
|
43
|
+
def exec_rsync_demo(source: nil, target: nil)
|
44
|
+
if source && target
|
45
|
+
puts "** demo rsync"
|
46
|
+
puts "source: #{source.inspect}"
|
47
|
+
puts "target: #{target.inspect}"
|
48
|
+
puts "switches: #{@switches}"
|
49
|
+
puts "command: rsync #{@switches} #{source} #{target}"
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
|
46
54
|
end
|
47
|
-
end
|
55
|
+
end
|
@@ -1,20 +1,21 @@
|
|
1
1
|
module Muwu
|
2
2
|
class RenderConcat
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
|
5
5
|
def initialize(project)
|
6
|
-
@output_path = project.
|
6
|
+
@output_path = project.path_compiled
|
7
7
|
@output_filename = project.html_basename + '.md'
|
8
8
|
@project = project
|
9
9
|
@manifest = project.manifest
|
10
10
|
end
|
11
|
-
|
12
|
-
|
11
|
+
|
12
|
+
|
13
13
|
public
|
14
|
-
|
15
|
-
|
14
|
+
|
15
|
+
|
16
16
|
def render
|
17
17
|
destination = File.join(@output_path, @output_filename)
|
18
|
+
puts "- Writing `#{@output_filename}`"
|
18
19
|
File.open(destination, 'w') do |f|
|
19
20
|
@manifest.text_blocks.each do |text|
|
20
21
|
text.sections.each do |text_item|
|
@@ -23,15 +24,15 @@ module Muwu
|
|
23
24
|
end
|
24
25
|
end
|
25
26
|
end
|
26
|
-
|
27
|
-
|
27
|
+
|
28
|
+
|
28
29
|
def render_text_item(f, text_item)
|
29
30
|
render_text_item_head(f, text_item)
|
30
31
|
render_text_item_source(f, text_item)
|
31
32
|
render_text_item_sections(f, text_item)
|
32
33
|
end
|
33
|
-
|
34
|
-
|
34
|
+
|
35
|
+
|
35
36
|
def render_text_item_head(f, text_item)
|
36
37
|
f.puts '# ' + text_item.numbering.join('.')
|
37
38
|
if heading_origin_is_basename_or_outline(text_item)
|
@@ -39,8 +40,8 @@ module Muwu
|
|
39
40
|
f.puts "\n"
|
40
41
|
end
|
41
42
|
end
|
42
|
-
|
43
|
-
|
43
|
+
|
44
|
+
|
44
45
|
def render_text_item_sections(f, text_item)
|
45
46
|
if text_item.does_have_child_sections
|
46
47
|
text_item.sections.each do |ti|
|
@@ -49,32 +50,30 @@ module Muwu
|
|
49
50
|
render_text_item_spacer(f, text_item)
|
50
51
|
end
|
51
52
|
end
|
52
|
-
|
53
|
-
|
53
|
+
|
54
|
+
|
54
55
|
def render_text_item_source(f, text_item)
|
55
56
|
if text_item.source_file_does_exist
|
56
57
|
f.puts text_item.source.strip
|
57
58
|
end
|
58
59
|
render_text_item_spacer(f, text_item)
|
59
60
|
end
|
60
|
-
|
61
|
-
|
61
|
+
|
62
|
+
|
62
63
|
def render_text_item_spacer(f, text_item)
|
63
64
|
f.puts "\n\n\n\n"
|
64
65
|
end
|
65
|
-
|
66
|
-
|
67
|
-
|
66
|
+
|
67
|
+
|
68
|
+
|
68
69
|
private
|
69
|
-
|
70
|
-
|
70
|
+
|
71
|
+
|
71
72
|
def heading_origin_is_basename_or_outline(text_item)
|
72
73
|
[:basename, :outline].include?(text_item.heading_origin)
|
73
74
|
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
75
|
+
|
76
|
+
|
77
|
+
|
78
78
|
end
|
79
79
|
end
|
80
|
-
|
@@ -1,7 +1,10 @@
|
|
1
1
|
module Muwu
|
2
2
|
class RenderHtml
|
3
|
-
|
4
|
-
|
3
|
+
|
4
|
+
|
5
|
+
require 'fileutils'
|
6
|
+
|
7
|
+
|
5
8
|
include Muwu
|
6
9
|
|
7
10
|
|
@@ -10,21 +13,21 @@ module Muwu
|
|
10
13
|
@project = project
|
11
14
|
halt_if_project_has_fatal_exceptions
|
12
15
|
end
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
|
17
|
+
|
18
|
+
|
16
19
|
public
|
17
|
-
|
18
|
-
|
19
|
-
def
|
20
|
+
|
21
|
+
|
22
|
+
def render_all
|
20
23
|
if @manifest.does_have_documents
|
21
24
|
build_and_render(@manifest.documents)
|
22
25
|
else
|
23
26
|
reply_nothing_to_do
|
24
27
|
end
|
25
28
|
end
|
26
|
-
|
27
|
-
|
29
|
+
|
30
|
+
|
28
31
|
def render_css_only
|
29
32
|
if @manifest.does_have_documents_css
|
30
33
|
build_and_render(@manifest.documents_css)
|
@@ -32,8 +35,8 @@ module Muwu
|
|
32
35
|
reply_nothing_to_do
|
33
36
|
end
|
34
37
|
end
|
35
|
-
|
36
|
-
|
38
|
+
|
39
|
+
|
37
40
|
def render_html_by_index(index)
|
38
41
|
document_html = @manifest.find_document_html_by_index(index)
|
39
42
|
if document_html
|
@@ -42,8 +45,8 @@ module Muwu
|
|
42
45
|
reply_nothing_to_do
|
43
46
|
end
|
44
47
|
end
|
45
|
-
|
46
|
-
|
48
|
+
|
49
|
+
|
47
50
|
def render_html_only
|
48
51
|
if @manifest.does_have_documents_html
|
49
52
|
build_and_render(@manifest.documents_html)
|
@@ -60,12 +63,12 @@ module Muwu
|
|
60
63
|
reply_nothing_to_do
|
61
64
|
end
|
62
65
|
end
|
63
|
-
|
66
|
+
|
64
67
|
|
65
68
|
|
66
69
|
private
|
67
|
-
|
68
|
-
|
70
|
+
|
71
|
+
|
69
72
|
def build_and_render(document)
|
70
73
|
case document
|
71
74
|
when Array
|
@@ -76,13 +79,13 @@ module Muwu
|
|
76
79
|
|
77
80
|
when ManifestTask::DocumentHtml
|
78
81
|
RenderHtmlBuilder.new(document).build_and_render
|
79
|
-
|
82
|
+
|
80
83
|
when ManifestTask::DocumentJs
|
81
84
|
RenderJsBuilder.new(document).build_and_render
|
82
85
|
end
|
83
86
|
end
|
84
|
-
|
85
|
-
|
87
|
+
|
88
|
+
|
86
89
|
def halt_if_project_has_fatal_exceptions
|
87
90
|
begin
|
88
91
|
if @project.exceptions_fatal.any?
|
@@ -90,12 +93,12 @@ module Muwu
|
|
90
93
|
end
|
91
94
|
end
|
92
95
|
end
|
93
|
-
|
94
|
-
|
96
|
+
|
97
|
+
|
95
98
|
def reply_nothing_to_do
|
96
99
|
$stderr.puts '- No documents to compile.'
|
97
100
|
end
|
98
|
-
|
99
|
-
|
101
|
+
|
102
|
+
|
100
103
|
end
|
101
104
|
end
|
@@ -4,12 +4,12 @@ module Muwu
|
|
4
4
|
|
5
5
|
|
6
6
|
include Muwu
|
7
|
-
|
8
|
-
|
7
|
+
|
8
|
+
|
9
9
|
require 'sassc'
|
10
|
-
|
11
|
-
|
12
|
-
attr_accessor(
|
10
|
+
|
11
|
+
|
12
|
+
attr_accessor(
|
13
13
|
:destination,
|
14
14
|
:head_css_filename,
|
15
15
|
:head_css_method,
|
@@ -23,15 +23,15 @@ module Muwu
|
|
23
23
|
:project,
|
24
24
|
:tasks
|
25
25
|
)
|
26
|
-
|
27
|
-
|
26
|
+
|
27
|
+
|
28
28
|
def initialize
|
29
29
|
@head_metadata = {}
|
30
30
|
@tasks = []
|
31
31
|
end
|
32
|
-
|
33
|
-
|
34
|
-
|
32
|
+
|
33
|
+
|
34
|
+
|
35
35
|
public
|
36
36
|
|
37
37
|
|
@@ -72,9 +72,9 @@ module Muwu
|
|
72
72
|
|
73
73
|
|
74
74
|
def render_head
|
75
|
-
@destination.padding_vertical(1) do
|
75
|
+
@destination.padding_vertical(1) do
|
76
76
|
write_tag_head_open
|
77
|
-
@destination.margin_indent do
|
77
|
+
@destination.margin_indent do
|
78
78
|
write_tag_title
|
79
79
|
render_head_meta_tags
|
80
80
|
render_head_css
|
@@ -105,7 +105,7 @@ module Muwu
|
|
105
105
|
def render_head_css_link
|
106
106
|
write_tag_link_stylesheet
|
107
107
|
end
|
108
|
-
|
108
|
+
|
109
109
|
|
110
110
|
def render_head_js
|
111
111
|
case @head_js_method
|
@@ -124,14 +124,14 @@ module Muwu
|
|
124
124
|
end
|
125
125
|
write_tag_script_close
|
126
126
|
end
|
127
|
-
|
128
|
-
|
127
|
+
|
128
|
+
|
129
129
|
def render_head_js_lib_navigation
|
130
130
|
if @project.options.html_uses_javascript_navigation
|
131
131
|
write_js_lib_navigation
|
132
132
|
end
|
133
133
|
end
|
134
|
-
|
134
|
+
|
135
135
|
|
136
136
|
def render_head_js_link
|
137
137
|
write_tag_script_src
|
@@ -148,8 +148,8 @@ module Muwu
|
|
148
148
|
write_tag_meta_generator
|
149
149
|
write_tag_meta_viewport
|
150
150
|
end
|
151
|
-
|
152
|
-
|
151
|
+
|
152
|
+
|
153
153
|
def render_tag_html_open
|
154
154
|
write_tag_doctype
|
155
155
|
if @html_lang
|
@@ -158,8 +158,8 @@ module Muwu
|
|
158
158
|
write_tag_html_open
|
159
159
|
end
|
160
160
|
end
|
161
|
-
|
162
|
-
|
161
|
+
|
162
|
+
|
163
163
|
def write_css_if_manifest_exists
|
164
164
|
if @project.exceptions_include?(ProjectException::CssManifestFileNotFound)
|
165
165
|
write_css_missing_comment
|
@@ -167,10 +167,10 @@ module Muwu
|
|
167
167
|
write_css
|
168
168
|
end
|
169
169
|
end
|
170
|
-
|
170
|
+
|
171
171
|
|
172
172
|
def write_css
|
173
|
-
@destination.write_inline
|
173
|
+
@destination.write_inline SassC::Engine.new(File.read(@project.css_manifest_filename), syntax: :scss, load_paths: ['config/css']).render
|
174
174
|
end
|
175
175
|
|
176
176
|
|
@@ -180,14 +180,14 @@ module Muwu
|
|
180
180
|
@destination.write_line " - CSS manifest file could not be found."
|
181
181
|
@destination.write_line " - Expecting `#{project.css_manifest_filename}`"
|
182
182
|
@destination.write_line "*/"
|
183
|
-
end
|
184
|
-
|
185
|
-
|
183
|
+
end
|
184
|
+
|
185
|
+
|
186
186
|
def write_js_library(library)
|
187
187
|
@destination.write_inline RenderHtmlPartial::JsLibrary.new.find(library)
|
188
188
|
end
|
189
|
-
|
190
|
-
|
189
|
+
|
190
|
+
|
191
191
|
def write_tag_body_close
|
192
192
|
@destination.write_line tag_body_close
|
193
193
|
end
|
@@ -196,8 +196,8 @@ module Muwu
|
|
196
196
|
def write_tag_body_open
|
197
197
|
@destination.write_line tag_body_open
|
198
198
|
end
|
199
|
-
|
200
|
-
|
199
|
+
|
200
|
+
|
201
201
|
def write_tag_doctype
|
202
202
|
@destination.write_line tag_doctype
|
203
203
|
end
|
@@ -236,18 +236,18 @@ module Muwu
|
|
236
236
|
def write_tag_meta(key, value)
|
237
237
|
@destination.write_line tag_meta(key, value)
|
238
238
|
end
|
239
|
-
|
240
|
-
|
239
|
+
|
240
|
+
|
241
241
|
def write_tag_meta_charset_utf8
|
242
242
|
@destination.write_line tag_meta_charset_utf8
|
243
243
|
end
|
244
|
-
|
245
|
-
|
244
|
+
|
245
|
+
|
246
246
|
def write_tag_meta_generator
|
247
247
|
@destination.write_line tag_meta_generator
|
248
248
|
end
|
249
|
-
|
250
|
-
|
249
|
+
|
250
|
+
|
251
251
|
def write_tag_meta_viewport
|
252
252
|
@destination.write_line tag_meta_viewport
|
253
253
|
end
|
@@ -261,13 +261,13 @@ module Muwu
|
|
261
261
|
def write_tag_script_close
|
262
262
|
@destination.write_line tag_script_close
|
263
263
|
end
|
264
|
-
|
265
|
-
|
264
|
+
|
265
|
+
|
266
266
|
def write_tag_script_open
|
267
267
|
@destination.write_line tag_script_open
|
268
268
|
end
|
269
|
-
|
270
|
-
|
269
|
+
|
270
|
+
|
271
271
|
def write_tag_script_src
|
272
272
|
@destination.write_line tag_script_src
|
273
273
|
end
|
@@ -276,13 +276,13 @@ module Muwu
|
|
276
276
|
def write_tag_style_close
|
277
277
|
@destination.write_line tag_style_close
|
278
278
|
end
|
279
|
-
|
280
|
-
|
279
|
+
|
280
|
+
|
281
281
|
def write_tag_style_open
|
282
282
|
@destination.write_line tag_style_open
|
283
283
|
end
|
284
|
-
|
285
|
-
|
284
|
+
|
285
|
+
|
286
286
|
def write_tag_title
|
287
287
|
@destination.write_line tag_title
|
288
288
|
end
|
@@ -290,8 +290,8 @@ module Muwu
|
|
290
290
|
|
291
291
|
|
292
292
|
private
|
293
|
-
|
294
|
-
|
293
|
+
|
294
|
+
|
295
295
|
def tag_body_close
|
296
296
|
"</body>"
|
297
297
|
end
|
@@ -305,8 +305,8 @@ module Muwu
|
|
305
305
|
def tag_doctype
|
306
306
|
"<!DOCTYPE html>"
|
307
307
|
end
|
308
|
-
|
309
|
-
|
308
|
+
|
309
|
+
|
310
310
|
def tag_head_close
|
311
311
|
"</head>"
|
312
312
|
end
|
@@ -340,23 +340,23 @@ module Muwu
|
|
340
340
|
def tag_meta(key, value)
|
341
341
|
"<meta name='#{key}' value='#{value}'>"
|
342
342
|
end
|
343
|
-
|
344
|
-
|
343
|
+
|
344
|
+
|
345
345
|
def tag_meta_charset_utf8
|
346
346
|
"<meta charset='UTF-8'>"
|
347
347
|
end
|
348
|
-
|
349
|
-
|
348
|
+
|
349
|
+
|
350
350
|
def tag_meta_generator
|
351
351
|
"<meta name='generator' content='Muwu #{Muwu::VERSION}'>"
|
352
352
|
end
|
353
|
-
|
354
|
-
|
353
|
+
|
354
|
+
|
355
355
|
def tag_meta_instance_date
|
356
356
|
"<meta name='date_of_this_edition' value='#{@project.instance_date}'>\n"
|
357
357
|
end
|
358
358
|
|
359
|
-
|
359
|
+
|
360
360
|
def tag_meta_viewport
|
361
361
|
"<meta name='viewport' content='width=device-width, initial-scale=1, user-scalable=yes'>"
|
362
362
|
end
|
@@ -365,32 +365,32 @@ module Muwu
|
|
365
365
|
def tag_script_close
|
366
366
|
"</script>"
|
367
367
|
end
|
368
|
-
|
369
|
-
|
368
|
+
|
369
|
+
|
370
370
|
def tag_script_open
|
371
371
|
"<script>"
|
372
372
|
end
|
373
|
-
|
374
|
-
|
373
|
+
|
374
|
+
|
375
375
|
def tag_script_src
|
376
376
|
"<script src='#{@head_js_filename}'></script>"
|
377
377
|
end
|
378
378
|
|
379
|
-
|
379
|
+
|
380
380
|
def tag_style_close
|
381
381
|
"</style>"
|
382
382
|
end
|
383
|
-
|
384
|
-
|
383
|
+
|
384
|
+
|
385
385
|
def tag_style_open
|
386
386
|
"<style>"
|
387
387
|
end
|
388
|
-
|
389
|
-
|
388
|
+
|
389
|
+
|
390
390
|
def tag_title
|
391
391
|
"<title>#{@html_title}</title>"
|
392
392
|
end
|
393
|
-
|
393
|
+
|
394
394
|
|
395
395
|
end
|
396
396
|
end
|