runeblog 0.2.5 → 0.2.6

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: b72b0b4ca22d08e40c691a27c1a9affa94dc9c3f8ff1063d85f7b72be8b83838
4
- data.tar.gz: d1919b3fef470e70acb7b7f8cc5f36f6ed7cb58176ee36e424e09691e83bd495
3
+ metadata.gz: 88eb977188fc29149692d23a5a8b08bdad83da5c9c105c39f1f0fc4bbf4a7483
4
+ data.tar.gz: 4f3423490452d300b229c775632e5f10c09781e5e0bbb7dbcbd2183467e7ae54
5
5
  SHA512:
6
- metadata.gz: 9a4feafd8e972f87280c3f4fbe43321d62de61a6eb9913deef08790e967c94d09fd2f451e7235f3cc4cc0620dd92087cb0c39ef6bb1fed6afe6a197fc1fc5450
7
- data.tar.gz: d5a9fec4a3412ff28a1acf607f60614a1c3ed4d1fdbdf43747b5250e4f6930503028ad8ba2d866ea4c00695b6b81bf52a376e9e642b906427f84bb09a5711718
6
+ metadata.gz: e446863886eed1c348fe9bbf5bdfa473d8154ccdec09fb6eca03f07d6cd4a453f8aad9f797dd2c453904c5e1edec8f8a37bbe6c4daca731faed29a7150efe32d
7
+ data.tar.gz: 50c8b29750e8844771ff218f7ce063c2cc282dff65e555e9e850cdee8de1c8bd85e4d5e46787a67822e9b5a3156a06a08362cf63aa27b121e90941c03358658a
data/lib/liveblog.rb CHANGED
@@ -423,6 +423,7 @@ def sidebar
423
423
  _out %[<div class="col-lg-3 col-md-3 col-sm-3 col-xs-12">]
424
424
  _args do |token|
425
425
  tag = token.chomp.strip.downcase
426
+ # Doesn't handle "split personality" widgets yet
426
427
  Dir.chdir("widgets/#{tag}") do
427
428
  livetext tag, "card-#{tag}.html"
428
429
  _include_file "card-#{tag}.html"
@@ -447,59 +448,43 @@ def script
447
448
  _out %[<script src="#{url}" integrity="#{integ}" crossorigin="#{cross}"></script>]
448
449
  end
449
450
 
450
-
451
- ### How this next bit works:
452
- ###
453
- ### all_teasers will call _find_recent_posts
454
- ###
455
- ### _find_recent_posts will search higher in the directory structure
456
- ### for where the posts are (0001, 0002, ...) NOTE: This implies you
457
- ### must be in some specific place when this code is run.
458
- ### It returns the 20 most recent posts.
459
- ###
460
- ### all_teasers will then pick a small number of posts and call _teaser
461
-
462
- ### on each one. (The code in _teaser really belongs in a small template
463
- ### somewhere.)
464
- ###
465
-
466
- def _find_recent_posts
467
- @vdir = _var(:FileDir).match(%r[(^.*/views/.*?)/])[1]
468
- posts = nil
469
- dir_posts = @vdir + "/posts"
470
- entries = Dir.entries(dir_posts)
471
- posts = entries.grep(/^\d\d\d\d/).map {|x| dir_posts + "/" + x }
472
- posts.select! {|x| File.directory?(x) }
473
- # directories that start with four digits
474
- posts = posts.sort {|a, b| b.to_i <=> a.to_i } # sort descending
475
- posts[0..19] # return 20 at most
476
- end
477
-
478
- def all_teasers
479
- open = <<-HTML
480
- <section class="posts">
481
- HTML
482
- close = <<-HTML
483
- </section>
484
- HTML
485
-
486
- text = <<-HTML
487
- <html>
488
- <head><link rel="stylesheet" href="etc/blog.css"></head>
489
- <body>
490
- HTML
491
- posts = _find_recent_posts
492
- wanted = [5, posts.size].min # estimate how many we want?
493
- enum = posts.each
494
- wanted.times do
495
- postid = File.basename(enum.next)
496
- postid = postid.to_i
497
- text << _teaser(postid) # side effect! calls _out
498
- end
499
- text << "</body></html>"
500
- File.write("recent.html", text)
501
- _out %[<iframe id="main" style="width: 100vw; height: 100vh; position: relative;" src='recent.html' width=100% frameborder="0" allowfullscreen></iframe>]
502
- end
451
+ # def _find_recent_posts
452
+ # @vdir = _var(:FileDir).match(%r[(^.*/views/.*?)/])[1]
453
+ # posts = nil
454
+ # dir_posts = @vdir + "/posts"
455
+ # entries = Dir.entries(dir_posts)
456
+ # posts = entries.grep(/^\d\d\d\d/).map {|x| dir_posts + "/" + x }
457
+ # posts.select! {|x| File.directory?(x) }
458
+ # # directories that start with four digits
459
+ # posts = posts.sort {|a, b| b.to_i <=> a.to_i } # sort descending
460
+ # posts[0..19] # return 20 at most
461
+ # end
462
+ #
463
+ # def all_teasers
464
+ # open = <<-HTML
465
+ # <section class="posts">
466
+ # HTML
467
+ # close = <<-HTML
468
+ # </section>
469
+ # HTML
470
+ #
471
+ # text = <<-HTML
472
+ # <html>
473
+ # <head><link rel="stylesheet" href="etc/blog.css"></head>
474
+ # <body>
475
+ # HTML
476
+ # posts = _find_recent_posts
477
+ # wanted = [5, posts.size].min # estimate how many we want?
478
+ # enum = posts.each
479
+ # wanted.times do
480
+ # postid = File.basename(enum.next)
481
+ # postid = postid.to_i
482
+ # text << _teaser(postid) # side effect! calls _out
483
+ # end
484
+ # text << "</body></html>"
485
+ # File.write("recent.html", text)
486
+ # _out %[<iframe id="main" style="width: 100vw; height: 100vh; position: relative;" src='recent.html' width=100% frameborder="0" allowfullscreen></iframe>]
487
+ # end
503
488
 
504
489
  def _post_lookup(postid) # side-effect
505
490
  # .. = templates, ../.. = views/thisview
@@ -521,21 +506,21 @@ def _interpolate(str, context) # FIXME move this later
521
506
  eval(wrapped, context)
522
507
  end
523
508
 
524
- def _teaser(slug)
525
- id = slug.to_i
526
- text = nil
527
- post_entry_name = @theme + "blog/post_entry.lt3"
528
- @_post_entry ||= File.read(post_entry_name)
529
- vp = _post_lookup(id)
530
- nslug, aslug, title, date, teaser_text =
531
- vp.nslug, vp.aslug, vp.title, vp.date, vp.teaser_text
532
- path = vp.path
533
- url = "#{path}/#{aslug}.html" # Should be relative to .blogs!! FIXME
534
- date = Date.parse(date)
535
- date = date.strftime("%B %e<br>%Y")
536
- text = _interpolate(@_post_entry, binding)
537
- text
538
- end
509
+ # def _teaser(slug)
510
+ # id = slug.to_i
511
+ # text = nil
512
+ # post_entry_name = @theme + "blog/post_entry.lt3"
513
+ # @_post_entry ||= File.read(post_entry_name)
514
+ # vp = _post_lookup(id)
515
+ # nslug, aslug, title, date, teaser_text =
516
+ # vp.nslug, vp.aslug, vp.title, vp.date, vp.teaser_text
517
+ # path = vp.path
518
+ # url = "#{path}/#{aslug}.html" # Should be relative to .blogs!! FIXME
519
+ # date = Date.parse(date)
520
+ # date = date.strftime("%B %e<br>%Y")
521
+ # text = _interpolate(@_post_entry, binding)
522
+ # text
523
+ # end
539
524
 
540
525
  def _card_generic(card_title:, middle:, extra: "")
541
526
  front = <<-HTML
data/lib/runeblog.rb CHANGED
@@ -59,7 +59,6 @@ class RuneBlog
59
59
  raise BlogRepoAlreadyExists if Dir.exist?(root)
60
60
  create_dirs(root)
61
61
  Dir.chdir(root) do
62
- # puts " pwd = #{Dir.pwd} Trying: cp #{RuneBlog::Path}/../empty_view.tgz ."
63
62
  system("cp #{RuneBlog::Path}/../empty_view.tgz .")
64
63
  create_dirs(:drafts, :views)
65
64
  new_sequence
@@ -108,7 +107,6 @@ class RuneBlog
108
107
  val = self.instance_variable_get(iv)
109
108
  str << "#{iv}: #{val} "
110
109
  end
111
- # str << "]]"
112
110
  str
113
111
  end
114
112
 
@@ -200,31 +198,14 @@ class RuneBlog
200
198
  vdir = arg.dup
201
199
  raise DirAlreadyExists(vdir) if Dir.exist?(vdir)
202
200
 
203
- # puts "cv: pwd = #{Dir.pwd} file = #{`ls`}"
204
201
  Dir.chdir(@root) do
205
- # puts "---- (#{arg}) tar operation..."
206
-
207
- # system("bash")
208
202
  cmd1 = "tar zxvf empty_view.tgz >/dev/null 2>&1"
209
203
  cmd2 = "cp -r empty_view views/#{arg}"
210
204
  system(cmd1)
211
- # puts " pwd = #{Dir.pwd}"
212
- # puts " . => #{`echo *`}"
213
- # puts " ./views => #{`ls views`}"
214
- # puts " #{cmd1}\n #{cmd2}"
215
205
  system(cmd2)
216
206
  end
217
- # create_dirs(vdir)
218
207
 
219
- # puts "vdir = #{vdir} pwd = #{Dir.pwd}"
220
208
  Dir.chdir("#@root/views/#{vdir}") do
