runeblog 0.2.88 → 0.2.93
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 -1
- data/empty_view/themes/standard/{blog → banner}/banner.lt3 +0 -0
- data/empty_view/themes/standard/banner/{about.lt3 → navbar/about.lt3} +0 -0
- data/empty_view/themes/standard/banner/{contact.lt3 → navbar/contact.lt3} +0 -0
- data/empty_view/themes/standard/banner/navbar/faq.lt3 +1 -0
- data/empty_view/themes/standard/banner/{list.data → navbar/list.data} +0 -0
- data/empty_view/themes/standard/banner/top.lt3 +2 -1
- data/empty_view/themes/standard/blog/generate.lt3 +1 -3
- data/empty_view/themes/standard/blog/post_entry.lt3 +0 -1
- data/empty_view/themes/standard/etc/blog.css.lt3 +0 -1
- data/empty_view/themes/standard/global.lt3 +1 -1
- data/empty_view/themes/standard/post/index.lt3 +8 -8
- data/empty_view/themes/standard/widgets/links/links.rb +1 -1
- data/empty_view/themes/standard/widgets/news/news.rb +1 -1
- data/empty_view/themes/standard/widgets/pages/pages.rb +2 -2
- data/empty_view/themes/standard/widgets/pinned/pinned.rb +1 -1
- data/lib/default.rb +4 -3
- data/lib/helpers-blog.rb +21 -2
- data/lib/liveblog.rb +28 -27
- data/lib/post.rb +0 -8
- data/lib/processing.rb +4 -3
- data/lib/publish.rb +6 -16
- data/lib/repl.rb +5 -16
- data/lib/runeblog.rb +26 -14
- data/lib/runeblog_version.rb +57 -2
- data/lib/view.rb +5 -2
- data/runeblog.gemspec +2 -2
- data/test/austin.rb +0 -1
- metadata +11 -13
- data/empty_view/remote/banner/austin-pano.jpg +0 -0
- data/empty_view/themes/standard/banner/faq.lt3 +0 -1
- data/lib/global.rb +0 -52
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51a1371a11eb69a62ff435090be403f586c0bddfd8c62ef7dc3e4f97020fee12
|
4
|
+
data.tar.gz: 4d1e82de93ebb0d408964b5d06e6dc4a42f450e064b7174eecd4cb8328054f4a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8e27ae9cb582a3a84746db31ce664b1ed3a5ed8c47fff9178de4ff5a55e9c41687390b655a13b8df533e498edfe5ffb16af2f3f832c9d9c082353409e2dd17bb
|
7
|
+
data.tar.gz: 73e512eb67281d74c141ecda0de9f75aec04e64402b5ef23a3552d0798e681b3b43aefa2a88fdb9b23bfda95f00b37938a6455599be11a665bcf182ff2b60659
|
data/bin/blog
CHANGED
@@ -146,7 +146,10 @@ end
|
|
146
146
|
|
147
147
|
major, minor = RUBY_VERSION.split(".").values_at(0,1)
|
148
148
|
ver = major.to_i*10 + minor.to_i
|
149
|
-
|
149
|
+
unless ver >= 24
|
150
|
+
RubyText.stop
|
151
|
+
abort "Need Ruby 2.4 or greater"
|
152
|
+
end
|
150
153
|
|
151
154
|
include RuneBlog::Helpers # for try_read_config
|
152
155
|
|
File without changes
|
File without changes
|
File without changes
|
@@ -0,0 +1 @@
|
|
1
|
+
.include ../../widgets/pages/faq.lt3
|
File without changes
|
@@ -4,8 +4,6 @@
|
|
4
4
|
. The user will more often edit blog/index.lt3 in
|
5
5
|
. the process of blog setup.
|
6
6
|
. --------------------------------------------------
|
7
|
-
.nopara
|
8
|
-
.mixin liveblog
|
9
7
|
|
10
8
|
<html>
|
11
9
|
<!-- Generated from $File on $$date.
|
@@ -13,7 +11,7 @@
|
|
13
11
|
$.seek global.lt3
|
14
12
|
$.include blog/head.lt3
|
15
13
|
<body>
|
16
|
-
$.include
|
14
|
+
$.include banner/banner.lt3
|
17
15
|
<div class="content container-fluid mt-4">
|
18
16
|
<div class="row">
|
19
17
|
$.include blog/index.lt3
|
@@ -6,19 +6,19 @@
|
|
6
6
|
. likely be the place.
|
7
7
|
. --------------------------------------------------
|
8
8
|
|
9
|
-
.mixin liveblog
|
10
|
-
. ^ get rid of this later
|
11
|
-
|
12
9
|
.post 0
|
13
10
|
|
14
|
-
.title
|
11
|
+
.title This is my title
|
15
12
|
.pubdate 2019-07-09
|
16
|
-
.views
|
13
|
+
.views stuff
|
17
14
|
.tags
|
18
15
|
|
19
16
|
.teaser
|
20
|
-
|
21
|
-
|
17
|
+
This is only a short excerpt from the top of the blog post.
|
22
18
|
.end
|
23
|
-
|
19
|
+
|
20
|
+
And now we continue the post.
|
21
|
+
Do we have anything to say?
|
22
|
+
|
23
|
+
Apparently not much.
|
24
24
|
|
@@ -4,12 +4,12 @@
|
|
4
4
|
|
5
5
|
class ::RuneBlog::Widget
|
6
6
|
class Pages
|
7
|
-
Type, Title = "pages", "Pages"
|
7
|
+
Type, Title = "pages", "My Pages"
|
8
8
|
|
9
9
|
def initialize(repo)
|
10
10
|
@blog = repo
|
11
11
|
@datafile = "list.data"
|
12
|
-
@lines =
|
12
|
+
@lines = _get_data(@datafile)
|
13
13
|
@data = @lines.map {|x| x.chomp.split(/, */, 2) }
|
14
14
|
end
|
15
15
|
|
data/lib/default.rb
CHANGED
@@ -8,10 +8,11 @@ def RuneBlog.post_template(num: 0, title: "No title", date: nil, view: "test_vie
|
|
8
8
|
log!(enter: __method__, args: [num, title, date, view, teaser, body, tags, views, back, home], level: 3)
|
9
9
|
viewlist = (views + [view.to_s]).join(" ")
|
10
10
|
taglist = ".tags " + tags.join(" ")
|
11
|
-
<<-TEXT
|
12
|
-
.mixin liveblog
|
13
|
-
. ^ get rid of this later
|
14
11
|
|
12
|
+
# .mixin liveblog
|
13
|
+
# . ^ get rid of this later
|
14
|
+
|
15
|
+
<<-TEXT
|
15
16
|
.post #{num}
|
16
17
|
|
17
18
|
.title #{title}
|
data/lib/helpers-blog.rb
CHANGED
@@ -5,6 +5,23 @@ require 'processing'
|
|
5
5
|
|
6
6
|
module RuneBlog::Helpers
|
7
7
|
|
8
|
+
def _get_data?(file) # File need not exist
|
9
|
+
if File.exist?(file)
|
10
|
+
_get_data(file)
|
11
|
+
else
|
12
|
+
[]
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def _get_data(file)
|
17
|
+
lines = File.readlines(file)
|
18
|
+
lines.reject! {|line| line[0] == "-" } # allow rejection of lines
|
19
|
+
lines = lines.map do |line|
|
20
|
+
line.sub(/ *# .*$/, "") # allow trailing comments
|
21
|
+
end
|
22
|
+
lines
|
23
|
+
end
|
24
|
+
|
8
25
|
def copy(src, dst)
|
9
26
|
log!(enter: __method__, args: [src, dst], level: 2)
|
10
27
|
cmd = "cp #{src} #{dst} 2>/dev/null"
|
@@ -54,6 +71,7 @@ module RuneBlog::Helpers
|
|
54
71
|
puts "Can't read vars file '#{file}': #{err}"
|
55
72
|
puts err.backtrace.join("\n")
|
56
73
|
puts "dir = #{Dir.pwd}"
|
74
|
+
sleep 6; RubyText.stop
|
57
75
|
exit
|
58
76
|
end
|
59
77
|
|
@@ -80,6 +98,7 @@ module RuneBlog::Helpers
|
|
80
98
|
puts "Can't read config file '#{file}': #{err}"
|
81
99
|
puts err.backtrace.join("\n")
|
82
100
|
puts "dir = #{Dir.pwd}"
|
101
|
+
sleep 6; RubyText.stop
|
83
102
|
exit
|
84
103
|
end
|
85
104
|
|
@@ -98,13 +117,13 @@ module RuneBlog::Helpers
|
|
98
117
|
end
|
99
118
|
end
|
100
119
|
|
101
|
-
def
|
120
|
+
def retrieve_views # read from filesystem
|
102
121
|
log!(enter: __method__, level: 3)
|
103
122
|
dirs = subdirs("#@root/views/").sort
|
104
123
|
dirs.map {|name| RuneBlog::View.new(name) }
|
105
124
|
end
|
106
125
|
|
107
|
-
def write_repo_config(root: "#{Dir.pwd}/.blogs", view: "#{root}/data/VIEW", editor: "/usr/local/bin/vim")
|
126
|
+
def write_repo_config(root: "#{Dir.pwd}/.blogs", view: File.read("#{root}/data/VIEW").chomp, editor: "/usr/local/bin/vim")
|
108
127
|
File.write(root + "/data/ROOT", root + "\n")
|
109
128
|
File.write(root + "/data/VIEW", view.to_s + "\n")
|
110
129
|
File.write(root + "/data/EDITOR", editor + "\n")
|
data/lib/liveblog.rb
CHANGED
@@ -7,6 +7,9 @@ require 'runeblog'
|
|
7
7
|
require 'pathmagic'
|
8
8
|
require 'processing'
|
9
9
|
|
10
|
+
# top = Livetext::Path + "/../plugin/liveblog/"
|
11
|
+
# eval(File.read("#{top}/testing.rb"))
|
12
|
+
|
10
13
|
|
11
14
|
def init_liveblog # FIXME - a lot of this logic sucks
|
12
15
|
dir = Dir.pwd.sub(/\.blogs.*/, "")
|
@@ -18,6 +21,8 @@ def init_liveblog # FIXME - a lot of this logic sucks
|
|
18
21
|
@vdir = @blog.view.dir rescue "NONAME"
|
19
22
|
@version = RuneBlog::VERSION
|
20
23
|
@theme = @vdir/:themes/:standard
|
24
|
+
rescue
|
25
|
+
raise "Only works inside a blog repo"
|
21
26
|
end
|
22
27
|
|
23
28
|
##################
|
@@ -42,7 +47,7 @@ end
|
|
42
47
|
|
43
48
|
def post_trailer
|
44
49
|
perma = _var("publish.proto") + "://" + _var("publish.server") +
|
45
|
-
"/" + _var("publish.path") + "/
|
50
|
+
"/" + _var("publish.path") + "/" + _var("post.aslug") +
|
46
51
|
".html"
|
47
52
|
tags = _var("post.tags")
|
48
53
|
if tags.empty?
|
@@ -83,19 +88,20 @@ def code
|
|
83
88
|
end
|
84
89
|
|
85
90
|
def _read_navbar_data
|
86
|
-
|
91
|
+
vdir = @blog.root/:views/@blog.view
|
92
|
+
dir = vdir/"themes/standard/banner/navbar/"
|
87
93
|
datafile = dir/"list.data"
|
88
|
-
|
94
|
+
_get_data(datafile)
|
89
95
|
end
|
90
96
|
|
91
97
|
def banner
|
92
98
|
count = 0
|
93
|
-
span = 1
|
94
99
|
bg = "white" # outside loop
|
95
100
|
wide = nil
|
96
101
|
high = 250
|
97
102
|
str2 = ""
|
98
103
|
navbar = nil
|
104
|
+
vdir = @blog.root/:views/@blog.view
|
99
105
|
lines = _body.to_a
|
100
106
|
|
101
107
|
lines.each do |line|
|
@@ -111,35 +117,28 @@ def banner
|
|
111
117
|
image = "banner"/image
|
112
118
|
wide = data[0]
|
113
119
|
width = wide ? "width=#{wide}" : ""
|
114
|
-
str2 << " <td
|
120
|
+
str2 << " <td><img src=#{image} #{width} height=#{high}></img></td>" + "\n"
|
115
121
|
when "svg_title"
|
116
122
|
stuff, hash = _svg_title(*data)
|
117
123
|
wide = hash["width"]
|
118
|
-
str2 << " <td
|
124
|
+
str2 << " <td width=#{wide}>#{stuff}</td>" + "\n"
|
119
125
|
when "text"
|
120
126
|
data[0] ||= "top.html"
|
121
127
|
file = "banner"/data[0]
|
122
128
|
if ! File.exist?(file)
|
123
129
|
src = file.sub(/html$/, "lt3")
|
124
130
|
if File.exist?(src)
|
125
|
-
preprocess src: src, dst: file, vars:
|
131
|
+
preprocess src: src, dst: file, call: ".nopara" # , vars: @blog.view.globals
|
126
132
|
else
|
127
133
|
raise "Neither #{file} nor #{src} found"
|
128
134
|
end
|
129
135
|
end
|
130
|
-
str2 << "<td
|
136
|
+
str2 << "<td>" + File.read(file) + "</td>" + "\n"
|
131
137
|
when "navbar"
|
132
|
-
|
133
|
-
_make_navbar # horiz is default
|
134
|
-
file = "banner/navbar.html"
|
135
|
-
navbar = File.read(file)
|
138
|
+
navbar = _make_navbar # horiz is default
|
136
139
|
when "vnavbar"
|
137
|
-
|
138
|
-
_make_navbar(:vert)
|
139
|
-
file = "banner/vnavbar.html"
|
140
|
-
navbar = File.read(file)
|
140
|
+
navbar = _make_navbar(:vert)
|
141
141
|
when "break"
|
142
|
-
# span = count - 1
|
143
142
|
str2 << " </tr>\n <tr>" + "\n"
|
144
143
|
else
|
145
144
|
str2 << " '#{tag}' isn't known" + "\n"
|
@@ -347,7 +346,7 @@ def pin
|
|
347
346
|
pinned.each do |pinview|
|
348
347
|
dir = @blog.root/:views/pinview/"themes/standard/widgets/pinned/"
|
349
348
|
datafile = dir/"list.data"
|
350
|
-
pins =
|
349
|
+
pins = _get_data?(datafile)
|
351
350
|
pins << "#{@meta.num} #{@meta.title}\n"
|
352
351
|
pins.uniq!
|
353
352
|
File.open(datafile, "w") {|out| pins.each {|pin| out.puts pin } }
|
@@ -498,6 +497,7 @@ def _load_local(widget)
|
|
498
497
|
rescue => err
|
499
498
|
STDERR.puts err.to_s
|
500
499
|
STDERR.puts err.backtrace.join("\n")
|
500
|
+
sleep 6; RubyText.stop
|
501
501
|
exit
|
502
502
|
end
|
503
503
|
|
@@ -552,11 +552,10 @@ def sidebar
|
|
552
552
|
num = rand(1..4)
|
553
553
|
img = "widgets/ad/ad#{num}.png"
|
554
554
|
src, dst = img, @root/:views/@view_name/"remote/widgets/ad/"
|
555
|
-
system!("cp #{src} #{dst}")
|
556
|
-
File.open(wtag/"vars.lt3", "w")
|
557
|
-
|
558
|
-
|
559
|
-
preprocess cwd: wtag, src: tag, dst: tcard, force: true # , debug: true # , deps: depend
|
555
|
+
system!("cp #{src} #{dst}")
|
556
|
+
File.open(wtag/"vars.lt3", "w") {|f| f.puts ".set ad.image = #{img}" }
|
557
|
+
preprocess cwd: wtag, src: tag, dst: tcard, call: ".nopara",
|
558
|
+
force: true # , debug: true # , deps: depend
|
560
559
|
end
|
561
560
|
|
562
561
|
_include_file wtag/tcard
|
@@ -565,6 +564,7 @@ def sidebar
|
|
565
564
|
rescue => err
|
566
565
|
puts "err = #{err}"
|
567
566
|
puts err.backtrace.join("\n")
|
567
|
+
sleep 6; RubyText.stop
|
568
568
|
exit
|
569
569
|
end
|
570
570
|
|
@@ -687,20 +687,21 @@ def _make_navbar(orient = :horiz)
|
|
687
687
|
</td></tr></table>
|
688
688
|
HTML
|
689
689
|
|
690
|
-
html_file = @blog.root/:views/@blog.view/"themes/standard/banner"/name
|
690
|
+
html_file = @blog.root/:views/@blog.view/"themes/standard/banner/navbar"/name
|
691
691
|
output = File.new(html_file, "w")
|
692
692
|
output.puts start
|
693
693
|
lines = _read_navbar_data
|
694
694
|
lines = ["index Home"] + lines unless _args.include?("nohome")
|
695
695
|
lines.each do |line|
|
696
696
|
basename, cdata = line.chomp.strip.split(" ", 2)
|
697
|
-
full = :banner/basename+".html"
|
697
|
+
full = :banner/:navbar/basename+".html"
|
698
698
|
href_main = _main(full)
|
699
699
|
if basename == "index" # special case
|
700
700
|
output.puts %[#{li1} <a class="nav-link" href="index.html">#{cdata}<span class="sr-only">(current)</span></a> #{li2}]
|
701
701
|
else
|
702
|
-
dir = @blog.root/:views/@blog.view/"themes/standard/banner"
|
703
|
-
|
702
|
+
dir = @blog.root/:views/@blog.view/"themes/standard/banner/navbar"
|
703
|
+
dest = vdir/"remote/banner/navbar"/basename+".html"
|
704
|
+
preprocess cwd: dir, src: basename, dst: dest, call: ".nopara" # , debug: true
|
704
705
|
output.puts %[#{li1} <a class="nav-link" #{href_main}>#{cdata}</a> #{li2}]
|
705
706
|
end
|
706
707
|
end
|
data/lib/post.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'runeblog'
|
2
|
-
require 'global'
|
3
2
|
require 'pathmagic'
|
4
3
|
|
5
4
|
class RuneBlog::Post
|
@@ -9,12 +8,6 @@ class RuneBlog::Post
|
|
9
8
|
|
10
9
|
include RuneBlog::Helpers
|
11
10
|
|
12
|
-
# def self.files(num, root)
|
13
|
-
# log!(enter: __method__, args: [num, root], level: 3)
|
14
|
-
# files = ::Find.find(root).to_a
|
15
|
-
# result = files.grep(/#{prefix(num)}-/)
|
16
|
-
# result
|
17
|
-
# end
|
18
11
|
|
19
12
|
def self.load(post)
|
20
13
|
log!(enter: __method__, args: [post], level: 3)
|
@@ -22,7 +15,6 @@ class RuneBlog::Post
|
|
22
15
|
raise NoBlogAccessor if RuneBlog.blog.nil?
|
23
16
|
# "post" is a slug
|
24
17
|
pdir = RuneBlog.blog.root/:drafts/post
|
25
|
-
puts "-- load: opening #{pdir}"
|
26
18
|
meta = nil
|
27
19
|
Dir.chdir(pdir) do
|
28
20
|
meta = read_config("metadata.txt")
|
data/lib/processing.rb
CHANGED
@@ -22,7 +22,8 @@ end
|
|
22
22
|
|
23
23
|
def preprocess(cwd: Dir.pwd, src:,
|
24
24
|
dst: (strip = true; File.basename(src).sub(/.lt3$/,"")),
|
25
|
-
deps: [], copy: nil, debug: false, force: false,
|
25
|
+
deps: [], copy: nil, debug: false, force: false,
|
26
|
+
mix: [], call: [], vars: {})
|
26
27
|
src += LEXT unless src.end_with?(LEXT)
|
27
28
|
dst += ".html" unless (dst.end_with?(".html") || strip)
|
28
29
|
sp = " "*12
|
@@ -37,8 +38,8 @@ def preprocess(cwd: Dir.pwd, src:,
|
|
37
38
|
end
|
38
39
|
stale = stale?(src, dst, deps, force)
|
39
40
|
if stale
|
40
|
-
live = Livetext.
|
41
|
-
out = live.xform_file(src
|
41
|
+
live = Livetext.customize(mix: "liveblog", call: call, vars: vars)
|
42
|
+
out = live.xform_file(src)
|
42
43
|
File.write(dst, out)
|
43
44
|
system!("cp #{dst} #{copy}") if copy
|
44
45
|
end
|
data/lib/publish.rb
CHANGED
@@ -2,7 +2,6 @@ if ! defined?(Already_publish)
|
|
2
2
|
|
3
3
|
Already_publish = nil
|
4
4
|
|
5
|
-
require 'global'
|
6
5
|
require 'pathmagic'
|
7
6
|
|
8
7
|
class RuneBlog::Publishing
|
@@ -17,6 +16,7 @@ class RuneBlog::Publishing
|
|
17
16
|
@blog = RuneBlog.blog
|
18
17
|
gfile = @blog.root/:views/view/"themes/standard/global.lt3"
|
19
18
|
data = File.readlines(gfile)
|
19
|
+
# Please refactor the Hal out of this
|
20
20
|
grab = ->(var) { data.grep(/^#{var} /).first.chomp.split(" ", 2)[1] }
|
21
21
|
@user = grab.call("publish.user")
|
22
22
|
@server = grab.call("publish.server")
|
@@ -43,24 +43,14 @@ class RuneBlog::Publishing
|
|
43
43
|
rc
|
44
44
|
end
|
45
45
|
|
46
|
-
def publish
|
47
|
-
log!(enter: __method__,
|
46
|
+
def publish
|
47
|
+
log!(enter: __method__, level: 1)
|
48
48
|
dir = @docroot/@path
|
49
49
|
view_name = @blog.view.name
|
50
50
|
viewpath = dir # /view_name
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
file.gsub!(/\/\//, "/") # weird... :-/
|
55
|
-
cmd = "scp -r #{file} #{dest} >/dev/null 2>/tmp/wtf"
|
56
|
-
debug "cmd = #{cmd.inspect} - see /tmp/wtf"
|
57
|
-
result = system!(cmd) || puts("\n Could not copy #{file} to #{dest}")
|
58
|
-
end
|
59
|
-
unless assets.empty?
|
60
|
-
cmd = "scp #{assets.join(' ')} #@user@#@server:#{viewpath}/assets >/dev/null 2>/tmp/wtf2"
|
61
|
-
result = system!(cmd)
|
62
|
-
raise PublishError if !result
|
63
|
-
end
|
51
|
+
# FIXME rsync doesn't work
|
52
|
+
cmd = "rsync -a -r -z #{@blog.root}/views/#{@blog.view}/remote/ #@user@#@server:#{viewpath}/"
|
53
|
+
system!(cmd)
|
64
54
|
dump(files, "#{@blog.view.dir}/last_published")
|
65
55
|
true
|
66
56
|
end
|
data/lib/repl.rb
CHANGED
@@ -1,5 +1,4 @@
|
|
1
1
|
require 'runeblog'
|
2
|
-
require 'global'
|
3
2
|
require 'ostruct'
|
4
3
|
require 'helpers-repl' # FIXME structure
|
5
4
|
|
@@ -40,6 +39,7 @@ module RuneBlog::REPL
|
|
40
39
|
|
41
40
|
def cmd_config(arg, testing = false)
|
42
41
|
hash = {"global.lt3 Global configuration" => "global.lt3",
|
42
|
+
"banner/top.lt3 Text portion of banner" => "banner/top.lt3",
|
43
43
|
"blog/generate.lt3 Generator for view (usu not edited)" => "blog/generate.lt3",
|
44
44
|
".... head.lt3 HEAD info for view" => "blog/head.lt3",
|
45
45
|
".... banner.lt3 banner description" => "blog/banner.lt3",
|
@@ -76,10 +76,10 @@ module RuneBlog::REPL
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def _manage_navbar(arg, testing = false) # cloned from manage_pages
|
79
|
-
dir = @blog.view.dir/"themes/standard/navbar"
|
79
|
+
dir = @blog.view.dir/"themes/standard/banner/navbar"
|
80
80
|
files = Dir.entries(dir) - %w[. .. navbar.lt3]
|
81
|
-
new_item = " [New item] "
|
82
81
|
main_file = "[ navbar.lt3 ]"
|
82
|
+
new_item = " [New item] "
|
83
83
|
files = [main_file] + files + [new_item]
|
84
84
|
num, fname = STDSCR.menu(title: "Edit navbar:", items: files)
|
85
85
|
return if fname.nil?
|
@@ -114,7 +114,7 @@ module RuneBlog::REPL
|
|
114
114
|
dir = @blog.view.dir/"themes/standard/widgets/pages"
|
115
115
|
# Assume child files already generated (and list.data??)
|
116
116
|
data = dir/"list.data"
|
117
|
-
lines =
|
117
|
+
lines = _get_data?(data)
|
118
118
|
hash = {}
|
119
119
|
lines.each do |line|
|
120
120
|
url, name = line.chomp.split(",")
|
@@ -187,23 +187,12 @@ module RuneBlog::REPL
|
|
187
187
|
puts unless testing
|
188
188
|
reset_output
|
189
189
|
unless @blog.view.can_publish?
|
190
|
-
msg = "Can't publish... see
|
190
|
+
msg = "Can't publish... see global.lt3"
|
191
191
|
puts msg unless testing
|
192
192
|
output! msg
|
193
193
|
return @out
|
194
194
|
end
|
195
195
|
|
196
|
-
# Need to check dirty/clean status first
|
197
|
-
dirty, all, assets = @blog.view.publishable_files
|
198
|
-
files = dirty
|
199
|
-
if dirty.empty?
|
200
|
-
puts fx("\n No files are out of date." + " "*20, :bold)
|
201
|
-
print " Publish anyway? "
|
202
|
-
yn = RubyText.gets.chomp
|
203
|
-
files = all if yn == "y"
|
204
|
-
end
|
205
|
-
return @out if files.empty?
|
206
|
-
|
207
196
|
ret = RubyText.spinner(label: " Publishing... ") do
|
208
197
|
@blog.view.publisher.publish(files, assets) # FIXME weird?
|
209
198
|
end
|
data/lib/runeblog.rb
CHANGED
@@ -9,7 +9,6 @@ require 'ostruct'
|
|
9
9
|
require 'logging'
|
10
10
|
|
11
11
|
require 'runeblog_version'
|
12
|
-
require 'global'
|
13
12
|
require 'helpers-blog'
|
14
13
|
require 'default'
|
15
14
|
require 'view'
|
@@ -91,10 +90,11 @@ class RuneBlog
|
|
91
90
|
self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
|
92
91
|
|
93
92
|
@root = Dir.pwd/root_rel
|
94
|
-
copy_data(:config, @root/:data)
|
93
|
+
copy_data(:config, @root/:data) unless File.exist?(@root/"data/VIEW")
|
95
94
|
write_repo_config(root: @root)
|
96
95
|
get_repo_config
|
97
|
-
@views =
|
96
|
+
@views = retrieve_views
|
97
|
+
self.view = File.read(@root/"data/VIEW").chomp
|
98
98
|
md = Dir.pwd.match(%r[.*/views/(.*?)/])
|
99
99
|
if md
|
100
100
|
@view_name = md[1]
|
@@ -107,13 +107,14 @@ class RuneBlog
|
|
107
107
|
|
108
108
|
def _generate_global
|
109
109
|
vars = read_vars("#@root/data/universal.lt3")
|
110
|
-
|
110
|
+
gfile = "#@root/data/global.lt3"
|
111
|
+
global = File.read(gfile)
|
111
112
|
global.gsub!(/AUTHOR/, vars["author"])
|
112
113
|
global.gsub!(/SITE/, vars["site"])
|
113
114
|
global.gsub!(/FONT/, vars["font.family"])
|
114
115
|
global.gsub!(/CHARSET/, vars["charset"])
|
115
116
|
global.gsub!(/LOCALE/, vars["locale"])
|
116
|
-
File.write(
|
117
|
+
File.write(gfile, global)
|
117
118
|
end
|
118
119
|
|
119
120
|
def _deploy_local(dir)
|
@@ -163,7 +164,8 @@ class RuneBlog
|
|
163
164
|
dir = @root/:posts/nslug
|
164
165
|
create_dirs(dir)
|
165
166
|
# FIXME dependencies?
|
166
|
-
preprocess cwd: dir, src: @root/:drafts/sourcefile
|
167
|
+
preprocess cwd: dir, src: @root/:drafts/sourcefile,
|
168
|
+
mix: "liveblog" # , debug: true
|
167
169
|
_deploy_local(dir)
|
168
170
|
rescue => err
|
169
171
|
_tmp_error(err)
|
@@ -336,8 +338,10 @@ class RuneBlog
|
|
336
338
|
@theme = @view.dir/"themes/standard"
|
337
339
|
post_entry_name = @theme/"blog/post_entry.lt3"
|
338
340
|
depend = [post_entry_name]
|
339
|
-
|
340
|
-
|
341
|
+
html = "/tmp/post_entry.html"
|
342
|
+
preprocess src: post_entry_name, dst: html,
|
343
|
+
call: ".nopara" # , deps: depend # , debug: true
|
344
|
+
@_post_entry ||= File.read(html)
|
341
345
|
vp = post_lookup(id)
|
342
346
|
nslug, aslug, title, date, teaser_text =
|
343
347
|
vp.nslug, vp.aslug, vp.title, vp.date, vp.teaser_text
|
@@ -464,10 +468,14 @@ class RuneBlog
|
|
464
468
|
# @theme/"navbar/navbar.lt3",
|
465
469
|
@theme/"blog/index.lt3"] # FIXME what about assets?
|
466
470
|
preprocess cwd: vdir/"themes/standard/etc", # deps: depend, debug: true,
|
467
|
-
src: "blog.css.lt3", copy: vdir/"remote/etc/"
|
471
|
+
src: "blog.css.lt3", copy: vdir/"remote/etc/",
|
472
|
+
call: ".nopara" # , dst: "blog.css"
|
468
473
|
preprocess cwd: vdir/"themes/standard", deps: depend, force: true,
|
469
|
-
src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
|
474
|
+
src: "blog/generate.lt3", dst: vdir/:remote/"index.html",
|
475
|
+
call: ".nopara"
|
476
|
+
copy!("#{vdir}/themes/standard/banner/*", "#{vdir}/remote/banner/") # includes navbar/
|
470
477
|
copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
|
478
|
+
# rebuild widgets
|
471
479
|
copy_widget_html(view)
|
472
480
|
rescue => err
|
473
481
|
STDERR.puts err
|
@@ -574,7 +582,8 @@ class RuneBlog
|
|
574
582
|
# Step 1...
|
575
583
|
create_dirs(pdraft)
|
576
584
|
# FIXME dependencies?
|
577
|
-
preprocess cwd: pdraft, src: draft, dst: "guts.html"
|
585
|
+
preprocess cwd: pdraft, src: draft, dst: "guts.html",
|
586
|
+
mix: "liveblog" # , debug: true
|
578
587
|
_post_metadata(draft, pdraft)
|
579
588
|
# Step 2...
|
580
589
|
vposts = @root/:views/view_name/:posts
|
@@ -585,10 +594,13 @@ class RuneBlog
|
|
585
594
|
# Step 4...
|
586
595
|
# FIXME dependencies?
|
587
596
|
preprocess cwd: @theme/:post, src: "generate.lt3", force: true,
|
588
|
-
dst: remote/ahtml, copy: @theme/:post
|
597
|
+
dst: remote/ahtml, copy: @theme/:post,
|
598
|
+
call: ".nopara" # , debug: true
|
599
|
+
# copy(remote/ahtml, remote/permalink/ahtml)
|
589
600
|
# FIXME dependencies?
|
590
|
-
|
591
|
-
|
601
|
+
# preprocess cwd: @theme/:post, src: "permalink.lt3",
|
602
|
+
# dst: remote/:permalink/ahtml,
|
603
|
+
# mix: "liveblog" # , debug: true
|
592
604
|
copy_widget_html(view_name)
|
593
605
|
rescue => err
|
594
606
|
_tmp_error(err)
|
data/lib/runeblog_version.rb
CHANGED
@@ -1,11 +1,66 @@
|
|
1
|
+
if !defined?(RuneBlog::Path)
|
1
2
|
|
2
|
-
if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
|
3
|
+
# if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
|
3
4
|
|
4
5
|
class RuneBlog
|
5
|
-
VERSION = "0.2.
|
6
|
+
VERSION = "0.2.93"
|
6
7
|
|
7
8
|
path = Gem.find_files("runeblog").grep(/runeblog-/).first
|
8
9
|
Path = File.dirname(path)
|
9
10
|
end
|
10
11
|
|
12
|
+
# skeleton
|
13
|
+
|
14
|
+
class RuneBlog
|
15
|
+
module Helpers
|
16
|
+
end
|
17
|
+
|
18
|
+
class Default
|
19
|
+
end
|
20
|
+
|
21
|
+
class View
|
22
|
+
end
|
23
|
+
|
24
|
+
class Publishing
|
25
|
+
end
|
26
|
+
|
27
|
+
class Post
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# Refactor, move stuff elsewhere?
|
32
|
+
|
33
|
+
def make_exception(sym, str)
|
34
|
+
log!(enter: __method__, args: [sym, str], level: 3)
|
35
|
+
return if Object.constants.include?(sym)
|
36
|
+
Object.const_set(sym, StandardError.dup)
|
37
|
+
define_method(sym) do |*args|
|
38
|
+
msg = str
|
39
|
+
args.each.with_index {|arg, i| msg.sub!("$#{i+1}", arg) }
|
40
|
+
Object.class_eval(sym.to_s).new(msg)
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def system!(str, show: false)
|
45
|
+
log!(enter: __method__, args: [str], level: 2)
|
46
|
+
STDERR.puts str if show
|
47
|
+
rc = system(str)
|
48
|
+
if rc
|
49
|
+
return rc
|
50
|
+
else
|
51
|
+
STDERR.puts "FAILED: #{str.inspect}"
|
52
|
+
STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
|
53
|
+
sleep 6; RubyText.stop
|
54
|
+
exit
|
55
|
+
return rc
|
56
|
+
end
|
57
|
+
rc
|
58
|
+
end
|
59
|
+
|
60
|
+
def prefix(num)
|
61
|
+
log!(enter: __method__, args: [num], level: 3)
|
62
|
+
"#{'%04d' % num.to_i}"
|
63
|
+
end
|
64
|
+
|
65
|
+
|
11
66
|
end
|
data/lib/view.rb
CHANGED
@@ -1,8 +1,7 @@
|
|
1
|
-
require 'global'
|
2
1
|
require 'logging'
|
3
2
|
|
4
3
|
class RuneBlog::View
|
5
|
-
attr_reader :name, :state
|
4
|
+
attr_reader :name, :state, :globals
|
6
5
|
attr_accessor :publisher
|
7
6
|
|
8
7
|
include RuneBlog::Helpers
|
@@ -15,6 +14,10 @@ class RuneBlog::View
|
|
15
14
|
@publisher = RuneBlog::Publishing.new(name)
|
16
15
|
@can_publish = true # FIXME
|
17
16
|
@blog.view = self
|
17
|
+
gfile = @blog.root/"views/#{name}/themes/standard/global.lt3"
|
18
|
+
live = Livetext.customize(call: ".nopara")
|
19
|
+
live.xform_file(gfile)
|
20
|
+
@globals = live.vars
|
18
21
|
end
|
19
22
|
|
20
23
|
def dir
|
data/runeblog.gemspec
CHANGED
@@ -20,8 +20,8 @@ spec = Gem::Specification.new do |s|
|
|
20
20
|
s.authors = ["Hal Fulton"]
|
21
21
|
s.email = 'rubyhacker@gmail.com'
|
22
22
|
s.executables << "blog"
|
23
|
-
s.add_runtime_dependency 'livetext', '~> 0.8', '>= 0.8.
|
24
|
-
s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.
|
23
|
+
s.add_runtime_dependency 'livetext', '~> 0.8', '>= 0.8.99'
|
24
|
+
s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.20'
|
25
25
|
|
26
26
|
s.add_development_dependency 'minitest', '~> 5.10', '>= 5.10.0'
|
27
27
|
|
data/test/austin.rb
CHANGED
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.93
|
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-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: livetext
|
@@ -19,7 +19,7 @@ dependencies:
|
|
19
19
|
version: '0.8'
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
|
-
version: 0.8.
|
22
|
+
version: 0.8.99
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -29,7 +29,7 @@ dependencies:
|
|
29
29
|
version: '0.8'
|
30
30
|
- - ">="
|
31
31
|
- !ruby/object:Gem::Version
|
32
|
-
version: 0.8.
|
32
|
+
version: 0.8.99
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: rubytext
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
version: '0.1'
|
40
40
|
- - ">="
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.1.
|
42
|
+
version: 0.1.20
|
43
43
|
type: :runtime
|
44
44
|
prerelease: false
|
45
45
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -49,7 +49,7 @@ dependencies:
|
|
49
49
|
version: '0.1'
|
50
50
|
- - ">="
|
51
51
|
- !ruby/object:Gem::Version
|
52
|
-
version: 0.1.
|
52
|
+
version: 0.1.20
|
53
53
|
- !ruby/object:Gem::Dependency
|
54
54
|
name: minitest
|
55
55
|
requirement: !ruby/object:Gem::Requirement
|
@@ -91,7 +91,6 @@ files:
|
|
91
91
|
- empty_view/assets/sky2.jpg
|
92
92
|
- empty_view/posts/GIT_IS_DUMB
|
93
93
|
- empty_view/remote/assets/GIT_IS_DUMB
|
94
|
-
- empty_view/remote/banner/austin-pano.jpg
|
95
94
|
- empty_view/remote/etc/GIT_IS_DUMB
|
96
95
|
- empty_view/remote/permalink/GIT_IS_DUMB
|
97
96
|
- empty_view/remote/widgets/ad/GIT_IS_DUMB
|
@@ -100,12 +99,12 @@ files:
|
|
100
99
|
- empty_view/remote/widgets/pages/GIT_IS_DUMB
|
101
100
|
- empty_view/remote/widgets/pinned/GIT_IS_DUMB
|
102
101
|
- empty_view/themes/standard/README
|
103
|
-
- empty_view/themes/standard/banner/
|
104
|
-
- empty_view/themes/standard/banner/
|
105
|
-
- empty_view/themes/standard/banner/
|
106
|
-
- empty_view/themes/standard/banner/
|
102
|
+
- empty_view/themes/standard/banner/banner.lt3
|
103
|
+
- empty_view/themes/standard/banner/navbar/about.lt3
|
104
|
+
- empty_view/themes/standard/banner/navbar/contact.lt3
|
105
|
+
- empty_view/themes/standard/banner/navbar/faq.lt3
|
106
|
+
- empty_view/themes/standard/banner/navbar/list.data
|
107
107
|
- empty_view/themes/standard/banner/top.lt3
|
108
|
-
- empty_view/themes/standard/blog/banner.lt3
|
109
108
|
- empty_view/themes/standard/blog/generate.lt3
|
110
109
|
- empty_view/themes/standard/blog/head.lt3
|
111
110
|
- empty_view/themes/standard/blog/index.lt3
|
@@ -184,7 +183,6 @@ files:
|
|
184
183
|
- lib/exper/gen_svg.rb
|
185
184
|
- lib/exper/s2.html
|
186
185
|
- lib/exper/varmint.rb
|
187
|
-
- lib/global.rb
|
188
186
|
- lib/helpers-blog.rb
|
189
187
|
- lib/helpers-repl.rb
|
190
188
|
- lib/liveblog.rb
|
Binary file
|
@@ -1 +0,0 @@
|
|
1
|
-
.include ../widgets/pages/faq.lt3
|
data/lib/global.rb
DELETED
@@ -1,52 +0,0 @@
|
|
1
|
-
# skeleton
|
2
|
-
|
3
|
-
class RuneBlog
|
4
|
-
module Helpers
|
5
|
-
end
|
6
|
-
|
7
|
-
class Default
|
8
|
-
end
|
9
|
-
|
10
|
-
class View
|
11
|
-
end
|
12
|
-
|
13
|
-
class Publishing
|
14
|
-
end
|
15
|
-
|
16
|
-
class Post
|
17
|
-
end
|
18
|
-
end
|
19
|
-
|
20
|
-
# Refactor, move stuff elsewhere?
|
21
|
-
|
22
|
-
def make_exception(sym, str)
|
23
|
-
log!(enter: __method__, args: [sym, str], level: 3)
|
24
|
-
return if Object.constants.include?(sym)
|
25
|
-
Object.const_set(sym, StandardError.dup)
|
26
|
-
define_method(sym) do |*args|
|
27
|
-
msg = str
|
28
|
-
args.each.with_index {|arg, i| msg.sub!("$#{i+1}", arg) }
|
29
|
-
Object.class_eval(sym.to_s).new(msg)
|
30
|
-
end
|
31
|
-
end
|
32
|
-
|
33
|
-
def system!(str, show: false)
|
34
|
-
log!(enter: __method__, args: [str], level: 2)
|
35
|
-
STDERR.puts str if show
|
36
|
-
rc = system(str)
|
37
|
-
if rc
|
38
|
-
return rc
|
39
|
-
else
|
40
|
-
STDERR.puts "FAILED: #{str.inspect}"
|
41
|
-
STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
|
42
|
-
exit
|
43
|
-
return rc
|
44
|
-
end
|
45
|
-
rc
|
46
|
-
end
|
47
|
-
|
48
|
-
def prefix(num)
|
49
|
-
log!(enter: __method__, args: [num], level: 3)
|
50
|
-
"#{'%04d' % num.to_i}"
|
51
|
-
end
|
52
|
-
|