muwu 3.0.0.alpha → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. checksums.yaml +4 -4
  2. data/lib/{muwu_loader.rb → loader.rb} +2 -2
  3. data/lib/muwu.rb +3 -3
  4. data/lib/muwu/cli/cli.rb +33 -22
  5. data/lib/muwu/cli/help/compile +4 -4
  6. data/lib/muwu/cli/help/publish +19 -6
  7. data/lib/muwu/cli/help/reset +5 -2
  8. data/lib/muwu/cli/help/summary +4 -4
  9. data/lib/muwu/cli/help/sync +23 -15
  10. data/lib/muwu/cli/help/view +3 -0
  11. data/lib/muwu/controller/controller.rb +65 -30
  12. data/lib/muwu/controller/controller_interaction.rb +66 -44
  13. data/lib/muwu/default/default.rb +12 -9
  14. data/lib/muwu/destination/destination.rb +61 -57
  15. data/lib/muwu/destination_builder/destination_builder.rb +31 -33
  16. data/lib/muwu/manifest_task_builder/text_item_builder.rb +1 -8
  17. data/lib/muwu/project/project.rb +146 -127
  18. data/lib/muwu/project_builder/assets/config/css/base/html_elements.scss +19 -15
  19. data/lib/muwu/project_builder/assets/config/css/base/mixin_text_section_heading.scss +12 -11
  20. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_contents.scss +5 -5
  21. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_metadata.scss +2 -4
  22. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_navigator.scss +3 -4
  23. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_subcontents.scss +5 -5
  24. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_text.scss +16 -15
  25. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_title.scss +9 -6
  26. data/lib/muwu/project_builder/project_reader.rb +1 -0
  27. data/lib/muwu/project_builder/project_reset_compiled.rb +31 -0
  28. data/lib/muwu/project_builder/project_reset_css.rb +30 -30
  29. data/lib/muwu/project_builder/project_starter.rb +7 -7
  30. data/lib/muwu/project_builder/project_validator.rb +14 -4
  31. data/lib/muwu/project_builder/project_writer.rb +12 -11
  32. data/lib/muwu/project_exception/compiled_folder_not_found.rb +23 -0
  33. data/lib/muwu/project_exception/lynx_not_available.rb +23 -0
  34. data/lib/muwu/project_exception_handler/fatal.rb +10 -9
  35. data/lib/muwu/project_options/project_options.rb +9 -8
  36. data/lib/muwu/project_options_builder/project_option_validator.rb +12 -12
  37. data/lib/muwu/project_options_builder/project_option_validator_value.rb +78 -82
  38. data/lib/muwu/publish/publish.rb +42 -34
  39. data/lib/muwu/render_concat/render_concat.rb +26 -27
  40. data/lib/muwu/render_html/render_html.rb +27 -24
  41. data/lib/muwu/render_html_partial/render_document_html.rb +64 -64
  42. data/lib/muwu/render_html_partial/render_text_item.rb +16 -16
  43. data/lib/muwu/sync/sync.rb +40 -36
  44. data/lib/muwu/var/deflistdiv.rb +0 -0
  45. data/lib/muwu/viewer/viewer.rb +25 -0
  46. data/test/what_no_tests.md +1 -3
  47. metadata +16 -11
@@ -8,12 +8,24 @@ module Muwu
8
8
  def initialize
9
9
  @slug = ''
10
10
  end
11
-
12
-
13
-
11
+
12
+
13
+
14
14
  public
15
-
16
-
15
+
16
+
17
+ def confirm_reset_compiled(project)
18
+ render_reset_compiled_heading
19
+ render_reset_compiled_prompt
20
+ @answer = $stdin.gets.chomp.strip.downcase
21
+ if @answer == 'y'
22
+ return true
23
+ else
24
+ return false
25
+ end
26
+ end
27
+
28
+
17
29
  def confirm_reset_css(project)
18
30
  render_reset_css_heading(project)
19
31
  render_reset_css_prompt
@@ -24,21 +36,21 @@ module Muwu
24
36
  return false
25
37
  end
26
38
  end
27
-
28
-
39
+
40
+
29
41
  def request_metadata
30
42
  request_metadata_phase_1_render_heading
31
43
  request_metadata_phase_2_request_and_set_slug
32
44
  { slug: @slug }
33
45
  end
34
-
35
-
46
+
47
+
36
48
  def request_metadata_phase_1_render_heading
37
49
  render_new_project_heading
38
50
  render_lf
39
51
  end
40
-
41
-
52
+
53
+
42
54
  def request_metadata_phase_2_request_and_set_slug
43
55
  render_slug_heading
44
56
  while @slug == ''
@@ -52,13 +64,13 @@ module Muwu
52
64
  end
53
65
  render_lf
54
66
  end
55
-
56
-
57
-
67
+
68
+
69
+
58
70
  private
59
-
60
-
61
-
71
+
72
+
73
+
62
74
  def determine_reset_css_files(project)
