runeblog 0.2.9 → 0.2.10

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: ae634ff247c9e37f85f453412336c0256c6c2d51277b602d3d6a730cc6690d0f
4
- data.tar.gz: 6c1820b2b838177cf75ae2762143ac476d63800ca47fdd5965885c4e84c653c9
3
+ metadata.gz: a037d087baf23e47f7b3c254dac3348048cc9c498ad439a5f235149b9bbf96cb
4
+ data.tar.gz: f82a11b32ee3eb3738abdc1a60f3fc1606efb5252a29f5902d53591117199c6c
5
5
  SHA512:
6
- metadata.gz: 373bb671173802b8a18391facbaa1f08623e2983b4af30e85b9df581fad0a8513aa0da517bead1be0cee1ae8ef1cf36d24d3be84741741dbdb1c51c30e40041b
7
- data.tar.gz: 326dee189dd41fe401004684e05bc4b8587809911d2ad4ac0c9555e7da238a3febc9e4fd12b970ac4db9c47818cc4ece7b420f67807216456ed3639b6e0611b9
6
+ metadata.gz: 9fa1d23bd68596356383676b5d4c5c9fba04afaba2d98ccf8bb1d27fb4b68aba8b9a1078aaebcc7a61cefb8d8bb5102e51d09ecd68e82ce436afaa734c028862
7
+ data.tar.gz: aae6ba4be7009d1cfcc7461f6dfb5f4459d880b796a7842e67050863e6f48d9ede6923a8995c4945a0923153b7f97c051f18691f8e0d343ed450dcba586c88e0
Binary file
@@ -38,7 +38,7 @@ exit unless rc
38
38
  return false
39
39
  end
40
40
 
41
- def livetext(src, dst=nil)
41
+ def livetext(src, dst=nil, dir=".")
42
42
  log!(enter: __method__, args: [src, dst])
43
43
  src << ".lt3" unless src.end_with?(".lt3")
44
44
  if dst
@@ -47,7 +47,21 @@ exit unless rc
47
47
  dst = src.sub(/.lt3$/, "")
48
48
  end
49
49
  # return unless stale?(src, dst)
50
- system("livetext #{src} >#{dst}")
50
+ Dir.chdir(dir) { system("livetext #{src} >#{dst}") }
51
+ end
52
+
53
+ def livetext!(src, dst=nil, dir=".")
54
+ log!(enter: __method__, args: [src, dst])
55
+ src << ".lt3" unless src.end_with?(".lt3")
56
+ if dst
57
+ dst << ".html" unless dst.end_with?(".html")
58
+ else
59
+ dst = src.sub(/.lt3$/, "")
60
+ end
61
+ # return unless stale?(src, dst)
62
+ STDERR.puts "-- livetext #{src} >#{dst} \n in: #{Dir.pwd}\n from: #{caller[0]}"
63
+ Dir.chdir(dir) { system("livetext #{src} >#{dst}") }
64
+ STDERR.puts "... completed"
51
65
  end
52
66
 
53
67
  def get_root
@@ -206,7 +206,7 @@ class RuneBlog
206
206
  end
207
207
 
208
208
  Dir.chdir("#@root/views/#{vdir}") do
209
- livetext "themes/standard/blog/generate", "remote/index"
209
+ livetext "generate", "../../../remote/index", "themes/standard/blog"
210
210
  pub = "user: xxx\nserver: xxx\ndocroot: xxx\npath: xxx\nproto: xxx\n"
211
211
  dump(pub, "publish")
212
212
 
@@ -388,37 +388,73 @@ class RuneBlog
388
388
  [noext, viewdir, slugdir, aslug, theme]
389
389
  end
390
390
 
