muwu 3.0.0.alpha → 3.0.0.beta

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,41 @@
1
+ // @mixin text_section_heading($font-size, $margin-bottom) {
2
+ // >.section_number {
3
+ // font-size: $font-size;
4
+ // & + h1:first-of-type,
5
+ // & + h2:first-of-type,
6
+ // & + h3:first-of-type,
7
+ // & + h4:first-of-type,
8
+ // & + h5:first-of-type,
9
+ // & + h6:first-of-type {
10
+ // font-size: $font-size;
11
+ // margin-bottom: $margin-bottom;
12
+ // }
13
+ // }
14
+ // >h1:first-child,
15
+ // >h2:first-child,
16
+ // >h3:first-child,
17
+ // >h4:first-child,
18
+ // >h5:first-child,
19
+ // >h6:first-child {
20
+ // font-size: $font-size;
21
+ // margin-bottom: $margin-bottom;
22
+ // }
23
+ // }
24
+
1
25
  @mixin text_section_heading($font-size, $margin-bottom) {
2
- >.section_number {
26
+ >h1:first-child,
27
+ >h2:first-child,
28
+ >h3:first-child,
29
+ >h4:first-child,
30
+ >h5:first-child,
31
+ >h6:first-child {
32
+ font-size: $font-size;
33
+ margin-bottom: $margin-bottom;
34
+ }
35
+ >h1.section_number {
3
36
  font-size: $font-size;
4
- & + h1:first-of-type,
37
+ margin-bottom: 0;
38
+ & + h1:nth-of-type(2),
5
39
  & + h2:first-of-type,
6
40
  & + h3:first-of-type,
7
41
  & + h4:first-of-type,
@@ -11,13 +45,4 @@
11
45
  margin-bottom: $margin-bottom;
12
46
  }
13
47
  }
14
- >h1:first-child,
15
- >h2:first-child,
16
- >h3:first-child,
17
- >h4:first-child,
18
- >h5:first-child,
19
- >h6:first-child {
20
- font-size: $font-size;
21
- margin-bottom: $margin-bottom;
22
- }
23
48
  }
@@ -77,6 +77,7 @@ module Muwu
77
77
 
78
78
 
79
79
  def phase_4_validate
80
+ @validator.validate_dir_compiled
80
81
  @validator.validate_file_css
81
82
  @validator.validate_option_remote_publish
82
83
  @validator.validate_option_remote_sync
@@ -0,0 +1,24 @@
1
+ module Muwu
2
+ class ProjectResetCompiled
3
+
4
+
5
+ require 'fileutils'
6
+
7
+
8
+ include Muwu
9
+
10
+
11
+ def initialize(project)
12
+ @project = project
13
+ end
14
+
15
+
16
+ def reset_compiled
17
+ puts "- Resetting #{@project.path_compiled}"
18
+ FileUtils.remove_entry_secure(@project.path_compiled)
19
+ FileUtils.mkdir(@project.path_compiled)
20
+ end
21
+
22
+
23
+ end
24
+ end
@@ -1,21 +1,21 @@
1
1
  module Muwu
2
2
  class ProjectResetCss
3
-
4
-
3
+
4
+
5
5
  include Muwu
6
-
7
-
6
+
7
+
8
8
  require 'fileutils'
9
-
10
-
9
+
10
+
11
11
  def initialize(project)
12
12
  @project = project
13
13
  end
14
-
15
-
14
+
15
+
16
16
  public
17
-
18
-
17
+
18
+
19
19
  def reset_css
20
20
  phase_1_verify_or_create_css_folder
21
21
  phase_2_clear_base_folder
@@ -25,8 +25,8 @@ module Muwu
25
25
  phase_6_copy_index
26
26
  phase_7_verify_or_create_extensions_folder
27
27
  end
28
-
29
-
28
+
29
+
30
30
  def phase_1_verify_or_create_css_folder
31
31
  if Dir.exists?(@project.path_config) == false
32
32
  puts "Creating folder #{@project.path_config}"
@@ -37,50 +37,50 @@ module Muwu
37
37
  FileUtils.mkdir(@project.path_css)