63
75
  [
64
76
  File.join(project.path_css_base),
@@ -68,75 +80,85 @@ module Muwu
68
80
  File.join(project.path_css, 'index.scss'),
69
81
  ]
70
82
  end
71
-
83
+
72
84
 
73
85
  def render_lf
74
86
  puts "\n"
75
87
  end
76
-
77
-
88
+
89
+
78
90
  def render_new_project_heading
79
91
  puts '# Muwu'
80
92
  puts '# New Project'
81
93
  end
82
-
83
-
94
+
95
+
96
+ def render_reset_compiled_heading
97
+ puts '# Muwu'
98
+ puts '# Reset `compiled/`'
99
+ puts '- This will remove all contents of the `compiled/` folder.'
100
+ puts '- This action cannot be undone.'
101
+ end
102
+
103
+
104
+ def render_reset_compiled_prompt
105
+ print '> Continue resetting the `compiled/` folder? (y/N) '
106
+ end
107
+
108
+
84
109
  def render_reset_css_heading(project)
85
110
  puts '# Muwu'
86
111
  puts '# Reset CSS'
87
- puts
88
112
  puts '- This will reset the following files and folders to their original state:'
89
- puts
90
113
  determine_reset_css_files(project).each do |file|
91
- puts " - #{file}"
114
+ puts " * #{file}"
92
115
  end
93
- puts
94
- puts "* If #{project.path_css_extensions} does not exist, it will be created."
116
+ puts "- If #{project.path_css_extensions} does not exist, it will be created."
95
117
  puts ' Otherwise, its existing contents will remain unchanged.'
96
- puts
118
+ puts '- This action cannot be undone'
97
119
  end
98
-
99
-
120
+
121
+
100
122
  def render_reset_css_prompt
101
123
  print '> Continue with CSS reset? (y/N) '
102
124
  end
103
-
104
-
125
+
126
+
105
127
  def render_slug_heading
106
128
  puts '# Project Directory Name'
107
129
  puts '- Word characters `[a-zA-Z0-9_]` only; non-word characters will be removed.'
108
130
  end
109
-
110
-
131
+
132
+
111
133
  def render_slug_prompt
112
134
  print '> Directory Name for project: '
113
135
  end
114
-
115
-
136
+
137
+
116
138
  def render_slug_can_not_be_blank
117
139
  puts '- Directory Name can not be blank.'
118
140
  end
119
-
120
-
141
+
142
+
121
143
  def render_slug_was_sanitized(result: nil)
122
144
  puts '- Directory Name contained non-word characters that were removed.'
123
145
  if result
124
146
  puts " - Modified Directory Name: `#{result}`"
125
147
  end
126
148
  end
127
-
128
-
149
+
150
+
129
151
  def render_title_heading
130
152
  puts "\n"
131
153
  puts '# Project Title'
132
154
  end
133
-
134
-
155
+
156
+
135
157
  def render_title_prompt
136
158
  print '> Title of project: '
137
159
  end
138
-
139
-
160
+
161
+
140
162
  def render_title_can_not_be_blank
141
163
  puts '- Title can not be blank.'
142
164
  end
@@ -1,7 +1,7 @@
1
1
  module Muwu
2
2
  module Default
3
-
4
-
3
+
4
+
5
5
  FILENAMES = {
6
6
  css_manifest: 'index.scss',
7
7
  metadata: 'metadata.yml',
@@ -9,8 +9,9 @@ module Muwu
9
9
  outline: 'outline.yml'
10
10
  }
11
11
 
12
-
12
+
13
13
  FILEPATHS = {
14
+ compiled: './compiled',
14
15
  css: './config/css',
15
16
  metadata: '',
16
17
  options: '',
@@ -18,8 +19,9 @@ module Muwu
18
19
  text: './text'
19
20
  }
20
21
 
21
-
22
+
22
23
  PROJECT_OPTIONS = {
24
+ contents_section_numbers_receive_link: true,
23
25
  generate_navigators_automatically: true,
24
26
  generate_subcontents_automatically: false,
25
27
  html_head_includes_metadata_tags: true,
@@ -40,14 +42,15 @@ module Muwu
40
42
  render_section_numbers: true,
41
43
  render_sections_distinctly_depth_max: nil,
42
44
  render_title_section_metadata: ['title', 'subtitle', 'author'],
45
+ rsync_options: '--itemize-changes --recursive --verbose',
43
46
  warning_if_parent_heading_lacks_source: true
44
47
  }
45
-
46
-
48
+
49
+
47
50
  PROJECT_OUTLINE = {
48
51
  default_text_block_name: 'main'
49
52
  }
50
-
51
-
53
+
54
+
52
55
  end
53
- end
56
+ end
@@ -1,7 +1,7 @@
1
1
  module Muwu
2
2
  class Destination
3
-
4
-
3
+
4
+
5
5
  include Muwu
