muwu 2.5.1 → 3.0.0.rc1

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 (55) hide show
  1. checksums.yaml +4 -4
  2. data/lib/{muwu_loader.rb → loader.rb} +4 -2
  3. data/lib/muwu.rb +3 -3
  4. data/lib/muwu/cli/cli.rb +52 -11
  5. data/lib/muwu/cli/help/compile +4 -4
  6. data/lib/muwu/cli/help/publish +20 -0
  7. data/lib/muwu/cli/help/reset +6 -3
  8. data/lib/muwu/cli/help/summary +4 -2
  9. data/lib/muwu/cli/help/sync +26 -0
  10. data/lib/muwu/cli/help/view +3 -0
  11. data/lib/muwu/controller/controller.rb +71 -18
  12. data/lib/muwu/controller/controller_interaction.rb +66 -44
  13. data/lib/muwu/default/default.rb +14 -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/document_css.rb +5 -0
  17. data/lib/muwu/manifest_task/document_html.rb +6 -1
  18. data/lib/muwu/manifest_task/document_js.rb +6 -1
  19. data/lib/muwu/manifest_task_builder/text_item_builder.rb +1 -8
  20. data/lib/muwu/project/project.rb +146 -127
  21. data/lib/muwu/project_builder/assets/config/css/base/html_elements.scss +19 -15
  22. data/lib/muwu/project_builder/assets/config/css/base/mixin_text_section_heading.scss +12 -11
  23. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_contents.scss +5 -5
  24. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_metadata.scss +2 -4
  25. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_navigator.scss +3 -4
  26. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_subcontents.scss +5 -5
  27. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_text.scss +16 -15
  28. data/lib/muwu/project_builder/assets/config/css/base/section_muwu_title.scss +9 -6
  29. data/lib/muwu/project_builder/project_reader.rb +3 -0
  30. data/lib/muwu/project_builder/project_reset_compiled.rb +31 -0
  31. data/lib/muwu/project_builder/project_reset_css.rb +30 -30
  32. data/lib/muwu/project_builder/project_starter.rb +7 -7
  33. data/lib/muwu/project_builder/project_validator.rb +24 -0
  34. data/lib/muwu/project_builder/project_writer.rb +12 -11
  35. data/lib/muwu/project_exception/compiled_folder_not_found.rb +23 -0
  36. data/lib/muwu/project_exception/lynx_not_available.rb +23 -0
  37. data/lib/muwu/project_exception/option_remote_publish_value_nil.rb +18 -0
  38. data/lib/muwu/project_exception/option_remote_sync_value_nil.rb +18 -0
  39. data/lib/muwu/project_exception/rsync_not_available.rb +23 -0
  40. data/lib/muwu/project_exception/scp_not_available.rb +23 -0
  41. data/lib/muwu/project_exception_handler/fatal.rb +10 -9
  42. data/lib/muwu/project_options/project_options.rb +11 -8
  43. data/lib/muwu/project_options_builder/project_option_validator.rb +12 -12
  44. data/lib/muwu/project_options_builder/project_option_validator_value.rb +92 -76
  45. data/lib/muwu/publish/publish.rb +56 -0
  46. data/lib/muwu/render_concat/render_concat.rb +26 -27
  47. data/lib/muwu/render_html/render_html.rb +27 -24
  48. data/lib/muwu/render_html_partial/render_contents.rb +4 -1
  49. data/lib/muwu/render_html_partial/render_document_html.rb +64 -64
  50. data/lib/muwu/render_html_partial/render_text_item.rb +16 -16
  51. data/lib/muwu/sync/sync.rb +73 -0
  52. data/lib/muwu/var/deflistdiv.rb +0 -0
  53. data/lib/muwu/viewer/viewer.rb +25 -0
  54. data/test/what_no_tests.md +1 -3
  55. metadata +18 -5
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dafa3354f3a57677adacf16fe9372167ce2572b68e445fb0f95192142c116633
4
- data.tar.gz: 83130270c6bcfbbb7c3fd46a3cc8825441999eae801dd1ba15368acffc315464
3
+ metadata.gz: e2c92b3ed920a385c367fdb42b072943e08cbe720e8b0fce3c2ef7b40235b13e
4
+ data.tar.gz: 6d903e1f206fb36d2d8e37cbdff8137efbd0a7e8478dad7e22f80574f08061da
5
5
  SHA512:
6
- metadata.gz: 8a036a78dd8a1ef10f0776a7d014c4e953ababeb0ca154e0718499a8252b06b3b4a708fa9c4542803a986e70f0fdad4bef8e9997b541eabb9f01858f82118722
7
- data.tar.gz: 819c5595a937ff67464e3829b0243d86a2cf3b429bcadf232dfc13eea7995d9c6fe583c48f39555479597a66ebc4cff2dc95eb199693ffd10dcb3d9850a281df
6
+ metadata.gz: c39adc090bb2734d3263ca40889b8f398918d0f68d6199a5a485c8da50b521d0dfa0347f7f06f26228d1ea61cdf6155c22c1ee6183d405f24e57191aff8126ab
7
+ data.tar.gz: 7f11e98b6a1c803314942dbfc8a0777456080a1a09cd0599978e1caf10faacfed9023448c4ca24f8207759c1d77d6505107f3213c030eeb2f34343c6e7db06df
@@ -16,13 +16,16 @@ paths = [
16
16
  'project_exception_handler',
17
17
  'project_options',
18
18
  'project_options_builder',
19
+ 'publish',
19
20
  'render_concat',
20
21
  'render_html',
21
22
  'render_html_builder',
22
23
  'render_html_partial',
23
24
  'render_html_partial_builder',
24
25
  'render_inspector',
25
- 'var'
26
+ 'sync',
27
+ 'var',
28
+ 'viewer'
26
29
  ]
27
30
 
28
31
 
@@ -32,4 +35,3 @@ paths.map do |path|
32
35
  require file
33
36
  end
34
37
  end
35
-
@@ -1,7 +1,7 @@
1
1
  module Muwu
2
2
 
3
3
 
4
- VERSION = '2.5.1'
4
+ VERSION = '3.0.0.rc1'
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'))
@@ -18,7 +18,7 @@ module Muwu
18
18
  require 'yaml'
19
19
 
20
20
 
21
- require_relative 'muwu_loader'
21
+ require_relative 'loader'
22
22
 
23
23
 
24
24
 
@@ -26,7 +26,7 @@ module Muwu
26
26
 
27
27
 
28
28
  def debug(file, line, info)
29
- logger.new(STDERR).debug("#{file} #{line} #{info}")
29
+ Logger.new(STDERR).debug("#{file} #{line} #{info}")
30
30
  end
31
31
 
32
32
 
@@ -3,7 +3,7 @@ module Muwu
3
3
 
4
4
 
5
5
  include Muwu
6
-
6
+
7
7
 
8
8
  def initialize(args)
9
9
  @args = args.map do |a|
@@ -14,7 +14,7 @@ module Muwu
14
14
  a.downcase.strip
15
15
  end
16
16
  end
17
-
17
+
18
18
  @current_working_directory = Dir.pwd
19
19
  end
20
20
 
@@ -38,8 +38,14 @@ module Muwu
38
38
  evaluate_command_inspect
39
39
  when 'new'
40
40
  evaluate_command_new
41
+ when 'publish'
42
+ evaluate_command_publish
41
43
  when 'reset'
42
44
  evaluate_command_reset
45
+ when 'sync'
46
+ evaluate_command_sync
47
+ when 'view'
48
+ evaluate_command_view
43
49
  when '--version'
44
50
  puts VERSION
45
51
  else
@@ -59,7 +65,7 @@ module Muwu
59
65
 
60
66
  elsif @args[1] == 'css'
61
67
  Controller.new(@current_working_directory).compile_css
62
-
68
+
63
69
  elsif @args[1] == 'html'
64
70
  evaluate_command_compile_html
65
71
 
@@ -70,12 +76,12 @@ module Muwu
70
76
  puts CliHelp.new(:compile).message
71
77
  end
72
78
  end
73
-
74
-
79
+
80
+
75
81
  def evaluate_command_compile_html
76
82
  if @args[2] == nil
77
83
  Controller.new(@current_working_directory).compile_html
78
-
84
+
79
85
  elsif @args[2] =~ /\A[0-9]+\z/
80
86
  Controller.new(@current_working_directory).compile_html_by_index(@args[2].to_i)
81
87
 
@@ -83,12 +89,12 @@ module Muwu
83
89
  puts CliHelp.new(:compile).message
84
90
  end
85
91
  end
86
-
87
-
92
+
93
+
88
94
  def evaluate_command_concat
89
95
  Controller.new(@current_working_directory).concat
90
96
  end
91
-
97
+
92
98
 
93
99
 
94
100
  def evaluate_command_help
@@ -105,8 +111,14 @@ module Muwu
105
111
  puts CliHelp.new(:inspect).message
106
112
  when 'new'
107
113
  puts CliHelp.new(:new).message
114
+ when 'publish'
115
+ puts CliHelp.new(:publish).message
108
116
  when 'reset'
109
117
  puts CliHelp.new(:reset).message
118
+ when 'sync'
119
+ puts CliHelp.new(:sync).message
120
+ when 'view'
121
+ puts CliHelp.new(:view).message
110
122
  else
111
123
  puts CliHelp.new(:summary).message
112
124
  end
@@ -124,12 +136,19 @@ module Muwu
124
136
  end
125
137
 
126
138
 
139
+ def evaluate_command_publish
140
+ Controller.new(@current_working_directory).publish(@args[1..-1])
141
+ end
142
+
143
+
127
144
  def evaluate_command_reset
128
145
  if @args[1] == nil
129
146
  puts CliHelp.new(:reset).message
130
-
147
+
131
148
  else
132
149
  case @args[1]
150
+ when 'compiled'
151
+ Controller.new(@current_working_directory).reset_compiled
133
152
  when 'css'
134
153
  Controller.new(@current_working_directory).reset_css
135
154
  else
@@ -137,7 +156,29 @@ module Muwu
137
156
  end
138
157
  end
139
158
  end
140
-
159
+
160
+
161
+ def evaluate_command_sync
162
+ if @args[1] == nil
163
+ puts CliHelp.new(:sync).message
164
+
165
+ else
166
+ case @args[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
+ else
172
+ puts CliHelp.new(:sync).message
173
+ end
174
+ end
175
+ end
176
+
177
+
178
+ def evaluate_command_view
179
+ Controller.new(@current_working_directory).view
180
+ end
181
+
141
182
 
142
183
  end
143
184
  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`.
@@ -0,0 +1,20 @@
1
+ - muwu publish [options]
2
+ - Publishes compiled documents currently in `compiled/` to a remote location
3
+ using rsync. Rsync must be installed on the local system.
4
+
5
+ - [options]
6
+ - Muwu will pass any further command-line arguments to rsync. See the rsync
7
+ man page for more information about valid rsync options.
8
+
9
+ - Other useful options: (verify against the rsync man page before using)
10
+ --delete Delete files from the target host that aren't present on the
11
+ source host.
12
+ --dry-run Show which changes would be made, but don't perform them.
13
+ --update Only update the files on the target host that have older
14
+ timestamps than on the source; do not change files on the
15
+ target host that have newer timestamps.
16
+
17
+ * [options] for rsync can also be specified in 'options.yml' using the
18
+ 'rsync_options' value.
19
+
20
+ * Specify the remote host in 'options.yml' using the 'remote_publish' value.
@@ -1,7 +1,10 @@
1
- - reset css
1
+ - muwu reset compiled
2
+ - Clear the entire contentes of the `compiled/` folder.
3
+
4
+ - muwu reset css
2
5
  - Reset the `config/css` folder. The following files and folders will
3
6
  revert to their original state:
4
-
7
+
5
8
  - config/css/base/
6
9
  - config/css/colors/dark.scss
7
10
  - config/css/colors/index.scss
@@ -10,5 +13,5 @@
10
13
 
11
14
  * If `config/css/extensions` does exist, it and its contents will remain
12
15
  unchanged.
13
-
16
+
14
17
  * If `config/css/extensions` does not exist, Muwu will create it.
@@ -6,9 +6,11 @@ Command line:
6
6
  muwu help show this message
7
7
  muwu inspect inspect a project
8
8
  muwu new create a new project directory
9
+ muwu publish publish to a remote server (requires rsync)
10
+ muwu reset compiled reset the `compiled/` subdirectory
9
11
  muwu reset css reset the default CSS files
10
-
11
- All comands operate within the current working directory.
12
+ muwu sync synchronize from/to a remote location (requires rsync)
13
+ muwu view view a compiled project (requires lynx)
12
14
 
13
15
  For more detailed instructions:
14
16
  muwu help [command]
@@ -0,0 +1,26 @@
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
+
5
+ - muwu sync pull
6
+ - Use rsync to download the project from a remote host.
7
+
8
+ - muwu sync push
9
+ - Use rsync to upload the project to a remote host.
10
+
11
+ - [options]
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
+
15
+ - Other useful options: (verify against the rsync man page before using)
16
+ --delete Delete files from the target host that aren't present on the
17
+ source host.
18
+ --dry-run Show which changes would be made, but don't perform them.
19
+ --update Only update the files on the target host that have older
20
+ timestamps than on the source; do not change files on the
21
+ target host that have newer timestamps.
22
+
23
+ * [options] for rsync can also be specified in 'options.yml' using the
24
+ 'rsync_options' value.
25
+
26
+ * Specify the remote host in 'options.yml' using the 'remote_sync' value.
@@ -0,0 +1,3 @@
1
+ - muwu view
2
+ - View a compiled project in `compiled/` using lynx. Lynx must be installed
3
+ on the local system.
@@ -3,7 +3,7 @@ module Muwu
3
3
 
4
4
 
5
5
  include Muwu
6
-
6
+
7
7
 
8
8
  def initialize(current_working_directory)
9
9
  @current_working_directory = File.absolute_path(current_working_directory)
@@ -20,11 +20,11 @@ module Muwu
20
20
  if @project.does_not_have_crucial_files
21
21
  reply_folder_does_not_have_valid_project
22
22
  else
23
- RenderHtml.new(@project).render
23
+ RenderHtml.new(@project).render_all
24
24
  end
25
25
  end
26
-
27
-
26
+
27
+
28
28
  def compile_css
29
29
  @project = read_project_from_current_working_directory
30
30
  if @project.does_not_have_crucial_files
@@ -33,8 +33,8 @@ module Muwu
33
33
  RenderHtml.new(@project).render_css_only
34
34
  end
35
35
  end
36
-
37
-
36
+
37
+
38
38
  def compile_html_by_index(index)
39
39
  @project = read_project_from_current_working_directory
40
40
  if @project.does_not_have_crucial_files
@@ -43,7 +43,7 @@ module Muwu
43
43
  RenderHtml.new(@project).render_html_by_index(index)
44
44
  end
45
45
  end
46
-
46
+
47
47
 
48
48
  def compile_html
49
49
  @project = read_project_from_current_working_directory
@@ -53,8 +53,8 @@ module Muwu
53
53
  RenderHtml.new(@project).render_html_only
54
54
  end
55
55
  end
56
-
57
-
56
+
57
+
58
58
  def compile_js
59
59
  @project = read_project_from_current_working_directory
60
60
  if @project.does_not_have_crucial_files
@@ -63,8 +63,8 @@ module Muwu
63
63
  RenderHtml.new(@project).render_js_only
64
64
  end
65
65
  end
66
-
67
-
66
+
67
+
68
68
  def concat
69
69
  @project = read_project_from_current_working_directory
70
70
  if @project.does_not_have_crucial_files
@@ -73,8 +73,8 @@ module Muwu
73
73
  RenderConcat.new(@project).render
74
74
  end
75
75
  end
76
-
77
-
76
+
77
+
78
78
  def inspect
79
79
  @project = read_project_from_current_working_directory
80
80
  if @project.does_not_have_crucial_files
@@ -90,8 +90,30 @@ module Muwu
90
90
  @project = ProjectStarter.new(@current_working_directory, metadata).new_project
91
91
  ProjectWriter.new(@project).write
92
92
  end
93
-
94
-
93
+
94
+
95
+ def publish(args)
96
+ @project = read_project_from_current_working_directory
97
+ if @project.does_not_have_crucial_files
98
+ reply_folder_does_not_have_valid_project
99
+ else
100
+ Publish.new(@project, args: args).up
101
+ end
102
+ end
103
+
104
+
105
+ def reset_compiled
106
+ @project = read_project_from_current_working_directory
107
+ if @project.does_not_have_crucial_files
108
+ reply_folder_does_not_have_valid_project
109
+ else
110
+ if ControllerInteraction.new.confirm_reset_compiled(@project)
111
+ ProjectResetCompiled.new(@project).reset_compiled
112
+ end
113
+ end
114
+ end
115
+
116
+
95
117
  def reset_css
96
118
  @project = read_project_from_current_working_directory
97
119
  if @project.does_not_have_crucial_files
@@ -102,10 +124,40 @@ module Muwu
102
124
  end
103
125
 
104
126
 
127
+ def sync_pull(args)
128
+ @project = read_project_from_current_working_directory
129
+ if @project.does_not_have_crucial_files
130
+ reply_folder_does_not_have_valid_project
131
+ else
132
+ Sync.new(@project, args: args).pull
133
+ end
134
+ end
135
+
136
+
137
+ def sync_push(args)
138
+ @project = read_project_from_current_working_directory
139
+ if @project.does_not_have_crucial_files
140
+ reply_folder_does_not_have_valid_project
141
+ else
142
+ Sync.new(@project, args: args).push
143
+ end
144
+ end
145
+
146
+
147
+ def view
148
+ @project = read_project_from_current_working_directory
149
+ if @project.does_not_have_crucial_files
150
+ reply_folder_does_not_have_valid_project
151
+ else
152
+ Viewer.new(@project)
153
+ end
154
+ end
155
+
156
+
105
157
 
106
158
  private
107
-
108
-
159
+
160
+
109
161
  def read_project_from_current_working_directory
110
162
  ProjectReader.build { |b| b.load_path(@current_working_directory) }
111
163
  end
@@ -113,8 +165,9 @@ module Muwu
113
165
 
114
166
  def reply_folder_does_not_have_valid_project
115
167
  puts @project.exceptions
116
- puts "Is this a Muwu project folder?"
168
+ puts "Is this a Muwu project home folder?"
117
169
  end
118
170
 
171
+
119
172
  end
120
173
  end