runeblog 0.2.73 → 0.2.74
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/global.rb +1 -0
- data/lib/helpers-blog.rb +8 -9
- data/lib/liveblog.rb +4 -7
- data/lib/runeblog.rb +35 -45
- data/lib/runeblog_version.rb +1 -1
- data/lib/view.rb +1 -0
- data/lib/xlate.rb +1 -1
- 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: a66a7e9938f682fe72d0a6f693cad408fffbeb93f34da1f91732548d879211cf
|
4
|
+
data.tar.gz: c2beeb6b86e7d08926bca781d6adca2560f7413501319295abf23a194ee6e039
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd1d9d4a194f2f28683e20fbf027b87f3f27e4ced5c16e21c1e7e292dceacc75f87f718b6abe018e46e37c3645c32c107e3e24a4e1c5fb14aa5c38925198dbb1
|
7
|
+
data.tar.gz: 2d4ce56d3dd5d97b168692d984706ac941fa6f5a3daf3f227dfd42023ae1c7a5c734692eed321e8752eb4eca601809c5e5d350ff58851be6cb12feca84ec933a
|
data/lib/global.rb
CHANGED
data/lib/helpers-blog.rb
CHANGED
@@ -21,13 +21,13 @@ module RuneBlog::Helpers
|
|
21
21
|
|
22
22
|
def get_repo_config
|
23
23
|
log!(enter: __method__, level: 3)
|
24
|
-
@editor = File.read("
|
25
|
-
@current_view = File.read("
|
26
|
-
@root = File.read("
|
24
|
+
@editor = File.read("#@root/data/EDITOR").chomp
|
25
|
+
@current_view = File.read("#@root/data/VIEW").chomp
|
26
|
+
@root = File.read("#@root/data/ROOT").chomp
|
27
27
|
rescue => err
|
28
|
-
puts "Can't read config: #{err}"
|
29
|
-
puts err.backtrace.join("\n")
|
30
|
-
puts "dir = #{Dir.pwd}"
|
28
|
+
STDERR.puts "Can't read config: #{err}"
|
29
|
+
STDERR.puts err.backtrace.join("\n")
|
30
|
+
STDERR.puts "dir = #{Dir.pwd}"
|
31
31
|
end
|
32
32
|
|
33
33
|
def copy_data(tag, dest)
|
@@ -80,12 +80,11 @@ module RuneBlog::Helpers
|
|
80
80
|
|
81
81
|
def get_views # read from filesystem
|
82
82
|
log!(enter: __method__, level: 3)
|
83
|
-
dirs = subdirs("#@root
|
83
|
+
dirs = subdirs("#@root/views/").sort
|
84
84
|
dirs.map {|name| RuneBlog::View.new(name) }
|
85
85
|
end
|
86
86
|
|
87
|
-
def write_repo_config(root: "#{Dir.pwd}/.blogs", view: "
|
88
|
-
p root
|
87
|
+
def write_repo_config(root: "#{Dir.pwd}/.blogs", view: "[no view]", editor: "/usr/local/bin/vim")
|
89
88
|
File.write(root + "/data/ROOT", root + "\n")
|
90
89
|
File.write(root + "/data/VIEW", view.to_s + "\n")
|
91
90
|
File.write(root + "/data/EDITOR", editor + "\n")
|
data/lib/liveblog.rb
CHANGED
@@ -9,11 +9,9 @@ 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"
|
@@ -748,7 +745,7 @@ def navbar
|
|
748
745
|
end
|
749
746
|
|
750
747
|
def _make_navbar(orient = :horiz)
|
751
|
-
vdir = @blog.view
|
748
|
+
vdir = @root/:views/@blog.view
|
752
749
|
title = _var(:blog)
|
753
750
|
|
754
751
|
extra = ""
|
data/lib/runeblog.rb
CHANGED
@@ -53,55 +53,48 @@ class RuneBlog
|
|
53
53
|
puts "Error: See #{out}"
|
54
54
|
end
|
55
55
|
|
56
|
-
def self.create_new_blog_repo(
|
57
|
-
log!(enter: __method__, args: [
|
58
|
-
raise ArgumentError unless
|
59
|
-
root_dir = Dir.pwd/root
|
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(
|
65
|
-
create_dirs(:drafts, :views, :posts)
|
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
|
64
|
+
create_dirs(:data, :drafts, :views, :posts)
|
66
65
|
new_sequence
|
67
66
|
end
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
write_repo_config
|
72
|
-
@blog = self.new(root)
|
67
|
+
copy_data(:config, repo_root/:data)
|
68
|
+
write_repo_config(root: repo_root)
|
69
|
+
@blog = self.new
|
73
70
|
@blog
|
74
71
|
rescue => err
|
75
|
-
puts "Can't create blog repo: '#{
|
72
|
+
puts "Can't create blog repo: '#{repo_root}' - #{err}"
|
76
73
|
puts err.backtrace.join("\n")
|
77
74
|
end
|
78
75
|
|
79
|
-
def self.open(
|
80
|
-
log!(enter: __method__, args: [
|
81
|
-
# Crude - FIXME later - # What views are there? Publishing, etc.
|
76
|
+
def self.open(root_rel = ".blogs")
|
77
|
+
log!(enter: __method__, args: [root_rel])
|
82
78
|
self.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
83
|
-
|
84
|
-
blog = self.new(root)
|
79
|
+
blog = self.new(root_rel)
|
85
80
|
rescue => err
|
86
81
|
_tmp_error(err)
|
87
82
|
end
|
88
83
|
|
89
|
-
def initialize(
|
90
|
-
log!(enter: "initialize", args: [
|
91
|
-
# 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])
|
92
86
|
self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
93
87
|
|
94
|
-
@root =
|
95
|
-
|
96
|
-
|
97
|
-
raise errmsg unless File.exist?(file)
|
98
|
-
|
88
|
+
@root = Dir.pwd/root_rel
|
89
|
+
copy_data(:config, @root/:data)
|
90
|
+
write_repo_config(root: @root)
|
99
91
|
get_repo_config
|
100
|
-
@root, @view_name, @editor = read_config(file, :root, :current_view, :editor)
|
101
|
-
md = Dir.pwd.match(%r[.*/views/(.*?)/])
|
102
|
-
@view_name = md[1] if md
|
103
92
|
@views = get_views
|
104
|
-
|
93
|
+
md = Dir.pwd.match(%r[.*/views/(.*?)/])
|
94
|
+
if md
|
95
|
+
@view_name = md[1]
|
96
|
+
@view = str2view(@view_name)
|
97
|
+
end
|
105
98
|
@sequence = get_sequence
|
106
99
|
@post_views = []
|
107
100
|
@post_tags = []
|
@@ -228,15 +221,15 @@ class RuneBlog
|
|
228
221
|
|
229
222
|
def viewdir(v = nil) # delete?
|
230
223
|
log!(enter: __method__, args: [v], level: 3)
|
224
|
+
v ||= @view
|
231
225
|
v = str2view(v) if v.is_a?(String)
|
232
226
|
raise ArgumentError unless v.nil? || v.is_a?(RuneBlog::View)
|
233
|
-
v ||= @view
|
234
227
|
return @root/:views/v
|
235
228
|
end
|
236
229
|
|
237
230
|
def self.exist?
|
238
231
|
log!(enter: __method__, level: 3)
|
239
|
-
Dir.exist?(DotDir)
|
232
|
+
Dir.exist?(DotDir)
|
240
233
|
end
|
241
234
|
|
242
235
|
def mark_last_published(str)
|
@@ -247,7 +240,8 @@ class RuneBlog
|
|
247
240
|
def add_view(view_name)
|
248
241
|
log!(enter: __method__, args: [view_name], level: 2)
|
249
242
|
view = RuneBlog::View.new(view_name)
|
250
|
-
|
243
|
+
self.view = view # current view
|
244
|
+
File.write(@root/"data/VIEW", view_name)
|
251
245
|
@views << view # all views
|
252
246
|
view
|
253
247
|
end
|
@@ -276,7 +270,6 @@ class RuneBlog
|
|
276
270
|
|
277
271
|
def create_view(view_name)
|
278
272
|
log!(enter: __method__, args: [view_name], level: 2)
|
279
|
-
check_valid_new_view(view_name)
|
280
273
|
make_empty_view_tree(view_name)
|
281
274
|
add_view(view_name)
|
282
275
|
mark_last_published("Initial creation")
|
@@ -325,11 +318,8 @@ class RuneBlog
|
|
325
318
|
text = nil
|
326
319
|
@theme = @view.dir/"themes/standard"
|
327
320
|
post_entry_name = @theme/"blog/post_entry.lt3"
|
328
|
-
# STDERR.puts "-- @pename = #{post_entry_name}"
|
329
|
-
# STDERR.puts "-- @pe = #{@_post_entry.inspect}"
|
330
321
|
depend = [post_entry_name]
|
331
322
|
xlate src: post_entry_name, dst: "/tmp/post_entry.html" # , deps: depend # , debug: true
|
332
|
-
# STDERR.puts "-- xlate result: #{`ls -l /tmp/post_entry.html`}"
|
333
323
|
@_post_entry ||= File.read("/tmp/post_entry.html")
|
334
324
|
vp = post_lookup(id)
|
335
325
|
nslug, aslug, title, date, teaser_text =
|
@@ -422,10 +412,8 @@ class RuneBlog
|
|
422
412
|
def change_view(view)
|
423
413
|
log!(enter: __method__, args: [view], level: 3)
|
424
414
|
raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
|
425
|
-
|
426
|
-
|
427
|
-
copy_data(:config, @root/:data)
|
428
|
-
write_config(x, @root/ConfigFile)
|
415
|
+
File.write(@root/"data/VIEW", view)
|
416
|
+
# write_repo_config
|
429
417
|
self.view = view # error checking?
|
430
418
|
end
|
431
419
|
|
@@ -448,13 +436,15 @@ class RuneBlog
|
|
448
436
|
# @theme/"navbar/navbar.lt3",
|
449
437
|
@theme/"blog/index.lt3"] # FIXME what about assets?
|
450
438
|
xlate cwd: vdir/"themes/standard/etc", deps: depend,
|
451
|
-
src: "blog.css.lt3", copy: vdir/"remote/etc/
|
439
|
+
src: "blog.css.lt3", copy: vdir/"remote/etc/" # , debug: true
|
452
440
|
xlate cwd: vdir/"themes/standard", deps: depend, force: true,
|
453
441
|
src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
|
454
442
|
copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
|
455
443
|
copy_widget_html(view)
|
456
444
|
rescue => err
|
457
|
-
|
445
|
+
STDERR.puts err
|
446
|
+
STDERR.puts err.backtrace.join("\n")
|
447
|
+
# _tmp_error(err)
|
458
448
|
end
|
459
449
|
|
460
450
|
def _get_views(draft)
|
data/lib/runeblog_version.rb
CHANGED
data/lib/view.rb
CHANGED
data/lib/xlate.rb
CHANGED
@@ -45,7 +45,7 @@ def xlate(cwd: Dir.pwd, src:,
|
|
45
45
|
dst: (strip = true; File.basename(src).sub(/.lt3$/,"")),
|
46
46
|
deps: [], copy: nil, debug: false, force: false)
|
47
47
|
src += LEXT unless src.end_with?(LEXT)
|
48
|
-
dst += ".html" unless (dst.end_with?(".html")
|
48
|
+
dst += ".html" unless (dst.end_with?(".html") || strip)
|
49
49
|
indent = " "*12
|
50
50
|
Dir.chdir(cwd) do
|
51
51
|
if debug
|
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.74
|
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
|