38
38
  end
39
39
  end
40
-
41
-
40
+
41
+
42
42
  def phase_2_clear_base_folder
43
43
  if Dir.exists?(@project.path_css_base) == true
44
44
  puts "Clearing folder #{@project.path_css_base}"
45
- FileUtils.remove_dir(@project.path_css_base)
45
+ FileUtils.remove_entry_secure(@project.path_css_base)
46
46
  end
47
47
  end
48
-
49
-
48
+
49
+
50
50
  def phase_3_copy_base_css_files
51
51
  folder_source_gem = File.absolute_path(File.join(Muwu::GEM_HOME_LIB, 'muwu','project_builder','assets','config','css','base'))
52
52
  folder_destination_project = @project.path_css_base
53
53
  puts "Resetting folder #{@project.path_css_base}"
54
54
  FileUtils.cp_r(folder_source_gem, folder_destination_project)
55
55
  end
56
-
57
-
56
+
57
+
58
58
  def phase_4_verify_or_create_colors_folder
59
59
  if Dir.exists?(@project.path_css_colors) == false
60
60
  puts "Creating folder #{@project.path_css_colors}"
61
61
  FileUtils.mkdir(@project.path_css_colors)
62
62
  end
63
63
  end
64
-
65
-
64
+
65
+
66
66
  def phase_5_copy_colors_css_files
67
67
  colors_source_gem = File.absolute_path(File.join(Muwu::GEM_HOME_LIB, 'muwu','project_builder','assets','config','css','colors','.'))
68
68
  colors_destination_project = @project.path_css
69
69
  puts "Resetting file #{File.join(@project.path_css_colors,'dark.scss')}"
70
- puts "Resetting file #{File.join(@project.path_css_colors,'dark.scss')}"
71
- puts "Resetting file #{File.join(@project.path_css_colors,'dark.scss')}"
70
+ puts "Resetting file #{File.join(@project.path_css_colors,'index.scss')}"
71
+ puts "Resetting file #{File.join(@project.path_css_colors,'light.scss')}"
72
72
  FileUtils.cp_r(colors_source_gem, colors_destination_project)
73
73
  end
74
-
75
-
74
+
75
+
76
76
  def phase_6_copy_index
77
77
  index_source_gem = File.absolute_path(File.join(Muwu::GEM_HOME_LIB, 'muwu','project_builder','assets','config','css','index.scss'))
78
78
  index_destination_project = @project.path_css
79
79
  puts "Resetting file #{File.join(@project.path_css, 'index.scss')}"
80
80
  FileUtils.cp_r(index_source_gem, index_destination_project)
81
81
  end
82
-
83
-
82
+
83
+
84
84
  def phase_7_verify_or_create_extensions_folder
85
85
  if Dir.exists?(@project.path_css_extensions) == false
86
86
  folder_source_gem = File.absolute_path(File.join(Muwu::GEM_HOME_LIB, 'muwu','project_builder','assets','config','css','extensions'))
@@ -89,7 +89,7 @@ module Muwu
89
89
  FileUtils.cp_r(folder_source_gem, folder_destination_project)
90
90
  end
91
91
  end
92
-
93
-
92
+
93
+
94
94
  end
95
- end
95
+ end
@@ -14,6 +14,16 @@ module Muwu
14
14
  public
15
15
 
16
16
 
17
+ def validate_dir_compiled
18
+ if @project.path_compiled_does_exist
19
+ return true
20
+ else
21
+ @project.exceptions_add ProjectException::CompiledFolderNotFound.new(@project)
22
+ return false
23
+ end
24
+ end
25
+
26
+
17
27
  def validate_file_css
18
28
  if @project.css_manifest_file_does_exist
19
29
  return true
@@ -52,8 +62,8 @@ module Muwu
52
62
  return false
53
63
  end
54
64
  end
55
-
56
-
65
+
66
+
57
67
  def validate_option_remote_publish
58
68
  if @project.options.remote_publish.to_s == ''
59
69
  @project.exceptions_add ProjectException::OptionRemotePublishValueNil.new
@@ -106,8 +116,8 @@ module Muwu
106
116
  @project.exceptions_add ProjectException::MultipleFormatsRequestedWithStdout.new
107
117
  end
108
118
  end
109
-
110
-
119
+
120
+
111
121
  def validate_scenario_if_more_than_one_document
112
122
  if @project.outline_has_more_than_one_document && @project.output_destination_requests_stdout
113
123
  @project.exceptions_add ProjectException::MultipleDocumentsOutlinedWithStdout.new
@@ -8,8 +8,8 @@ module Muwu
8
8
 
9
9
  require 'fileutils'
10
10
  require 'yaml'
11
-
12
-
11
+
12
+
13
13
  attr_accessor(
14
14
  :project
15
15
  )
@@ -40,19 +40,20 @@ module Muwu
40
40
 
41
41
  end
42
42
  end
43
-
44
-
43
+
44
+
45
45
  def phase_1_make_project_folder
46
46
  announce_and_execute_dir_mkdir(@project.working_directory)
47
47
  end
48
-
49
-
48
+
49
+
50
50
  def phase_2_make_project_subfolders
51
+ announce_and_execute_dir_mkdir(@project.path_compiled)
51
52
  announce_and_execute_dir_mkdir(@project.path_config)
52
53
  announce_and_execute_dir_mkdir(@project.path_images)
53
54
  announce_and_execute_dir_mkdir(@project.path_text)
54
55
  end
55
-
56
+
56
57
 
57
58
  def phase_2_make_folder_css_and_copy_files
58
59
  folder_source_gem = File.absolute_path(File.join(Muwu::GEM_HOME_LIB, 'muwu','project_builder','assets','config','css'))
@@ -79,8 +80,8 @@ module Muwu
79
80
  phase_3_write_file_outline_yml_blank
80
81
  end
81
82
  end
82
-
83
-
83
+
84
+
84
85
  def phase_3_write_file_outline_yml_dump
85
86
  announce_and_execute_yaml_dump(@project.outline, @project.outline_filename)
86
87
  end
@@ -124,4 +125,4 @@ module Muwu
124
125
 
125
126
 
126
127
  end
127
- end
128
+ end
@@ -0,0 +1,23 @@
1
+ module Muwu
2
+ module ProjectException
3
+ class CompiledFolderNotFound
4
+
5
+
6
+ def initialize(project)
7
+ @compiled_folder = project.path_compiled
8
+ end
9
+
10
+
11
+ def report
12
+ "The folder for compiled documents `#{@compiled_folder}` could not be found."
13
+ end
14
+
15
+
16
+ def type
17
+ :fatal
18
+ end
19
+
20
+
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,23 @@
1
+ module Muwu
2
+ module ProjectException
3
+ class LynxNotAvailable
4
+
5
+
6
+ def initialize
7
+ $stderr.puts "#{self.class}"
8
+ end
9
+
10
+
11
+ def report
12
+ "lynx is not available"
13
+ end
14
+
15
+
16
+ def type
17
+ :view
18
+ end
19
+
20
+
21
+ end
22
+ end
23
+ end
@@ -3,6 +3,7 @@ module Muwu
3
3
 
4
4
 
5
5
  attr_accessor(
6
+ :expunge_when_compiling_all,
6
7
  :generate_navigators_automatically,
7
8
  :generate_subcontents_automatically,
8
9
  :html_head_includes_metadata_tags,
@@ -25,15 +26,15 @@ module Muwu
25
26
  :render_title_section_metadata,
26
27
  :warning_if_parent_heading_lacks_source
27
28
  )
28
-
29
-
29
+
30
+
30
31
  def initialize
31
32
  Default::PROJECT_OPTIONS.each_pair do |key, value|
32
33
  set_option(key, value)
33
34
  end
34
35
  end
35
-
36
-
36
+
37
+
37
38
  def inspect
38
39
  ["#{self.to_s}", "{", inspect_instance_variables, "}"].join(' ')
39
40
  end
@@ -42,15 +43,15 @@ module Muwu
42
43
  def inspect_instance_variables
43
44
  instance_variables.map { |v| "#{v}=#{instance_variable_get(v).inspect}" }.join(", ")
44
45
  end
45
-
46
-
46
+
47
+
47
48
  def set_option(key, value)
48
49
  if Default::PROJECT_OPTIONS.has_key?(key)
49
50
  key_ivsym = "@#{key.to_s}"
50
51
  instance_variable_set(key_ivsym, value)
51
52
  end
52
53
  end
53
-
54
-
54
+
55
+
55
56
  end
56
57
  end
@@ -3,32 +3,32 @@ module Muwu
3
3
 
4
4
 
5
5
  require 'iso-639'
6
-
7
-
6
+
7
+
8
8
  include Muwu
9
9
  include Helper
10
10
 
11
-
11
+
12
12
  attr_accessor(
13
13
  :key_validated,
14
14
  :project,
15
15
  :validation_method_name,
16
16
  :value_provided
17
17
  )
18
-
19
-
18
+
19
+
20
20
  def initialize(key_validated, value_provided, project)
21
21
  @key_validated = key_validated.to_s.gsub(/\W/,'_')
22
22
  @project = project
23
23
  @validation_method_name = "validate_option_#{@key_validated}"
24
24
  @value_provided = value_provided
25
25
  end
26
-
27
-
28
-
26
+
27
+
28
+
29
29
  public
30
-
31
-
30
+
31
+
32
32
  def validated_value
33
33
  if private_methods.include?(@validation_method_name.to_sym)
34
34
  return method(@validation_method_name).call
@@ -37,20 +37,6 @@ module Muwu
37
37
  return nil
38
38
  end
39
39
  end
40
-
41
-
42
- # def value_as_array(value)
43
- # result = []
44
- # if String === value
45
- # result = value.split(/,\s*/).map{ |v| value_as_string(v) }.sort
46
- # elsif Array === value
47
- # result = value.map{ |v| value_as_string(v) }.sort
48
- # elsif Boolean === @value_provided
49
- # result << value
50
- # end
51
- # result.reject!{ |r| r == '' }
52
- # result
53
- # end
54
40
 
55
41
 
56
42
  def value_as_array(value)
@@ -66,13 +52,13 @@ module Muwu
66
52
  result.reject!{ |r| r == '' }
67
53
  result
68
54
  end
69
-
70
-
55
+
56
+
71
57
  def value_as_integer(value)
72
58
  value.to_i
73
59
  end
74
-
75
-
60
+
61
+
76
62
  def value_as_string(value)
77
63
  value.to_s.strip.downcase
78
64
  end
@@ -81,8 +67,8 @@ module Muwu
81
67
  def value_as_string_preserving_case(value)
82
68
  value.to_s.strip
83
69
  end
84
-
85
-
70
+
71
+
86
72
  def value_provided_as_array
87
73
  value_as_array(@value_provided)
88
74
  end
@@ -91,22 +77,22 @@ module Muwu
91
77
  def value_provided_as_integer
92
78
  value_as_integer(@value_provided)
93
79
  end
94
-
95
-
80
+
81
+
96
82
  def value_provided_as_string
97
83
  value_as_string(@value_provided)
98
84
  end
99
-
100
-
85
+
86
+
101
87
  def value_provided_as_string_preserving_case
102
88
  value_as_string_preserving_case(@value_provided)
103
89
  end
104
-
90
+
105
91
 
106
92
 
107
93
  private
108
-
109
-
94
+
95
+
110
96
  def validate_option_boolean
111
97
  case @value_provided
112
98
  when false, true
@@ -118,23 +104,28 @@ module Muwu
118
104
  return nil
119
105
  end
120
106
  end
121
-
122
-
107
+
108
+
109
+ def validate_option_expunge_when_compiling_all
110
+ return validate_option_boolean
111
+ end
112
+
113
+
123
114
  def validate_option_generate_navigators_automatically
124
115
  return validate_option_boolean
125
116
  end
126
-
127
-
117
+
118
+
128
119
  def validate_option_generate_subcontents_automatically
