runeblog 0.2.37 → 0.2.42
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/mkwidget +209 -0
- data/empty_view/themes/standard/blog/generate.lt3 +12 -12
- data/empty_view/themes/standard/blog/index.lt3 +0 -1
- data/empty_view/themes/standard/etc/blog.css.lt3 +0 -1
- data/empty_view/themes/standard/post/generate.lt3 +4 -0
- data/empty_view/themes/standard/widgets/bydates/README +2 -0
- data/empty_view/themes/standard/widgets/bydates/bydates.lt3 +2 -0
- data/empty_view/themes/standard/widgets/bydates/bydates.rb +14 -0
- data/empty_view/themes/standard/widgets/bydates/card.css +1 -0
- data/empty_view/themes/standard/widgets/bydates/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/bydates/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/bydates/main.css +2 -0
- data/empty_view/themes/standard/widgets/bydates/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/bydates/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/bydates/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/bydates/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/links/README +2 -0
- data/empty_view/themes/standard/widgets/links/card.css +1 -0
- data/empty_view/themes/standard/widgets/links/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/links/links.lt3 +1 -1
- data/empty_view/themes/standard/widgets/links/links.rb +14 -0
- data/empty_view/themes/standard/widgets/links/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/links/main.css +2 -0
- data/empty_view/themes/standard/widgets/links/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/links/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/links/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/links/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/news/README +2 -0
- data/empty_view/themes/standard/widgets/news/card.css +1 -0
- data/empty_view/themes/standard/widgets/news/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/news/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/news/main.css +2 -0
- data/empty_view/themes/standard/widgets/news/news.rb +14 -0
- data/empty_view/themes/standard/widgets/news/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/news/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/news/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/news/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/pages/card.css +1 -0
- data/empty_view/themes/standard/widgets/pages/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/pages/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/pages/local.rb +0 -8
- data/empty_view/themes/standard/widgets/pages/main.css +2 -0
- data/empty_view/themes/standard/widgets/pages/pages.rb +21 -0
- data/empty_view/themes/standard/widgets/pages/pieces/card-head.lt3 +1 -0
- data/empty_view/themes/standard/widgets/pages/pieces/card-tail.lt3 +1 -0
- data/empty_view/themes/standard/widgets/pages/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/pages/pieces/main-tail.lt3 +2 -0
- data/empty_view/themes/standard/widgets/pinned/README +2 -0
- data/empty_view/themes/standard/widgets/pinned/card.css +1 -0
- data/empty_view/themes/standard/widgets/pinned/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/pinned/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/pinned/main.css +2 -0
- data/empty_view/themes/standard/widgets/pinned/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/pinned/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/pinned/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/pinned/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/pinned/pinned.lt3 +2 -0
- data/empty_view/themes/standard/widgets/pinned/pinned.rb +14 -0
- data/empty_view/themes/standard/widgets/search/README +2 -0
- data/empty_view/themes/standard/widgets/search/card.css +1 -0
- data/empty_view/themes/standard/widgets/search/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/search/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/search/main.css +2 -0
- data/empty_view/themes/standard/widgets/search/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/search/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/search/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/search/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/search/search.lt3 +2 -0
- data/empty_view/themes/standard/widgets/search/search.rb +14 -0
- data/empty_view/themes/standard/widgets/sitemap/README +2 -0
- data/empty_view/themes/standard/widgets/sitemap/card.css +1 -0
- data/empty_view/themes/standard/widgets/sitemap/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/sitemap/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/sitemap/main.css +2 -0
- data/empty_view/themes/standard/widgets/sitemap/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/sitemap/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/sitemap/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/sitemap/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/sitemap/sitemap.lt3 +2 -0
- data/empty_view/themes/standard/widgets/sitemap/sitemap.rb +14 -0
- data/empty_view/themes/standard/widgets/tag-cloud/OLD-example.lt3 +12 -0
- data/empty_view/themes/standard/widgets/tag-cloud/README +2 -0
- data/empty_view/themes/standard/widgets/tag-cloud/card.css +1 -0
- data/empty_view/themes/standard/widgets/tag-cloud/custom.rb +1 -0
- data/empty_view/themes/standard/widgets/tag-cloud/local-vars.lt3 +12 -0
- data/empty_view/themes/standard/widgets/tag-cloud/main.css +2 -0
- data/empty_view/themes/standard/widgets/tag-cloud/pieces/card-head.lt3 +8 -0
- data/empty_view/themes/standard/widgets/tag-cloud/pieces/card-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/tag-cloud/pieces/main-head.lt3 +10 -0
- data/empty_view/themes/standard/widgets/tag-cloud/pieces/main-tail.lt3 +4 -0
- data/empty_view/themes/standard/widgets/tag-cloud/tag-cloud.lt3 +1 -10
- data/empty_view/themes/standard/widgets/tag-cloud/tag-cloud.rb +14 -0
- data/lib/default.rb +0 -3
- data/lib/helpers-repl.rb +4 -2
- data/lib/liveblog.rb +56 -9
- data/lib/repl.rb +34 -21
- data/lib/runeblog.rb +24 -10
- data/lib/runeblog_version.rb +1 -1
- data/lib/xlate.rb +5 -0
- data/test/austin.rb +150 -0
- data/test/make_blog.rb +23 -2
- metadata +88 -4
- data/empty_view/remote/widgets/pages/SUBFILES +0 -1
- data/empty_view/themes/standard/widgets/calendar/calendar.lt3 +0 -6
@@ -1,12 +1,3 @@
|
|
1
1
|
.mixin liveblog
|
2
2
|
|
3
|
-
|
4
|
-
https://google.com/,btn btn-dark m-1,Programming
|
5
|
-
https://google.com/,btn btn-danger m-1,Science Fiction
|
6
|
-
https://google.com/,btn btn-light m-1,Art
|
7
|
-
https://google.com/,btn btn-dark m-1,Robotics
|
8
|
-
https://google.com/,btn btn-warning m-1,Food and Travel
|
9
|
-
https://google.com/,btn btn-light m-1,DIY Hacks
|
10
|
-
https://google.com/,btn btn-info m-1,Surfing
|
11
|
-
.end
|
12
|
-
|
3
|
+
<h3>Currently nothing here -- not implemented</h3)
|
data/lib/helpers-repl.rb
CHANGED
@@ -40,7 +40,9 @@ module RuneBlog::REPL
|
|
40
40
|
"list assets" => :cmd_list_assets,
|
41
41
|
"lsa" => :cmd_list_assets,
|
42
42
|
|
43
|
-
"
|
43
|
+
"pages" => :cmd_pages,
|
44
|
+
|
45
|
+
"delete >postid" => :cmd_remove_post,
|
44
46
|
"undel $postid" => :cmd_undelete_post,
|
45
47
|
|
46
48
|
"edit $postid" => :cmd_edit_post,
|
@@ -103,7 +105,7 @@ module RuneBlog::REPL
|
|
103
105
|
end
|
104
106
|
meth = found || :cmd_INVALID
|
105
107
|
params = cmd if meth == :cmd_INVALID
|
106
|
-
puts "choose: #{[meth, params].inspect}"
|
108
|
+
# puts "choose: #{[meth, params].inspect}"
|
107
109
|
[meth, params]
|
108
110
|
end
|
109
111
|
|
data/lib/liveblog.rb
CHANGED
@@ -45,7 +45,7 @@ def dropcap
|
|
45
45
|
p:first-child:first-letter {
|
46
46
|
color: #0000ff;
|
47
47
|
float: left;
|
48
|
-
font-family:
|
48
|
+
font-family: Verdana;
|
49
49
|
font-size: 75px;
|
50
50
|
line-height: 60px;
|
51
51
|
padding-top: 4px;
|
@@ -142,7 +142,7 @@ def inset
|
|
142
142
|
end
|
143
143
|
lr = _args.first
|
144
144
|
wide = _args[1] || "25"
|
145
|
-
_passthru "<div style='float:#{lr}; width: #{wide}%; padding:8px; padding-right:12px; font-family:verdana'>"
|
145
|
+
_passthru "<div style='float:#{lr}; width: #{wide}%; padding:8px; padding-right:12px'>" # ; font-family:verdana'>"
|
146
146
|
_passthru '<b><i>'
|
147
147
|
_passthru box
|
148
148
|
_passthru_noline '</i></b></div>'
|
@@ -154,7 +154,8 @@ def title
|
|
154
154
|
title = @_data.chomp
|
155
155
|
@meta.title = title
|
156
156
|
setvar :title, title
|
157
|
-
|
157
|
+
# FIXME refactor -- just output variables for a template
|
158
|
+
# _out %[<h1 class="post-title">#{title}</h1><br>]
|
158
159
|
_optional_blank_line
|
159
160
|
end
|
160
161
|
|
@@ -319,9 +320,22 @@ def recent_posts # side-effect
|
|
319
320
|
HTML
|
320
321
|
end
|
321
322
|
|
322
|
-
def
|
323
|
+
def _make_class_name(app)
|
324
|
+
if app =~ /[-_]/
|
325
|
+
words = app.split(/[-_]/)
|
326
|
+
name = words.map(&:capitalize).join
|
327
|
+
else
|
328
|
+
name = app.capitalize
|
329
|
+
end
|
330
|
+
return name
|
331
|
+
end
|
332
|
+
|
333
|
+
def _load_local(widget)
|
323
334
|
Dir.chdir("widgets/#{widget}") do
|
324
|
-
|
335
|
+
rclass = _make_class_name(widget)
|
336
|
+
found = (require("./#{widget}") if File.exist?("#{widget}.rb"))
|
337
|
+
code = found ? ::RuneBlog::Widget.class_eval(rclass) : nil
|
338
|
+
code
|
325
339
|
end
|
326
340
|
rescue => err
|
327
341
|
STDOUT.puts err
|
@@ -342,7 +356,8 @@ def sidebar
|
|
342
356
|
raise "Can't find #{wtag}" unless Dir.exist?(wtag)
|
343
357
|
tcard = "#{tag}-card.html"
|
344
358
|
|
345
|
-
|
359
|
+
code = _load_local(tag)
|
360
|
+
code && Dir.chdir(wtag) { code.build }
|
346
361
|
|
347
362
|
# if File.exist?(wtag/"SUBFILES")
|
348
363
|
# children = Dir[wtag/"*.lt3"] - [wtag/tag+".lt3"]
|
@@ -623,12 +638,44 @@ def page_type(tag, title)
|
|
623
638
|
end
|
624
639
|
end
|
625
640
|
|
641
|
+
def _write_main_pages(mainfile, pairs, card_title, tag)
|
642
|
+
local = _local_tag?(tag)
|
643
|
+
pieces = @blog.view.dir/"themes/standard/widgets"/tag/:pieces
|
644
|
+
main_head = xlate! cwd: pieces, src: "main-head.lt3"
|
645
|
+
main_tail = xlate! cwd: pieces, src: "main-tail.lt3"
|
646
|
+
# ^ make into methods in pages.rb or whatever?
|
647
|
+
|
648
|
+
File.open("#{mainfile}.html", "w") do |f|
|
649
|
+
f.puts main_head
|
650
|
+
pairs.each do |file, title|
|
651
|
+
type, title = page_type(tag, title)
|
652
|
+
title = title.gsub(/\\/, "") # kludge
|
653
|
+
case type
|
654
|
+
when :local; url_ref = _widget_main(file, tag) # local always frameable
|
655
|
+
when :frame; url_ref = "href = '#{file}'" # local always frameable
|
656
|
+
when :noframe; url_ref = _blank(file) # local always frameable
|
657
|
+
end
|
658
|
+
css = "color: #8888FF; text-decoration: none; font-size: 21px" # ; font-family: verdana"
|
659
|
+
f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
|
660
|
+
end
|
661
|
+
f.puts main_tail
|
662
|
+
end
|
663
|
+
end
|
664
|
+
|
626
665
|
def _write_main(mainfile, pairs, card_title, tag)
|
627
666
|
log!(str: "Creating #{mainfile}.html", pwd: true)
|
667
|
+
|
668
|
+
if tag == "pages" # temporary experiment
|
669
|
+
_write_main_pages(mainfile, pairs, card_title, tag)
|
670
|
+
return
|
671
|
+
end
|
672
|
+
|
628
673
|
local = _local_tag?(tag)
|
674
|
+
setvar "card.title", card_title
|
675
|
+
css = "* { font-family: verdana }"
|
629
676
|
File.open("#{mainfile}.html", "w") do |f|
|
630
|
-
_html_body(f) do
|
631
|
-
f.puts "<h1>#{card_title}</h1>"
|
677
|
+
_html_body(f, css) do
|
678
|
+
f.puts "<h1>#{card_title}</h1><br><hr>"
|
632
679
|
pairs.each do |file, title|
|
633
680
|
type, title = page_type(tag, title)
|
634
681
|
title = title.gsub(/\\/, "") # kludge
|
@@ -637,7 +684,7 @@ def _write_main(mainfile, pairs, card_title, tag)
|
|
637
684
|
when :frame; url_ref = "href = '#{file}'" # local always frameable
|
638
685
|
when :noframe; url_ref = _blank(file) # local always frameable
|
639
686
|
end
|
640
|
-
css = "color: #8888FF; text-decoration: none; font-size:
|
687
|
+
css = "color: #8888FF; text-decoration: none; font-size: 21px" # ; font-family: verdana"
|
641
688
|
f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
|
642
689
|
end
|
643
690
|
end
|
data/lib/repl.rb
CHANGED
@@ -36,28 +36,40 @@ module RuneBlog::REPL
|
|
36
36
|
@out
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
39
|
+
def cmd_pages(arg, testing = false)
|
40
40
|
check_empty(arg)
|
41
|
-
dir = @blog.view.dir
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
41
|
+
dir = @blog.view.dir/"themes/standard/widgets/pages"
|
42
|
+
# Assume child files already generated (and list.data??)
|
43
|
+
data = dir/"list.data"
|
44
|
+
lines = File.readlines(data)
|
45
|
+
hash = {}
|
46
|
+
lines.each do |line|
|
47
|
+
url, name = line.chomp.split(",")
|
48
|
+
source = url.sub(/.html$/, ".lt3")
|
49
|
+
hash[name] = source
|
50
|
+
end
|
51
|
+
new_item = "[New page]"
|
52
|
+
num, fname = STDSCR.menu(title: "Edit page:", items: hash.keys + [new_item])
|
53
|
+
return if fname.nil?
|
54
|
+
if fname == new_item
|
55
|
+
print "Page title: "
|
56
|
+
title = RubyText.gets
|
57
|
+
title.chomp!
|
58
|
+
print "File name (.lt3): "
|
59
|
+
fname = RubyText.gets
|
60
|
+
fname << ".lt3" unless fname.end_with?(".lt3")
|
61
|
+
fhtml = fname.sub(/.lt3$/, ".html")
|
62
|
+
File.open(data, "a") {|f| f.puts "#{fhtml},#{title}" }
|
63
|
+
new_file = dir/fname
|
64
|
+
File.open(new_file, "w") do |f|
|
65
|
+
f.puts "<h1>#{title}</h1>\n\n\n "
|
66
|
+
f.puts ".backlink"
|
67
|
+
end
|
68
|
+
edit_file(new_file)
|
69
|
+
else
|
70
|
+
target = hash[fname]
|
71
|
+
edit_file(dir/target)
|
72
|
+
end
|
61
73
|
end
|
62
74
|
|
63
75
|
def cmd_import(arg, testing = false)
|
@@ -143,6 +155,7 @@ module RuneBlog::REPL
|
|
143
155
|
n = viewnames.find_index(@blog.view.name)
|
144
156
|
name = @blog.view.name
|
145
157
|
k, name = STDSCR.menu(title: "Views", items: viewnames, curr: n) unless testing
|
158
|
+
return if name.nil?
|
146
159
|
@blog.view = name
|
147
160
|
output name + "\n"
|
148
161
|
puts "\n ", fx(name, :bold), "\n" unless testing
|
data/lib/runeblog.rb
CHANGED
@@ -289,7 +289,7 @@ class RuneBlog
|
|
289
289
|
vp
|
290
290
|
end
|
291
291
|
|
292
|
-
def
|
292
|
+
def index_entry(slug)
|
293
293
|
log!(enter: __method__, args: [slug])
|
294
294
|
id = slug.to_i
|
295
295
|
text = nil
|
@@ -303,7 +303,7 @@ class RuneBlog
|
|
303
303
|
path = vp.path
|
304
304
|
url = aslug + ".html"
|
305
305
|
date = ::Date.parse(date)
|
306
|
-
date = date.strftime("%B %e<br>%Y")
|
306
|
+
date = date.strftime("%B %e<br><div style='float: right'>%Y</div>")
|
307
307
|
text = interpolate(@_post_entry, binding)
|
308
308
|
text
|
309
309
|
end
|
@@ -328,7 +328,7 @@ class RuneBlog
|
|
328
328
|
wanted.times do
|
329
329
|
postid = File.basename(enum.next)
|
330
330
|
postid = postid.to_i
|
331
|
-
text <<
|
331
|
+
text << index_entry(postid) # side effect! calls _out
|
332
332
|
end
|
333
333
|
text << "</body></html>"
|
334
334
|
File.write(@vdir/:remote/file, text)
|
@@ -393,13 +393,15 @@ class RuneBlog
|
|
393
393
|
|
394
394
|
def generate_view(view) # huh?
|
395
395
|
log!(enter: __method__, args: [view])
|
396
|
-
|
396
|
+
# generate_index(view) # recent posts (recent.html)
|
397
397
|
vdir = @root/:views/view
|
398
398
|
@theme = @root/:views/view/:themes/:standard
|
399
399
|
xlate cwd: vdir/"themes/standard/etc",
|
400
400
|
src: "blog.css.lt3", copy: vdir/"remote/etc/blog.css" # , debug: true
|
401
401
|
xlate cwd: vdir/"themes/standard",
|
402
402
|
src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
|
403
|
+
generate_index(view) # recent posts (recent.html)
|
404
|
+
# ^ HERE
|
403
405
|
copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
|
404
406
|
rescue => err
|
405
407
|
puts err
|
@@ -436,9 +438,20 @@ class RuneBlog
|
|
436
438
|
log!(enter: __method__, args: [draft, pdraft])
|
437
439
|
Dir.chdir(pdraft) do
|
438
440
|
excerpt = File.read("teaser.txt")
|
441
|
+
date = _retrieve_metadata(:date)
|
442
|
+
longdate = ::Date.parse(date).strftime("%B %e, %Y")
|
439
443
|
title = _retrieve_metadata(:title)
|
440
|
-
vars =
|
441
|
-
|
444
|
+
vars = <<~LIVE
|
445
|
+
.heredoc title
|
446
|
+
#{title.chomp}
|
447
|
+
.end
|
448
|
+
.heredoc teaser
|
449
|
+
#{excerpt.chomp}
|
450
|
+
.end
|
451
|
+
.heredoc longdate
|
452
|
+
#{longdate}
|
453
|
+
.end
|
454
|
+
LIVE
|
442
455
|
File.open(pdraft/"vars.lt3", "w") {|f| f.puts vars }
|
443
456
|
end
|
444
457
|
end
|
@@ -454,8 +467,8 @@ class RuneBlog
|
|
454
467
|
rem = w.sub(/themes.standard/, "remote")
|
455
468
|
create_dirs(rem)
|
456
469
|
files = Dir[w/"*"]
|
457
|
-
|
458
|
-
system!("cp #{
|
470
|
+
files = files.select {|x| x =~ /(html|css)$/ }
|
471
|
+
files.each {|file| system!("cp #{file} #{rem}") }
|
459
472
|
end
|
460
473
|
end
|
461
474
|
|
@@ -493,11 +506,12 @@ class RuneBlog
|
|
493
506
|
views = _get_views(draft)
|
494
507
|
views.each do |view|
|
495
508
|
_handle_post(draft, view)
|
496
|
-
|
509
|
+
# generate_view(view) # FIXME leads to inefficiency?
|
510
|
+
# ^ HERE
|
497
511
|
end
|
498
512
|
end
|
499
513
|
|
500
|
-
def
|
514
|
+
def OLD_index_entry(view, meta)
|
501
515
|
log!(enter: __method__, args: [view, meta])
|
502
516
|
debug "=== index_entry #{view.to_s.inspect} #{meta.num} #{meta.title.inspect}"
|
503
517
|
check_meta(meta, "index_entry1")
|
data/lib/runeblog_version.rb
CHANGED
data/lib/xlate.rb
CHANGED
@@ -35,3 +35,8 @@ LEXT = ".lt3"
|
|
35
35
|
end
|
36
36
|
end
|
37
37
|
|
38
|
+
def xlate!(cwd: Dir.pwd, src:, copy: nil, debug: false, force: false)
|
39
|
+
output = "/tmp/xlate-#{File.basename(src).sub(/.lt3$/, "")}"
|
40
|
+
xlate cwd: cwd, src: src, dst: output, debug: debug, force: force
|
41
|
+
File.read(output + ".html") # return all content as string
|
42
|
+
end
|
data/test/austin.rb
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
$LOAD_PATH << "./lib"
|
2
|
+
|
3
|
+
major, minor = RUBY_VERSION.split(".").values_at(0,1)
|
4
|
+
ver = major.to_i*10 + minor.to_i
|
5
|
+
abort "Need Ruby 2.4 or greater" unless ver >= 24
|
6
|
+
|
7
|
+
Home = Dir.pwd
|
8
|
+
|
9
|
+
require 'global'
|
10
|
+
require 'runeblog'
|
11
|
+
require 'repl'
|
12
|
+
|
13
|
+
def bold(str)
|
14
|
+
"\e[1m#{str}\e[0m"
|
15
|
+
end
|
16
|
+
|
17
|
+
def getch
|
18
|
+
# sleep 5
|
19
|
+
end
|
20
|
+
|
21
|
+
def debug(str = "")
|
22
|
+
t = Time.now
|
23
|
+
time = t.to_f.to_s
|
24
|
+
n = time.index(".")
|
25
|
+
msec = time[n..(n+2)]
|
26
|
+
time = t.strftime("%H:%M:%S") + msec
|
27
|
+
STDERR.puts "#{'%-11s' % time} #{str}"
|
28
|
+
end
|
29
|
+
|
30
|
+
def make_post(x, title, teaser, body, views=[])
|
31
|
+
debug " make_post #{bold(title)}"
|
32
|
+
x.create_new_post(title, true, teaser: teaser, body: body, views: views)
|
33
|
+
views.each do |view|
|
34
|
+
debug
|
35
|
+
debug "** generate_index #{bold(view)}"
|
36
|
+
x.generate_index(view)
|
37
|
+
end # recent.html
|
38
|
+
end
|
39
|
+
|
40
|
+
def show_lines(text)
|
41
|
+
lines = text.split("\n")
|
42
|
+
str = "#{lines.size} lines\n"
|
43
|
+
lines.each {|line| str << " #{line.inspect}\n" }
|
44
|
+
str
|
45
|
+
end
|
46
|
+
|
47
|
+
# "Main"...
|
48
|
+
|
49
|
+
t0 = Time.now
|
50
|
+
|
51
|
+
puts bold("\nGenerating test blog...")
|
52
|
+
|
53
|
+
system("rm -rf .blogs")
|
54
|
+
RuneBlog.create_new_blog_repo(".blogs")
|
55
|
+
x = RuneBlog.new(".blogs")
|
56
|
+
|
57
|
+
debug("create_view: #{bold('around_austin')}")
|
58
|
+
x.create_view("around_austin") # FIXME remember view title!
|
59
|
+
|
60
|
+
#### FIXME later!!
|
61
|
+
vars = <<-VARS
|
62
|
+
|
63
|
+
.variables
|
64
|
+
blog Around Austin
|
65
|
+
blog.desc The view from downtown...
|
66
|
+
.end
|
67
|
+
VARS
|
68
|
+
File.open(".blogs/views/around_austin/themes/standard/global.lt3", "a") do |f|
|
69
|
+
f.puts vars
|
70
|
+
end
|
71
|
+
####
|
72
|
+
|
73
|
+
debug("-- change_view: #{bold('around_austin')}")
|
74
|
+
x.change_view("around_austin") # 1 2 7 8 9
|
75
|
+
|
76
|
+
make_post(x, "What's at Stubbs...", <<-EXCERPT, <<-BODY, [])
|
77
|
+
Stubbs has been around for longer than civilization.
|
78
|
+
EXCERPT
|
79
|
+
That's a good thing. But their music isn't always the greatest.
|
80
|
+
BODY
|
81
|
+
|
82
|
+
make_post(x, "The new amphitheatre is overrated", <<-EXCERPT, <<-BODY)
|
83
|
+
It used to be that all major concerts played the Erwin Center.
|
84
|
+
EXCERPT
|
85
|
+
Now, depending on what you consider "major," blah blah blah...
|
86
|
+
BODY
|
87
|
+
|
88
|
+
make_post(x, "The graffiti wall", <<-EXCERPT, <<-BODY)
|
89
|
+
RIP, Hope Gallery
|
90
|
+
EXCERPT
|
91
|
+
.dropcap
|
92
|
+
|
93
|
+
It's been a while since I was there. They say it was torn down
|
94
|
+
while I wasn't looking.
|
95
|
+
|
96
|
+
This fake entry is a long one so as to demonstrate both drop-caps
|
97
|
+
(above) and an inset quote. Blah blah blah. Lorem ipsum dolor and
|
98
|
+
a partridge in a pear tree.
|
99
|
+
|
100
|
+
Wherever you go, there you are. Last night I saw upon the stair
|
101
|
+
a little man who was not there. He wasn't there again today; I
|
102
|
+
wish, I wish he'd go away.
|
103
|
+
|
104
|
+
As far as we know, our computer has never had an undetected error.
|
105
|
+
And never let it be denied that pobbles are happier without their
|
106
|
+
toes. And may your snark never be a boojum.
|
107
|
+
|
108
|
+
Contact light. Houston, this is Tranquility Base. The Eagle has
|
109
|
+
landed. That's one small step for (a) man, one giant leap for
|
110
|
+
mankind.
|
111
|
+
.inset left 20
|
112
|
+
On a clean disk, you can seek forever.
|
113
|
+
.end
|
114
|
+
|
115
|
+
Pity this busy monster, manunkind, not. Pity rather... Listen:
|
116
|
+
There's a hell of a universe next door; let's go.
|
117
|
+
BODY
|
118
|
+
|
119
|
+
make_post(x, "The Waller Creek project", <<-EXCERPT, <<-BODY)
|
120
|
+
Will it ever be finished?
|
121
|
+
EXCERPT
|
122
|
+
Blah blah Waller Creek blah blah...
|
123
|
+
BODY
|
124
|
+
|
125
|
+
make_post(x, "Life on Sabine Street", <<-EXCERPT, <<-BODY)
|
126
|
+
It's like Pooh Corner, except not.
|
127
|
+
EXCERPT
|
128
|
+
This is about Sabine St, blah blah lorem ipsum dolor...
|
129
|
+
BODY
|
130
|
+
|
131
|
+
make_post(x, "Remember Modest Mouse?", <<-EXCERPT, <<-BODY, [])
|
132
|
+
They date to the 90s or before.
|
133
|
+
EXCERPT
|
134
|
+
But I first heard of them
|
135
|
+
in 2005.
|
136
|
+
BODY
|
137
|
+
|
138
|
+
debug
|
139
|
+
debug("** generate_view: #{bold('around_austin')}")
|
140
|
+
x.generate_view("around_austin")
|
141
|
+
x.change_view("around_austin")
|
142
|
+
debug
|
143
|
+
|
144
|
+
puts bold("...finished.\n")
|
145
|
+
|
146
|
+
t1 = Time.now
|
147
|
+
|
148
|
+
elapsed = t1 - t0
|
149
|
+
puts "\nElapsed: #{'%3.2f' % elapsed} secs\n "
|
150
|
+
|