runeblog 0.2.71 → 0.2.76
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/{ROOT.txt → ROOT} +0 -0
- data/empty_view/themes/standard/etc/misc.js +1 -0
- data/lib/global.rb +1 -0
- data/lib/helpers-blog.rb +57 -11
- data/lib/liveblog.rb +5 -18
- data/lib/post.rb +1 -8
- data/lib/runeblog.rb +34 -68
- data/lib/runeblog_version.rb +1 -3
- data/lib/view.rb +1 -0
- data/lib/xlate.rb +14 -10
- data/runeblog.gemspec +1 -1
- data/test/austin.rb +60 -60
- metadata +9 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0c80c77d6bdb17bf32c8a90ed26aa3e98b43493c7b38f7341a359e53bda7cff
|
4
|
+
data.tar.gz: 89d0a30d6f2ac56b932c8fd65d966ddcebed9320627ec032ae2d2ac68971a2e6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6bc7626f7e00f7e656982c3bb6f5fea92da173ae430a1b4cdb888dfb170a6af84c33dcd99b6541f57e67c716e23ed484e947ba616f43156dacc7242a97871af2
|
7
|
+
data.tar.gz: dd235b09c2f2f592f5a16afa574c62949731cbd634945b79e6969cfdfedbd9eb1132dad5bbd976416354972b4b9bf9d585e75bcd7aec264ec1d40c8f57e92a34
|
data/data/{ROOT.txt → ROOT}
RENAMED
File without changes
|
data/lib/global.rb
CHANGED
data/lib/helpers-blog.rb
CHANGED
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'runeblog_version'
|
2
2
|
require 'fileutils'
|
3
3
|
|
4
|
-
#require 'pathmagic'
|
5
4
|
require 'xlate'
|
6
5
|
|
7
6
|
module RuneBlog::Helpers
|
@@ -20,38 +19,84 @@ module RuneBlog::Helpers
|
|
20
19
|
puts " Failed: #{cmd} - from #{caller[0]}" unless rc
|
21
20
|
end
|
22
21
|
|
22
|
+
def get_repo_config
|
23
|
+
log!(enter: __method__, level: 3)
|
24
|
+
@editor = File.read(".blogs/data/EDITOR").chomp
|
25
|
+
@current_view = File.read(".blogs/data/VIEW").chomp
|
26
|
+
@root = File.read(".blogs/data/ROOT").chomp
|
27
|
+
rescue => err
|
28
|
+
puts "Can't read config: #{err}"
|
29
|
+
puts err.backtrace.join("\n")
|
30
|
+
puts "dir = #{Dir.pwd}"
|
31
|
+
end
|
32
|
+
|
23
33
|
def copy_data(tag, dest)
|
24
|
-
data = RuneBlog::Path
|
34
|
+
data = RuneBlog::Path + "/../data" # files kept inside gem
|
25
35
|
case tag
|
26
36
|
when :config; files = %w[ROOT VIEW EDITOR]
|
27
37
|
end
|
28
|
-
files.each {|file| copy(data/file, dest) }
|
38
|
+
files.each {|file| copy(data + "/" + file, dest) }
|
29
39
|
end
|
30
40
|
|
31
|
-
def read_config
|
32
|
-
log!(enter: __method__, level: 3)
|
33
|
-
|
34
|
-
|
35
|
-
|
41
|
+
def read_config(file, *syms)
|
42
|
+
log!(enter: __method__, args: [file, *syms], level: 3)
|
43
|
+
lines = File.readlines(file).map(&:chomp)
|
44
|
+
obj = ::OpenStruct.new
|
45
|
+
lines.each do |line|
|
46
|
+
next if line == "\n" || line[0] == "#"
|
47
|
+
key, val = line.split(/: +/, 2)
|
48
|
+
obj.send(key+"=", val)
|
49
|
+
end
|
50
|
+
return obj if syms.empty?
|
51
|
+
|
52
|
+
vals = []
|
53
|
+
if syms.empty?
|
54
|
+
vals = obj.to_hash.values
|
55
|
+
else
|
56
|
+
syms.each {|sym| vals << obj.send(sym) }
|
57
|
+
end
|
58
|
+
return vals
|
36
59
|
rescue => err
|
37
|
-
puts "Can't read config: #{err}"
|
60
|
+
puts "Can't read config file '#{file}': #{err}"
|
38
61
|
puts err.backtrace.join("\n")
|
39
62
|
puts "dir = #{Dir.pwd}"
|
40
63
|
exit
|
41
64
|
end
|
42
65
|
|
66
|
+
def try_read_config(file, hash)
|
67
|
+
log!(enter: __method__, args: [file, hash], level: 3)
|
68
|
+
return hash.values unless File.exist?(file)
|
69
|
+
vals = read_config(file, *hash.keys)
|
70
|
+
vals
|
71
|
+
end
|
72
|
+
|
73
|
+
def write_config(obj, file)
|
74
|
+
log!(enter: __method__, args: [obj, file], level: 2)
|
75
|
+
hash = obj.to_h
|
76
|
+
File.open(file, "w") do |out|
|
77
|
+
hash.each_pair {|key, val| out.puts "#{key}: #{val}" }
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
43
81
|
def get_views # read from filesystem
|
44
82
|
log!(enter: __method__, level: 3)
|
45
83
|
dirs = subdirs("#@root/views/").sort
|
46
84
|
dirs.map {|name| RuneBlog::View.new(name) }
|
47
85
|
end
|
48
86
|
|
87
|
+
def write_repo_config(root: "#{Dir.pwd}/.blogs", view: "#{root}/data/VIEW", editor: "#{root}/data/EDITOR")
|
88
|
+
File.write(root + "/data/ROOT", root + "\n")
|
89
|
+
File.write(root + "/data/VIEW", view.to_s + "\n")
|
90
|
+
File.write(root + "/data/EDITOR", editor + "\n")
|
91
|
+
end
|
92
|
+
|
49
93
|
def new_dotfile(root: ".blogs", current_view: "test_view", editor: "vi")
|
50
94
|
log!(enter: __method__, args: [root, current_view, editor], level: 3)
|
51
|
-
root = Dir.pwd/root
|
95
|
+
root = Dir.pwd + "/" + root
|
52
96
|
x = OpenStruct.new
|
53
97
|
x.root, x.current_view, x.editor = root, current_view, editor
|
54
|
-
write_config(x, root/RuneBlog::ConfigFile)
|
98
|
+
write_config(x, root + "/" + RuneBlog::ConfigFile)
|
99
|
+
write_repo_config
|
55
100
|
end
|
56
101
|
|
57
102
|
def new_sequence
|
@@ -63,6 +108,7 @@ module RuneBlog::Helpers
|
|
63
108
|
|
64
109
|
def subdirs(dir)
|
65
110
|
log!(enter: __method__, args: [dir], level: 3)
|
111
|
+
STDERR.puts dir
|
66
112
|
dirs = Dir.entries(dir) - %w[. ..]
|
67
113
|
dirs.reject! {|x| ! File.directory?("#@root/views/#{x}") }
|
68
114
|
dirs
|
data/lib/liveblog.rb
CHANGED
@@ -4,16 +4,14 @@ require 'date'
|
|
4
4
|
require 'find'
|
5
5
|
|
6
6
|
require 'runeblog'
|
7
|
-
|
7
|
+
require 'pathmagic'
|
8
8
|
require 'xlate'
|
9
9
|
|
10
10
|
|
11
11
|
def init_liveblog # FIXME - a lot of this logic sucks
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
Dir.chdir(here) # here??? or dir??
|
16
|
-
@blog = RuneBlog.new(dir)
|
12
|
+
dir = Dir.pwd.sub(/\.blogs.*/, "")
|
13
|
+
@blog = nil
|
14
|
+
Dir.chdir(dir) { @blog = RuneBlog.new }
|
17
15
|
@root = @blog.root
|
18
16
|
@view = @blog.view
|
19
17
|
@view_name = @blog.view.name unless @view.nil?
|
@@ -118,7 +116,6 @@ def banner
|
|
118
116
|
str2 << " <td colspan=#{span}><img src=#{image} #{width} height=#{high}></img></td>" + "\n"
|
119
117
|
when "svg_title"
|
120
118
|
stuff, hash = _svg_title(*data)
|
121
|
-
STDERR.puts hash.inspect
|
122
119
|
wide = hash["width"]
|
123
120
|
str2 << " <td colspan=#{span} width=#{wide}>#{stuff}</td>" + "\n"
|
124
121
|
when "text"
|
@@ -443,14 +440,10 @@ rescue => err
|
|
443
440
|
end
|
444
441
|
|
445
442
|
def write_post
|
446
|
-
STDERR.puts :wp1
|
447
443
|
raise "'post' was not called" unless @meta
|
448
|
-
STDERR.puts :wp2
|
449
444
|
@meta.views = @meta.views.join(" ") if @meta.views.is_a? Array
|
450
445
|
@meta.tags = @meta.tags.join(" ") if @meta.tags.is_a? Array
|
451
|
-
STDERR.puts :wp3
|
452
446
|
_write_metadata
|
453
|
-
STDERR.puts :wp4
|
454
447
|
rescue => err
|
455
448
|
puts "err = #{err}"
|
456
449
|
puts err.backtrace.join("\n")
|
@@ -471,19 +464,13 @@ def teaser
|
|
471
464
|
end
|
472
465
|
|
473
466
|
def finalize
|
474
|
-
STDERR.puts :final1
|
475
467
|
return unless @meta
|
476
|
-
STDERR.puts :final2
|
477
468
|
return @meta if @blog.nil?
|
478
|
-
STDERR.puts :final3
|
479
469
|
|
480
470
|
@slug = @blog.make_slug(@meta)
|
481
|
-
STDERR.puts :final4
|
482
471
|
slug_dir = @slug
|
483
472
|
@postdir = @blog.view.dir/:posts/slug_dir
|
484
|
-
STDERR.puts :final5
|
485
473
|
write_post
|
486
|
-
STDERR.puts :final6
|
487
474
|
@meta
|
488
475
|
end
|
489
476
|
|
@@ -758,7 +745,7 @@ def navbar
|
|
758
745
|
end
|
759
746
|
|
760
747
|
def _make_navbar(orient = :horiz)
|
761
|
-
vdir = @blog.view
|
748
|
+
vdir = @root/:views/@blog.view
|
762
749
|
title = _var(:blog)
|
763
750
|
|
764
751
|
extra = ""
|
data/lib/post.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require 'runeblog'
|
2
2
|
require 'global'
|
3
|
-
|
3
|
+
require 'pathmagic'
|
4
4
|
|
5
5
|
class RuneBlog::Post
|
6
6
|
|
@@ -42,9 +42,7 @@ puts "-- load: opening #{pdir}"
|
|
42
42
|
fname2 = "metadata.txt"
|
43
43
|
hash = meta.to_h
|
44
44
|
|
45
|
-
p :wmd1
|
46
45
|
File.write("teaser.txt", hash[:teaser])
|
47
|
-
p :wmd2
|
48
46
|
hash.delete(:teaser)
|
49
47
|
hash.delete(:body)
|
50
48
|
|
@@ -108,14 +106,9 @@ p :wmd2
|
|
108
106
|
def build
|
109
107
|
log!(enter: __method__)
|
110
108
|
post = self
|
111
|
-
p :bld1
|
112
109
|
views = post.meta.views
|
113
|
-
p :bld2
|
114
110
|
text = File.read(@draft)
|
115
|
-
p :bld3
|
116
|
-
p @draft
|
117
111
|
@blog.generate_post(@draft)
|
118
|
-
p :bld4
|
119
112
|
end
|
120
113
|
end
|
121
114
|
|
data/lib/runeblog.rb
CHANGED
@@ -12,13 +12,14 @@ require 'view'
|
|
12
12
|
require 'publish'
|
13
13
|
require 'post'
|
14
14
|
|
15
|
-
|
15
|
+
require 'pathmagic'
|
16
16
|
|
17
17
|
###
|
18
18
|
|
19
19
|
class RuneBlog
|
20
20
|
|
21
21
|
DotDir = ".blogs"
|
22
|
+
ConfigFile = "config"
|
22
23
|
Themes = RuneBlog::Path/"../themes"
|
23
24
|
|
24
25
|
make_exception(:FileNotFound, "File $1 was not found")
|
@@ -52,49 +53,46 @@ class RuneBlog
|
|
52
53
|
puts "Error: See #{out}"
|
53
54
|
end
|
54
55
|
|
55
|
-
def self.create_new_blog_repo(
|
56
|
-
log!(enter: __method__, args: [
|
57
|
-
raise ArgumentError unless
|
58
|
-
root_dir = Dir.pwd/root
|
59
|
-
# Crude - FIXME later - # What views are there? Publishing, etc.
|
56
|
+
def self.create_new_blog_repo(root_rel = ".blogs")
|
57
|
+
log!(enter: __method__, args: [root_rel])
|
58
|
+
raise ArgumentError unless root_rel.is_a?(String) && ! root_rel.empty?
|
60
59
|
self.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
61
|
-
|
62
|
-
raise BlogRepoAlreadyExists if Dir.exist?(
|
63
|
-
create_dirs(
|
64
|
-
Dir.chdir(
|
60
|
+
repo_root = Dir.pwd/root_rel
|
61
|
+
raise BlogRepoAlreadyExists if Dir.exist?(repo_root)
|
62
|
+
create_dirs(repo_root)
|
63
|
+
Dir.chdir(repo_root) do
|
65
64
|
create_dirs(:data, :drafts, :views, :posts)
|
66
|
-
copy_data(:config, "./data/")
|
67
|
-
File.write("data/ROOT", Dir.pwd + "\n")
|
68
65
|
new_sequence
|
69
66
|
end
|
70
|
-
|
67
|
+
copy_data(:config, repo_root/:data)
|
68
|
+
write_repo_config(root: repo_root)
|
69
|
+
@blog = self.new
|
71
70
|
@blog
|
72
71
|
rescue => err
|
73
|
-
puts "Can't create blog repo: '#{
|
72
|
+
puts "Can't create blog repo: '#{repo_root}' - #{err}"
|
74
73
|
puts err.backtrace.join("\n")
|
75
74
|
end
|
76
75
|
|
77
|
-
def self.open(
|
78
|
-
log!(enter: __method__, args: [
|
79
|
-
# Crude - FIXME later - # What views are there? Publishing, etc.
|
76
|
+
def self.open(root_rel = ".blogs")
|
77
|
+
log!(enter: __method__, args: [root_rel])
|
80
78
|
self.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
81
|
-
|
82
|
-
blog = self.new(root)
|
79
|
+
blog = self.new(root_rel)
|
83
80
|
rescue => err
|
84
81
|
_tmp_error(err)
|
85
82
|
end
|
86
83
|
|
87
|
-
def initialize(
|
88
|
-
log!(enter: "initialize", args: [
|
89
|
-
# Crude - FIXME later - # What views are there? Publishing, etc.
|
84
|
+
def initialize(root_rel = ".blogs") # always assumes existing blog
|
85
|
+
log!(enter: "initialize", args: [root_rel])
|
90
86
|
self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
91
87
|
|
92
|
-
@root =
|
93
|
-
|
88
|
+
@root = Dir.pwd/root_rel
|
89
|
+
copy_data(:config, @root/:data)
|
90
|
+
write_repo_config(root: @root)
|
91
|
+
get_repo_config
|
94
92
|
@views = get_views
|
95
93
|
md = Dir.pwd.match(%r[.*/views/(.*?)/])
|
96
94
|
if md
|
97
|
-
@view_name = md[1]
|
95
|
+
@view_name = md[1]
|
98
96
|
@view = str2view(@view_name)
|
99
97
|
end
|
100
98
|
@sequence = get_sequence
|
@@ -193,7 +191,6 @@ class RuneBlog
|
|
193
191
|
|
194
192
|
def view=(arg)
|
195
193
|
log!(enter: __method__, args: [arg], level: 2)
|
196
|
-
# FIXME should write VIEW file?
|
197
194
|
case arg
|
198
195
|
when RuneBlog::View
|
199
196
|
@view = arg
|
@@ -224,15 +221,15 @@ class RuneBlog
|
|
224
221
|
|
225
222
|
def viewdir(v = nil) # delete?
|
226
223
|
log!(enter: __method__, args: [v], level: 3)
|
224
|
+
v ||= @view
|
227
225
|
v = str2view(v) if v.is_a?(String)
|
228
226
|
raise ArgumentError unless v.nil? || v.is_a?(RuneBlog::View)
|
229
|
-
v ||= @view
|
230
227
|
return @root/:views/v
|
231
228
|
end
|
232
229
|
|
233
230
|
def self.exist?
|
234
231
|
log!(enter: __method__, level: 3)
|
235
|
-
Dir.exist?(DotDir)
|
232
|
+
Dir.exist?(DotDir)
|
236
233
|
end
|
237
234
|
|
238
235
|
def mark_last_published(str)
|
@@ -243,7 +240,8 @@ class RuneBlog
|
|
243
240
|
def add_view(view_name)
|
244
241
|
log!(enter: __method__, args: [view_name], level: 2)
|
245
242
|
view = RuneBlog::View.new(view_name)
|
246
|
-
|
243
|
+
self.view = view # current view
|
244
|
+
File.write(@root/"data/VIEW", view_name)
|
247
245
|
@views << view # all views
|
248
246
|
view
|
249
247
|
end
|
@@ -272,7 +270,6 @@ class RuneBlog
|
|
272
270
|
|
273
271
|
def create_view(view_name)
|
274
272
|
log!(enter: __method__, args: [view_name], level: 2)
|
275
|
-
check_valid_new_view(view_name)
|
276
273
|
make_empty_view_tree(view_name)
|
277
274
|
add_view(view_name)
|
278
275
|
mark_last_published("Initial creation")
|
@@ -321,11 +318,8 @@ class RuneBlog
|
|
321
318
|
text = nil
|
322
319
|
@theme = @view.dir/"themes/standard"
|
323
320
|
post_entry_name = @theme/"blog/post_entry.lt3"
|
324
|
-
# STDERR.puts "-- @pename = #{post_entry_name}"
|
325
|
-
# STDERR.puts "-- @pe = #{@_post_entry.inspect}"
|
326
321
|
depend = [post_entry_name]
|
327
322
|
xlate src: post_entry_name, dst: "/tmp/post_entry.html" # , deps: depend # , debug: true
|
328
|
-
# STDERR.puts "-- xlate result: #{`ls -l /tmp/post_entry.html`}"
|
329
323
|
@_post_entry ||= File.read("/tmp/post_entry.html")
|
330
324
|
vp = post_lookup(id)
|
331
325
|
nslug, aslug, title, date, teaser_text =
|
@@ -376,7 +370,7 @@ class RuneBlog
|
|
376
370
|
text << entry
|
377
371
|
end
|
378
372
|
text << "</body></html>"
|
379
|
-
File.write(@vdir/:remote/file, text
|
373
|
+
File.write(@vdir/:remote/file, text)
|
380
374
|
return posts.size
|
381
375
|
rescue => err
|
382
376
|
_tmp_error(err)
|
@@ -388,15 +382,10 @@ class RuneBlog
|
|
388
382
|
meta = nil
|
389
383
|
views = views + [self.view.to_s]
|
390
384
|
views.uniq!
|
391
|
-
p :cnp1
|
392
385
|
Dir.chdir(@root/"posts") do
|
393
|
-
p :cnp2
|
394
386
|
post = Post.create(title: title, teaser: teaser, body: body, pubdate: pubdate, views: views)
|
395
|
-
p :cnp3
|
396
387
|
post.edit unless testing
|
397
|
-
p :cnp4
|
398
388
|
post.build
|
399
|
-
p :cnp5
|
400
389
|
meta = post.meta
|
401
390
|
end
|
402
391
|
return meta.num
|
@@ -423,8 +412,8 @@ p :cnp5
|
|
423
412
|
def change_view(view)
|
424
413
|
log!(enter: __method__, args: [view], level: 3)
|
425
414
|
raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
|
426
|
-
|
427
|
-
|
415
|
+
File.write(@root/"data/VIEW", view)
|
416
|
+
# write_repo_config
|
428
417
|
self.view = view # error checking?
|
429
418
|
end
|
430
419
|
|
@@ -447,13 +436,15 @@ p :cnp5
|
|
447
436
|
# @theme/"navbar/navbar.lt3",
|
448
437
|
@theme/"blog/index.lt3"] # FIXME what about assets?
|
449
438
|
xlate cwd: vdir/"themes/standard/etc", deps: depend,
|
450
|
-
src: "blog.css.lt3", copy: vdir/"remote/etc/
|
439
|
+
src: "blog.css.lt3", copy: vdir/"remote/etc/" # , debug: true
|
451
440
|
xlate cwd: vdir/"themes/standard", deps: depend, force: true,
|
452
441
|
src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
|
453
442
|
copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
|
454
443
|
copy_widget_html(view)
|
455
444
|
rescue => err
|
456
|
-
|
445
|
+
STDERR.puts err
|
446
|
+
STDERR.puts err.backtrace.join("\n")
|
447
|
+
# _tmp_error(err)
|
457
448
|
end
|
458
449
|
|
459
450
|
def _get_views(draft)
|
@@ -487,24 +478,16 @@ p :cnp5
|
|
487
478
|
def _post_metadata(draft, pdraft)
|
488
479
|
log!(enter: __method__, args: [draft, pdraft], level: 2)
|
489
480
|
# FIXME store this somewhere
|
490
|
-
p :pm1
|
491
481
|
fname = File.basename(draft) # 0001-this-is-a-post.lt3
|
492
482
|
nslug = fname.sub(/.lt3$/, "") # 0001-this-is-a-post
|
493
483
|
aslug = nslug.sub(/\d\d\d\d-/, "") # this-is-a-post
|
494
484
|
pnum = nslug[0..3] # 0001
|
495
|
-
p :pm2
|
496
485
|
Dir.chdir(pdraft) do
|
497
|
-
p :pm3
|
498
486
|
excerpt = File.read("teaser.txt")
|
499
|
-
p :pm4
|
500
487
|
date = _retrieve_metadata(:date)
|
501
|
-
p :pm5
|
502
488
|
longdate = ::Date.parse(date).strftime("%B %e, %Y")
|
503
|
-
p :pm6
|
504
489
|
title = _retrieve_metadata(:title)
|
505
|
-
p :pm7
|
506
490
|
tags = _retrieve_metadata(:tags)
|
507
|
-
p :pm8
|
508
491
|
# FIXME simplify
|
509
492
|
vars = <<~LIVE
|
510
493
|
.set post.num = #{pnum}
|
@@ -524,9 +507,7 @@ p :pm8
|
|
524
507
|
#{longdate}
|
525
508
|
.end
|
526
509
|
LIVE
|
527
|
-
p :pm9
|
528
510
|
File.open(pdraft/"vars.lt3", "w") {|f| f.puts vars }
|
529
|
-
p :pma
|
530
511
|
end
|
531
512
|
rescue => err
|
532
513
|
_tmp_error(err)
|
@@ -562,54 +543,39 @@ p :pma
|
|
562
543
|
pdraft = @root/:posts/nslug
|
563
544
|
remote = @root/:views/view_name/:remote
|
564
545
|
@theme = @root/:views/view_name/:themes/:standard
|
565
|
-
p :hp1
|
566
546
|
# Step 1...
|
567
547
|
create_dirs(pdraft)
|
568
|
-
p :hp2
|
569
548
|
# FIXME dependencies?
|
570
549
|
xlate cwd: pdraft, src: draft, dst: "guts.html" # , debug: true
|
571
|
-
p :hp3
|
572
550
|
_post_metadata(draft, pdraft)
|
573
|
-
p :hp4
|
574
551
|
# Step 2...
|
575
552
|
vposts = @root/:views/view_name/:posts
|
576
553
|
copy!(pdraft, vposts) # ??
|
577
|
-
p :hp5
|
578
554
|
# Step 3..
|
579
555
|
copy(pdraft/"guts.html", @theme/:post)
|
580
556
|
copy(pdraft/"vars.lt3", @theme/:post)
|
581
|
-
p :hp5
|
582
557
|
# Step 4...
|
583
558
|
# FIXME dependencies?
|
584
559
|
xlate cwd: @theme/:post, src: "generate.lt3", force: true,
|
585
560
|
dst: remote/ahtml, copy: @theme/:post # , debug: true
|
586
|
-
p :hp7
|
587
561
|
# FIXME dependencies?
|
588
562
|
xlate cwd: @theme/:post, src: "permalink.lt3",
|
589
563
|
dst: remote/:permalink/ahtml # , debug: true
|
590
|
-
p :hp8
|
591
564
|
copy_widget_html(view_name)
|
592
|
-
p :hp9
|
593
565
|
rescue => err
|
594
566
|
_tmp_error(err)
|
595
567
|
end
|
596
568
|
|
597
569
|
def generate_post(draft)
|
598
570
|
log!(enter: __method__, args: [draft], level: 1)
|
599
|
-
p :gp1
|
600
571
|
views = _get_views(draft)
|
601
|
-
p :gp2
|
602
572
|
views.each do |view|
|
603
|
-
p :gp3
|
604
573
|
unless self.view?(view)
|
605
574
|
puts "Warning: '#{view}' is not a view"
|
606
575
|
next
|
607
576
|
end
|
608
|
-
p :gp4
|
609
577
|
_handle_post(draft, view)
|
610
|
-
p :gp5
|
611
578
|
end
|
612
|
-
p :gp6
|
613
579
|
rescue => err
|
614
580
|
_tmp_error(err)
|
615
581
|
end
|
data/lib/runeblog_version.rb
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
|
2
|
-
require 'pathmagic'
|
3
|
-
|
4
2
|
if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
|
5
3
|
|
6
4
|
class RuneBlog
|
7
|
-
VERSION = "0.2.
|
5
|
+
VERSION = "0.2.76"
|
8
6
|
|
9
7
|
path = Gem.find_files("runeblog").grep(/runeblog-/).first
|
10
8
|
Path = File.dirname(path)
|
data/lib/view.rb
CHANGED
data/lib/xlate.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
|
+
require 'livetext'
|
1
2
|
|
3
|
+
LIVE = Livetext.new
|
2
4
|
LEXT = ".lt3"
|
3
5
|
|
4
6
|
def newer?(f1, f2)
|
@@ -16,26 +18,28 @@ def stale?(src, dst, deps, force = false)
|
|
16
18
|
return false
|
17
19
|
end
|
18
20
|
|
19
|
-
def
|
21
|
+
def preprocess(cwd: Dir.pwd, src:,
|
20
22
|
dst: (strip = true; File.basename(src).sub(/.lt3$/,"")),
|
21
23
|
deps: [], copy: nil, debug: false, force: false)
|
22
24
|
src += LEXT unless src.end_with?(LEXT)
|
23
25
|
dst += ".html" unless (dst.end_with?(".html")) # || strip)
|
24
|
-
|
26
|
+
sp = " "*12
|
25
27
|
Dir.chdir(cwd) do
|
26
28
|
if debug
|
27
|
-
puts "#{
|
28
|
-
puts "#{
|
29
|
-
puts "#{
|
30
|
-
puts "#{
|
29
|
+
puts "#{sp} -- preprocess
|
30
|
+
puts "#{sp} src: #{src}"
|
31
|
+
puts "#{sp} dst: #{dst}"
|
32
|
+
puts "#{sp} in: #{Dir.pwd}"
|
33
|
+
puts "#{sp} from: #{caller[0]}"
|
34
|
+
puts "#{sp} copy: #{copy}" if copy
|
31
35
|
end
|
32
36
|
stale = stale?(src, dst, deps, force)
|
33
37
|
if stale
|
34
|
-
|
35
|
-
|
38
|
+
out = LIVE.xform_file(src)
|
39
|
+
File.write(dst, out)
|
36
40
|
system!("cp #{dst} #{copy}") if copy
|
37
41
|
else
|
38
|
-
puts "#{
|
42
|
+
puts "#{sp} -- ^ Already up to date!" if debug
|
39
43
|
return
|
40
44
|
end
|
41
45
|
end
|
@@ -45,7 +49,7 @@ def xlate(cwd: Dir.pwd, src:,
|
|
45
49
|
dst: (strip = true; File.basename(src).sub(/.lt3$/,"")),
|
46
50
|
deps: [], copy: nil, debug: false, force: false)
|
47
51
|
src += LEXT unless src.end_with?(LEXT)
|
48
|
-
dst += ".html" unless (dst.end_with?(".html")
|
52
|
+
dst += ".html" unless (dst.end_with?(".html") || strip)
|
49
53
|
indent = " "*12
|
50
54
|
Dir.chdir(cwd) do
|
51
55
|
if debug
|
data/runeblog.gemspec
CHANGED
@@ -23,7 +23,7 @@ spec = Gem::Specification.new do |s|
|
|
23
23
|
s.add_runtime_dependency 'livetext', '~> 0.8', '>= 0.8.95'
|
24
24
|
s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.16'
|
25
25
|
|
26
|
-
s.add_development_dependency 'minitest', '>= 5.10.0'
|
26
|
+
s.add_development_dependency 'minitest', '~> 5.10', '>= 5.10.0'
|
27
27
|
|
28
28
|
# Files...
|
29
29
|
main = Find.find("bin").to_a +
|
data/test/austin.rb
CHANGED
@@ -85,66 +85,66 @@ EXCERPT
|
|
85
85
|
That's a good thing. But their music isn't always the greatest.
|
86
86
|
BODY
|
87
87
|
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
88
|
+
make_post(x, "The new amphitheatre is overrated", <<-EXCERPT, <<-BODY)
|
89
|
+
It used to be that all major concerts played the Erwin Center.
|
90
|
+
EXCERPT
|
91
|
+
.pin around_austin
|
92
|
+
Now, depending on what you consider "major," blah blah blah...
|
93
|
+
BODY
|
94
|
+
|
95
|
+
make_post(x, "The graffiti wall", <<-EXCERPT, <<-BODY)
|
96
|
+
RIP, Hope Gallery
|
97
|
+
EXCERPT
|
98
|
+
|
99
|
+
.dropcap It's been a while since I was there. They say it was torn down
|
100
|
+
while I wasn't looking. Never tagged anything there, of course, nor
|
101
|
+
anywhere else. Spraypainting public places isn't my thing, but in this
|
102
|
+
case I condoned it because it was sort of there for that purpose.
|
103
|
+
|
104
|
+
This fake entry is a long one so as to demonstrate both drop-caps
|
105
|
+
(above) and an inset quote. Blah blah blah. Lorem ipsum dolor and
|
106
|
+
a partridge in a pear tree.
|
107
|
+
|
108
|
+
.inset left 20
|
109
|
+
Wherever you go, there you are. Last night I saw upon the stair
|
110
|
+
a little man who was not there. He wasn't there again today; I
|
111
|
+
wish, I wish he'd go away. As far as we know, our computer has
|
112
|
+
never had an undetected error.
|
113
|
+
|On a clean disk, you can seek forever.
|
114
|
+
And never let it be denied that
|
115
|
+
pobbles are happier without their toes. And may your snark never
|
116
|
+
be a boojum. How do you know you aren't dreaming right now? When
|
117
|
+
you see a butterfly, think of Chuang Tzu.
|
118
|
+
.end
|
119
|
+
|
120
|
+
Contact light. Houston, this is Tranquility Base. The Eagle has
|
121
|
+
landed. That's one small step for (a) man, one giant leap for
|
122
|
+
mankind.
|
123
|
+
|
124
|
+
Here's the PDF of $$link["Ruby for the Old-Time C Programmer"|http://rubyhacker.com/blog2/rubydino.pdf]
|
125
|
+
|
126
|
+
Pity this busy monster, manunkind, not. Pity rather... Listen:
|
127
|
+
There's a hell of a universe next door; let's go.
|
128
|
+
BODY
|
129
|
+
|
130
|
+
make_post(x, "The Waller Creek project", <<-EXCERPT, <<-BODY)
|
131
|
+
Will it ever be finished?
|
132
|
+
EXCERPT
|
133
|
+
Blah blah Waller Creek blah blah...
|
134
|
+
BODY
|
135
|
+
|
136
|
+
make_post(x, "Life on Sabine Street", <<-EXCERPT, <<-BODY)
|
137
|
+
It's like Pooh Corner, except not.
|
138
|
+
EXCERPT
|
139
|
+
This is about Sabine St, blah blah lorem ipsum dolor...
|
140
|
+
BODY
|
141
|
+
|
142
|
+
make_post(x, "Remember Modest Mouse?", <<-EXCERPT, <<-BODY)
|
143
|
+
They date to the 90s or before.
|
144
|
+
EXCERPT
|
145
|
+
But I first heard of them
|
146
|
+
in 2005.
|
147
|
+
BODY
|
148
148
|
|
149
149
|
debug
|
150
150
|
debug "** generate_index #{bold("around_austin")}"
|
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.76
|
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-12-
|
11
|
+
date: 2019-12-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: livetext
|
@@ -57,6 +57,9 @@ dependencies:
|
|
57
57
|
- - ">="
|
58
58
|
- !ruby/object:Gem::Version
|
59
59
|
version: 5.10.0
|
60
|
+
- - "~>"
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: '5.10'
|
60
63
|
type: :development
|
61
64
|
prerelease: false
|
62
65
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -64,6 +67,9 @@ dependencies:
|
|
64
67
|
- - ">="
|
65
68
|
- !ruby/object:Gem::Version
|
66
69
|
version: 5.10.0
|
70
|
+
- - "~>"
|
71
|
+
- !ruby/object:Gem::Version
|
72
|
+
version: '5.10'
|
67
73
|
description: A blog system based on Ruby and Livetext
|
68
74
|
email: rubyhacker@gmail.com
|
69
75
|
executables:
|
@@ -77,7 +83,7 @@ files:
|
|
77
83
|
- bin/blog
|
78
84
|
- bin/mkwidget
|
79
85
|
- data/EDITOR
|
80
|
-
- data/ROOT
|
86
|
+
- data/ROOT
|
81
87
|
- data/VIEW
|
82
88
|
- empty_view/assets/austin-pano.jpg
|
83
89
|
- empty_view/assets/sky2.jpg
|