221
- # system("bash")
222
- # x = RuneBlog::Default
223
- # copy!("#{Themes}", "themes")
224
- # create_dirs(:assets, :posts, :staging, "remote/permalink", "remote/navbar")
225
- # livetext "themes/standard/etc/blog.css.lt3" # strip ext
226
- # _copy_to_staging
227
- # _copy_to_remote
228
209
  livetext "themes/standard/blog/generate", "remote/index"
229
210
  pub = "user: xxx\nserver: xxx\ndocroot: xxx\npath: xxx\nproto: xxx\n"
230
211
  dump(pub, "publish")
@@ -257,7 +238,6 @@ class RuneBlog
257
238
 
258
239
  def post_lookup(postid) # side-effect?
259
240
  log!(enter: __method__, args: [postid])
260
- # .. = templates, ../.. = views/thisview
261
241
  slug = title = date = teaser_text = nil
262
242
 
263
243
  dir_posts = @vdir + "/posts"
@@ -281,7 +261,6 @@ class RuneBlog
281
261
  nslug, aslug, title, date, teaser_text =
282
262
  vp.nslug, vp.aslug, vp.title, vp.date, vp.teaser_text
283
263
  path = vp.path
284
- # url = "#{path}/#{aslug}.html" # Should be relative to .blogs!! FIXME
285
264
  url = "#{aslug}.html" # Should be relative to .blogs!! FIXME
286
265
  date = ::Date.parse(date)
287
266
  date = date.strftime("%B %e<br>%Y")
@@ -396,22 +375,6 @@ class RuneBlog
396
375
  views
397
376
  end
398
377
 
399
- # Remember: A post in multiple views will trigger multiple
400
- # views needing to be rebuilt (and published)
401
-
402
- # generate a post:
403
- # given draft 9999-title.lt3
404
- # create VIEW/posts/9999-title/index.lt3
405
- # LATER: metadata!! or is it in head?
406
- # Generate VIEW/posts/9999-title/head.lt3?
407
- # livetext draft_wrapper_plain.lt3 >generated/posts/plain-title.html # unframed
408
- # livetext draft_generate.lt3 >generated/posts/real-title.html # framed
409
- # livetext draft_wrapper_perma.lt3 >generated/posts/perma-title.html # permaframed
410
- #
411
- # Generate associated views:
412
- # livetext ??/recent.lt3 >VIEW/working/recent.html
413
- # livetext VIEW/blog/generate.lt3 ??
414
-
415
378
  def _copy_get_dirs(draft, view)
416
379
  log!(enter: __method__, args: [draft, view])
417
380
  fname = File.basename(draft)
@@ -430,19 +393,14 @@ class RuneBlog
430
393
  views = _get_views(draft)
431
394
  views.each do |view|
432
395
  noext, viewdir, slugdir, aslug, @theme = _copy_get_dirs(draft, view)
433
- # staging = viewdir + "/staging"
434
396
  remote = viewdir + "/remote"
435
397
  Dir.chdir(slugdir) do
436
398
  copy(draft, ".")
437
399
  lt3 = draft.split("/")[-1]
438
400
  # Remember: Some posts may be in more than one view -- careful with links back
439
- # system("livetext #{draft} >staging/#{name}/index.html") # permalink?
440
- # copy!("#{@theme}/*", "#{staging}")
441
- # copy(lt3, staging)
442
401
  copy(lt3, remote)
443
402
  html = noext[5..-1]
444
403
  livetext draft, html # livetext "foobar.lt3", "foobar.html"
445
- # copy(html, "../../staging/post/index.html")
446
404
  copy(html, "../../remote/post/index.html")
447
405
  title_line = File.readlines(draft).grep(/^.title /).first
448
406
  title = title_line.split(" ", 2)[1]
@@ -453,12 +411,6 @@ class RuneBlog
453
411
  File.open("vars.lt3", "w") {|f| f.puts vars }
454
412
  livetext "#{theme}/post/generate.lt3", "#{remote}/#{html}"
455
413
  livetext "#{theme}/post/permalink.lt3", "#{remote}/permalink/#{html}"
456
- # puts <<-TEXT
457
- # File.open("vars.lt3", "w") {|f| f.puts vars }
458
- # livetext "../post/generate.lt3", "#{remote}/#{html}"
459
- # livetext "../post/permalink.lt3", "#{remote}/permalink/#{html}"
460
- # TEXT
461
- # system("bash")
462
414
  log!(str: "About to enter remote/", pwd: true, dir: true)
463
415
  Dir.chdir(remote) do
464
416
  log!(str: "Now in remote/", pwd: true, dir: true)
@@ -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.5"
5
+ VERSION = "0.2.6"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
data/test/make_blog.rb CHANGED
@@ -132,5 +132,6 @@ BODY
132
132
 
133
133
  x.change_view("around_austin")
134
134
 
135
+ puts
135
136
  puts Time.now
136
137
  puts
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runeblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton