muwu 3.0.0.alpha → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
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
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b7a3546ed2eb6f4dead8a472ef9460ce5696a5967892151210026e947303766e
4
- data.tar.gz: f53c66c3a78df5157de9930c78444bc821eaa9de6484b628887b720c6cc4acea
3
+ metadata.gz: 2b9cc00d550f704b40f42c5b9082a0be65cafe79a35084840c1e304aff46c4a4
4
+ data.tar.gz: 64101f110b1e983bb42494910c7898a5d41bb6a4865156b7402d7d24d5f763a5
5
5
  SHA512:
6
- metadata.gz: 862b1e8424005ce9f952e3609634a986c0c4d31f3697b24502d1175c643cc88caef93113bd4043c9be22c8f220d5a87721923e3b0554c04cad1856fd78f16881
7
- data.tar.gz: 3e61b41b6dea81978e0226542a1e06ce1caec159bb55f070c2aee54452abd852e190c6328f77b9ee365272ff0dc9c3835dad5e3747eaf3b24196a764121e67fc
6
+ metadata.gz: fd06f9f0e7c0cdfbadd1a833c2e8ef7475ae8005dec20e6fb0d83dbc688b6bd157dc226e82beb45ef969aea720f2b777563d7ce3a264b03dc19c25df68b616a8
7
+ data.tar.gz: 8a575c78319de6e524947ff67b3b484949e593d022cdcf05be6436b3d6e7cb12845cec1fce540c15b966ba269491695e002f62ef9f91a6d48db9086e2064c514
@@ -24,7 +24,8 @@ paths = [
24
24
  'render_html_partial_builder',
25
25
  'render_inspector',
26
26
  'sync',
27
- 'var'
27
+ 'var',
28
+ 'viewer'
28
29
  ]
29
30
 
30
31
 
@@ -34,4 +35,3 @@ paths.map do |path|
34
35
  require file
35
36
  end
36
37
  end
37
-
@@ -1,7 +1,7 @@
1
1
  module Muwu
2
2
 
3
3
 
4
- VERSION = '3.0.0.alpha'
4
+ VERSION = '3.0.0'
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
 
@@ -44,6 +44,8 @@ module Muwu
44
44
  evaluate_command_reset
45
45
  when 'sync'
46
46
  evaluate_command_sync
47
+ when 'view'
48
+ evaluate_command_view
47
49
  when '--version'
48
50
  puts VERSION
49
51
  else
@@ -63,7 +65,7 @@ module Muwu
63
65
 
64
66
  elsif @args[1] == 'css'
65
67
  Controller.new(@current_working_directory).compile_css
66
-
68
+
67
69
  elsif @args[1] == 'html'
68
70
  evaluate_command_compile_html
69
71
 
@@ -74,12 +76,12 @@ module Muwu
74
76
  puts CliHelp.new(:compile).message
75
77
  end
76
78
  end
77
-
78
-
79
+
80
+
79
81
  def evaluate_command_compile_html
80
82
  if @args[2] == nil
81
83
  Controller.new(@current_working_directory).compile_html
82
-
84
+
83
85
  elsif @args[2] =~ /\A[0-9]+\z/
84
86
  Controller.new(@current_working_directory).compile_html_by_index(@args[2].to_i)
85
87
 
@@ -87,12 +89,12 @@ module Muwu
87
89
  puts CliHelp.new(:compile).message
88
90
  end
89
91
  end
90
-
91
-
92
+
93
+
92
94
  def evaluate_command_concat
93
95
  Controller.new(@current_working_directory).concat
94
96
  end
95
-
97
+
96
98
 
97
99
 
98
100
  def evaluate_command_help
@@ -115,6 +117,8 @@ module Muwu
115
117
  puts CliHelp.new(:reset).message
116
118
  when 'sync'
117
119
  puts CliHelp.new(:sync).message
120
+ when 'view'
121
+ puts CliHelp.new(:view).message
118
122
  else
119
123
  puts CliHelp.new(:summary).message
120
124
  end
@@ -133,16 +137,18 @@ module Muwu
133
137
 
134
138
 
135
139
  def evaluate_command_publish
136
- Controller.new(@current_working_directory).publish
140
+ Controller.new(@current_working_directory).publish(@args[1..-1])
137
141
  end
138
-
139
-
142
+
143
+
140
144
  def evaluate_command_reset
141
145
  if @args[1] == nil
142
146
  puts CliHelp.new(:reset).message
143
-
147
+
144
148
  else
145
149
  case @args[1]
150
+ when 'compiled'
151
+ Controller.new(@current_working_directory).reset_compiled
146
152
  when 'css'
147
153
  Controller.new(@current_working_directory).reset_css
148
154
  else
@@ -150,24 +156,29 @@ module Muwu
150
156
  end
151
157
  end
152
158
  end
153
-
154
-
159
+
160
+
155
161
  def evaluate_command_sync
156
162
  if @args[1] == nil
157
163
  puts CliHelp.new(:sync).message
158
-
164
+
159
165
  else
160
166
  case @args[1]
161
- when 'down'
162
- Controller.new(@current_working_directory).sync_down(@args[2..(@args.length-1)])
163
- when 'up'
164
- Controller.new(@current_working_directory).sync_up(@args[2..(@args.length-1)])
165
- else
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
166
172
  puts CliHelp.new(:sync).message
167
173
  end
168
174
  end
169
175
  end
170
-
176
+
177
+
178
+ def evaluate_command_view
179
+ Controller.new(@current_working_directory).view
180
+ end
181
+
171
182
 
172
183
  end
173
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`.
@@ -1,7 +1,20 @@
1
- - muwu publish
2
- - Publishes compiled documents (as indicated by the current outline and
3
- manifest) to a remote location using scp. Scp must be installed on the
4
- local system.
5
-
6
- * Specify the remote host in 'options.yml' using the 'remote_publish' value.
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.
7
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
+ - muwu reset compiled
2
+ - Clear the entire contentes of the `compiled/` folder.
3
+
1
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,11 +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 scp)
9
+ muwu publish publish to a remote server (requires rsync)
10
+ muwu reset compiled reset the `compiled/` subdirectory
10
11
  muwu reset css reset the default CSS files
11
- muwu sync syncronize from/to a remote server (requires rsync)
12
-
13
- 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)
14
14
 
15
15
  For more detailed instructions:
16
16
  muwu help [command]
@@ -1,18 +1,26 @@
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.
4
-
5
- - muwu sync down
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
6
  - Use rsync to download the project from a remote host.
7
-
8
- - muwu sync up
9
- - Use rsync to upload to project to a remote host.
10
-
7
+
8
+ - muwu sync push
9
+ - Use rsync to upload the project to a remote host.
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 files.
14
-
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
+
15
26
  * Specify the remote host in 'options.yml' using the 'remote_sync' value.
16
-
17
- * Muwu will invoke the rsync switches '-r' to recurse subdirectories, and
18
- '-v' to give a verbose description
@@ -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,14 +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
-
95
- def publish
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
96
106
  @project = read_project_from_current_working_directory
97
- Publish.new(@project).up
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
98
114
  end
99
-
100
-
115
+
116
+
101
117
  def reset_css
102
118
  @project = read_project_from_current_working_directory
103
119
  if @project.does_not_have_crucial_files
@@ -106,24 +122,42 @@ module Muwu
106
122
  ProjectResetCss.new(@project).reset_css
107
123
  end
108
124
  end
109
-
110
-
111
- def sync_down(args)
125
+
126
+
127
+ def sync_pull(args)
112
128
  @project = read_project_from_current_working_directory
113
- Sync.new(@project, args: args).down
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
114
134
  end
115
-
116
-
117
- def sync_up(args)
135
+
136
+
137
+ def sync_push(args)
118
138
  @project = read_project_from_current_working_directory
119
- Sync.new(@project, args: args).up
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
120
154
  end
121
155
 
122
156
 
123
157
 
124
158
  private
125
-
126
-
159
+
160
+
127
161
  def read_project_from_current_working_directory
128
162
  ProjectReader.build { |b| b.load_path(@current_working_directory) }
129
163
  end
@@ -131,8 +165,9 @@ module Muwu
131
165
 
132
166
  def reply_folder_does_not_have_valid_project
133
167
  puts @project.exceptions
134
- puts "Is this a Muwu project folder?"
168
+ puts "Is this a Muwu project home folder?"
135
169
  end
136
170
 
171
+
137
172
  end
138
173
  end