runeblog 0.2.81 → 0.2.82

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: d15f5bd6b7e8b87c3de63a77516dee2c6f57134a2a3c5b51db502aad0aaa3181
4
- data.tar.gz: ff84de0a2c007a9f75f38295ea6bbcd7dcdcb3b3963294b7c74c2dd79cfbb8c4
3
+ metadata.gz: cf0392a5b2be6bcfaf114bedc0840674a9c7d2908015409ea79eef9908b0d624
4
+ data.tar.gz: 494acd91ce701943026f595ac91f8db9559b918a6831935d14e1fa3439bbe19c
5
5
  SHA512:
6
- metadata.gz: ef4cfbb271c5711f0a55f771bed52e9d59327ffdccdc4eadda5eab8b9438c043224aeac21a766aa63dd0638887cfc3d16fd9eac0bf647a698b091cd282b330ca
7
- data.tar.gz: 4de4e96e9f22e523c48d512267a0bd51fbdb3ed6aecf61b8724aa98cab92e7988fc151d5e9ca8cf27fe1ca926758e7e4236c57f4e288bde334abfe9de5c61915
6
+ metadata.gz: f69efa439801300a96ffe32b9d0f78abd36ea641e22b39f78102f3fc123bc2150cd600fc8818708f3ca3228907c0d618483a7822cd16acfb98f5fb999d67a4ac
7
+ data.tar.gz: da42919ea67d3393036663a3178f2223d7ad9aec800a78c13fc536d7f871d6e5a834233e94bd001ed9519d61302dd900e3847689530e322c05df00d54ebfd3a5
@@ -18,7 +18,7 @@ class ::RuneBlog::Widget
18
18
  children = Dir["*.lt3"] - ["pages.lt3"]
19
19
  children.each do |child|
20
20
  dest = child.sub(/.lt3$/, ".html")
21
- xlate src: child, dst: dest
21
+ preprocess src: child, dst: dest
22
22
  end
23
23
  write_main
24
24
  write_card
@@ -1,7 +1,7 @@
1
1
  require 'runeblog_version'
2
2
  require 'fileutils'
3
3
 
4
- require 'xlate'
4
+ require 'processing'
5
5
 
6
6
  module RuneBlog::Helpers
7
7
 
@@ -5,7 +5,7 @@ require 'find'
5
5
 
6
6
  require 'runeblog'
7
7
  require 'pathmagic'
8
- require 'xlate'
8
+ require 'processing'
9
9
 
10
10
 
11
11
  def init_liveblog # FIXME - a lot of this logic sucks
@@ -424,19 +424,12 @@ def pin
424
424
  pinned.each do |pinview|
425
425
  dir = @blog.root/:views/pinview/"themes/standard/widgets/pinned/"
426
426
  datafile = dir/"list.data"
427
- if File.exist?(datafile)
428
- pins = File.readlines(datafile)
429
- else
430
- pins = []
431
- end
427
+ pins = File.exist?(datafile) ? File.readlines(datafile) : []
432
428
  pins << "#{@meta.num} #{@meta.title}\n"
433
429
  pins.uniq!
434
- File.open(datafile, "w") do |outfile|
435
- pins.each {|pin| outfile.puts pin }
436
- end
430
+ File.open(datafile, "w") {|out| pins.each {|pin| out.puts pin } }
437
431
  end
438
432
  _optional_blank_line
439
- pinned_rebuild # FIXME experimental
440
433
  rescue => err
441
434
  STDERR.puts "err = #{err}"
442
435
  STDERR.puts err.backtrace.join("\n")
@@ -585,21 +578,21 @@ rescue => err
585
578
  exit
586
579
  end
587
580
 
588
- def pinned_rebuild
589
- view = @blog.view
590
- view = _args[0] unless _args.empty?
591
- Dir.chdir(@blog.root/:views/view/"themes/standard/") do
592
- wtag = "widgets/pinned"
593
- code = _load_local("pinned")
594
- if code
595
- Dir.chdir(wtag) do
596
- widget = code.new(@blog)
597
- widget.build
598
- end
599
- # _include_file wtag/"pinned-card.html"
600
- end
601
- end
602
- end
581
+ # def pinned_rebuild
582
+ # view = @blog.view
583
+ # view = _args[0] unless _args.empty?
584
+ # Dir.chdir(@blog.root/:views/view/"themes/standard/") do
585
+ # wtag = "widgets/pinned"
586
+ # code = _load_local("pinned")
587
+ # if code
588
+ # Dir.chdir(wtag) do
589
+ # widget = code.new(@blog)
590
+ # widget.build
591
+ # end
592
+ # # _include_file wtag/"pinned-card.html"
593
+ # end
594
+ # end
595
+ # end
603
596
 
604
597
  def _handle_standard_widget(tag)
605
598
  wtag = :widgets/tag
@@ -640,14 +633,10 @@ def sidebar
640
633
  File.open(wtag/"vars.lt3", "w") do |f|
641
634
  f.puts ".set ad.image = #{img}"
642
635
  end
643
- xlate cwd: wtag, src: tag, dst: tcard, force: true # , deps: depend # , debug: true
636
+ preprocess cwd: wtag, src: tag, dst: tcard, force: true # , debug: true # , deps: depend
644
637
  end
645
638
 
646
639
  _include_file wtag/tcard
647
- # depend = %w[card.css main.css custom.rb local.rb]
648
- # depend += ["#{wtag}.lt3", "#{wtag}.rb"]
649
- # depend.map! {|x| @blog.view.dir/"themes/standard/widgets"/wtag/x }
650
- # _debug "--- call xlate #{tag} src = #{tag} dst = #{tcard}\r"
651
640
  end
652
641
  _out %[</div>]
653
642
  rescue => err
@@ -787,7 +776,7 @@ def _make_navbar(orient = :horiz)
787
776
  output.puts %[#{li1} <a class="nav-link" href="index.html">#{cdata}<span class="sr-only">(current)</span></a> #{li2}]
788
777
  else
789
778
  dir = @blog.root/:views/@blog.view/"themes/standard/banner"
790
- xlate cwd: dir, src: basename, dst: vdir/"remote/banner"/basename+".html" # , debug: true
779
+ preprocess cwd: dir, src: basename, dst: vdir/"remote/banner"/basename+".html" # , debug: true
791
780
  output.puts %[#{li1} <a class="nav-link" #{href_main}>#{cdata}</a> #{li2}]
792
781
  end
793
782
  end
@@ -0,0 +1,49 @@
1
+ if ! defined?(LIVE)
2
+
3
+ require 'livetext'
4
+
5
+ LIVE = Livetext.new
6
+ LEXT = ".lt3"
7
+
8
+ def newer?(f1, f2)
9
+ File.mtime(f1) > File.mtime(f2)
10
+ end
11
+
12
+ def stale?(src, dst, deps, force = false)
13
+ meh = File.new("/tmp/dammit-#{src.gsub(/\//, "-")}", "w")
14
+ log!(enter: __method__, args: [src, dst], level: 3)
15
+ raise "Source #{src} not found in #{Dir.pwd}" unless File.exist?(src)
16
+ return true if force
17
+ return true unless File.exist?(dst)
18
+ return true if newer?(src, dst)
19
+ deps.each {|dep| return true if newer?(dep, dst) }
20
+ return false
21
+ end
22
+
23
+ def preprocess(cwd: Dir.pwd, src:,
24
+ dst: (strip = true; File.basename(src).sub(/.lt3$/,"")),
25
+ deps: [], copy: nil, debug: false, force: false)
26
+ src += LEXT unless src.end_with?(LEXT)
27
+ dst += ".html" unless (dst.end_with?(".html") || strip)
28
+ sp = " "*12
29
+ Dir.chdir(cwd) do
30
+ if debug
31
+ STDERR.puts "#{sp} -- preprocess "
32
+ STDERR.puts "#{sp} src: #{src}"
33
+ STDERR.puts "#{sp} dst: #{dst}"
34
+ STDERR.puts "#{sp} in: #{Dir.pwd}"
35
+ STDERR.puts "#{sp} from: #{caller[0]}"
36
+ STDERR.puts "#{sp} copy: #{copy}" if copy
37
+ end
38
+ stale = stale?(src, dst, deps, force)
39
+ if stale
40
+ live = Livetext.new
41
+ out = live.xform_file(src)
42
+ File.write(dst, out)
43
+ system!("cp #{dst} #{copy}") if copy
44
+ end
45
+ puts "#{sp} -- ^ Already up to date!" if debug && ! stale
46
+ end
47
+ end
48
+
49
+ end
@@ -1,9 +1,14 @@
1
+ if ! defined?(Already_publish)
2
+
3
+ Already_publish = nil
4
+
1
5
  require 'global'
2
6
  require 'pathmagic'
3
7
 
4
8
  class RuneBlog::Publishing
5
9
  attr_reader :user, :server, :docroot, :path
6
10
 
11
+
7
12
  BadRemoteLogin = Exception.new("Can't login remotely")
8
13
  BadRemotePerms = Exception.new("Bad remote permissions")
9
14
 
@@ -80,3 +85,4 @@ class RuneBlog::Publishing
80
85
  end
81
86
  end
82
87
 
88
+ end
@@ -1,3 +1,7 @@
1
+ if ! defined?(Already_runeblog)
2
+
3
+ Already_runeblog = nil
4
+
1
5
  require 'date'
2
6
  require 'find'
3
7
  require 'ostruct'
@@ -160,7 +164,7 @@ STDERR.puts "Remember: fix global.lt3"
160
164
  dir = @root/:posts/nslug
161
165
  create_dirs(dir)
162
166
  # FIXME dependencies?
163
- xlate cwd: dir, src: @root/:drafts/sourcefile # , debug: true
167
+ preprocess cwd: dir, src: @root/:drafts/sourcefile # , debug: true
164
168
  _deploy_local(dir)
165
169
  rescue => err
166
170
  _tmp_error(err)
@@ -332,7 +336,7 @@ STDERR.puts "Remember: fix global.lt3"
332
336
  @theme = @view.dir/"themes/standard"
333
337
  post_entry_name = @theme/"blog/post_entry.lt3"
334
338
  depend = [post_entry_name]
335
- xlate src: post_entry_name, dst: "/tmp/post_entry.html" # , deps: depend # , debug: true
339
+ preprocess src: post_entry_name, dst: "/tmp/post_entry.html" # , deps: depend # , debug: true
336
340
  @_post_entry ||= File.read("/tmp/post_entry.html")
337
341
  vp = post_lookup(id)
338
342
  nslug, aslug, title, date, teaser_text =
@@ -448,10 +452,10 @@ STDERR.puts "Remember: fix global.lt3"
448
452
  @theme/"blog/head.lt3",
449
453
  # @theme/"navbar/navbar.lt3",
450
454
  @theme/"blog/index.lt3"] # FIXME what about assets?
451
- xlate cwd: vdir/"themes/standard/etc", # deps: depend, debug: true,
452
- src: "blog.css.lt3", copy: vdir/"remote/etc/" # , dst: "blog.css"
453
- xlate cwd: vdir/"themes/standard", deps: depend, force: true,
454
- src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
455
+ preprocess cwd: vdir/"themes/standard/etc", # deps: depend, debug: true,
456
+ src: "blog.css.lt3", copy: vdir/"remote/etc/" # , dst: "blog.css"
457
+ preprocess cwd: vdir/"themes/standard", deps: depend, force: true,
458
+ src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
455
459
  copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
456
460
  copy_widget_html(view)
457
461
  rescue => err
@@ -559,7 +563,7 @@ STDERR.puts "Remember: fix global.lt3"
559
563
  # Step 1...
560
564
  create_dirs(pdraft)
561
565
  # FIXME dependencies?
562
- xlate cwd: pdraft, src: draft, dst: "guts.html" # , debug: true
566
+ preprocess cwd: pdraft, src: draft, dst: "guts.html" # , debug: true
563
567
  _post_metadata(draft, pdraft)
564
568
  # Step 2...
565
569
  vposts = @root/:views/view_name/:posts
@@ -569,11 +573,11 @@ STDERR.puts "Remember: fix global.lt3"
569
573
  copy(pdraft/"vars.lt3", @theme/:post)
570
574
  # Step 4...
571
575
  # FIXME dependencies?
572
- xlate cwd: @theme/:post, src: "generate.lt3", force: true,
573
- dst: remote/ahtml, copy: @theme/:post # , debug: true
576
+ preprocess cwd: @theme/:post, src: "generate.lt3", force: true,
577
+ dst: remote/ahtml, copy: @theme/:post # , debug: true
574
578
  # FIXME dependencies?
575
- xlate cwd: @theme/:post, src: "permalink.lt3",
576
- dst: remote/:permalink/ahtml # , debug: true
579
+ preprocess cwd: @theme/:post, src: "permalink.lt3",
580
+ dst: remote/:permalink/ahtml # , debug: true
577
581
  copy_widget_html(view_name)
578
582
  rescue => err
579
583
  _tmp_error(err)
@@ -658,3 +662,4 @@ STDERR.puts "Remember: fix global.lt3"
658
662
  end
659
663
  end
660
664
 
665
+ end
@@ -2,7 +2,7 @@
2
2
  if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
3
3
 
4
4
  class RuneBlog
5
- VERSION = "0.2.81"
5
+ VERSION = "0.2.82"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
@@ -73,9 +73,6 @@ File.open(".blogs/views/around_austin/themes/standard/global.lt3", "a") do |f|
73
73
  end
74
74
  ####
75
75
 
76
- debug("** generate_view: #{bold('around_austin')}")
77
- x.generate_view("around_austin")
78
-
79
76
  debug("-- change_view: #{bold('around_austin')}")
80
77
  x.change_view("around_austin") # 1 2 7 8 9
81
78
 
@@ -150,8 +147,9 @@ debug
150
147
  debug "** generate_index #{bold("around_austin")}"
151
148
  x.generate_index("around_austin")
152
149
 
153
- debug
154
- x.change_view("around_austin")
150
+ debug("** generate_view: #{bold('around_austin')}")
151
+ x.generate_view("around_austin")
152
+
155
153
  debug bold("...finished.\n")
156
154
 
157
155
  t1 = Time.now
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.81
4
+ version: 0.2.82
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-13 00:00:00.000000000 Z
11
+ date: 2019-12-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -191,12 +191,12 @@ files:
191
191
  - lib/logging.rb
192
192
  - lib/pathmagic.rb
193
193
  - lib/post.rb
194
+ - lib/processing.rb
194
195
  - lib/publish.rb
195
196
  - lib/repl.rb
196
197
  - lib/runeblog.rb
197
198
  - lib/runeblog_version.rb
198
199
  - lib/view.rb
199
- - lib/xlate.rb
200
200
  - test/austin.rb
201
201
  - test/fakeimage.jpg
202
202
  - test/general_test.rb
@@ -1,77 +0,0 @@
1
- require 'livetext'
2
-
3
- LIVE = Livetext.new
4
- LEXT = ".lt3"
5
-
6
- def newer?(f1, f2)
7
- File.mtime(f1) > File.mtime(f2)
8
- end
9
-
10
- def stale?(src, dst, deps, force = false)
11
- meh = File.new("/tmp/dammit-#{src.gsub(/\//, "-")}", "w")
12
- log!(enter: __method__, args: [src, dst], level: 3)
13
- raise "Source #{src} not found in #{Dir.pwd}" unless File.exist?(src)
14
- return true if force
15
- return true unless File.exist?(dst)
16
- return true if newer?(src, dst)
17
- deps.each {|dep| return true if newer?(dep, dst) }
18
- return false
19
- end
20
-
21
- def preprocess(cwd: Dir.pwd, src:,
22
- dst: (strip = true; File.basename(src).sub(/.lt3$/,"")),
23
- deps: [], copy: nil, debug: false, force: false)
24
- src += LEXT unless src.end_with?(LEXT)
25
- dst += ".html" unless (dst.end_with?(".html") || strip)
26
- sp = " "*12
27
- Dir.chdir(cwd) do
28
- if debug
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
35
- end
36
- stale = stale?(src, dst, deps, force)
37
- if stale
38
- out = LIVE.xform_file(src)
39
- File.write(dst, out)
40
- system!("cp #{dst} #{copy}") if copy
41
- else
42
- puts "#{sp} -- ^ Already up to date!" if debug
43
- return
44
- end
45
- end
46
- end
47
-
48
- def xlate(cwd: Dir.pwd, src:,
49
- dst: (strip = true; File.basename(src).sub(/.lt3$/,"")),
50
- deps: [], copy: nil, debug: false, force: false)
51
- src += LEXT unless src.end_with?(LEXT)
52
- dst += ".html" unless (dst.end_with?(".html") || strip)
53
- indent = " "*12
54
- Dir.chdir(cwd) do
55
- if debug
56
- puts "#{indent} -- xlate #{src} >#{dst}"
57
- puts "#{indent} in: #{Dir.pwd}"
58
- puts "#{indent} from: #{caller[0]}"
59
- puts "#{indent} copy: #{copy}" if copy
60
- end
61
- stale = stale?(src, dst, deps, force)
62
- if stale
63
- rc = system("livetext #{src} >#{dst}")
64
- puts "...completed (shell returned #{rc})" if debug
65
- system!("cp #{dst} #{copy}") if copy
66
- else
67
- puts "#{indent} -- ^ Already up to date!" if debug
68
- return
69
- end
70
- end
71
- end
72
-
73
- def xlate!(cwd: Dir.pwd, src:, copy: nil, debug: false, force: false)
74
- output = "/tmp/xlate-#{File.basename(src).sub(/.lt3$/, "")}"
75
- xlate cwd: cwd, src: src, dst: output, debug: debug, force: force
76
- File.read(output + ".html") # return all content as string
77
- end