runeblog 0.2.89 → 0.2.94

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 69a5bfa546e814106599e4bd829ddf169bc07053b592db267bce813675f57119
4
- data.tar.gz: 05dfce46838cf7002e57dc1f279e8da776463a06734f3a445ca2d710d82b4e2a
3
+ metadata.gz: 7ed9580d074b2ce228aff385bbe22e907a9ae0c330f625aa2d42ee58464a1d3b
4
+ data.tar.gz: 0ce0642e8b2f0026cca4133916ff0dd3f992bb1ae8cb89e3304d90221d8195a8
5
5
  SHA512:
6
- metadata.gz: 170e5b90aff508ad77410a0b774bf30b79282e0928f863147d6da681879448e78a8e0d8053bf3c50a97a465b22a88d36409aaca16efe1c1fb20b59f1a365260b
7
- data.tar.gz: 37135518327009fd0300cc082914b29992934ecead7a62fe3c3f3bcbb72c6f290f0e7911a6ee94ed26f2b554d77cfd4da84f56cbfa6f95f5b15cac576639aa2a
6
+ metadata.gz: 84d30bada582bd3393e075a1cba653ec11e719941c675d1a9753d6dbf921643137e6096205b5120c91f385e6d9cb4a1e823440607b1db5ee23232c87885128bc
7
+ data.tar.gz: 0b0207066da6493400d66e9473c00659bef4b4169fb26cdbe554d220a59778579bd06207643516a409df39247fa8b263ae77229c16344912e81a8befb0237c6b
data/bin/blog CHANGED
@@ -25,8 +25,8 @@ end
25
25
  def get_universal
26
26
  univ = "#{@blog.root}/data/universal.lt3"
27
27
  if yesno("Faster initial setup? (no: edit universal.lt3)")
28
- author = ask("Author name: ")
29
- site = ask("Site/domain: ")
28
+ author = ask!("Author name: ")
29
+ site = ask!("Site/domain: ")
30
30
  # Now stash it...
31
31
  str = File.read(univ)
32
32
  str = str.gsub(/AUTHOR/, author)
@@ -41,8 +41,8 @@ def get_global
41
41
  if yesno("Faster view setup? (no: edit global.lt3)")
42
42
  view_name = ask("\nFilename: ")
43
43
  @blog.create_view(view_name) # call change_view??
44
- title = ask("View title: ")
45
- subtitle = ask("Subtitle : ")
44
+ title = ask!("View title: ")
45
+ subtitle = ask!("Subtitle : ")
46
46
  gname = "#{@blog.root}/views/#{view_name}/themes/standard/global.lt3"
47
47
  text = File.read(gname)
48
48
  text = text.gsub(/VIEW_NAME/, view_name)
@@ -50,7 +50,7 @@ def get_global
50
50
  text = text.gsub(/VIEW_SUBTITLE/, subtitle)
51
51
  File.write(gname, text)
52
52
  else
53
- view_name = ask("\nFilename: ")
53
+ view_name = ask!("\nFilename: ")
54
54
  @blog.create_view(view_name) # call change_view??
55
55
  vim_params = '-c ":set hlsearch" -c ":hi Search ctermfg=2 ctermbg=6" +/"\(VIEW_.*\|SITE.*\)"'
56
56
  edit_file(@blog.view.dir/"themes/standard/global.lt3", vim: vim_params)
@@ -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
- abort "Need Ruby 2.4 or greater" unless ver >= 24
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
 
@@ -0,0 +1 @@
1
+ .include ../../widgets/pages/faq.lt3
@@ -11,7 +11,7 @@
11
11
  $.seek global.lt3
12
12
  $.include blog/head.lt3
13
13
  <body>
14
- $.include blog/banner.lt3
14
+ $.include banner/banner.lt3
15
15
  <div class="content container-fluid mt-4">
16
16
  <div class="row">
17
17
  $.include blog/index.lt3
@@ -29,7 +29,7 @@ post.date.size 15px
29
29
  publish.user root
30
30
  publish.server rubyhacker.com