391
+ def _handle_post(draft, view)
392
+ noext, viewdir, slugdir, aslug, @theme = _copy_get_dirs(draft, view)
393
+ html = noext[5..-1] # strip "nnnn-"
394
+ remote = viewdir + "/remote"
395
+ Dir.chdir(slugdir) do
396
+ copy(draft, ".") # copy source into slugdir
397
+ lt3 = draft.split("/")[-1] # Remember: Some posts may be in more than
398
+ copy(lt3, remote) # one view -- careful with links back
399
+ STDERR.puts "1 pwd = #{Dir.pwd}"
400
+ livetext! draft, html
401
+ STDERR.puts " copy #{html}, #{remote}/#{html}"
402
+ copy(html, "#{remote}/#{html}")
403
+
404
+ title_line = File.readlines(draft).grep(/^.title /).first
405
+ title = title_line.split(" ", 2)[1]
406
+ excerpt = File.read("teaser.txt")
407
+ vars = %[.set title="#{title.chomp}"\n] +
408
+ %[.set teaser="#{excerpt.chomp}"]
409
+ theme = "#{viewdir}/themes/standard"
410
+ File.open("#{theme}/post/vars.lt3", "w") {|f| f.puts vars }
411
+
412
+ livetext! "generate.lt3", "#{remote}/html", "#{theme}/post"
413
+ copy("#{remote}/#{html}", "#{theme}/post")
414
+
415
+ livetext! "permalink.lt3", "#{remote}/permalink/#{html}", "#{theme}/post"
416
+ log!(str: "About to enter remote/", pwd: true, dir: true)
417
+ Dir.chdir(remote) do
418
+ log!(str: "Now in remote/", pwd: true, dir: true)
419
+ system("cp -r ../themes/standard/widgets .")
420
+ log!(str: "finished with remote/", pwd: true, dir: true)
421
+ end
422
+ end
423
+ end
424
+
391
425
  def generate_post(draft)
392
426
  log!(enter: __method__, args: [draft])
393
427
  views = _get_views(draft)
394
428
  views.each do |view|
395
- noext, viewdir, slugdir, aslug, @theme = _copy_get_dirs(draft, view)
396
- remote = viewdir + "/remote"
397
- Dir.chdir(slugdir) do
398
- copy(draft, ".")
399
- lt3 = draft.split("/")[-1]
400
- # Remember: Some posts may be in more than one view -- careful with links back
401
- copy(lt3, remote)
402
- html = noext[5..-1]
403
- livetext draft, html # livetext "foobar.lt3", "foobar.html"
404
- copy(html, "../../remote/post/index.html")
405
- title_line = File.readlines(draft).grep(/^.title /).first
406
- title = title_line.split(" ", 2)[1]
407
- excerpt = File.read("teaser.txt")
408
- vars = %[.set title="#{title.chomp}"\n] +
409
- %[.set teaser="#{excerpt.chomp}"]
410
- theme = "../../theme/standard"
411
- File.open("vars.lt3", "w") {|f| f.puts vars }
412
- livetext "#{theme}/post/generate.lt3", "#{remote}/#{html}"
413
- livetext "#{theme}/post/permalink.lt3", "#{remote}/permalink/#{html}"
414
- log!(str: "About to enter remote/", pwd: true, dir: true)
415
- Dir.chdir(remote) do
416
- log!(str: "Now in remote/", pwd: true, dir: true)
417
- system("cp -r ../themes/standard/widgets .")
418
- log!(str: "finished with remote/", pwd: true, dir: true)
419
- end
420
- end
429
+ _handle_post(draft, view)
421
430
  end
431
+ # noext, viewdir, slugdir, aslug, @theme = _copy_get_dirs(draft, view)
432
+ # remote = viewdir + "/remote"
433
+ # Dir.chdir(slugdir) do
434
+ # copy(draft, ".")
435
+ # lt3 = draft.split("/")[-1]
436
+ # # Remember: Some posts may be in more than one view -- careful with links back
437
+ # copy(lt3, remote)
438
+ # html = noext[5..-1] # strip "nnnn-"
439
+ # livetext! draft, html
440
+ # copy(html, "#{remote}/#{html}")
441
+ # title_line = File.readlines(draft).grep(/^.title /).first
442
+ # title = title_line.split(" ", 2)[1]
443
+ # excerpt = File.read("teaser.txt")
444
+ # vars = %[.set title="#{title.chomp}"\n] +
445
+ # %[.set teaser="#{excerpt.chomp}"]
446
+ # theme = "#{viewdir}/themes/standard"
447
+ # File.open("#{theme}/post/vars.lt3", "w") {|f| f.puts vars }
448
+ # livetext! "generate.lt3", "#{remote}/html", "#{theme}/post"
449
+ # copy("#{remote}/html", "#{theme}/post")
450
+ # livetext! "permalink.lt3", "#{remote}/permalink/#{html}", "#{theme}/post"
451
+ # log!(str: "About to enter remote/", pwd: true, dir: true)
452
+ # Dir.chdir(remote) do
453
+ # log!(str: "Now in remote/", pwd: true, dir: true)
454
+ # system("cp -r ../themes/standard/widgets .")
455
+ # log!(str: "finished with remote/", pwd: true, dir: true)
456
+ # end
457
+ # end
422
458
  end
423
459
 
424
460
  def relink
@@ -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.9"
5
+ VERSION = "0.2.10"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
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.9
4
+ version: 0.2.10
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-09-26 00:00:00.000000000 Z
11
+ date: 2019-09-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext