muwu 3.0.0.beta → 3.0.0.beta2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/lib/muwu.rb +1 -1
  3. data/lib/muwu/cli/cli.rb +5 -5
  4. data/lib/muwu/cli/help/compile +4 -4
  5. data/lib/muwu/cli/help/summary +1 -3
  6. data/lib/muwu/cli/help/sync +21 -11
  7. data/lib/muwu/cli/help/view +1 -2
  8. data/lib/muwu/controller/controller.rb +4 -4
  9. data/lib/muwu/controller/controller_interaction.rb +66 -44
  10. data/lib/muwu/default/default.rb +3 -1
  11. data/lib/muwu/project/project.rb +14 -21
  12. data/lib/muwu/project_builder/assets/config/css/base/html_elements.scss +19 -15
  13. data/lib/muwu/project_builder/assets/config/css/base/mixin_text_section_heading.scss +0 -24
  14. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_contents.scss +5 -5
  15. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_metadata.scss +2 -4
  16. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_navigator.scss +3 -4
  17. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_subcontents.scss +5 -5
  18. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_text.scss +16 -15
  19. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_title.scss +9 -6
  20. data/lib/muwu/project_builder/project_reset_compiled.rb +9 -2
  21. data/lib/muwu/project_builder/project_starter.rb +7 -7
  22. data/lib/muwu/project_builder/project_writer.rb +1 -1
  23. data/lib/muwu/project_options/project_options.rb +2 -1
  24. data/lib/muwu/project_options_builder/project_option_validator.rb +12 -12
  25. data/lib/muwu/project_options_builder/project_option_validator_value.rb +7 -1
  26. data/lib/muwu/render_concat/render_concat.rb +26 -27
  27. data/lib/muwu/render_html/render_html.rb +0 -3
  28. data/lib/muwu/sync/sync.rb +23 -16
  29. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cd84d886de0b03ecaef0c6cb6eafe2f81e0f36e67b42d1d0a315b76968bff743
4
- data.tar.gz: 01fec21c061156be890fd9445b3ba1b86f700893e929a1b51630017b6e5e3985
3
+ metadata.gz: 004b5b4bcff5064b7e92494afb02f04b34947f44d139c92bb9ad329d4ca5abfb
4
+ data.tar.gz: 2f1e3a3d6c973488921ed9904b1afdd698a251b21ec88639a514960e32f5955b
5
5
  SHA512:
6
- metadata.gz: eea61dd2032e8b8d25dd40236342a1a6753be24a3640d971727fd169e592ab78833d9d8152b36198bc7fb9199ceda36154794db2da2d9fb9a96af6165b5f4985
7
- data.tar.gz: 7cd2c9592176fb8d45bac5ed55a20f72e20657577656d48c2e97a0781046521fbdcf97a7fc16712e14129ed2ffc92b655c9ddbb6c6432346b1dfd2984389e401
6
+ metadata.gz: e2ad7a17cbbf04131c7a2377d032df0e0def82349b7dcb64ec07e79846f500fb792c3452882235acf8a34b7be91f75a7ab617e41e3c0c2fbc681e5c88875a31b
7
+ data.tar.gz: e3da5b0145e28f1bf7a944900e11c5f33b6b5f9c40739f72557154ce90221ed457a9474cf230da6ba0b7caa7176009227e044e2509d39ab2401c17001cf42bf3
@@ -1,7 +1,7 @@
1
1
  module Muwu
2
2
 
3
3
 
4
- VERSION = '3.0.0.beta'
4
+ VERSION = '3.0.0.beta2'
5
5
 
6
6
  GEM_HOME_LIB = File.absolute_path(File.join(File.dirname(__FILE__)))
7
7
  GEM_HOME_LIB_MUWU = File.absolute_path(File.join(GEM_HOME_LIB, 'muwu'))
@@ -137,7 +137,7 @@ module Muwu
137
137
 
138
138
 
139
139
  def evaluate_command_publish
140
- Controller.new(@current_working_directory).publish(@args[1..(@args.length-1)])
140
+ Controller.new(@current_working_directory).publish(@args[1..-1])
141
141
  end
142
142
 
143
143
 
@@ -164,10 +164,10 @@ module Muwu
164
164
 
165
165
  else
166
166
  case @args[1]
167
- when 'down'
168
- Controller.new(@current_working_directory).sync_down(@args[2..(@args.length-1)])
169
- when 'up'
170
- Controller.new(@current_working_directory).sync_up(@args[2..(@args.length-1)])
167
+ when 'pull'
168
+ Controller.new(@current_working_directory).sync_pull(@args[2..-1])
169
+ when 'push'
170
+ Controller.new(@current_working_directory).sync_push(@args[2..-1])
171
171
  else
172
172
  puts CliHelp.new(:sync).message
173
173
  end
@@ -14,9 +14,9 @@
14
14
  number of a document.
15
15
 
16
16
  - muwu compile js
17
- - Compile only the javascript library (if applicable) for the project.
17
+ - Compile only the Javascript library (if applicable) for the project.
18
18
 
19
19
  * Compiling a project will overwrite any previous output files without
20
- any warning.
21
-
22
- * You can specify output filenames in `options.yml`.
20
+ any warning.
21
+
22
+ * Specify output filenames in `options.yml`.
@@ -9,10 +9,8 @@ Command line:
9
9
  muwu publish publish to a remote server (requires rsync)
10
10
  muwu reset compiled reset the `compiled/` subdirectory
11
11
  muwu reset css reset the default CSS files
12
- muwu sync syncronize from/to a remote server (requires rsync)
12
+ muwu sync synchronize from/to a remote location (requires rsync)
13
13
  muwu view view a compiled project (requires lynx)
14
14
 
15
- All commands operate within the current working directory.
16
-
17
15
  For more detailed instructions:
18
16
  muwu help [command]
@@ -1,18 +1,28 @@
1
- - muwu sync [down | up] [options]
2
- - Synchronize project from/to a remote location using rsync. Rsync must be
3
- installed on the local system.
1
+ - muwu sync (pull/push) [options]
2
+ - Synchronize the project from/to a remote location using rsync. Rsync must
3
+ be installed on the local system.
4
4
 
5
- - muwu sync down
5
+ - muwu sync pull
6
6
  - Use rsync to download the project from a remote host.
7
7
 
8
- - muwu sync up
9
- - Use rsync to upload to project to a remote host.
8
+ - muwu sync push
9
+ - Use rsync to upload the project to a remote host.
10
10
 
11
11
  - [options]
12
- - dry-run: invoke the rsync '-n' switch to show which files will be
13
- transferred, but do not actually transfer any files.
12
+ - Muwu will pass any further command-line arguments to rsync. See the rsync
13
+ man page for more information about valid rsync options.
14
14
 
15
- * Specify the remote host in 'options.yml' using the 'remote_sync' value.
15
+ - Muwu will automatically include the following options:
16
+ --itemize-changes
17
+ --recursive
18
+ --verbose
19
+
20
+ - Other useful options: (verify against the rsync man page before using)
21
+ --delete Delete files from the target host that aren't present on the
22
+ source host.
23
+ --dry-run Show which changes would be made, but don't perform them.
24
+ --update Only update the files on the target host that have older
25
+ timestamps than on the source; do not change files on the
26
+ target host that have newer timestamps.
16
27
 
17
- * Muwu will invoke the rsync switches '-r' to recurse subdirectories, and
18
- '-v' to give a verbose description
28
+ * Specify the remote host in 'options.yml' using the 'remote_sync' value.
@@ -1,4 +1,3 @@
1
1
  - muwu view
2
- - View a compiled porject in `compiled/` using lynx. Lynx must be installed
2
+ - View a compiled project in `compiled/` using lynx. Lynx must be installed
3
3
  on the local system.
4
-
@@ -124,22 +124,22 @@ module Muwu
124
124
  end
125
125
 
126
126
 
127
- def sync_down(args)
127
+ def sync_pull(args)
128
128
  @project = read_project_from_current_working_directory
129
129
  if @project.does_not_have_crucial_files
130
130
  reply_folder_does_not_have_valid_project
131
131
  else
132
- Sync.new(@project, args: args).down
132
+ Sync.new(@project, args: args).pull
133
133
  end
134
134
  end
135
135
 
136
136
 
137
- def sync_up(args)
137
+ def sync_push(args)
138
138
  @project = read_project_from_current_working_directory
139
139
  if @project.does_not_have_crucial_files
140
140
  reply_folder_does_not_have_valid_project
141
141
  else
142
- Sync.new(@project, args: args).up
142
+ Sync.new(@project, args: args).push
143
143
  end
144
144
  end
145
145
 
@@ -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
@@ -21,7 +21,9 @@ module Muwu
21
21
 
22
22
 
23
23
  PROJECT_OPTIONS = {
24
- expunge_when_compiling_all: true,
24
+ # TODO: this was probably an anti-pattern
25
+ # compile_all_resets_compiled_folder: true,
26
+ contents_section_numbers_receive_link: true,
25
27
  generate_navigators_automatically: true,
26
28
  generate_subcontents_automatically: false,
27
29
  html_head_includes_metadata_tags: true,
@@ -27,17 +27,6 @@ module Muwu
27
27
  end
28
28
 
29
29
 
30
- def inspect
31
- ["#{self.to_s}", "{", inspect_instance_variables, "}"].join(' ')
32
- end
33
-
34
-
35
- def inspect_instance_variables
36
- self.instance_variables.map { |v| "#{v}=#<#{instance_variable_get(v).class}>" }.join(", ")
37
- end
38
-
39
-
40
-
41
30
  public
42
31
 
43
32
 
@@ -65,13 +54,6 @@ module Muwu
65
54
  end
66
55
 
67
56
 
68
- # def does_not_have_crucial_files
69
- # exceptions_include?(ProjectException::MetadataFileNotFound) &&
70
- # exceptions_include?(ProjectException::OptionsFileNotFound) &&
71
- # exceptions_include?(ProjectException::OutlineFileNotFound)
72
- # end
73
-
74
-
75
57
  def does_not_have_crucial_files
76
58
  metadata_file_does_not_exist &&
77
59
  options_file_does_not_exist &&
@@ -108,6 +90,16 @@ module Muwu
108
90
  end
109
91
 
110
92
 
93
+ def inspect
94
+ ["#{self.to_s}", "{", inspect_instance_variables, "}"].join(' ')
95
+ end
96
+
97
+
98
+ def inspect_instance_variables
99
+ self.instance_variables.map { |v| "#{v}=#<#{instance_variable_get(v).class}>" }.join(", ")
100
+ end
101
+
102
+
111
103
  def js_basename
112
104
  if @options.output_file_js_basename.to_s == ''
113
105
  SanitizerHelper::sanitize_destination_file_basename(slug).downcase
@@ -295,9 +287,10 @@ module Muwu
295
287
  end
296
288
 
297
289
 
298
- def path_images
299
- File.absolute_path(File.join(@working_directory, 'images'))
300
- end
290
+ # DEPRECATED
291
+ # def path_images
292
+ # File.absolute_path(File.join(@working_directory, 'images'))
293
+ # end
301
294
 
302
295
 
303
296
  def path_outline
@@ -17,16 +17,19 @@
17
17
  // proportional, while the content box could shrink). An HTML document with
18
18
  // adequately-defined heirarchial organization has no need for `padding-box`
19
19
  // sizing, and a layout editor working with a mindset of variable-size media
20
- // can successfully rely on `content-box` sizing.
20
+ // can successfully rely on `content-box` sizing.
21
21
  //
22
22
 
23
+ $muwu-root-font-size: 1rem;
24
+ $muwu-root-line-height: ($muwu-root-font-size * 1.16667);
25
+
23
26
  * {
24
27
  box-sizing: content-box;
25
- line-height: 1.16667;
28
+ font-size: $muwu-root-font-size;
29
+ line-height: $muwu-root-line-height;
26
30
  margin: 0;
27
31
  padding: 0;
28
32
  text-indent: 0;
29
- font-size: 1rem;
30
33
  }
31
34
 
32
35
 
@@ -41,16 +44,16 @@ body {
41
44
  }
42
45
 
43
46
  blockquote {
44
- margin: 1rem 2rem;
47
+ margin: $muwu-root-line-height 2rem;
45
48
  }
46
49
 
47
50
  code {
48
- font-size: 1rem;
51
+ font-size: $muwu-root-font-size;
49
52
  padding: 0rem 0.15rem;
50
53
  }
51
54
 
52
55
  dl {
53
- margin: 1rem 0;
56
+ margin: $muwu-root-line-height 0;
54
57
  div {
55
58
  dt {
56
59
  display: list-item;
@@ -63,7 +66,7 @@ dl {
63
66
  dd {
64
67
  display: list-item;
65
68
  list-style-type: none;
66
- p {
69
+ p {
67
70
  display: inline;
68
71
  }
69
72
  }
@@ -77,30 +80,31 @@ img {
77
80
  }
78
81
 
79
82
  h1, h2, h3, h4, h5, h6 {
80
- font-size: 1.125rem;
83
+ font-size: ($muwu-root-font-size * 1.125);
84
+ margin: $muwu-root-line-height 0rem;
81
85
  }
82
86
 
83
87
  hr {
84
- margin: 1rem 0;
88
+ margin: $muwu-root-line-height 0;
85
89
  border-width: 0;
86
90
  }
87
91
 
88
92
  ol {
89
- margin: 1rem;
93
+ margin: $muwu-root-line-height;
90
94
  ol, ul {
91
95
  margin: 0rem 1rem;
92
96
  }
93
97
  }
94
98
 
95
99
  p {
96
- margin: 1rem 0rem;
100
+ margin: $muwu-root-line-height 0rem;
97
101
  }
98
102
 
99
103
  pre {
100
- font-size: 0.9rem;
101
- margin: 1rem 0;
104
+ font-size: ($muwu-root-font-size * 0.9);
105
+ margin: $muwu-root-line-height 0;
102
106
  >code {
103
- font-size: 0.8rem;
107
+ font-size: ($muwu-root-font-size * 0.8);
104
108
  padding: 0rem 0rem;
105
109
  }
106
110
  }
@@ -110,7 +114,7 @@ q {
110
114
  }
111
115
 
112
116
  ul {
113
- margin: 1rem;
117
+ margin: $muwu-root-line-height;
114
118
  ol, ul {
115
119
  margin: 0rem 1rem;
116
120
  }
@@ -1,27 +1,3 @@
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
-
25
1
  @mixin text_section_heading($font-size, $margin-bottom) {
26
2
  >h1:first-child,
27
3
  >h2:first-child,
@@ -1,8 +1,8 @@
1
1
  body >div.contents {
2
- margin: 4em 0;
2
+ margin: ($muwu-root-line-height * 4) 0;
3
3
  >h1 {
4
- font-size: 1.25em;
5
- margin: 0 0 2rem 0;
4
+ font-size: ($muwu-root-font-size * 1.25);
5
+ margin: 0 0 ($muwu-root-line-height * 2) 0;
6
6
  text-align: left;
7
7
  }
8
8
  .compiler_warning {
@@ -33,7 +33,7 @@ body >div.contents {
33
33
  }
34
34
  td.heading {
35
35
  text-align: left;
36
- }
36
+ }
37
37
  td.number {
38
38
  text-align: right;
39
39
  }
@@ -44,7 +44,7 @@ body >div.contents {
44
44
  display: block;
45
45
  margin: 0rem;
46
46
  li {
47
- margin: 0.5rem 0rem;
47
+ margin: ($muwu-root-line-height * 0.5) 0rem;
48
48
  a {
49
49
  display: inline;
50
50
  }
@@ -1,8 +1,8 @@
1
1
  body >div.metadata {
2
- margin: 4em 0;
2
+ margin: ($muwu-root-line-height * 4) 0;
3
3
  dl {
4
4
  div {
5
- margin: 1rem 0;
5
+ margin: $muwu-root-line-height 0;
6
6
  dt {
7
7
  font-weight: bold;
8
8
  display: block;
@@ -13,5 +13,3 @@ body >div.metadata {
13
13
  }
14
14
  }
15
15
  }
16
-
17
-
@@ -1,13 +1,12 @@
1
1
  body >div.navigator {
2
- margin: 0.5rem 0;
2
+ margin: ($muwu-root-line-height * 0.5) 0;
3
3
  nav.document_links {
4
4
  width: 100%;
5
5
  display: flex;
6
6
  justify-content: space-around;
7
7
  a.document_link {
8
- font-size: 0.8rem;
9
- padding: 0.5rem;
8
+ font-size: ($muwu-root-font-size * 0.8);
9
+ padding: ($muwu-root-line-height * 0.5);
10
10
  }
11
11
  }
12
12
  }
13
-
@@ -1,8 +1,8 @@
1
1
  body >div.subcontents {
2
- margin: 4em 0;
2
+ margin: ($muwu-root-line-height * 4) 0;
3
3
  >h1 {
4
- font-size: 1.75em;
5
- margin: 0 0 2rem 0;
4
+ font-size: ($muwu-root-font-size * 1.75);
5
+ margin: 0 0 ($muwu-root-line-height * 2) 0;
6
6
  text-align: left;
7
7
  }
8
8
  .compiler_warning {
@@ -33,7 +33,7 @@ body >div.subcontents {
33
33
  }
34
34
  td.heading {
35
35
  text-align: left;
36
- }
36
+ }
37
37
  td.number {
38
38
  text-align: right;
39
39
  }
@@ -44,7 +44,7 @@ body >div.subcontents {
44
44
  display: block;
45
45
  margin: 0rem 0.5rem;
46
46
  li {
47
- margin: 0.5rem 0rem;
47
+ margin: ($muwu-root-line-height * 0.5) 0rem;
48
48
  a {
49
49
  display: inline;
50
50
  }
@@ -1,7 +1,7 @@
1
1
  @import 'mixin_text_section_heading';
2
2
 
3
3
  body >div.text {
4
- margin: 6rem 0rem;
4
+ margin: ($muwu-root-line-height * 6) 0rem;
5
5
  ol {
6
6
  padding-left: 1rem;
7
7
  }
@@ -9,40 +9,41 @@ body >div.text {
9
9
  padding-left: 1rem;
10
10
  }
11
11
 
12
- section[data-section_depth] {
12
+ section[data-section_depth] {
13
13
  >.section_number {
14
14
  font-weight: bold;
15
15
  display: block;
16
+ margin-bottom: none;
16
17
  text-decoration: none;
17
18
  }
18
19
  nav.document_links {
19
20
  width: 100%;
20
- margin: 2rem 0rem 4rem 0rem;
21
+ margin: ($muwu-root-line-height * 2) 0rem ($muwu-root-line-height * 4) 0rem;
21
22
  text-align: right;
22
23
  a.document_link {
23
- font-size: 0.75em;
24
+ font-size: ($muwu-root-font-size * 0.75);
24
25
  margin: 0rem 0.5rem
25
26
  }
26
27
  }
27
28
  }
28
-
29
+
29
30
  section[data-section_depth='1'] {
30
- margin: 6rem 0;
31
- @include text_section_heading(1.5rem, 2rem);
31
+ margin: ($muwu-root-line-height * 6) 0;
32
+ @include text_section_heading(($muwu-root-font-size * 1.5), ($muwu-root-line-height * 2));
32
33
  }
33
-
34
+
34
35
  section[data-section_depth='2'] {
35
- margin: 4rem 0;
36
- @include text_section_heading(1.375rem, 1.5rem);
36
+ margin: ($muwu-root-line-height * 4) 0;
37
+ @include text_section_heading(($muwu-root-font-size * 1.375), ($muwu-root-line-height * 1.5));
37
38
  }
38
39
 
39
40
  section[data-section_depth='3'] {
40
- margin: 2rem 0;
41
- @include text_section_heading(1.25rem, 1.5rem);
41
+ margin: ($muwu-root-line-height * 2) 0;
42
+ @include text_section_heading(($muwu-root-font-size * 1.25), ($muwu-root-line-height * 1.5));
42
43
  section[data-section_depth] {
43
- margin: 2rem 0;
44
- @include text_section_heading(1rem, 1.5rem);
44
+ margin: ($muwu-root-line-height * 2) 0;
45
+ @include text_section_heading(($muwu-root-font-size * 1), ($muwu-root-line-height * 1.5));
45
46
  }
46
47
  }
47
48
 
48
- }
49
+ }
@@ -1,20 +1,23 @@
1
1
  body >div.title {
2
- margin: 4em 0;
2
+ margin: ($muwu-root-line-height * 4) 0;
3
3
  text-align: left;
4
4
  h1 {
5
5
  display: block;
6
6
  font-weight: bold;
7
- margin: 0.5rem 0;
7
+ margin: ($muwu-root-line-height * 0.5) 0;
8
8
  }
9
9
  [data-metadata_key='title'] {
10
- font-size: 2.0em;
10
+ font-size: ($muwu-root-font-size * 2);
11
+ line-height: ($muwu-root-line-height * 2);
11
12
  }
12
13
  [data-metadata_key='subtitle'] {
13
- font-size: 1.5em;
14
+ font-size: ($muwu-root-font-size * 1.5);
15
+ line-height: ($muwu-root-line-height * 1.5);
14
16
  }
15
17
  [data-metadata_key='author'] {
16
- margin: 2rem 0rem;
17
- font-size: 1.25em;
18
+ font-size: ($muwu-root-font-size * 1.25);
19
+ line-height: ($muwu-root-line-height * 1.25);
20
+ margin: ($muwu-root-line-height * 2) 0rem;
18
21
  }
19
22
  h1:first-child {
20
23
  margin-top: 0;
@@ -13,10 +13,17 @@ module Muwu
13
13
  end
14
14
 
15
15
 
16
+ public
17
+
18
+
16
19
  def reset_compiled
17
20
  puts "- Resetting #{@project.path_compiled}"
18
- FileUtils.remove_entry_secure(@project.path_compiled)
19
- FileUtils.mkdir(@project.path_compiled)
21
+ begin
22
+ FileUtils.remove_entry_secure(@project.path_compiled)
23
+ rescue Errno::ENOENT
24
+ ensure
25
+ FileUtils.mkdir(@project.path_compiled)
26
+ end
20
27
  end
21
28
 
22
29
 
@@ -1,10 +1,10 @@
1
1
  module Muwu
2
2
  class ProjectStarter
3
-
4
-
3
+
4
+
5
5
  include Muwu
6
-
7
-
6
+
7
+
8
8
  def initialize(current_working_directory, metadata)
9
9
  @current_working_directory = File.absolute_path(current_working_directory)
10
10
  @metadata = metadata
@@ -21,7 +21,7 @@ module Muwu
21
21
  project.working_directory = File.absolute_path(File.join(@current_working_directory, @metadata[:slug]))
22
22
  project
23
23
  end
24
-
25
-
24
+
25
+
26
26
  end
27
- end
27
+ end
@@ -50,7 +50,7 @@ module Muwu
50
50
  def phase_2_make_project_subfolders
51
51
  announce_and_execute_dir_mkdir(@project.path_compiled)
52
52
  announce_and_execute_dir_mkdir(@project.path_config)
53
- announce_and_execute_dir_mkdir(@project.path_images)
53
+ # announce_and_execute_dir_mkdir(@project.path_images) # DEPRECATED
54
54
  announce_and_execute_dir_mkdir(@project.path_text)
55
55
  end
56
56
 
@@ -3,7 +3,8 @@ module Muwu
3
3
 
4
4
 
5
5
  attr_accessor(
6
- :expunge_when_compiling_all,
6
+ # TODO: this was probably an anti-pattern
7
+ # :expunge_when_compiling_all,
7
8
  :generate_navigators_automatically,
8
9
  :generate_subcontents_automatically,
9
10
  :html_head_includes_metadata_tags,
@@ -1,26 +1,26 @@
1
1
  module Muwu
2
2
  class ProjectOptionValidator
3
-
4
-
3
+
4
+
5
5
  include Muwu
6
-
7
-
6
+
7
+
8
8
  attr_reader(
9
9
  :key,
10
10
  :value
11
11
  )
12
-
13
-
12
+
13
+
14
14
  def initialize(key, value, project)
15
15
  key_validator = ProjectOptionValidatorKey.new(key, value, project)
16
16
  @key = key_validator.validated_key
17
17
  @value = key_validator.validated_value
18
18
  end
19
-
20
-
21
-
19
+
20
+
21
+
22
22
  protected
23
-
23
+
24
24
 
25
25
  def self.new_if_valid_key(key, value, project)
26
26
  option_validator = new(key, value, project)
@@ -32,6 +32,6 @@ module Muwu
32
32
  end
33
33
 
34
34
 
35
-
35
+
36
36
  end
37
- end
37
+ end
@@ -106,7 +106,13 @@ module Muwu
106
106
  end
107
107
 
108
108
 
109
- def validate_option_expunge_when_compiling_all
109
+ # TODO: this was probably an anti-pattern
110
+ # def validate_option_compile_all_resets_compiled_folder
111
+ # return validate_option_boolean
112
+ # end
113
+
114
+
115
+ def validate_option_contents_section_numbers_receive_link
110
116
  return validate_option_boolean
111
117
  end
112
118
 
@@ -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.working_directory
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
-
@@ -20,9 +20,6 @@ module Muwu
20
20
 
21
21
 
22
22
  def render_all
23
- if @project.options.expunge_when_compiling_all == true
24
- ProjectResetCompiled.new(@project).reset_compiled
25
- end
26
23
  if @manifest.does_have_documents
27
24
  build_and_render(@manifest.documents)
28
25
  else
@@ -9,50 +9,48 @@ module Muwu
9
9
  @path_local = project.working_directory + File::SEPARATOR
10
10
  @path_remote = project.options.remote_sync
11
11
  @project = project
12
-
13
- switches = ['i','r','v']
14
- @args = args.map { |a| a.to_s.downcase }
15
- if @args.include?('dry-run')
16
- @dry_run = true
17
- switches << 'n'
18
- end
19
- @switches = switches.sort.join
12
+ @switches = args.push('--itemize-changes', '--recursive', '--verbose').sort.join(' ')
20
13
  end
21
14
 
22
15
 
23
16
  public
24
17
 
25
18
 
26
- def down
19
+ def pull
27
20
  if @project.exceptions_include?(ProjectException::OptionRemoteSyncValueNil)
28
21
  raise ProjectExceptionHandler::Fatal.new(ProjectException::OptionRemoteSyncValueNil.new)
29
22
  else
30
- exec_sync(source: @path_remote, target: @path_local)
23
+ sync(source: @path_remote, target: @path_local)
31
24
  end
32
25
  end
33
26
 
34
27
 
35
- def up
28
+ def push
36
29
  if @project.exceptions_include?(ProjectException::OptionRemoteSyncValueNil)
37
30
  raise ProjectExceptionHandler::Fatal.new(ProjectException::OptionRemoteSyncValueNil.new)
38
31
  else
39
- exec_sync(source: @path_local, target: @path_remote)
32
+ sync(source: @path_local, target: @path_remote)
40
33
  end
41
34
  end
42
35
 
43
36
 
37
+ def sync(source: nil, target: nil)
38
+ if source && target
39
+ exec_rsync(source: source, target: target)
40
+ end
41
+ end
42
+
44
43
 
45
44
  private
46
45
 
47
46
 
48
- def exec_sync(source: nil, target: nil)
47
+ def exec_rsync(source: nil, target: nil)
49
48
  if source && target
50
49
  puts "source: #{source.inspect}"
51
50
  puts "target: #{target.inspect}"
52
- puts "args: #{@args}"
53
- puts "switches: -#{@switches}"
51
+ puts "switches: #{@switches}"
54
52
  begin
55
- system "rsync -#{@switches} #{source} #{target}", exception: true
53
+ system "rsync #{@switches} #{source} #{target}", exception: true
56
54
  rescue Errno::ENOENT
57
55
  raise ProjectExceptionHandler::Fatal.new(ProjectException::RsyncNotAvailable.new)
58
56
  end
@@ -60,6 +58,15 @@ module Muwu
60
58
  end
61
59
 
62
60
 
61
+ def exec_rsync_demo(source: nil, target: nil)
62
+ if source && target
63
+ puts "source: #{source.inspect}"
64
+ puts "target: #{target.inspect}"
65
+ puts "switches: -#{@switches}"
66
+ puts "command: rsync #{@switches} #{source} #{target}"
67
+ end
68
+ end
69
+
63
70
 
64
71
  end
65
72
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: muwu
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0.beta
4
+ version: 3.0.0.beta2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eli Harrison
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-04-20 00:00:00.000000000 Z
11
+ date: 2020-06-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: commonmarker