31
31
  publish.docroot /var/www/
32
- publish.path around_austin
32
+ publish.path stuff
33
33
  publish.proto http
34
34
  .end
35
35
 
@@ -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 The new amphitheatre is overrated
11
+ .title This is my title
15
12
  .pubdate 2019-07-09
16
- .views around_austin
13
+ .views stuff
17
14
  .tags
18
15
 
19
16
  .teaser
20
- It used to be that all major concerts played the Erwin Center.
21
-
17
+ This is only a short excerpt from the top of the blog post.
22
18
  .end
23
- Now, depending on what you consider "major," blah blah blah...
19
+
20
+ And now we continue the post.
21
+ Do we have anything to say?
22
+
23
+ Apparently not much.
24
24
 
@@ -9,7 +9,7 @@ class ::RuneBlog::Widget
9
9
  def initialize(repo)
10
10
  @blog = repo
11
11
  @datafile = input = "list.data"
12
- @lines = File.readlines(input)
12
+ @lines = _get_data(@datafile)
13
13
  end
14
14
 
15
15
  def build
@@ -7,7 +7,7 @@ class ::RuneBlog::Widget
7
7
  def initialize(repo)
8
8
  @blog = repo
9
9
  @datafile = "list.data"
10
- lines = File.readlines(@datafile)
10
+ lines = _get_data(@datafile)
11
11
  @data = lines.map {|line| line.chomp.split(/, */) }
12
12
  end
13
13
 
@@ -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 = File.readlines(@datafile)
12
+ @lines = _get_data(@datafile)
13
13
  @data = @lines.map {|x| x.chomp.split(/, */, 2) }
14
14
  end
15
15
 
@@ -7,7 +7,7 @@ class ::RuneBlog::Widget
7
7
  def initialize(repo)
8
8
  @blog = repo
9
9
  @datafile = "list.data"
10
- @lines = File.exist?(@datafile) ? File.readlines(@datafile) : []
10
+ @lines = _get_data?(@datafile)
11
11
  end
12
12
 
13
13
  def _html_body(file, css = nil) # FIXME
@@ -3,20 +3,15 @@ require 'fileutils'
3
3
 
4
4
  require 'processing'
5
5
 
6
- module RuneBlog::Helpers
6
+ require 'lowlevel'
7
7
 
8
- def copy(src, dst)
9
- log!(enter: __method__, args: [src, dst], level: 2)
10
- cmd = "cp #{src} #{dst} 2>/dev/null"
11
- rc = system!(cmd)
12
- puts " Failed: #{cmd} - from #{caller[0]}" unless rc
13
- end
8
+ module RuneBlog::Helpers
14
9
 
15
- def copy!(src, dst)
16
- log!(enter: __method__, args: [src, dst], level: 2)
17
- cmd = "cp -r #{src} #{dst} 2>/dev/null"
18
- rc = system!(cmd)
19
- puts " Failed: #{cmd} - from #{caller[0]}" unless rc
10
+ def quit_RubyText
11
+ return unless defined? RubyText
12
+ sleep 6
13
+ RubyText.stop
14
+ exit
20
15
  end
21
16
 
22
17
  def get_repo_config
@@ -54,7 +49,7 @@ module RuneBlog::Helpers
54
49
  puts "Can't read vars file '#{file}': #{err}"
55
50
  puts err.backtrace.join("\n")
56
51
  puts "dir = #{Dir.pwd}"
57
- exit
52
+ stop_RubyText
58
53
  end
59
54
 
60
55
  def read_config(file, *syms)
@@ -80,7 +75,7 @@ module RuneBlog::Helpers
80
75
  puts "Can't read config file '#{file}': #{err}"
81
76
  puts err.backtrace.join("\n")
82
77
  puts "dir = #{Dir.pwd}"
83
- exit
78
+ stop_RubyText
84
79
  end
85
80
 
86
81
  def try_read_config(file, hash)
@@ -98,26 +93,27 @@ module RuneBlog::Helpers
98
93
  end
99
94
  end