129
120
  return validate_option_boolean
130
121
  end
131
-
132
-
122
+
123
+
133
124
  def validate_option_html_head_includes_metadata_tags
134
125
  return validate_option_boolean
135
126
  end
136
-
137
-
127
+
128
+
138
129
  def validate_option_html_lang
139
130
  case @value_provided
140
131
  when nil, 'nil'
@@ -149,18 +140,18 @@ module Muwu
149
140
  end
150
141
  end
151
142
  end
152
-
153
-
143
+
144
+
154
145
  def validate_option_html_uses_javascript_navigation
155
146
  return validate_option_boolean
156
147
  end
157
-
158
-
148
+
149
+
159
150
  def validate_option_markdown_allows_raw_html
160
151
  return validate_option_boolean
161
152
  end
162
-
163
-
153
+
154
+
164
155
  def validate_option_markdown_renderer
165
156
  value = value_provided_as_string
166
157
  case value
@@ -173,8 +164,8 @@ module Muwu
173
164
  return nil
174
165
  end
175
166
  end
176
-
177
-
167
+
168
+
178
169
  def validate_option_outline_text_pathnames
179
170
  value = value_provided_as_string
180
171
  case value
@@ -185,8 +176,8 @@ module Muwu
185
176
  return nil
186
177
  end
187
178
  end
188
-
189
-
179
+
180
+
190
181
  def validate_option_output_destination
191
182
  value = value_provided_as_string
192
183
  case value
@@ -210,22 +201,22 @@ module Muwu
210
201
  return nil
211
202
  end
212
203
  end
213
-
214
-
204
+
205
+
215
206
  def validate_option_output_file_css_basename
216
207
  return validate_option_output_file_basename
217
208
  end
218
-
219
-
209
+
210
+
220
211
  def validate_option_output_file_html_basename
221
212
  return validate_option_output_file_basename
222
213
  end
223
-
224
-
214
+
215
+
225
216
  def validate_option_output_file_js_basename
226
217
  return validate_option_output_file_basename
227
218
  end
228
-
219
+
229
220
 
230
221
  def validate_option_output_formats
231
222
  result = []
@@ -239,23 +230,23 @@ module Muwu
239
230
  end
240
231
  return result
241
232
  end
242
-
243
-
233
+
234
+
244
235
  def validate_option_remote_publish
245
236
  return value_provided_as_string_preserving_case
246
237
  end
247
-
248
-
238
+
239
+
249
240
  def validate_option_remote_sync
250
241
  return value_provided_as_string_preserving_case
251
242
  end
252
-
253
-
243
+
244
+
254
245
  def validate_option_render_punctuation_smart
255
246
  return validate_option_boolean
256
247
  end
257
-
258
-
248
+
249
+
259
250
  def validate_option_render_section_end_links
260
251
  result = []
261
252
  value_provided_as_array.each do |value|
@@ -272,12 +263,12 @@ module Muwu
272
263
  end
273
264
  return result
274
265
  end
275
-
276
-
266
+
267
+
277
268
  def validate_option_render_section_numbers
278
269
  return validate_option_boolean
279
270
  end
280
-
271
+
281
272
 
282
273
  def validate_option_render_sections_distinctly_depth_max
283
274
  case @value_provided
@@ -290,8 +281,8 @@ module Muwu
290
281
  return nil
291
282
  end
292
283
  end
293
-
294
-
284
+
285
+
295
286
  def validate_option_render_title_section_metadata
296
287
  case @value_provided
297
288
  when nil, '', 'nil'
@@ -304,17 +295,17 @@ module Muwu
304
295
  return [@value_provided.to_s].flatten
305
296
  end
306
297
  end
307
-
308
-
298
+
299
+
309
300
  def validate_option_render_punctuation_smart
310
301
  return validate_option_boolean
311
302
  end
312
-
313
-
303
+
304
+
314
305
  def validate_option_warning_if_parent_heading_lacks_source
315
306
  return validate_option_boolean
316
307
  end
317
-
318
-
308
+
309
+
319
310
  end
320
- end
311
+ end