muwu 2.5.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/bin/muwu +5 -0
- data/lib/muwu.rb +38 -0
- data/lib/muwu/cli/cli.rb +143 -0
- data/lib/muwu/cli/cli_help.rb +28 -0
- data/lib/muwu/cli/help/compile +22 -0
- data/lib/muwu/cli/help/concat +8 -0
- data/lib/muwu/cli/help/heading +2 -0
- data/lib/muwu/cli/help/inspect +7 -0
- data/lib/muwu/cli/help/new +8 -0
- data/lib/muwu/cli/help/reset +14 -0
- data/lib/muwu/cli/help/summary +14 -0
- data/lib/muwu/controller/controller.rb +120 -0
- data/lib/muwu/controller/controller_interaction.rb +146 -0
- data/lib/muwu/default/default.rb +51 -0
- data/lib/muwu/destination/destination.rb +212 -0
- data/lib/muwu/destination_builder/destination_builder.rb +127 -0
- data/lib/muwu/helper/hash_helper.rb +37 -0
- data/lib/muwu/helper/html_href_helper.rb +101 -0
- data/lib/muwu/helper/outline_helper.rb +160 -0
- data/lib/muwu/helper/regexp_lib.rb +101 -0
- data/lib/muwu/helper/sanitizer_helper.rb +50 -0
- data/lib/muwu/manifest/manifest.rb +158 -0
- data/lib/muwu/manifest_builder/manifest_builder.rb +102 -0
- data/lib/muwu/manifest_task/contents.rb +42 -0
- data/lib/muwu/manifest_task/document_css.rb +25 -0
- data/lib/muwu/manifest_task/document_html.rb +69 -0
- data/lib/muwu/manifest_task/document_js.rb +25 -0
- data/lib/muwu/manifest_task/metadata.rb +35 -0
- data/lib/muwu/manifest_task/navigator.rb +29 -0
- data/lib/muwu/manifest_task/subcontents.rb +48 -0
- data/lib/muwu/manifest_task/text.rb +51 -0
- data/lib/muwu/manifest_task/text_item.rb +124 -0
- data/lib/muwu/manifest_task/title.rb +34 -0
- data/lib/muwu/manifest_task_builder/contents_builder.rb +88 -0
- data/lib/muwu/manifest_task_builder/document_css_builder.rb +63 -0
- data/lib/muwu/manifest_task_builder/document_html_builder.rb +210 -0
- data/lib/muwu/manifest_task_builder/document_js_builder.rb +69 -0
- data/lib/muwu/manifest_task_builder/metadata_builder.rb +118 -0
- data/lib/muwu/manifest_task_builder/navigator_builder.rb +78 -0
- data/lib/muwu/manifest_task_builder/subcontents_builder.rb +90 -0
- data/lib/muwu/manifest_task_builder/text_builder.rb +125 -0
- data/lib/muwu/manifest_task_builder/text_item_builder.rb +314 -0
- data/lib/muwu/manifest_task_builder/title_builder.rb +122 -0
- data/lib/muwu/project/project.rb +430 -0
- data/lib/muwu/project_builder/assets/config/css/base/html_elements.scss +138 -0
- data/lib/muwu/project_builder/assets/config/css/base/index.scss +11 -0
- data/lib/muwu/project_builder/assets/config/css/base/mixin_text_section_heading.scss +23 -0
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_contents.scss +58 -0
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_metadata.scss +17 -0
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_navigator.scss +13 -0
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_subcontents.scss +58 -0
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_text.scss +48 -0
- data/lib/muwu/project_builder/assets/config/css/base/section_muwu_title.scss +22 -0
- data/lib/muwu/project_builder/assets/config/css/colors/dark.scss +32 -0
- data/lib/muwu/project_builder/assets/config/css/colors/index.scss +1 -0
- data/lib/muwu/project_builder/assets/config/css/colors/light.scss +34 -0
- data/lib/muwu/project_builder/assets/config/css/extensions/index.scss +1 -0
- data/lib/muwu/project_builder/assets/config/css/index.scss +19 -0
- data/lib/muwu/project_builder/assets/config/css_debugger/debug_section_text.scss +27 -0
- data/lib/muwu/project_builder/project_reader.rb +144 -0
- data/lib/muwu/project_builder/project_reset_css.rb +95 -0
- data/lib/muwu/project_builder/project_starter.rb +27 -0
- data/lib/muwu/project_builder/project_validator.rb +157 -0
- data/lib/muwu/project_builder/project_writer.rb +127 -0
- data/lib/muwu/project_exception/css_manifest_file_not_found.rb +23 -0
- data/lib/muwu/project_exception/dry_output_recommended_with_multiple_documents.rb +19 -0
- data/lib/muwu/project_exception/metadata_file_not_found.rb +24 -0
- data/lib/muwu/project_exception/metadata_value_not_given.rb +42 -0
- data/lib/muwu/project_exception/multiple_documents_outlined_with_stdout.rb +18 -0
- data/lib/muwu/project_exception/multiple_formats_requested_with_stdout.rb +18 -0
- data/lib/muwu/project_exception/navigator_not_recommended_with_stdout.rb +23 -0
- data/lib/muwu/project_exception/navigators_will_be_generated_automatically.rb +23 -0
- data/lib/muwu/project_exception/option_key_not_understood.rb +23 -0
- data/lib/muwu/project_exception/option_not_validatable.rb +23 -0
- data/lib/muwu/project_exception/option_value_not_understood.rb +24 -0
- data/lib/muwu/project_exception/options_file_not_found.rb +24 -0
- data/lib/muwu/project_exception/outline_file_not_found.rb +24 -0
- data/lib/muwu/project_exception/outline_step_not_understood.rb +23 -0
- data/lib/muwu/project_exception/output_already_open.rb +18 -0
- data/lib/muwu/project_exception/output_not_open.rb +18 -0
- data/lib/muwu/project_exception/subcontents_will_be_generated_automatically copy.rb +23 -0
- data/lib/muwu/project_exception/target_project_folder_already_exists.rb +24 -0
- data/lib/muwu/project_exception/text_source_file_not_found.rb +26 -0
- data/lib/muwu/project_exception_handler/fatal.rb +39 -0
- data/lib/muwu/project_options/project_options.rb +54 -0
- data/lib/muwu/project_options_builder/project_option_validator.rb +37 -0
- data/lib/muwu/project_options_builder/project_option_validator_key.rb +56 -0
- data/lib/muwu/project_options_builder/project_option_validator_value.rb +300 -0
- data/lib/muwu/project_options_builder/project_options_reader.rb +80 -0
- data/lib/muwu/render_concat/render_concat.rb +80 -0
- data/lib/muwu/render_html/render_html.rb +101 -0
- data/lib/muwu/render_html/render_markup_to_html.rb +87 -0
- data/lib/muwu/render_html_builder/render_css_builder.rb +34 -0
- data/lib/muwu/render_html_builder/render_html_builder.rb +34 -0
- data/lib/muwu/render_html_builder/render_js_builder.rb +34 -0
- data/lib/muwu/render_html_partial/js_library/_init_bare.js +7 -0
- data/lib/muwu/render_html_partial/js_library/_zepto.min.js +2 -0
- data/lib/muwu/render_html_partial/js_library/init.js +10 -0
- data/lib/muwu/render_html_partial/js_library/navigation.js +140 -0
- data/lib/muwu/render_html_partial/render_contents.rb +369 -0
- data/lib/muwu/render_html_partial/render_document_css.rb +45 -0
- data/lib/muwu/render_html_partial/render_document_html.rb +397 -0
- data/lib/muwu/render_html_partial/render_document_js.rb +37 -0
- data/lib/muwu/render_html_partial/render_js_library.rb +54 -0
- data/lib/muwu/render_html_partial/render_metadata.rb +120 -0
- data/lib/muwu/render_html_partial/render_navigator.rb +136 -0
- data/lib/muwu/render_html_partial/render_subcontents.rb +374 -0
- data/lib/muwu/render_html_partial/render_text.rb +74 -0
- data/lib/muwu/render_html_partial/render_text_item.rb +230 -0
- data/lib/muwu/render_html_partial/render_title.rb +71 -0
- data/lib/muwu/render_html_partial_builder/render_contents_builder.rb +100 -0
- data/lib/muwu/render_html_partial_builder/render_document_css_builder.rb +46 -0
- data/lib/muwu/render_html_partial_builder/render_document_html_builder.rb +211 -0
- data/lib/muwu/render_html_partial_builder/render_document_js_builder.rb +52 -0
- data/lib/muwu/render_html_partial_builder/render_metadata_builder.rb +47 -0
- data/lib/muwu/render_html_partial_builder/render_navigator_builder.rb +74 -0
- data/lib/muwu/render_html_partial_builder/render_subcontents_builder.rb +85 -0
- data/lib/muwu/render_html_partial_builder/render_text_builder.rb +86 -0
- data/lib/muwu/render_html_partial_builder/render_text_item_builder.rb +274 -0
- data/lib/muwu/render_html_partial_builder/render_title_builder.rb +47 -0
- data/lib/muwu/render_inspector/render_inspector.rb +224 -0
- data/lib/muwu/var/deflistdiv.rb +239 -0
- data/lib/muwu_loader.rb +35 -0
- data/test/what_no_tests.md +5 -0
- metadata +251 -0
@@ -0,0 +1,127 @@
|
|
1
|
+
module Muwu
|
2
|
+
class ProjectWriter
|
3
|
+
|
4
|
+
|
5
|
+
include Muwu
|
6
|
+
include Helper
|
7
|
+
|
8
|
+
|
9
|
+
require 'fileutils'
|
10
|
+
require 'yaml'
|
11
|
+
|
12
|
+
|
13
|
+
attr_accessor(
|
14
|
+
:project
|
15
|
+
)
|
16
|
+
|
17
|
+
|
18
|
+
def initialize(project)
|
19
|
+
@project = project
|
20
|
+
end
|
21
|
+
|
22
|
+
|
23
|
+
public
|
24
|
+
|
25
|
+
|
26
|
+
def write
|
27
|
+
if Dir.exist?(@project.working_directory) == false
|
28
|
+
puts '# Writing project'
|
29
|
+
phase_1_make_project_folder
|
30
|
+
phase_2_make_project_subfolders
|
31
|
+
phase_2_make_folder_css_and_copy_files
|
32
|
+
phase_3_write_file_metadata_yml
|
33
|
+
phase_3_write_file_options_yml
|
34
|
+
phase_3_write_file_outline_yml
|
35
|
+
puts "\n"
|
36
|
+
puts '# Project written.'
|
37
|
+
|
38
|
+
elsif Dir.exist?(@project.working_directory) == true
|
39
|
+
raise ProjectExceptionHandler::Fatal.new(ProjectException::TargetProjectFolderAlreadyExists.new(@project))
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
|
45
|
+
def phase_1_make_project_folder
|
46
|
+
announce_and_execute_dir_mkdir(@project.working_directory)
|
47
|
+
end
|
48
|
+
|
49
|
+
|
50
|
+
def phase_2_make_project_subfolders
|
51
|
+
announce_and_execute_dir_mkdir(@project.path_config)
|
52
|
+
announce_and_execute_dir_mkdir(@project.path_images)
|
53
|
+
announce_and_execute_dir_mkdir(@project.path_text)
|
54
|
+
end
|
55
|
+
|
56
|
+
|
57
|
+
def phase_2_make_folder_css_and_copy_files
|
58
|
+
folder_source_gem = File.absolute_path(File.join(Muwu::GEM_HOME_LIB, 'muwu','project_builder','assets','config','css'))
|
59
|
+
folder_destination_project = @project.path_css
|
60
|
+
announce_and_execute_fileutils_cp_r(folder_source_gem, folder_destination_project)
|
61
|
+
end
|
62
|
+
|
63
|
+
|
64
|
+
def phase_3_write_file_metadata_yml
|
65
|
+
announce_and_execute_yaml_dump(HashHelper.human_readable_hash(@project.metadata), @project.metadata_filename)
|
66
|
+
end
|
67
|
+
|
68
|
+
|
69
|
+
def phase_3_write_file_options_yml
|
70
|
+
announce_and_execute_yaml_dump(HashHelper.human_readable_hash(@project.options), @project.options_filename)
|
71
|
+
end
|
72
|
+
|
73
|
+
|
74
|
+
|
75
|
+
def phase_3_write_file_outline_yml
|
76
|
+
if @project.outline.any?
|
77
|
+
phase_3_write_file_outline_yml_dump
|
78
|
+
elsif @project.outline.empty?
|
79
|
+
phase_3_write_file_outline_yml_blank
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
|
84
|
+
def phase_3_write_file_outline_yml_dump
|
85
|
+
announce_and_execute_yaml_dump(@project.outline, @project.outline_filename)
|
86
|
+
end
|
87
|
+
|
88
|
+
|
89
|
+
def phase_3_write_file_outline_yml_blank
|
90
|
+
announce_and_execute_fileutils_touch(@project.outline_filename)
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
private
|
96
|
+
|
97
|
+
|
98
|
+
def announce_and_execute_dir_mkdir(dir)
|
99
|
+
print "- Making directory".ljust(18)
|
100
|
+
puts " `#{dir}`"
|
101
|
+
Dir.mkdir(dir)
|
102
|
+
end
|
103
|
+
|
104
|
+
|
105
|
+
def announce_and_execute_fileutils_cp_r(folder_source_gem, folder_destination_project)
|
106
|
+
print "- Writing tree".ljust(18)
|
107
|
+
puts " `#{folder_destination_project}`"
|
108
|
+
FileUtils.cp_r(folder_source_gem, folder_destination_project)
|
109
|
+
end
|
110
|
+
|
111
|
+
|
112
|
+
def announce_and_execute_fileutils_touch(filename)
|
113
|
+
print "- Writing file".ljust(18)
|
114
|
+
puts " `#{filename}`"
|
115
|
+
FileUtils.touch(filename)
|
116
|
+
end
|
117
|
+
|
118
|
+
|
119
|
+
def announce_and_execute_yaml_dump(obj, filename)
|
120
|
+
print "- Writing file".ljust(18)
|
121
|
+
puts " `#{filename}`"
|
122
|
+
File.open(filename,'w') { |file| YAML.dump(obj, file, canonical: false) }
|
123
|
+
end
|
124
|
+
|
125
|
+
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class CssManifestFileNotFound
|
4
|
+
|
5
|
+
|
6
|
+
def initialize(css_manifest_filename)
|
7
|
+
@css_manifest_filename = css_manifest_filename
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def report
|
12
|
+
"The css manifest file `#{@css_manifest_filename}` could not be found."
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def type
|
17
|
+
:warning
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class DryOutputRecommendedWithMultipleDocuments
|
4
|
+
|
5
|
+
|
6
|
+
def report
|
7
|
+
"Shared assets will be embedded. Including `css` and `js` in `output_formats` is recommended with multiple documents."
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def type
|
12
|
+
:warning
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class MetadataFileNotFound
|
4
|
+
|
5
|
+
|
6
|
+
|
7
|
+
def initialize(project)
|
8
|
+
@filename = project.metadata_filename
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
def report
|
13
|
+
"The metadata file `#{@filename}` could not be found."
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def type
|
18
|
+
:warning
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class MetadataValueNotGiven
|
4
|
+
|
5
|
+
|
6
|
+
include Muwu
|
7
|
+
|
8
|
+
|
9
|
+
def initialize(task, key)
|
10
|
+
@task = task
|
11
|
+
@index = task.document_index
|
12
|
+
@key = key
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def report
|
17
|
+
"Metadata value for `#{@key}` not found (document #{@index}, block `#{block_type}`)."
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
def type
|
22
|
+
:warning
|
23
|
+
end
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
|
30
|
+
def block_type
|
31
|
+
case @task
|
32
|
+
when ManifestTask::Metadata
|
33
|
+
'metadata'
|
34
|
+
when ManifestTask::Title
|
35
|
+
'title'
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class MultipleDocumentsOutlinedWithStdout
|
4
|
+
|
5
|
+
|
6
|
+
def report
|
7
|
+
'The output destination `stdout` can only accommodate a single outlined document.'
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def type
|
12
|
+
:fatal
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class MultipleFormatsRequestedWithStdout
|
4
|
+
|
5
|
+
|
6
|
+
def report
|
7
|
+
'The output destination `stdout` can only accommodate a single output format.'
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def type
|
12
|
+
:fatal
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class NavigatorNotRecommendedWithSingleDocument
|
4
|
+
|
5
|
+
|
6
|
+
def initialize(index)
|
7
|
+
@index = index
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def report
|
12
|
+
"Navigator not recommended with a single outlined document."
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def type
|
17
|
+
:warning
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class NavigatorsWillBeGeneratedAutomatically
|
4
|
+
|
5
|
+
|
6
|
+
def initialize(index)
|
7
|
+
@index = index
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def report
|
12
|
+
"Navigators will be generated automatically. Ignoring outline directive (document #{@index})."
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def type
|
17
|
+
:warning
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class OptionKeyNotUnderstood
|
4
|
+
|
5
|
+
|
6
|
+
def initialize(key)
|
7
|
+
@key = key
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def report
|
12
|
+
"The option key `#{@key}` is not understood."
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def type
|
17
|
+
:warning
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class OptionNotValidatable
|
4
|
+
|
5
|
+
|
6
|
+
def initialize(key)
|
7
|
+
@key = key
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def report
|
12
|
+
"The option `#{@key}` cannot be validated. (Muwu::ProjectOptionValidatorValue)"
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def type
|
17
|
+
:internal
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class OptionValueNotUnderstood
|
4
|
+
|
5
|
+
|
6
|
+
def initialize(key, value)
|
7
|
+
@key = key
|
8
|
+
@value = value
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
def report
|
13
|
+
"For option key `#{@key}`, the value `#{@value}` is not understood."
|
14
|
+
end
|
15
|
+
|
16
|
+
|
17
|
+
def type
|
18
|
+
:warning
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class OptionsFileNotFound
|
4
|
+
|
5
|
+
|
6
|
+
def initialize(project)
|
7
|
+
@filename = project.options_filename
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def report
|
12
|
+
"The options file `#{@filename}` could not be found."
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def type
|
17
|
+
:warning
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Muwu
|
2
|
+
module ProjectException
|
3
|
+
class OutlineFileNotFound
|
4
|
+
|
5
|
+
|
6
|
+
def initialize(project)
|
7
|
+
@filename = project.outline_filename
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
def report
|
12
|
+
"The outline file `#{@filename}` could not be found."
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def type
|
17
|
+
:warning
|
18
|
+
end
|
19
|
+
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|