100
95
 
101
- def get_views # read from filesystem
96
+ def retrieve_views # read from filesystem
102
97
  log!(enter: __method__, level: 3)
103
98
  dirs = subdirs("#@root/views/").sort
104
99
  dirs.map {|name| RuneBlog::View.new(name) }
105
100
  end
106
101
 
107
- def write_repo_config(root: "#{Dir.pwd}/.blogs", view: "#{root}/data/VIEW", editor: "/usr/local/bin/vim")
102
+ def write_repo_config(root: "#{Dir.pwd}/.blogs", view: nil, editor: "/usr/local/bin/vim")
103
+ view ||= File.read("#{root}/data/VIEW").chomp rescue "[no view]"
108
104
  File.write(root + "/data/ROOT", root + "\n")
109
105
  File.write(root + "/data/VIEW", view.to_s + "\n")
110
106
  File.write(root + "/data/EDITOR", editor + "\n")
111
107
  end
112
108
 
113
- def new_dotfile(root: ".blogs", current_view: "test_view", editor: "vi")
114
- log!(enter: __method__, args: [root, current_view, editor], level: 3)
115
- root = Dir.pwd + "/" + root
116
- x = OpenStruct.new
117
- x.root, x.current_view, x.editor = root, current_view, editor
118
- write_config(x, root + "/" + RuneBlog::ConfigFile)
119
- write_repo_config
120
- end
109
+ # def new_dotfile(root: ".blogs", current_view: "test_view", editor: "vi")
110
+ # log!(enter: __method__, args: [root, current_view, editor], level: 3)
111
+ # root = Dir.pwd + "/" + root
112
+ # x = OpenStruct.new
113
+ # x.root, x.current_view, x.editor = root, current_view, editor
114
+ # write_config(x, root + "/" + RuneBlog::ConfigFile)
115
+ # write_repo_config
116
+ # end
121
117
 
122
118
  def new_sequence
123
119
  log!(enter: __method__, level: 3)
@@ -145,38 +141,6 @@ module RuneBlog::Helpers
145
141
  files
146
142
  end
147
143
 
148
- def create_dirs(*dirs)
149
- log!(enter: __method__, args: [*dirs], level: 3)
150
- dirs.each do |dir|
151
- dir = dir.to_s # symbols allowed
152
- next if Dir.exist?(dir)
153
- cmd = "mkdir -p #{dir} >/dev/null"
154
- result = system!(cmd)
155
- raise CantCreateDir(dir) unless result
156
- end
157
- end
158
-
159
- def interpolate(str, bind)
160
- log!(enter: __method__, args: [str, bind], level: 3)
161
- wrap = "<<-EOS\n#{str}\nEOS"
162
- eval wrap, bind
163
- end
164
-
165
- def error(err) # Hmm, this is duplicated
166
- log!(str: "duplicated method", enter: __method__, args: [err], level: 2)
167
- str = "\n Error: #{err}"
168
- puts str
169
- puts err.backtrace.join("\n")
170
- end
171
-
172
- def dump(obj, name)
173
- log!(enter: __method__, args: [obj, name], level: 3)
174
- File.write(name, obj)
175
- end
176
144
  end
177
145
 
178
- def dump(obj, name) # FIXME scope
179
- log!(str: "scope problem", enter: __method__, args: [obj, name], level: 3)
180
- File.write(name, obj)
181
- end
182
146
 
@@ -109,26 +109,16 @@ module RuneBlog::REPL
109
109
  end
110
110
  meth = found || :cmd_INVALID
111
111
  params = cmd if meth == :cmd_INVALID
112
- # puts "choose: #{[meth, params].inspect}"
113
112
  [meth, params]
114
113
  end
115
114
 
116
- def error(err) # Hmm, this is duplicated
117
- str = "\n Error: #{err}"
118
- puts str
119
- puts err.backtrace.join("\n")
120
- end
121
-
122
115
  def ask(prompt, meth = :to_s)
123
116
  print prompt
124
- str = gets
125
- str.chomp!
126
- str.send(meth)
117
+ gets.chomp.send(meth)
127
118
  end
128
119
 
129
- def yesno(prompt, meth = :to_s)
130
- print prompt
131
- gets.chomp.upcase[0] == "Y"
120
+ def ask!(prompt, meth = :to_s)
121
+ ask(fx(prompt, :bold), meth)
132
122
  end
133
123
 
134
124
  def reset_output(initial = "")
@@ -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.*/, "")
@@ -44,7 +47,7 @@ end
44
47
 
45
48
  def post_trailer
46
49
  perma = _var("publish.proto") + "://" + _var("publish.server") +
47
- "/" + _var("publish.path") + "/permalink/" + _var("post.aslug") +
50
+ "/" + _var("publish.path") + "/" + _var("post.aslug") +
48
51
  ".html"
49
52
  tags = _var("post.tags")
50
53
  if tags.empty?
@@ -85,9 +88,10 @@ def code
85
88
  end
86
89
 
87
90
  def _read_navbar_data
88
- dir = @blog.root/:views/@blog.view/"themes/standard/banner/"
91
+ vdir = @blog.root/:views/@blog.view
92
+ dir = vdir/"themes/standard/banner/navbar/"
89
93
  datafile = dir/"list.data"
90
- File.readlines(datafile)
94
+ _get_data(datafile)
91
95
  end
92
96
 
93
97
  def banner
@@ -97,6 +101,7 @@ def banner
97
101
  high = 250
98
102
  str2 = ""
99
103
  navbar = nil
104
+ vdir = @blog.root/:views/@blog.view
100
105
  lines = _body.to_a
101
106
 
102
107
  lines.each do |line|
@@ -130,15 +135,9 @@ def banner
130
135
  end
131
136
  str2 << "<td>" + File.read(file) + "</td>" + "\n"
132
137
  when "navbar"
133
- dir = @blog.root/:views/@blog.view/"themes/standard/banner/" + "\n"
134
- _make_navbar # horiz is default
135
- file = "banner/navbar.html"
136
- navbar = File.read(file)
138
+ navbar = _make_navbar # horiz is default
137
139
  when "vnavbar"
138
- dir = @blog.root/:views/@blog.view/"themes/standard/banner/"
139
- _make_navbar(:vert)
140
- file = "banner/vnavbar.html"
141
- navbar = File.read(file)
140
+ navbar = _make_navbar(:vert)
142
141
  when "break"
143
142
  str2 << " </tr>\n <tr>" + "\n"
144
143
  else
@@ -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 = File.exist?(datafile) ? File.readlines(datafile) : []
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,25 +497,10 @@ 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
 
504
- # def pinned_rebuild
505
- # view = @blog.view
506
- # view = _args[0] unless _args.empty?
507
- # Dir.chdir(@blog.root/:views/view/"themes/standard/") do
508
- # wtag = "widgets/pinned"
509
- # code = _load_local("pinned")
510
- # if code
511
- # Dir.chdir(wtag) do
512
- # widget = code.new(@blog)
513
- # widget.build
514
- # end
515
- # # _include_file wtag/"pinned-card.html"
516
- # end
517
- # end
518
- # end
519
-
520
504
  def _handle_standard_widget(tag)
521
505
  wtag = :widgets/tag
522
506
  code = _load_local(tag)
@@ -564,6 +548,7 @@ def sidebar
564
548
  rescue => err
565
549
  puts "err = #{err}"
566
550
  puts err.backtrace.join("\n")
551
+ sleep 6; RubyText.stop
567
552
  exit
568
553
  end
569
554
 
@@ -686,20 +671,20 @@ def _make_navbar(orient = :horiz)
686
671
  </td></tr></table>
687
672
  HTML
688
673
 
689
- html_file = @blog.root/:views/@blog.view/"themes/standard/banner"/name
674
+ html_file = @blog.root/:views/@blog.view/"themes/standard/banner/navbar"/name
690
675
  output = File.new(html_file, "w")
691
676
  output.puts start
692
677
  lines = _read_navbar_data
693
678
  lines = ["index Home"] + lines unless _args.include?("nohome")
694
679
  lines.each do |line|
695
680
  basename, cdata = line.chomp.strip.split(" ", 2)
696
- full = :banner/basename+".html"
681
+ full = :banner/:navbar/basename+".html"
697
682
  href_main = _main(full)
698
683
  if basename == "index" # special case
699
684
  output.puts %[#{li1} <a class="nav-link" href="index.html">#{cdata}<span class="sr-only">(current)</span></a> #{li2}]
700
685
  else
701
- dir = @blog.root/:views/@blog.view/"themes/standard/banner"
702
- dest = vdir/"remote/banner"/basename+".html"
686
+ dir = @blog.root/:views/@blog.view/"themes/standard/banner/navbar"
687
+ dest = vdir/"remote/banner/navbar"/basename+".html"
703
688
  preprocess cwd: dir, src: basename, dst: dest, call: ".nopara" # , debug: true
704
689
  output.puts %[#{li1} <a class="nav-link" #{href_main}>#{cdata}</a> #{li2}]
705
690
  end
@@ -768,11 +753,6 @@ def _post_lookup(postid) # side-effect
768
753
  vp
769
754
  end
770
755
 
771
- def _interpolate(str, context) # FIXME move this later
772
- wrapped = "%[" + str.dup + "]" # could fail...
773
- eval(wrapped, context)
774
- end
775
-
776
756
  def _card_generic(card_title:, middle:, extra: "")
777
757
  front = <<-HTML
778
758
  <div class="card #{extra} mb-3">
@@ -0,0 +1,73 @@
1
+
2
+ def dump(obj, name)
3
+ File.write(name, obj)
4
+ end
5
+
6
+ def system!(str, show: false)
7
+ log!(enter: __method__, args: [str], level: 2)
8
+ STDERR.puts str if show
9
+ rc = system(str)
10
+ return rc if rc
11
+ STDERR.puts "FAILED: #{str.inspect}"
12
+ STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
13
+ if defined?(RubyText)
14
+ sleep 6
15
+ RubyText.stop
16
+ exit
17
+ end
18
+ return rc
19
+ end
20
+
21
+ def _get_data?(file) # File need not exist
22
+ if File.exist?(file)
23
+ _get_data(file)
24
+ else
25
+ []
26
+ end
27
+ end
28
+
29
+ def _get_data(file)
30
+ lines = File.readlines(file)
31
+ lines.reject! {|line| line[0] == "-" } # allow rejection of lines
32
+ lines = lines.map do |line|
33
+ line.sub(/ *# .*$/, "") # allow trailing comments
34
+ end
35
+ lines
36
+ end
37
+
38
+ def copy(src, dst)
39
+ log!(enter: __method__, args: [src, dst], level: 2)
40
+ cmd = "cp #{src} #{dst} 2>/dev/null"
41
+ system!(cmd)
42
+ end
43
+
44
+ def copy!(src, dst)
45
+ log!(enter: __method__, args: [src, dst], level: 2)
46
+ cmd = "cp -r #{src} #{dst} 2>/dev/null"
47
+ system!(cmd)
48
+ end
49
+
50
+ def create_dirs(*dirs)
51
+ log!(enter: __method__, args: [*dirs], level: 3)
52
+ dirs.each do |dir|
53
+ dir = dir.to_s # symbols allowed
54
+ next if Dir.exist?(dir)
55
+ cmd = "mkdir -p #{dir} >/dev/null"
56
+ result = system!(cmd)
57
+ raise CantCreateDir(dir) unless result
58
+ end
59
+ end
60
+
61
+ def interpolate(str, bind)
62
+ log!(enter: __method__, args: [str, bind], level: 3)
63
+ wrap = "<<-EOS\n#{str}\nEOS"
64
+ eval wrap, bind
65
+ end
66
+
67
+ def error(err)
68
+ log!(str: err, enter: __method__, args: [err], level: 2)
69
+ str = "\n Error: #{err}"
70
+ puts str
71
+ puts err.backtrace.join("\n")
72
+ end
73
+
@@ -37,31 +37,15 @@ class RuneBlog::Publishing
37
37
  url = "#@proto://#@server/#@path" # /#{vname}"
38
38
  end
39
39
 
40
- def system!(str)
41
- log!(enter: __method__, args: [str], level: 1)
42
- rc = system(str)
43
- rc
44
- end
45
-
46
- def publish(files, assets=[])
47
- log!(enter: __method__, args: [files, assets], level: 1)
40
+ def publish
41
+ log!(enter: __method__, level: 1)
48
42
  dir = @docroot/@path
49
43
  view_name = @blog.view.name
50
44
  viewpath = dir # /view_name
51
- result = system!("ssh #@user@#@server -x mkdir -p #{viewpath}/assets")
52
- files.each do |file|
53
- dest = "#@user@#@server:" + dir # /view_name
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
64
- dump(files, "#{@blog.view.dir}/last_published")
45
+ # FIXME rsync doesn't work
46
+ cmd = "rsync -r -z #{@blog.root}/views/#{@blog.view}/remote/ #@user@#@server:#{viewpath}/"
47
+ system!(cmd)
48
+ dump("#{@blog.view} at #{Time.now}", "#{@blog.view.dir}/last_published")
65
49
  true
66
50
  end
67
51
 
@@ -39,6 +39,7 @@ module RuneBlog::REPL
39
39
 
40
40
  def cmd_config(arg, testing = false)
41
41
  hash = {"global.lt3 Global configuration" => "global.lt3",
42
+ "banner/top.lt3 Text portion of banner" => "banner/top.lt3",
42
43
  "blog/generate.lt3 Generator for view (usu not edited)" => "blog/generate.lt3",
43
44
  ".... head.lt3 HEAD info for view" => "blog/head.lt3",
44
45
  ".... banner.lt3 banner description" => "blog/banner.lt3",
@@ -75,10 +76,10 @@ module RuneBlog::REPL
75
76
  end
76
77
 
77
78
  def _manage_navbar(arg, testing = false) # cloned from manage_pages
78
- dir = @blog.view.dir/"themes/standard/navbar"
79
+ dir = @blog.view.dir/"themes/standard/banner/navbar"
79
80
  files = Dir.entries(dir) - %w[. .. navbar.lt3]
80
- new_item = " [New item] "
81
81
  main_file = "[ navbar.lt3 ]"
82
+ new_item = " [New item] "
82
83
  files = [main_file] + files + [new_item]
83
84
  num, fname = STDSCR.menu(title: "Edit navbar:", items: files)
84
85
  return if fname.nil?
@@ -113,7 +114,7 @@ module RuneBlog::REPL
113
114
  dir = @blog.view.dir/"themes/standard/widgets/pages"
114
115
  # Assume child files already generated (and list.data??)
115
116
  data = dir/"list.data"
116
- lines = File.readlines(data)
117
+ lines = _get_data?(data)
117
118
  hash = {}
118
119
  lines.each do |line|
119
120
  url, name = line.chomp.split(",")
@@ -192,19 +193,8 @@ module RuneBlog::REPL
192
193
  return @out
193
194
  end
194
195
 
195
- # Need to check dirty/clean status first
196
- dirty, all, assets = @blog.view.publishable_files
197
- files = dirty
198
- if dirty.empty?
199
- puts fx("\n No files are out of date." + " "*20, :bold)
200
- print " Publish anyway? "
201
- yn = RubyText.gets.chomp
202
- files = all if yn == "y"
203
- end
204
- return @out if files.empty?
205
-
206
196
  ret = RubyText.spinner(label: " Publishing... ") do
207
- @blog.view.publisher.publish(files, assets) # FIXME weird?
197
+ @blog.view.publisher.publish
208
198
  end
209
199
  return @out unless ret
210
200
 
@@ -10,7 +10,6 @@ require 'logging'
10
10
 
11
11
  require 'runeblog_version'
12
12
  require 'helpers-blog'
13
- require 'default'
14
13
  require 'view'
15
14
  require 'publish'
16
15
  require 'post'
@@ -48,6 +47,34 @@ class RuneBlog
48
47
 
49
48
  include Helpers
50
49
 
50
+ class Default
51
+
52
+ # This will all become much more generic later.
53
+
54
+ def RuneBlog.post_template(num: 0, title: "No title", date: nil, view: "test_view",
55
+ teaser: "No teaser", body: "No body", tags: ["untagged"],
56
+ views: [], back: "javascript:history.go(-1)", home: "no url")
57
+ log!(enter: __method__, args: [num, title, date, view, teaser, body, tags, views, back, home], level: 3)
58
+ viewlist = (views + [view.to_s]).join(" ")
59
+ taglist = ".tags " + tags.join(" ")
60
+
61
+ <<~TEXT
62
+ .post #{num}
63
+
64
+ .title #{title}
65
+ .pubdate #{date}
66
+ .views #{viewlist}
67
+ #{taglist}
68
+
69
+ .teaser
70
+ #{teaser}
71
+ .end
72
+ #{body}
73
+ TEXT
74
+ end
75
+
76
+ end
77
+
51
78
  def _tmp_error(err) # FIXME move to helpers
52
79
  out = "/tmp/blog#{rand(100)}.txt"
53
80
  File.open(out, "w") do |f|
@@ -68,7 +95,7 @@ class RuneBlog
68
95
  create_dirs(:data, :drafts, :views, :posts)
69
96
  new_sequence
70
97
  end
71
- copy_data(:config, repo_root/:data)
98
+ copy_data(:config, repo_root/:data) unless File.exist?(repo_root/"data/VIEW")
72
99
  write_repo_config(root: repo_root)
73
100
  @blog = self.new
74
101
  @blog
@@ -90,10 +117,11 @@ class RuneBlog
90
117
  self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
91
118
 
92
119
  @root = Dir.pwd/root_rel
93
- copy_data(:config, @root/:data)
120
+ # copy_data(:config, @root/:data) unless File.exist?(@root/"data/VIEW")
94
121
  write_repo_config(root: @root)
95
122
  get_repo_config
96
- @views = get_views
123
+ @views = retrieve_views
124
+ self.view = File.read(@root/"data/VIEW").chomp
97
125
  md = Dir.pwd.match(%r[.*/views/(.*?)/])
98
126
  if md
99
127
  @view_name = md[1]
@@ -209,6 +237,9 @@ class RuneBlog
209
237
  def view=(arg)
210
238
  log!(enter: __method__, args: [arg], level: 2)
211
239
  case arg
240
+ when "[no view]"
241
+ # puts "Warning: No current view set"
242
+ @view = nil
212
243
  when RuneBlog::View
213
244
  @view = arg
214
245
  _set_publisher
@@ -472,7 +503,9 @@ class RuneBlog
472
503
  preprocess cwd: vdir/"themes/standard", deps: depend, force: true,
473
504
  src: "blog/generate.lt3", dst: vdir/:remote/"index.html",
474
505
  call: ".nopara"
506
+ copy!("#{vdir}/themes/standard/banner/*", "#{vdir}/remote/banner/") # includes navbar/
475
507
  copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
508
+ # rebuild widgets
476
509
  copy_widget_html(view)
477
510
  rescue => err
478
511
  STDERR.puts err
@@ -484,8 +517,8 @@ class RuneBlog
484
517
  log!(enter: __method__, args: [draft], level: 2)
485
518
  # FIXME dumb code
486
519
  view_line = File.readlines(draft).grep(/^.views /)
487
- raise "More than one .views call!" if view_line.size > 1
488
- raise "No .views call!" if view_line.size < 1
520
+ raise "More than one .views call in #{draft}" if view_line.size > 1
521
+ raise "No .views call in #{draft}" if view_line.size < 1
489
522
  view_line = view_line.first
490
523
  views = view_line[7..-1].split
491
524
  views.uniq
@@ -593,10 +626,11 @@ class RuneBlog
593
626
  preprocess cwd: @theme/:post, src: "generate.lt3", force: true,
594
627
  dst: remote/ahtml, copy: @theme/:post,
595
628
  call: ".nopara" # , debug: true
629
+ # copy(remote/ahtml, remote/permalink/ahtml)
596
630
  # FIXME dependencies?
597
- preprocess cwd: @theme/:post, src: "permalink.lt3",
598
- dst: remote/:permalink/ahtml,
599
- mix: "liveblog" # , debug: true
631
+ # preprocess cwd: @theme/:post, src: "permalink.lt3",
632
+ # dst: remote/:permalink/ahtml,
633
+ # mix: "liveblog" # , debug: true
600
634
  copy_widget_html(view_name)
601
635
  rescue => err
602
636
  _tmp_error(err)
@@ -3,7 +3,7 @@ if !defined?(RuneBlog::Path)
3
3
  # if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
4
4
 
5
5
  class RuneBlog
6
- VERSION = "0.2.89"
6
+ VERSION = "0.2.94"
7
7
 
8
8
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
9
9
  Path = File.dirname(path)
@@ -41,21 +41,6 @@ def make_exception(sym, str)
41
41
  end
42
42
  end
43
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
- exit
54
- return rc
55
- end
56
- rc
57
- end
58
-
59
44
  def prefix(num)
60
45
  log!(enter: __method__, args: [num], level: 3)
61
46
  "#{'%04d' % num.to_i}"
@@ -8,7 +8,6 @@ abort "Need Ruby 2.4 or greater" unless ver >= 24
8
8
 
9
9
  require 'date'
10
10
 
11
- require 'global'
12
11
  require 'runeblog'
13
12
  require 'repl'
14
13
 
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.89
4
+ version: 0.2.94
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-18 00:00:00.000000000 Z
11
+ date: 2019-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -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/about.lt3
104
- - empty_view/themes/standard/banner/contact.lt3
105
- - empty_view/themes/standard/banner/faq.lt3
106
- - empty_view/themes/standard/banner/list.data
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
@@ -176,7 +175,6 @@ files:
176
175
  - empty_view/themes/standard/widgets/tag-cloud/tag-cloud.lt3
177
176
  - empty_view/themes/standard/widgets/tag-cloud/tag-cloud.rb
178
177
  - lib/Javascript.stuff
179
- - lib/default.rb
180
178
  - lib/exper/2svg.lt3
181
179
  - lib/exper/callout.js
182
180
  - lib/exper/fbtw-js
@@ -188,6 +186,7 @@ files:
188
186
  - lib/helpers-repl.rb
189
187
  - lib/liveblog.rb
190
188
  - lib/logging.rb
189
+ - lib/lowlevel.rb
191
190
  - lib/pathmagic.rb
192
191
  - lib/post.rb
193
192
  - lib/processing.rb
@@ -1 +0,0 @@
1
- .include ../widgets/pages/faq.lt3
@@ -1,31 +0,0 @@
1
- class RuneBlog::Default
2
-
3
- # This will all become much more generic later.
4
-
5
- def RuneBlog.post_template(num: 0, title: "No title", date: nil, view: "test_view",
6
- teaser: "No teaser", body: "No body", tags: ["untagged"],
7
- views: [], back: "javascript:history.go(-1)", home: "no url")
8
- log!(enter: __method__, args: [num, title, date, view, teaser, body, tags, views, back, home], level: 3)
9
- viewlist = (views + [view.to_s]).join(" ")
10
- taglist = ".tags " + tags.join(" ")
11
-
12
- # .mixin liveblog
13
- # . ^ get rid of this later
14
-
15
- <<-TEXT
16
- .post #{num}
17
-
18
- .title #{title}
19
- .pubdate #{date}
20
- .views #{viewlist}
21
- #{taglist}
22
-
23
- .teaser
24
- #{teaser}
25
- .end
26
- #{body}
27
- TEXT
28
-
29
- end
30
-
31
- end