6
6
 
7
7
 
@@ -14,41 +14,46 @@ module Muwu
14
14
  attr_writer(
15
15
  :output
16
16
  )
17
-
18
-
17
+
18
+
19
19
  MARGIN = ' '
20
-
21
-
20
+
21
+
22
22
  def initialize
23
23
  @margin_depth = 0
24
24
  @output = nil
25
25
  end
26
-
27
-
26
+
27
+
28
28
  def inspect
29
29
  ["#{self.to_s}", "{", inspect_instance_variables, "}"].join(' ')
30
30
  end
31
31
 
32
-
32
+
33
33
  def inspect_instance_variables
34
34
  self.instance_variables.map { |v| "#{v}=#{instance_variable_get(v).inspect}" }.join(", ")
35
35
  end
36
-
37
-
38
-
36
+
37
+
38
+
39
39
  public
40
-
41
-
40
+
41
+
42
+ def filename
43
+ @output_filename
44
+ end
45
+
46
+
42
47
  def margin_dec
43
48
  @margin_depth = @margin_depth.to_i - 1
44
49
  end
45
50
 
46
-
51
+
47
52
  def margin_inc
48
53
  @margin_depth = @margin_depth.to_i + 1
49
54
  end
50
55
 
51
-
56
+
52
57
  def margin_indent
53
58
  margin_inc
54
59
  yield
@@ -59,8 +64,8 @@ module Muwu
59
64
  def margin_to_zero
60
65
  @margin_depth = 0
61
66
  end
62
-
63
-
67
+
68
+
64
69
  def output
65
70
  begin
66
71
  if output_is_closed
@@ -70,55 +75,55 @@ module Muwu
70
75
  end
71
76
  end
72
77
  end
73
-
74
-
78
+
79
+
75
80
  def output_is_closed
76
81
  @output == nil
77
82
  end
78
-
79
-
83
+
84
+
80
85
  def output_is_opened
81
86
  @output != nil
82
87
  end
83
-
84
-
88
+
89
+
85
90
  def output_stream
86
91
  announce_open
87
92
  output_open
88
93
  yield
89
94
  output_close
90
95
  end
91
-
92
-
96
+
97
+
93
98
  def padding_vertical(n)
94
99
  output.print ("\n" * n)
95
100
  yield
96
101
  output.print ("\n" * n)
97
- end
98
-
99
-
102
+ end
103
+
104
+
100
105
  def write_inline(value)
101
106
  write_value(value)
102
107
  end
103
108
 
104
-
109
+
105
110
  def write_inline_end(value)
106
111
  write_value(value)
107
112
  write_lf
108
113
  end
109
114
 
110
-
115
+
111
116
  def write_inline_indented(value)
112
117
  write_margin
113
118
  write_value(value)
114
119
  end
115
-
116
-
120
+
121
+
117
122
  def write_lf
118
123
  output.print "\n"
119
124
  end
120
-
121
-
125
+
126
+
122
127
  def write_line(value)
123
128
  write_margin
124
129
  write_value(value)
@@ -129,35 +134,35 @@ module Muwu
129
134
  def write_margin
130
135
  output.print render_current_margin
131
136
  end
132
-
133
-
137
+
138
+
134
139
  def write_value(value)
135
140
  output.print value
136
141
  end
137
-
138
-
142
+
143
+
139
144
 
140
145
  private
141
-
142
-
146
+
147
+
143
148
  def announce_open
144
149
  if @output_class == 'file'
145
150
  puts "- Writing `#{output_filename}`."
146
151
  end
147
152
  end
148
-
153
+
149
154
 
150
155
  def destination_file_open
151
156
  filename = File.join(@output_working_directory, @output_filename)
152
157
  File.new(filename, 'w')
153
158
  end
154
-
155
-
159
+
160
+
156
161
  def destination_stdout
157
162
  $stdout
158
163
  end
159
-
160
-
164
+
165
+
161
166
  def output_close
162
167
  begin
163
168
  if output_is_closed
@@ -168,8 +173,8 @@ module Muwu
168
173
  end
169
174
  margin_to_zero
170
175
  end
171
-
172
-
176
+
177
+
173
178
  def output_close_assignment
174
179
  if File === @output
175
180
  @output.close
@@ -178,8 +183,8 @@ module Muwu
178
183
  @output = nil
179
184
  end
180
185
  end
181
-
182
-
186
+
187
+
183
188
  def output_open
184
189
  margin_to_zero
185
190
  begin
@@ -199,14 +204,13 @@ module Muwu
199
204
  when 'stdout'
200
205
  @output = destination_stdout
201
206
  end
202
- end
203
-
204
-
207
+ end
208
+
209
+
205
210
  def render_current_margin
206
211
  (MARGIN * @margin_depth.to_i)
207
212
  end
208
-
209
-
210
- end
211
- end
212
213
 
214
+
215
+ end
216
+ end