runeblog 0.2.47 → 0.2.48
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/blog +4 -3
- data/empty_view/themes/standard/blog/post_entry.lt3 +4 -1
- data/lib/liveblog.rb +13 -7
- data/lib/post.rb +17 -10
- data/lib/repl.rb +50 -5
- data/lib/runeblog.rb +71 -23
- data/lib/runeblog_version.rb +1 -1
- data/lib/xlate.rb +6 -5
- data/test/austin.rb +2 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d4bd7b67f736b85651eb0650c5af974cbcf74fce48be345920e9bac4c9dba9dd
|
4
|
+
data.tar.gz: 5fda0c05a32e16103e7f7f31b7ffe104c307b63c2e14e96216644dfbc6fdefff
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55b9141f9b2d0d7a06cb5134d1e1da871cd78c2dffa7502310d0ae0caedec7c27eabfa28dc7957754f611122283abc2bc833512e58f9414a541b87d8cf4e146f
|
7
|
+
data.tar.gz: 60b1546750066d75a623a3ca7866b5f5307b31e14a806a85f726fe87507ab1c3d24c5ce7737742ffdb3e41fb7cbcb0eac244089c9f96efddc6534299e9ab9ef1
|
data/bin/blog
CHANGED
@@ -23,7 +23,8 @@ TEXT
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def mainloop
|
26
|
-
|
26
|
+
info = @blog.view || "no view"
|
27
|
+
print fx("[#{info}] ", Red, :bold)
|
27
28
|
cmd = STDSCR.gets(history: @cmdhist, tab: @tabcom)
|
28
29
|
cmd_quit(nil) if cmd.nil? # ^D
|
29
30
|
cmd.chomp!
|
@@ -72,7 +73,7 @@ puts fx("\n RuneBlog", :bold), fx(" v #{RuneBlog::VERSION}\n", Red)
|
|
72
73
|
|
73
74
|
loop { mainloop }
|
74
75
|
|
75
|
-
|
76
|
-
|
76
|
+
system("tput clear")
|
77
|
+
sleep 0.2
|
77
78
|
puts
|
78
79
|
|
@@ -2,13 +2,14 @@
|
|
2
2
|
. This HTML fragment gives the format of a post's
|
3
3
|
. "index" entry (recent posts on blog front page).
|
4
4
|
. --------------------------------------------------
|
5
|
+
.nopara
|
5
6
|
|
6
7
|
<div class="post">
|
7
8
|
<table width=100% cellpadding=7>
|
8
9
|
<tr>
|
9
10
|
<td width=14% valign=top align=right style="margin-top: -1px;">
|
10
11
|
<!-- <span class="post-date mt-1 mb-1" style="margin-top: 3px; text-align: right"> -->
|
11
|
-
<font size=-1
|
12
|
+
<font size=-1>#{date}</font>
|
12
13
|
<!-- </span> -->
|
13
14
|
</td>
|
14
15
|
<td>
|
@@ -21,3 +22,5 @@
|
|
21
22
|
</tr>
|
22
23
|
</table>
|
23
24
|
</div>
|
25
|
+
|
26
|
+
<font size=-4><br></font>
|
data/lib/liveblog.rb
CHANGED
@@ -70,7 +70,7 @@ end
|
|
70
70
|
|
71
71
|
def quote
|
72
72
|
_passthru "<blockquote>"
|
73
|
-
_passthru _body
|
73
|
+
_passthru _body.join(" ")
|
74
74
|
_passthru "</blockquote>"
|
75
75
|
_optional_blank_line
|
76
76
|
end
|
@@ -364,8 +364,8 @@ def _load_local(widget)
|
|
364
364
|
code
|
365
365
|
end
|
366
366
|
rescue => err
|
367
|
-
|
368
|
-
|
367
|
+
STDERR.puts err.to_s
|
368
|
+
STDERR.puts err.backtrace.join("\n")
|
369
369
|
exit
|
370
370
|
end
|
371
371
|
|
@@ -480,10 +480,16 @@ class Livetext::Functions
|
|
480
480
|
::Livetext::Vars[name] || "[:#{name} is undefined]"
|
481
481
|
end
|
482
482
|
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
483
|
+
# def link(param = nil)
|
484
|
+
# puts "--- WTF?? param = #{param.inspect}"; gets
|
485
|
+
# file, cdata = param.split("||", 2)
|
486
|
+
# %[<a href="assets/#{file}">#{cdata}</a>]
|
487
|
+
# end
|
488
|
+
#
|
489
|
+
# def link(param = nil)
|
490
|
+
# file, cdata = param.split("||", 2)
|
491
|
+
# %[<link type="application/atom+xml" rel="alternate" href="#{_var(:host)}#{file}" title="#{_var(:title)}">]
|
492
|
+
# end
|
487
493
|
end
|
488
494
|
|
489
495
|
###
|
data/lib/post.rb
CHANGED
@@ -62,8 +62,8 @@ class RuneBlog::Post
|
|
62
62
|
end
|
63
63
|
|
64
64
|
def self.create(title:, teaser:, body:, pubdate: Time.now.strftime("%Y-%m-%d"),
|
65
|
-
views:[])
|
66
|
-
log!(enter: __method__, args: [title, teaser, body, pubdate, views])
|
65
|
+
views:[], file: nil)
|
66
|
+
log!(enter: __method__, args: [title, teaser, body, pubdate, views], stderr: true)
|
67
67
|
post = self.new
|
68
68
|
# NOTE: This is the ONLY place next_sequence is called!
|
69
69
|
num = post.meta.num = post.blog.next_sequence
|
@@ -78,14 +78,18 @@ class RuneBlog::Post
|
|
78
78
|
# create_draft
|
79
79
|
viewhome = post.blog.view.publisher.url
|
80
80
|
meta = post.meta
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
81
|
+
if file.nil?
|
82
|
+
text = RuneBlog.post_template(num: meta.num, title: meta.title, date: meta.pubdate,
|
83
|
+
view: meta.view, teaser: meta.teaser, body: meta.body,
|
84
|
+
views: meta.views, tags: meta.tags, home: viewhome)
|
85
|
+
srcdir = post.blog.root/:drafts + "/"
|
86
|
+
vpdir = post.blog.root/:drafts + "/"
|
87
|
+
fname = meta.slug + ".lt3"
|
88
|
+
post.draft = srcdir + fname
|
89
|
+
dump(text, post.draft)
|
90
|
+
else
|
91
|
+
dump(File.read(file), post.draft)
|
92
|
+
end
|
89
93
|
return post
|
90
94
|
end
|
91
95
|
|
@@ -125,6 +129,9 @@ class RuneBlog::ViewPost
|
|
125
129
|
lines = File.readlines(mdfile)
|
126
130
|
@title = lines.grep(/title:/).first[7..-1].chomp
|
127
131
|
@date = lines.grep(/pubdate:/).first[9..-1].chomp
|
132
|
+
# print "-- date = #{@date.inspect} "; gets
|
133
|
+
rescue => err
|
134
|
+
STDERR.puts "--- #{err}\n #{err.backtrace.join("\n ")}"
|
128
135
|
end
|
129
136
|
|
130
137
|
def get_dirs
|
data/lib/repl.rb
CHANGED
@@ -11,13 +11,15 @@ module RuneBlog::REPL
|
|
11
11
|
result = system!("#{@blog.editor} #{file}")
|
12
12
|
raise EditorProblem(file) unless result
|
13
13
|
sleep 0.1
|
14
|
-
|
14
|
+
cmd_clear(nil)
|
15
15
|
end
|
16
16
|
|
17
17
|
def cmd_quit(arg, testing = false)
|
18
18
|
check_empty(arg)
|
19
19
|
RubyText.stop
|
20
|
-
|
20
|
+
sleep 0.1
|
21
|
+
cmd_clear(nil)
|
22
|
+
sleep 0.1
|
21
23
|
exit
|
22
24
|
end
|
23
25
|
|
@@ -98,6 +100,13 @@ module RuneBlog::REPL
|
|
98
100
|
result = system!("open #{local}")
|
99
101
|
raise CantOpen(local) unless result
|
100
102
|
@out
|
103
|
+
rescue => err
|
104
|
+
out = "/tmp/blog#{rand(100)}.txt"
|
105
|
+
File.open(out, "w") do |f|
|
106
|
+
f.puts err
|
107
|
+
f.puts err.backtrace.join("\n")
|
108
|
+
end
|
109
|
+
puts "Error: See #{out}"
|
101
110
|
end
|
102
111
|
|
103
112
|
def cmd_publish(arg, testing = false)
|
@@ -135,6 +144,13 @@ module RuneBlog::REPL
|
|
135
144
|
output! "...finished.\n"
|
136
145
|
end
|
137
146
|
return @out
|
147
|
+
rescue => err
|
148
|
+
out = "/tmp/blog#{rand(100)}.txt"
|
149
|
+
File.open(out, "w") do |f|
|
150
|
+
f.puts err
|
151
|
+
f.puts err.backtrace.join("\n")
|
152
|
+
end
|
153
|
+
puts "Error: See #{out}"
|
138
154
|
end
|
139
155
|
|
140
156
|
def cmd_rebuild(arg, testing = false)
|
@@ -145,6 +161,13 @@ module RuneBlog::REPL
|
|
145
161
|
@blog.generate_view(@blog.view)
|
146
162
|
@blog.generate_index(@blog.view)
|
147
163
|
@out
|
164
|
+
rescue => err
|
165
|
+
out = "/tmp/blog#{rand(100)}.txt"
|
166
|
+
File.open(out, "w") do |f|
|
167
|
+
f.puts err
|
168
|
+
f.puts err.backtrace.join("\n")
|
169
|
+
end
|
170
|
+
puts "Error: See #{out}"
|
148
171
|
end
|
149
172
|
|
150
173
|
def cmd_change_view(arg, testing = false)
|
@@ -178,18 +201,30 @@ module RuneBlog::REPL
|
|
178
201
|
@out
|
179
202
|
rescue ViewAlreadyExists
|
180
203
|
puts 'Blog already exists'
|
204
|
+
rescue => err
|
205
|
+
out = "/tmp/blog#{rand(100)}.txt"
|
206
|
+
File.open(out, "w") do |f|
|
207
|
+
f.puts err
|
208
|
+
f.puts err.backtrace.join("\n")
|
209
|
+
end
|
210
|
+
puts "Error: See #{out}"
|
181
211
|
end
|
182
212
|
|
183
213
|
def cmd_new_post(arg, testing = false)
|
184
214
|
reset_output
|
185
215
|
check_empty(arg)
|
186
216
|
title = ask("\nTitle: ")
|
217
|
+
puts
|
187
218
|
@blog.create_new_post(title)
|
188
219
|
# STDSCR.clear
|
189
220
|
@out
|
190
221
|
rescue => err
|
191
|
-
|
192
|
-
|
222
|
+
out = "/tmp/blog#{rand(100)}.txt"
|
223
|
+
File.open(out, "w") do |f|
|
224
|
+
f.puts err
|
225
|
+
f.puts err.backtrace.join("\n")
|
226
|
+
end
|
227
|
+
puts "Error: See #{out}"
|
193
228
|
end
|
194
229
|
|
195
230
|
def _remove_post(arg, testing=false)
|
@@ -235,6 +270,13 @@ module RuneBlog::REPL
|
|
235
270
|
draft = "#{@blog.root}/drafts/#{file}"
|
236
271
|
result = edit_file(draft)
|
237
272
|
@blog.generate_post(draft)
|
273
|
+
rescue => err
|
274
|
+
out = "/tmp/blog#{rand(100)}.txt"
|
275
|
+
File.open(out, "w") do |f|
|
276
|
+
f.puts err
|
277
|
+
f.puts err.backtrace.join("\n")
|
278
|
+
end
|
279
|
+
puts "Error: See #{out}"
|
238
280
|
end
|
239
281
|
|
240
282
|
def cmd_list_views(arg, testing = false)
|
@@ -318,7 +360,10 @@ module RuneBlog::REPL
|
|
318
360
|
|
319
361
|
def cmd_ssh(arg, testing = false)
|
320
362
|
pub = @blog.view.publisher
|
321
|
-
|
363
|
+
puts
|
364
|
+
system!("tputs clear; ssh #{pub.user}@#{pub.server}")
|
365
|
+
sleep 0.1
|
366
|
+
cmd_clear(nil)
|
322
367
|
end
|
323
368
|
|
324
369
|
def cmd_INVALID(arg, testing = false)
|
data/lib/runeblog.rb
CHANGED
@@ -43,6 +43,15 @@ class RuneBlog
|
|
43
43
|
|
44
44
|
include Helpers
|
45
45
|
|
46
|
+
def _tmp_error(err) # FIXME move to helpers
|
47
|
+
out = "/tmp/blog#{rand(100)}.txt"
|
48
|
+
File.open(out, "w") do |f|
|
49
|
+
f.puts err
|
50
|
+
f.puts err.backtrace.join("\n")
|
51
|
+
end
|
52
|
+
puts "Error: See #{out}"
|
53
|
+
end
|
54
|
+
|
46
55
|
def self.create_new_blog_repo(dir = ".blogs")
|
47
56
|
log!(enter: __method__, args: [dir])
|
48
57
|
raise ArgumentError unless dir.is_a?(String) && ! dir.empty?
|
@@ -68,8 +77,9 @@ class RuneBlog
|
|
68
77
|
x.root, x.current_view, x.editor = root, "test_view", "/usr/bin/vim " # dumb - FIXME later
|
69
78
|
write_config(x, root/ConfigFile)
|
70
79
|
@blog = self.new(root)
|
71
|
-
@blog.create_view("test_view")
|
72
80
|
@blog
|
81
|
+
rescue => err
|
82
|
+
_tmp_error(err)
|
73
83
|
end
|
74
84
|
|
75
85
|
def self.open(root = ".blogs")
|
@@ -78,6 +88,8 @@ class RuneBlog
|
|
78
88
|
self.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
79
89
|
root = Dir.pwd/root
|
80
90
|
blog = self.new(root)
|
91
|
+
rescue => err
|
92
|
+
_tmp_error(err)
|
81
93
|
end
|
82
94
|
|
83
95
|
def initialize(root_dir = ".blogs") # always assumes existing blog
|
@@ -106,6 +118,8 @@ class RuneBlog
|
|
106
118
|
views = _retrieve_metadata(:views)
|
107
119
|
views.each {|v| system!("cp *html #@root/views/#{v}/remote") }
|
108
120
|
end
|
121
|
+
rescue => err
|
122
|
+
_tmp_error(err)
|
109
123
|
end
|
110
124
|
|
111
125
|
def _retrieve_metadata(key)
|
@@ -129,6 +143,8 @@ class RuneBlog
|
|
129
143
|
raise "Too many #{key} instances in metadata.txt!"
|
130
144
|
end
|
131
145
|
return result
|
146
|
+
rescue => err
|
147
|
+
_tmp_error(err)
|
132
148
|
end
|
133
149
|
|
134
150
|
def process_post(sourcefile)
|
@@ -138,6 +154,8 @@ class RuneBlog
|
|
138
154
|
create_dir(dir)
|
139
155
|
xlate cwd: dir, src: sourcefile # , debug: true
|
140
156
|
_deploy_local(dir)
|
157
|
+
rescue => err
|
158
|
+
_tmp_error(err)
|
141
159
|
end
|
142
160
|
|
143
161
|
def inspect
|
@@ -172,6 +190,8 @@ class RuneBlog
|
|
172
190
|
def _set_publisher
|
173
191
|
log!(enter: __method__, level: 3)
|
174
192
|
@view.publisher = RuneBlog::Publishing.new(@view.to_s) # FIXME refactor
|
193
|
+
rescue => err
|
194
|
+
_tmp_error(err)
|
175
195
|
end
|
176
196
|
|
177
197
|
def view=(arg)
|
@@ -188,6 +208,8 @@ class RuneBlog
|
|
188
208
|
else
|
189
209
|
raise CantAssignView(arg.class.to_s)
|
190
210
|
end
|
211
|
+
rescue => err
|
212
|
+
_tmp_error(err)
|
191
213
|
end
|
192
214
|
|
193
215
|
def get_sequence
|
@@ -234,6 +256,8 @@ class RuneBlog
|
|
234
256
|
cmd = "cp -r #{RuneBlog::Path}/../empty_view views/#{view_name}"
|
235
257
|
system!(cmd)
|
236
258
|
end
|
259
|
+
rescue => err
|
260
|
+
_tmp_error(err)
|
237
261
|
end
|
238
262
|
|
239
263
|
def check_valid_new_view(view_name)
|
@@ -254,6 +278,8 @@ class RuneBlog
|
|
254
278
|
make_empty_view_tree(view_name)
|
255
279
|
add_view(view_name)
|
256
280
|
mark_last_published("Initial creation")
|
281
|
+
rescue => err
|
282
|
+
_tmp_error(err)
|
257
283
|
end
|
258
284
|
|
259
285
|
def delete_view(name, force = false)
|
@@ -287,6 +313,8 @@ class RuneBlog
|
|
287
313
|
postdir = post.first
|
288
314
|
vp = RuneBlog::ViewPost.new(self.view, postdir)
|
289
315
|
vp
|
316
|
+
rescue => err
|
317
|
+
_tmp_error(err)
|
290
318
|
end
|
291
319
|
|
292
320
|
def index_entry(slug)
|
@@ -302,10 +330,13 @@ class RuneBlog
|
|
302
330
|
vp.nslug, vp.aslug, vp.title, vp.date, vp.teaser_text
|
303
331
|
path = vp.path
|
304
332
|
url = aslug + ".html"
|
333
|
+
# puts "--- vp = #{[vp.nslug, vp.aslug, vp.title, vp.date, vp.teaser_text].inspect}"; gets
|
305
334
|
date = ::Date.parse(date)
|
306
335
|
date = date.strftime("%B %e<br><div style='float: right'>%Y</div>")
|
307
336
|
text = interpolate(@_post_entry, binding)
|
308
337
|
text
|
338
|
+
rescue => err
|
339
|
+
_tmp_error(err)
|
309
340
|
end
|
310
341
|
|
311
342
|
def collect_recent_posts(file)
|
@@ -316,14 +347,20 @@ class RuneBlog
|
|
316
347
|
posts = entries.grep(/^\d\d\d\d/).map {|x| dir_posts/x }
|
317
348
|
posts.select! {|x| File.directory?(x) }
|
318
349
|
# directories that start with four digits
|
319
|
-
posts = posts.sort
|
350
|
+
posts = posts.sort do |a, b|
|
351
|
+
ai = a.index(/\d\d\d\d-/)
|
352
|
+
bi = b.index(/\d\d\d\d-/)
|
353
|
+
na = a[ai..(ai+3)].to_i
|
354
|
+
nb = b[bi..(bi+3)].to_i
|
355
|
+
nb <=> na
|
356
|
+
end # sort descending
|
320
357
|
posts = posts[0..19] # return 20 at most
|
321
358
|
text = <<-HTML
|
322
359
|
<html>
|
323
360
|
<head><link rel="stylesheet" href="etc/blog.css"></head>
|
324
361
|
<body>
|
325
362
|
HTML
|
326
|
-
wanted = [
|
363
|
+
wanted = [8, posts.size].min # estimate how many we want?
|
327
364
|
enum = posts.each
|
328
365
|
wanted.times do
|
329
366
|
postid = File.basename(enum.next)
|
@@ -332,13 +369,16 @@ class RuneBlog
|
|
332
369
|
end
|
333
370
|
text << "</body></html>"
|
334
371
|
File.write(@vdir/:remote/file, text)
|
372
|
+
rescue => err
|
373
|
+
_tmp_error(err)
|
335
374
|
end
|
336
375
|
|
337
376
|
def create_new_post(title, testing = false, teaser: nil, body: nil,
|
338
377
|
pubdate: Time.now.strftime("%Y-%m-%d"), views: [])
|
339
|
-
log!(enter: __method__, args: [title, testing, teaser, body, views], level: 1)
|
378
|
+
log!(enter: __method__, args: [title, testing, teaser, body, views], level: 1, stderr: true)
|
340
379
|
meta = nil
|
341
380
|
views = views + [self.view.to_s]
|
381
|
+
views.uniq!
|
342
382
|
Dir.chdir(@root/:posts) do
|
343
383
|
post = Post.create(title: title, teaser: teaser, body: body, pubdate: pubdate, views: views)
|
344
384
|
post.edit unless testing
|
@@ -347,14 +387,12 @@ class RuneBlog
|
|
347
387
|
end
|
348
388
|
return meta.num
|
349
389
|
rescue => err
|
350
|
-
|
351
|
-
puts err.backtrace.join("\n")
|
390
|
+
_tmp_error(err)
|
352
391
|
end
|
353
392
|
|
354
393
|
def edit_initial_post(file, testing = false)
|
355
394
|
log!(enter: __method__, args: [file, testing], level: 3)
|
356
395
|
debug "=== edit_initial_post #{file.inspect} => #{sourcefile}"
|
357
|
-
sourcefile = @root/:drafts/file
|
358
396
|
result = system!("#@editor #{sourcefile} +8") unless testing
|
359
397
|
raise EditorProblem(sourcefile) unless result
|
360
398
|
process_post(sourcefile)
|
@@ -390,6 +428,8 @@ class RuneBlog
|
|
390
428
|
raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
|
391
429
|
@vdir = @root/:views/view
|
392
430
|
collect_recent_posts("recent.html")
|
431
|
+
rescue => err
|
432
|
+
_tmp_error(err)
|
393
433
|
end
|
394
434
|
|
395
435
|
def generate_view(view) # huh?
|
@@ -402,10 +442,7 @@ class RuneBlog
|
|
402
442
|
src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
|
403
443
|
copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
|
404
444
|
rescue => err
|
405
|
-
|
406
|
-
puts err.backtrace.join("\n")
|
407
|
-
print "Pause... "
|
408
|
-
gets
|
445
|
+
_tmp_error(err)
|
409
446
|
end
|
410
447
|
|
411
448
|
def _get_views(draft)
|
@@ -416,7 +453,9 @@ class RuneBlog
|
|
416
453
|
raise "No .views call!" if view_line.size < 1
|
417
454
|
view_line = view_line.first
|
418
455
|
views = view_line[7..-1].split
|
419
|
-
views
|
456
|
+
views.uniq
|
457
|
+
rescue => err
|
458
|
+
_tmp_error(err)
|
420
459
|
end
|
421
460
|
|
422
461
|
def _copy_get_dirs(draft, view)
|
@@ -430,6 +469,8 @@ class RuneBlog
|
|
430
469
|
viewdir, slugdir, aslug = vdir, dir, noext[5..-1]
|
431
470
|
theme = viewdir/:themes/:standard
|
432
471
|
[noext, viewdir, slugdir, aslug, theme]
|
472
|
+
rescue => err
|
473
|
+
_tmp_error(err)
|
433
474
|
end
|
434
475
|
|
435
476
|
def _post_metadata(draft, pdraft)
|
@@ -466,6 +507,8 @@ class RuneBlog
|
|
466
507
|
LIVE
|
467
508
|
File.open(pdraft/"vars.lt3", "w") {|f| f.puts vars }
|
468
509
|
end
|
510
|
+
rescue => err
|
511
|
+
_tmp_error(err)
|
469
512
|
end
|
470
513
|
|
471
514
|
def copy_widget_html(view)
|
@@ -483,10 +526,12 @@ class RuneBlog
|
|
483
526
|
tag = File.basename(w)
|
484
527
|
files.each {|file| system!("cp #{file} #{rem}", show: (tag == "zzz")) }
|
485
528
|
end
|
529
|
+
rescue => err
|
530
|
+
_tmp_error(err)
|
486
531
|
end
|
487
532
|
|
488
|
-
def _handle_post(draft, view)
|
489
|
-
log!(enter: __method__, args: [draft,
|
533
|
+
def _handle_post(draft, view_name = self.view.to_s)
|
534
|
+
log!(enter: __method__, args: [draft, view_name], level: 2)
|
490
535
|
# break into separate methods?
|
491
536
|
|
492
537
|
fname = File.basename(draft) # 0001-this-is-a-post.lt3
|
@@ -494,30 +539,34 @@ class RuneBlog
|
|
494
539
|
aslug = nslug.sub(/\d\d\d\d-/, "") # this-is-a-post
|
495
540
|
ahtml = aslug + ".html" # this-is-a-post.html
|
496
541
|
pdraft = @root/:posts/nslug
|
497
|
-
remote = @root/:views/
|
498
|
-
@theme = @root/:views/
|
542
|
+
remote = @root/:views/view_name/:remote
|
543
|
+
@theme = @root/:views/view_name/:themes/:standard
|
499
544
|
# Step 1...
|
500
545
|
create_dirs(pdraft)
|
501
|
-
xlate cwd: pdraft, src: draft, dst: "guts.html"
|
546
|
+
xlate cwd: pdraft, src: draft, dst: "guts.html", debug: true
|
502
547
|
_post_metadata(draft, pdraft)
|
503
548
|
# Step 2...
|
504
|
-
vposts = @root/:views/
|
549
|
+
vposts = @root/:views/view_name/:posts
|
505
550
|
copy!(pdraft, vposts) # ??
|
506
551
|
# Step 3..
|
507
552
|
copy(pdraft/"guts.html", @theme/:post)
|
508
553
|
copy(pdraft/"vars.lt3", @theme/:post)
|
509
554
|
# Step 4...
|
510
|
-
xlate cwd: @theme/:post, src: "generate.lt3",
|
511
|
-
dst: remote/ahtml, copy: @theme/:post
|
555
|
+
xlate cwd: @theme/:post, src: "generate.lt3", force: true,
|
556
|
+
dst: remote/ahtml, copy: @theme/:post, debug: true
|
512
557
|
xlate cwd: @theme/:post, src: "permalink.lt3",
|
513
558
|
dst: remote/:permalink/ahtml # , debug: true
|
514
|
-
copy_widget_html(
|
559
|
+
copy_widget_html(view_name)
|
560
|
+
rescue => err
|
561
|
+
_tmp_error(err)
|
515
562
|
end
|
516
563
|
|
517
564
|
def generate_post(draft)
|
518
565
|
log!(enter: __method__, args: [draft], level: 1)
|
519
566
|
views = _get_views(draft)
|
520
567
|
views.each {|view| _handle_post(draft, view) }
|
568
|
+
rescue => err
|
569
|
+
_tmp_error(err)
|
521
570
|
end
|
522
571
|
|
523
572
|
def rebuild_post(file)
|
@@ -531,8 +580,7 @@ class RuneBlog
|
|
531
580
|
@views_dirty.flatten!
|
532
581
|
@views_dirty.uniq!
|
533
582
|
rescue => err
|
534
|
-
|
535
|
-
getch
|
583
|
+
_tmp_error(err)
|
536
584
|
end
|
537
585
|
|
538
586
|
def remove_post(num)
|
data/lib/runeblog_version.rb
CHANGED
data/lib/xlate.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
LEXT = ".lt3"
|
3
3
|
|
4
4
|
def stale?(src, dst, force = false)
|
5
|
+
meh = File.new("/tmp/dammit-#{src.gsub(/\//, "-")}", "w")
|
5
6
|
log!(enter: __method__, args: [src, dst], level: 3)
|
6
7
|
raise "Source #{src} not found in #{Dir.pwd}" unless File.exist?(src)
|
7
8
|
return true if force
|
@@ -23,15 +24,15 @@ def xlate(cwd: Dir.pwd, src:,
|
|
23
24
|
STDERR.puts "#{indent} from: #{caller[0]}"
|
24
25
|
STDERR.puts "#{indent} copy: #{copy}" if copy
|
25
26
|
end
|
26
|
-
|
27
|
-
|
27
|
+
stale = stale?(src, dst, force)
|
28
|
+
if stale
|
29
|
+
rc = system("livetext #{src} >#{dst}")
|
30
|
+
STDERR.puts "...completed (shell returned #{rc})" if debug
|
31
|
+
system!("cp #{dst} #{copy}") if copy
|
28
32
|
else
|
29
33
|
STDERR.puts "#{indent} -- ^ Already up to date!" if debug
|
30
34
|
return
|
31
35
|
end
|
32
|
-
rc = system("livetext #{src} >#{dst}")
|
33
|
-
STDERR.puts "...completed (shell returned #{rc})" if debug
|
34
|
-
system!("cp #{dst} #{copy}") if copy
|
35
36
|
end
|
36
37
|
end
|
37
38
|
|
data/test/austin.rb
CHANGED
@@ -119,6 +119,8 @@ Contact light. Houston, this is Tranquility Base. The Eagle has
|
|
119
119
|
landed. That's one small step for (a) man, one giant leap for
|
120
120
|
mankind.
|
121
121
|
|
122
|
+
Here's the PDF of $$link["Ruby for the Old-Time C Programmer"|http://rubyhacker.com/blog2/rubydino.pdf]
|
123
|
+
|
122
124
|
Pity this busy monster, manunkind, not. Pity rather... Listen:
|
123
125
|
There's a hell of a universe next door; let's go.
|
124
126
|
BODY
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: runeblog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.48
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Hal Fulton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-10-
|
11
|
+
date: 2019-10-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: livetext
|