runeblog 0.3.04 → 0.3.05
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/blog +9 -6
- data/empty_view/settings/recent.txt +2 -2
- data/lib/helpers-repl.rb +3 -41
- data/lib/lowlevel.rb +9 -0
- data/lib/repl.rb +83 -162
- data/lib/runeblog.rb +0 -9
- data/lib/runeblog_version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4c6fa9176107c58120ebb4753221228bfe0d031f08f21a20dc2f7f86d6b2c6af
|
4
|
+
data.tar.gz: c3bf5183cbeddb2cc3c9022695fcd9aa9ba50cf0e5364afd4632fac8a837e315
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bb8f0fb6b1a59ac69eabdcb0c50a20bf20308e4155fb1d305be5a19ab8eece7ffa7aecdbff3d4cfc48000dbbb891c3a2777068608a1e28750d8751b39a39af8
|
7
|
+
data.tar.gz: 113a34a9fba90a9f8b9d9bc47cab433b00359a0c8f159b8fbf807e7609b50056ebf4e0e368d6b369256083a7a6c25316dd2c710297ea4bbccfa7fadd85bbf458
|
data/bin/blog
CHANGED
@@ -66,6 +66,8 @@ def get_started
|
|
66
66
|
puts " First choose your editor."
|
67
67
|
@blog.editor = pick_editor
|
68
68
|
File.write("#{@blog.root}/data/EDITOR", @blog.editor)
|
69
|
+
print " Default editor is "
|
70
|
+
puts fx(@blog.editor, :bold)
|
69
71
|
|
70
72
|
get_universal
|
71
73
|
# Now create a custom global.lt3
|
@@ -90,11 +92,11 @@ def mainloop
|
|
90
92
|
info = @blog.view || "no view"
|
91
93
|
print fx("[#{info}] ", Red, :bold)
|
92
94
|
cmd = STDSCR.gets(history: @cmdhist, tab: @tabcom)
|
93
|
-
cmd_quit
|
95
|
+
cmd_quit if cmd.nil? # ^D
|
94
96
|
cmd.chomp!
|
95
97
|
return if cmd.empty? # CR does nothing
|
96
|
-
|
97
|
-
ret
|
98
|
+
invoking = RuneBlog::REPL.choose_method(cmd)
|
99
|
+
ret = send(*invoking)
|
98
100
|
rescue => err
|
99
101
|
puts err
|
100
102
|
end
|
@@ -106,7 +108,7 @@ def cmdline_preview
|
|
106
108
|
end
|
107
109
|
|
108
110
|
def cmdline_publish
|
109
|
-
abort "
|
111
|
+
abort "Not implemented yet"
|
110
112
|
_need_view
|
111
113
|
end
|
112
114
|
|
@@ -152,7 +154,8 @@ major, minor = RUBY_VERSION.split(".").values_at(0,1)
|
|
152
154
|
ver = major.to_i*10 + minor.to_i
|
153
155
|
unless ver >= 24
|
154
156
|
RubyText.stop
|
155
|
-
|
157
|
+
sleep 0.2
|
158
|
+
abort "Needs Ruby 2.4 or greater"
|
156
159
|
end
|
157
160
|
|
158
161
|
include RuneBlog::Helpers # for try_read_config
|
@@ -194,7 +197,7 @@ puts fx("\n RuneBlog", :bold), fx(" v #{RuneBlog::VERSION}\n", Red)
|
|
194
197
|
|
195
198
|
loop { mainloop }
|
196
199
|
|
197
|
-
system("tput clear")
|
200
|
+
# system("tput clear")
|
198
201
|
sleep 0.2
|
199
202
|
puts
|
200
203
|
|
data/lib/helpers-repl.rb
CHANGED
@@ -109,7 +109,9 @@ module RuneBlog::REPL
|
|
109
109
|
end
|
110
110
|
meth = found || :cmd_INVALID
|
111
111
|
params = cmd if meth == :cmd_INVALID
|
112
|
-
[meth
|
112
|
+
result = [meth]
|
113
|
+
result << params unless params.nil?
|
114
|
+
result
|
113
115
|
end
|
114
116
|
|
115
117
|
def ask(prompt, meth = :to_s)
|
@@ -121,42 +123,6 @@ module RuneBlog::REPL
|
|
121
123
|
ask(fx(prompt, :bold), meth)
|
122
124
|
end
|
123
125
|
|
124
|
-
def reset_output(initial = "")
|
125
|
-
@out ||= ""
|
126
|
-
@out.replace initial
|
127
|
-
end
|
128
|
-
|
129
|
-
def flush_output(initial = "")
|
130
|
-
CantOpen
|
131
|
-
@out ||= ""
|
132
|
-
puts @out
|
133
|
-
reset_output
|
134
|
-
end
|
135
|
-
|
136
|
-
def output(str) # \n and indent
|
137
|
-
@out ||= ""
|
138
|
-
@out << " " + str.to_s
|
139
|
-
end
|
140
|
-
|
141
|
-
def outstr(str) # indent
|
142
|
-
@out ||= ""
|
143
|
-
@out << str
|
144
|
-
end
|
145
|
-
|
146
|
-
def output!(str) # \n and indent
|
147
|
-
@out ||= ""
|
148
|
-
@out << " " + str
|
149
|
-
end
|
150
|
-
|
151
|
-
def output_newline(n = 1)
|
152
|
-
@out ||= ""
|
153
|
-
n.times { @out << "\n" }
|
154
|
-
end
|
155
|
-
|
156
|
-
def check_empty(arg)
|
157
|
-
raise InternalError(caller[0], arg.inspect) unless arg.nil?
|
158
|
-
end
|
159
|
-
|
160
126
|
def get_integer(arg)
|
161
127
|
Integer(arg)
|
162
128
|
rescue
|
@@ -176,10 +142,6 @@ module RuneBlog::REPL
|
|
176
142
|
end
|
177
143
|
end
|
178
144
|
|
179
|
-
def colored_slug(slug)
|
180
|
-
slug[0..3] + slug[4..-1]
|
181
|
-
end
|
182
|
-
|
183
145
|
def tags_for_view(vname = @blog.view)
|
184
146
|
Dir.chdir(vname) do
|
185
147
|
fname = "tagpool"
|
data/lib/lowlevel.rb
CHANGED
data/lib/repl.rb
CHANGED
@@ -14,11 +14,14 @@ module RuneBlog::REPL
|
|
14
14
|
result = system!("#{@blog.editor} #{file} #{params}")
|
15
15
|
raise EditorProblem(file) unless result
|
16
16
|
STDSCR.restback
|
17
|
-
cmd_clear
|
17
|
+
cmd_clear
|
18
18
|
end
|
19
19
|
|
20
|
-
def cmd_quit
|
21
|
-
|
20
|
+
def cmd_quit
|
21
|
+
STDSCR.rows.times { puts " "*(STDSCR.cols-1) }
|
22
|
+
# FIXME please?
|
23
|
+
sleep 0.1
|
24
|
+
STDSCR.clear
|
22
25
|
sleep 0.1
|
23
26
|
RubyText.stop
|
24
27
|
sleep 0.1
|
@@ -27,19 +30,17 @@ module RuneBlog::REPL
|
|
27
30
|
exit
|
28
31
|
end
|
29
32
|
|
30
|
-
def cmd_clear
|
33
|
+
def cmd_clear
|
31
34
|
STDSCR.rows.times { puts " "*(STDSCR.cols-1) }
|
35
|
+
sleep 0.1
|
32
36
|
STDSCR.clear
|
33
37
|
end
|
34
38
|
|
35
|
-
def cmd_version
|
36
|
-
|
37
|
-
output RuneBlog::VERSION
|
38
|
-
puts fx("\n RuneBlog", :bold), fx(" v #{RuneBlog::VERSION}\n", Red) unless testing
|
39
|
-
@out
|
39
|
+
def cmd_version
|
40
|
+
puts fx("\n RuneBlog", :bold), fx(" v #{RuneBlog::VERSION}\n", Red)
|
40
41
|
end
|
41
42
|
|
42
|
-
def cmd_config
|
43
|
+
def cmd_config
|
43
44
|
hash = {"Global configuration" => "global.lt3",
|
44
45
|
" View-specific variables" => "../../settings/view.txt",
|
45
46
|
" Recent posts" => "../../settings/recent.txt",
|
@@ -65,24 +66,24 @@ module RuneBlog::REPL
|
|
65
66
|
edit_file(dir/target)
|
66
67
|
end
|
67
68
|
|
68
|
-
def cmd_manage(arg
|
69
|
+
def cmd_manage(arg)
|
69
70
|
case arg
|
70
|
-
when "pages"; _manage_pages(nil
|
71
|
-
when "links"; _manage_links(nil
|
72
|
-
when "navbar"; _manage_navbar(nil
|
73
|
-
# when "pinned"; _manage_pinned(nil
|
71
|
+
when "pages"; _manage_pages(nil)
|
72
|
+
when "links"; _manage_links(nil)
|
73
|
+
when "navbar"; _manage_navbar(nil)
|
74
|
+
# when "pinned"; _manage_pinned(nil) # ditch this??
|
74
75
|
else
|
75
76
|
puts "#{arg} is unknown"
|
76
77
|
end
|
77
78
|
end
|
78
79
|
|
79
|
-
def _manage_pinned
|
80
|
+
def _manage_pinned # cloned from manage_links
|
80
81
|
dir = @blog.view.dir/"themes/standard/widgets/pinned"
|
81
82
|
data = dir/"list.data"
|
82
83
|
edit_file(data)
|
83
84
|
end
|
84
85
|
|
85
|
-
def _manage_navbar
|
86
|
+
def _manage_navbar # cloned from manage_pages
|
86
87
|
dir = @blog.view.dir/"themes/standard/banner/navbar"
|
87
88
|
files = Dir.entries(dir) - %w[. .. navbar.lt3]
|
88
89
|
main_file = "[ navbar.lt3 ]"
|
@@ -111,13 +112,13 @@ module RuneBlog::REPL
|
|
111
112
|
end
|
112
113
|
end
|
113
114
|
|
114
|
-
def _manage_links
|
115
|
+
def _manage_links
|
115
116
|
dir = @blog.view.dir/"themes/standard/widgets/links"
|
116
117
|
data = dir/"list.data"
|
117
118
|
edit_file(data)
|
118
119
|
end
|
119
120
|
|
120
|
-
def _manage_pages(arg
|
121
|
+
def _manage_pages(arg)
|
121
122
|
dir = @blog.view.dir/"themes/standard/widgets/pages"
|
122
123
|
# Assume child files already generated (and list.data??)
|
123
124
|
data = dir/"list.data"
|
@@ -152,73 +153,53 @@ module RuneBlog::REPL
|
|
152
153
|
end
|
153
154
|
end
|
154
155
|
|
155
|
-
def cmd_import
|
156
|
+
def cmd_import
|
156
157
|
files = ask("\n File(s) = ")
|
157
158
|
system!("cp #{files} #{@blog.root}/views/#{@blog.view.name}/assets/")
|
158
159
|
end
|
159
160
|
|
160
|
-
def cmd_browse
|
161
|
-
reset_output
|
161
|
+
def cmd_browse
|
162
162
|
url = @blog.view.publisher.url
|
163
163
|
if url.nil?
|
164
|
-
output! "Publish first."
|
165
164
|
puts "\n Publish first."
|
166
|
-
return
|
165
|
+
return
|
167
166
|
end
|
168
167
|
result = system!("open '#{url}'")
|
169
168
|
raise CantOpen(url) unless result
|
170
|
-
return
|
169
|
+
return
|
171
170
|
end
|
172
171
|
|
173
|
-
def cmd_preview
|
174
|
-
reset_output
|
172
|
+
def cmd_preview
|
175
173
|
local = @blog.view.local_index
|
176
174
|
unless File.exist?(local)
|
177
175
|
puts "\n No index. Rebuilding..."
|
178
|
-
cmd_rebuild
|
176
|
+
cmd_rebuild
|
179
177
|
end
|
180
178
|
result = system!("open #{local}")
|
181
179
|
raise CantOpen(local) unless result
|
182
|
-
@out
|
183
180
|
rescue => err
|
184
|
-
|
185
|
-
File.open(out, "w") do |f|
|
186
|
-
f.puts err
|
187
|
-
f.puts err.backtrace.join("\n")
|
188
|
-
end
|
189
|
-
puts "Error: See #{out}"
|
181
|
+
_tmp_error(err)
|
190
182
|
end
|
191
183
|
|
192
|
-
def cmd_publish
|
184
|
+
def cmd_publish
|
193
185
|
# Future Hal says please refactor this
|
194
|
-
puts
|
195
|
-
reset_output
|
186
|
+
puts
|
196
187
|
unless @blog.view.can_publish?
|
197
188
|
msg = "Can't publish... see global.lt3"
|
198
|
-
puts msg
|
199
|
-
|
200
|
-
return @out
|
189
|
+
puts msg
|
190
|
+
return
|
201
191
|
end
|
202
192
|
|
203
193
|
ret = RubyText.spinner(label: " Publishing... ") do
|
204
194
|
@blog.view.publisher.publish
|
205
195
|
end
|
206
|
-
return
|
196
|
+
return unless ret
|
207
197
|
|
208
198
|
vdir = @blog.view.dir
|
209
199
|
dump("fix this later", "#{vdir}/last_published")
|
210
|
-
|
211
|
-
puts " ...finished.\n "
|
212
|
-
output! "...finished.\n"
|
213
|
-
end
|
214
|
-
return @out
|
200
|
+
puts " ...finished.\n " unless ret
|
215
201
|
rescue => err
|
216
|
-
|
217
|
-
File.open(out, "w") do |f|
|
218
|
-
f.puts err
|
219
|
-
f.puts err.backtrace.join("\n")
|
220
|
-
end
|
221
|
-
puts "Error: See #{out}"
|
202
|
+
_tmp_error(err)
|
222
203
|
end
|
223
204
|
|
224
205
|
def fresh?(src, dst)
|
@@ -239,49 +220,37 @@ module RuneBlog::REPL
|
|
239
220
|
puts
|
240
221
|
end
|
241
222
|
|
242
|
-
def cmd_rebuild
|
223
|
+
def cmd_rebuild
|
243
224
|
debug "Starting cmd_rebuild..."
|
244
|
-
|
245
|
-
puts unless testing
|
225
|
+
puts
|
246
226
|
@blog.generate_view(@blog.view)
|
247
227
|
@blog.generate_index(@blog.view)
|
248
228
|
regen_posts
|
249
|
-
@out
|
250
229
|
rescue => err
|
251
|
-
|
252
|
-
File.open(out, "w") do |f|
|
253
|
-
f.puts err
|
254
|
-
f.puts err.backtrace.join("\n")
|
255
|
-
end
|
256
|
-
puts "Error: See #{out}"
|
230
|
+
_tmp_error(err)
|
257
231
|
end
|
258
232
|
|
259
|
-
def cmd_change_view(arg
|
260
|
-
reset_output
|
233
|
+
def cmd_change_view(arg)
|
261
234
|
# Simplify this
|
262
235
|
if arg.nil?
|
263
236
|
viewnames = @blog.views.map {|x| x.name }
|
264
237
|
n = viewnames.find_index(@blog.view.name)
|
265
238
|
name = @blog.view.name
|
266
239
|
# TODO: Add view description
|
267
|
-
k, name = STDSCR.menu(title: "Views", items: viewnames, curr: n)
|
240
|
+
k, name = STDSCR.menu(title: "Views", items: viewnames, curr: n)
|
268
241
|
return if name.nil?
|
269
242
|
@blog.view = name
|
270
|
-
|
271
|
-
|
272
|
-
return @out
|
243
|
+
puts "\n ", fx(name, :bold), "\n"
|
244
|
+
return
|
273
245
|
else
|
274
246
|
if @blog.view?(arg)
|
275
247
|
@blog.view = arg
|
276
|
-
|
277
|
-
puts "\n ", fx(arg, :bold), "\n" unless testing
|
248
|
+
puts "\n ", fx(arg, :bold), "\n"
|
278
249
|
end
|
279
250
|
end
|
280
|
-
return @out
|
281
251
|
end
|
282
252
|
|
283
|
-
def cmd_new_view(arg
|
284
|
-
reset_output
|
253
|
+
def cmd_new_view(arg)
|
285
254
|
if arg.nil?
|
286
255
|
arg = ask(fx("\nFilename: ", :bold))
|
287
256
|
puts
|
@@ -293,20 +262,13 @@ module RuneBlog::REPL
|
|
293
262
|
vim_params = '-c ":set hlsearch" -c ":hi Search ctermfg=2 ctermbg=6" +/"\(VIEW_.*\|SITE.*\)"'
|
294
263
|
edit_file(@blog.view.dir/"themes/standard/global.lt3", vim: vim_params)
|
295
264
|
@blog.change_view(arg)
|
296
|
-
@out
|
297
265
|
rescue ViewAlreadyExists
|
298
266
|
puts 'Blog already exists'
|
299
267
|
rescue => err
|
300
|
-
|
301
|
-
File.open(out, "w") do |f|
|
302
|
-
f.puts err
|
303
|
-
f.puts err.backtrace.join("\n")
|
304
|
-
end
|
305
|
-
puts "Error: See #{out}"
|
268
|
+
_tmp_error(err)
|
306
269
|
end
|
307
270
|
|
308
|
-
def cmd_new_post
|
309
|
-
reset_output
|
271
|
+
def cmd_new_post
|
310
272
|
if @blog.views.empty?
|
311
273
|
puts "\n Create a view before creating the first post!\n "
|
312
274
|
return
|
@@ -314,15 +276,8 @@ module RuneBlog::REPL
|
|
314
276
|
title = ask("\nTitle: ")
|
315
277
|
puts
|
316
278
|
@blog.create_new_post(title)
|
317
|
-
# STDSCR.clear
|
318
|
-
@out
|
319
279
|
rescue => err
|
320
|
-
|
321
|
-
File.open(out, "w") do |f|
|
322
|
-
f.puts err
|
323
|
-
f.puts err.backtrace.join("\n")
|
324
|
-
end
|
325
|
-
puts "Error: See #{out}"
|
280
|
+
_tmp_error(err)
|
326
281
|
end
|
327
282
|
|
328
283
|
def _remove_post(arg, testing=false)
|
@@ -331,20 +286,16 @@ module RuneBlog::REPL
|
|
331
286
|
puts "Post #{id} not found" if result.nil?
|
332
287
|
end
|
333
288
|
|
334
|
-
def cmd_remove_post(arg
|
335
|
-
reset_output
|
289
|
+
def cmd_remove_post(arg)
|
336
290
|
args = arg.split
|
337
291
|
args.each do |x|
|
338
292
|
# FIXME
|
339
293
|
ret = _remove_post(x.to_i, false)
|
340
294
|
puts ret
|
341
|
-
output ret
|
342
295
|
end
|
343
|
-
@out
|
344
296
|
end
|
345
297
|
|
346
|
-
def cmd_edit_post(arg
|
347
|
-
reset_output
|
298
|
+
def cmd_edit_post(arg)
|
348
299
|
id = get_integer(arg)
|
349
300
|
# Simplify this
|
350
301
|
tag = "#{'%04d' % id}"
|
@@ -353,14 +304,12 @@ module RuneBlog::REPL
|
|
353
304
|
files = files.map {|f| File.basename(f) }
|
354
305
|
if files.size > 1
|
355
306
|
msg = "Multiple files: #{files}"
|
356
|
-
|
357
|
-
puts msg unless testing
|
307
|
+
puts msg
|
358
308
|
return [false, msg]
|
359
309
|
end
|
360
310
|
if files.empty?
|
361
311
|
msg = "\n Can't edit post #{id}"
|
362
|
-
|
363
|
-
puts msg unless testing
|
312
|
+
puts msg
|
364
313
|
return [false, msg]
|
365
314
|
end
|
366
315
|
|
@@ -370,48 +319,36 @@ module RuneBlog::REPL
|
|
370
319
|
result = edit_file(draft)
|
371
320
|
@blog.generate_post(draft)
|
372
321
|
rescue => err
|
373
|
-
|
374
|
-
File.open(out, "w") do |f|
|
375
|
-
f.puts err
|
376
|
-
f.puts err.backtrace.join("\n")
|
377
|
-
end
|
378
|
-
puts "Error: See #{out}"
|
322
|
+
_tmp_error(err)
|
379
323
|
end
|
380
324
|
|
381
|
-
def cmd_list_views
|
382
|
-
|
383
|
-
puts unless testing
|
325
|
+
def cmd_list_views
|
326
|
+
puts
|
384
327
|
@blog.views.each do |v|
|
385
328
|
v = v.to_s
|
386
329
|
v = fx(v, :bold) if v == @blog.view.name
|
387
|
-
output v + "\n"
|
388
330
|
# FIXME: next 3 lines are crufty as hell
|
389
|
-
lines = File.readlines(@blog.root/"views/#{v}/
|
390
|
-
lines = lines.select {|x| x =~ /^
|
331
|
+
lines = File.readlines(@blog.root/"views/#{v}/settings/view.txt")
|
332
|
+
lines = lines.select {|x| x =~ /^title / && x !~ /VIEW_/ }
|
391
333
|
title = lines.first.split(" ", 2)[1]
|
392
|
-
print " ", ('%15s' % v)
|
393
|
-
puts " ", fx(title, :black)
|
334
|
+
print " ", ('%15s' % v)
|
335
|
+
puts " ", fx(title, :black)
|
394
336
|
end
|
395
|
-
puts
|
396
|
-
# @out
|
337
|
+
puts
|
397
338
|
end
|
398
339
|
|
399
|
-
def cmd_list_posts
|
400
|
-
reset_output
|
340
|
+
def cmd_list_posts
|
401
341
|
posts = @blog.posts # current view
|
402
342
|
str = @blog.view.name + ":\n"
|
403
|
-
|
404
|
-
puts
|
405
|
-
puts " ", fx(str, :bold) unless testing
|
343
|
+
puts
|
344
|
+
puts " ", fx(str, :bold)
|
406
345
|
if posts.empty?
|
407
|
-
|
408
|
-
puts " No posts" unless testing
|
346
|
+
puts " No posts"
|
409
347
|
else
|
410
348
|
posts.each do |post|
|
411
|
-
outstr " #{colored_slug(post)}\n"
|
412
349
|
base = post.sub(/.lt3$/, "")
|
413
350
|
num, rest = base[0..3], base[4..-1]
|
414
|
-
puts " ", fx(num, Red), fx(rest, Blue)
|
351
|
+
puts " ", fx(num, Red), fx(rest, Blue)
|
415
352
|
draft = @blog.root/:drafts/post + ".lt3"
|
416
353
|
other = @blog._get_views(draft) - [@blog.view.to_s]
|
417
354
|
unless other.empty?
|
@@ -420,24 +357,20 @@ module RuneBlog::REPL
|
|
420
357
|
end
|
421
358
|
end
|
422
359
|
end
|
423
|
-
puts
|
424
|
-
@out
|
360
|
+
puts
|
425
361
|
end
|
426
362
|
|
427
|
-
def cmd_list_drafts
|
428
|
-
reset_output
|
363
|
+
def cmd_list_drafts
|
429
364
|
drafts = @blog.drafts # current view
|
430
365
|
if drafts.empty?
|
431
|
-
|
432
|
-
|
433
|
-
return @out
|
366
|
+
puts "\n No drafts\n "
|
367
|
+
return
|
434
368
|
else
|
435
|
-
puts
|
369
|
+
puts
|
436
370
|
drafts.each do |draft|
|
437
|
-
outstr " #{colored_slug(draft.sub(/.lt3$/, ""))}\n"
|
438
371
|
base = draft.sub(/.lt3$/, "")
|
439
372
|
num, rest = base[0..3], base[4..-1]
|
440
|
-
puts " ", fx(num, Red), fx(rest, Blue)
|
373
|
+
puts " ", fx(num, Red), fx(rest, Blue)
|
441
374
|
other = @blog._get_views(@blog.root/:drafts/draft) - [@blog.view.to_s]
|
442
375
|
unless other.empty?
|
443
376
|
print fx(" "*7 + "also in: ", :bold)
|
@@ -445,48 +378,40 @@ module RuneBlog::REPL
|
|
445
378
|
end
|
446
379
|
end
|
447
380
|
end
|
448
|
-
puts
|
449
|
-
@out
|
381
|
+
puts
|
450
382
|
end
|
451
383
|
|
452
|
-
def cmd_list_assets
|
453
|
-
reset_output
|
384
|
+
def cmd_list_assets
|
454
385
|
dir = @blog.view.dir + "/assets"
|
455
386
|
assets = Dir[dir + "/*"]
|
456
387
|
if assets.empty?
|
457
|
-
|
458
|
-
|
459
|
-
return @out
|
388
|
+
puts " No assets"
|
389
|
+
return
|
460
390
|
else
|
461
|
-
puts
|
391
|
+
puts
|
462
392
|
assets.each do |name|
|
463
393
|
asset = File.basename(name)
|
464
|
-
|
465
|
-
puts " ", fx(asset, Blue) unless testing
|
394
|
+
puts " ", fx(asset, Blue)
|
466
395
|
end
|
467
396
|
end
|
468
|
-
puts
|
469
|
-
@out
|
397
|
+
puts
|
470
398
|
end
|
471
399
|
|
472
|
-
def cmd_ssh
|
400
|
+
def cmd_ssh
|
473
401
|
pub = @blog.view.publisher
|
474
402
|
puts
|
475
403
|
system!("tputs clear; ssh #{pub.user}@#{pub.server}")
|
476
404
|
sleep 0.1
|
477
|
-
cmd_clear
|
405
|
+
cmd_clear
|
478
406
|
end
|
479
407
|
|
480
|
-
def cmd_INVALID(arg
|
481
|
-
reset_output "\n Command '#{arg}' was not understood."
|
408
|
+
def cmd_INVALID(arg)
|
482
409
|
print fx("\n Command ", :bold)
|
483
410
|
print fx(arg, Red, :bold)
|
484
411
|
puts fx(" was not understood.\n ", :bold)
|
485
|
-
@out
|
486
412
|
end
|
487
413
|
|
488
|
-
def cmd_legacy
|
489
|
-
# dir = ask("Dir = ")
|
414
|
+
def cmd_legacy
|
490
415
|
dir = "sources/computing"
|
491
416
|
puts "Importing from: #{dir}"
|
492
417
|
files = Dir[dir/"**"]
|
@@ -535,7 +460,7 @@ module RuneBlog::REPL
|
|
535
460
|
{Posts:} {Advanced:}
|
536
461
|
------------------------------------------- -------------------------------------------
|
537
462
|
{p, post} Create a new post {config} Edit various system files
|
538
|
-
{new post} Same as p, post
|
463
|
+
{new post} Same as p, post
|
539
464
|
{lsp, list posts} List posts in current view {preview} Look at current (local) view in browser
|
540
465
|
{lsd, list drafts} List all drafts (all views) {browse} Look at current (published) view in browser
|
541
466
|
{delete ID [ID...]} Remove multiple posts {rebuild} Regenerate all posts and relink
|
@@ -544,10 +469,8 @@ module RuneBlog::REPL
|
|
544
469
|
{import ASSETS} Import assets (images, etc.) {manage WIDGET} Manage content/layout of a widget
|
545
470
|
EOS
|
546
471
|
|
547
|
-
def cmd_help
|
548
|
-
reset_output
|
472
|
+
def cmd_help
|
549
473
|
msg = Help
|
550
|
-
output msg
|
551
474
|
msg.each_line do |line|
|
552
475
|
e = line.each_char
|
553
476
|
first = true
|
@@ -570,8 +493,6 @@ module RuneBlog::REPL
|
|
570
493
|
print s1
|
571
494
|
end
|
572
495
|
end
|
573
|
-
puts
|
574
|
-
@out
|
496
|
+
puts
|
575
497
|
end
|
576
498
|
end
|
577
|
-
|
data/lib/runeblog.rb
CHANGED
@@ -75,15 +75,6 @@ class RuneBlog
|
|
75
75
|
|
76
76
|
end
|
77
77
|
|
78
|
-
def _tmp_error(err) # FIXME move to helpers
|
79
|
-
out = "/tmp/blog#{rand(100)}.txt"
|
80
|
-
File.open(out, "w") do |f|
|
81
|
-
f.puts err
|
82
|
-
f.puts err.backtrace.join("\n")
|
83
|
-
end
|
84
|
-
puts "Error: See #{out}"
|
85
|
-
end
|
86
|
-
|
87
78
|
def self.create_new_blog_repo(root_rel = ".blogs")
|
88
79
|
log!(enter: __method__, args: [root_rel])
|
89
80
|
raise ArgumentError unless root_rel.is_a?(String) && ! root_rel.empty?
|
data/lib/runeblog_version.rb
CHANGED