runeblog 0.2.50 → 0.2.51

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: 420d1360e5f860c1396eb2ba36a804c999b18d25da0b7157d577280d0cb2d42b
4
- data.tar.gz: 65c66113d384de0e752b1abc5a2c9b68074319958f4a7762b8e00781b8a46c91
3
+ metadata.gz: 600dac0389d976fd41b8c3a5f4f63e4896a1b3f330525faa6b703dfb38e0b825
4
+ data.tar.gz: 52472d46f783f209ad13e95f8e230c89173780a98867389a075833fb3cb1edd9
5
5
  SHA512:
6
- metadata.gz: d4a17c66ba757ea6b350d13a9a777e637157065392bfb7096e7c3de302b36c24e7d875ea8ad7cc8143fc384025dc590d5c8e03047b8b6c6477d4a2a967881c43
7
- data.tar.gz: ce5188e490205aca014c158fe5f5202664c7d6ac9821c1408c761e2a3185d2c74eec38e9c2c0c98407f7f8e02591d2b1290a07bcc8909aa2dab22d2b65ff5f8a
6
+ metadata.gz: 9a650511f857069328ec4295e4ab1c70add5730118b68c16d45113844215f8db540bad78580225228b24ae4b26022abda6ab1e5af487edc231360d1a1c50fbda
7
+ data.tar.gz: 641d6ae9269a77d36929f36810ff779736cee66e81e0bb27660f8e7832f2f6ecce57977362a2128585789365d503a4f79b03580674293bf7a8575facadc296ac
@@ -8,7 +8,7 @@
8
8
  . not needed.
9
9
  . --------------------------------------------------
10
10
 
11
- .navbar
11
+ .navbar2
12
12
  index Home
13
13
  about About
14
14
  contact Contact
@@ -1,6 +1,7 @@
1
1
  require 'ostruct'
2
2
  require 'pp'
3
3
  require 'date'
4
+ require 'find'
4
5
 
5
6
  require 'runeblog'
6
7
  require 'pathmagic'
@@ -96,15 +97,19 @@ def banner # still experimental
96
97
  _out " <td colspan=#{span}>"
97
98
  case
98
99
  when piece.start_with?("hnav")
99
- _out "<center>hnav1 hnav2 hnav3 hnav4</center>"
100
+ # horizontal navbar
101
+ # _out "<center>hnav1 hnav2 hnav3 hnav4</center>"
100
102
  when piece.start_with?("vnav")
101
- _out "vnav1<br>vnav2<br>vnav3<br>vnav4<br>"
103
+ # vertical navbar
104
+ # _out "vnav1<br>vnav2<br>vnav3<br>vnav4<br>"
102
105
  when piece.start_with?("text")
103
106
  file = piece.split(":")[1]
107
+ file ||= "banner/text.html"
104
108
  _out File.read(file)
105
109
  when piece.start_with?("image")
106
- file = piece.split(":")[1]
107
- _out " <img src=#{file} height=100></img>"
110
+ image = piece.split(":")[1]
111
+ image ||= "banner/banner.jpg"
112
+ _out " <img src=#{image} height=100></img>"
108
113
  else
109
114
  _out " '#{piece}' isn't known"
110
115
  end
@@ -461,7 +466,12 @@ def sidebar
461
466
  end
462
467
  end
463
468
 
464
- xlate cwd: wtag, src: tag, dst: tcard, force: true # , debug: (tag == "ad")
469
+ depend = %w[card.css main.css custom.rb local.rb]
470
+ depend += ["#{wtag}.lt3", "#{wtag}.rb"]
471
+ depend += %w[pieces/card-head.lt3 pieces/card-tail.lt3]
472
+ depend += %w[pieces/main-head.lt3 pieces/main-tail.lt3]
473
+ depend.map! {|x| @blog.view.dir/"themes/standard/widgets"/wtag/x }
474
+ xlate cwd: wtag, src: tag, dst: tcard, force: true, deps: depend , debug: (tag == "ad")
465
475
  _include_file wtag/tcard
466
476
  end
467
477
  _out %[</div>]
@@ -471,6 +481,26 @@ rescue => err
471
481
  exit
472
482
  end
473
483
 
484
+ =begin
485
+ ets/widgets/pages//card.css
486
+ ets/widgets/pages//custom.rb
487
+ ets/widgets/pages//disclaim.lt3
488
+ ets/widgets/pages//faq.lt3
489
+ ets/widgets/pages//like-dislike.lt3
490
+ ets/widgets/pages//list.data
491
+ ets/widgets/pages//local-vars.lt3
492
+ ets/widgets/pages//local.rb
493
+ ets/widgets/pages//main.css
494
+ ets/widgets/pages//other-stuff.lt3
495
+ ets/widgets/pages//pages.lt3
496
+ ets/widgets/pages//pages.rb
497
+ ets/widgets/pages//pieces
498
+ ets/widgets/pages//pieces/card-head.lt3
499
+ ets/widgets/pages//pieces/card-tail.lt3
500
+ ets/widgets/pages//pieces/main-head.lt3
501
+ ets/widgets/pages//pieces/main-tail.lt3
502
+ =end
503
+
474
504
  def stylesheet
475
505
  lines = _body
476
506
  url = lines[0]
@@ -688,7 +718,8 @@ def navbar
688
718
  first = false # hardcode this part??
689
719
  _out %[<li class="nav-item active"> <a class="nav-link" href="index.html">#{cdata}<span class="sr-only">(current)</span></a> </li>]
690
720
  else
691
- xlate cwd: "navbar", src: basename, dst: vdir/"remote/navbar"/basename+".html" # , debug: true
721
+ depend = Find.find(@blog.root/:views/@blog.view.to_s/"themes/standard/navbar/").to_a
722
+ xlate cwd: "navbar", src: basename, dst: vdir/"remote/navbar"/basename+".html", deps: depend # , debug: true
692
723
  _out %[<li class="nav-item"> <a class="nav-link" #{href_main}>#{cdata}</a> </li>]
693
724
  end
694
725
  end
@@ -265,6 +265,10 @@ puts "Got to #{__method__}"
265
265
 
266
266
  def cmd_new_view(arg, testing = false)
267
267
  reset_output
268
+ if arg.nil?
269
+ arg = ask("\nFilename: ")
270
+ puts
271
+ end
268
272
  @blog.create_view(arg)
269
273
  edit_file(@blog.view.dir/"themes/standard/global.lt3")
270
274
  @blog.change_view(arg)
@@ -116,7 +116,13 @@ class RuneBlog
116
116
  log!(enter: __method__, args: [dir], level: 1)
117
117
  Dir.chdir(dir) do
118
118
  views = _retrieve_metadata(:views)
119
- views.each {|v| system!("cp *html #@root/views/#{v}/remote") }
119
+ views.each do |v|
120
+ unless @blog.view?(v)
121
+ puts "Warning: '#{v}' is not a view"
122
+ next
123
+ end
124
+ system!("cp *html #@root/views/#{v}/remote")
125
+ end
120
126
  end
121
127
  rescue => err
122
128
  _tmp_error(err)
@@ -152,6 +158,7 @@ class RuneBlog
152
158
  nslug = sourcefile.sub(/.lt3/, "")
153
159
  dir = @root/:posts/nslug
154
160
  create_dir(dir)
161
+ # FIXME dependencies?
155
162
  xlate cwd: dir, src: sourcefile # , debug: true
156
163
  _deploy_local(dir)
157
164
  rescue => err
@@ -323,7 +330,8 @@ class RuneBlog
323
330
  text = nil
324
331
  @theme = @view.dir/"themes/standard"
325
332
  post_entry_name = @theme/"blog/post_entry.lt3"
326
- xlate src: post_entry_name, dst: "/tmp/post_entry.html" # , debug: true
333
+ depend = [post_entry_name]
334
+ xlate src: post_entry_name, dst: "/tmp/post_entry.html", deps: depend # , debug: true
327
335
  @_post_entry ||= File.read("/tmp/post_entry.html")
328
336
  vp = post_lookup(id)
329
337
  nslug, aslug, title, date, teaser_text =
@@ -436,9 +444,12 @@ class RuneBlog
436
444
  log!(enter: __method__, args: [view])
437
445
  vdir = @root/:views/view
438
446
  @theme = @root/:views/view/:themes/:standard
439
- xlate cwd: vdir/"themes/standard/etc",
447
+ depend = [vdir/"remote/etc/blog.css", @theme/"global.lt3",
448
+ @theme/"blog/head.lt3", @theme/"navbar/navbar.lt3",
449
+ @theme/"blog/index.lt3"] # FIXME what about assets?
450
+ xlate cwd: vdir/"themes/standard/etc", deps: depend,
440
451
  src: "blog.css.lt3", copy: vdir/"remote/etc/blog.css" # , debug: true
441
- xlate cwd: vdir/"themes/standard", force: true,
452
+ xlate cwd: vdir/"themes/standard", deps: depend,
442
453
  src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
443
454
  copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
444
455
  rescue => err
@@ -543,6 +554,7 @@ class RuneBlog
543
554
  @theme = @root/:views/view_name/:themes/:standard
544
555
  # Step 1...
545
556
  create_dirs(pdraft)
557
+ # FIXME dependencies?
546
558
  xlate cwd: pdraft, src: draft, dst: "guts.html" # , debug: true
547
559
  _post_metadata(draft, pdraft)
548
560
  # Step 2...
@@ -552,8 +564,10 @@ class RuneBlog
552
564
  copy(pdraft/"guts.html", @theme/:post)
553
565
  copy(pdraft/"vars.lt3", @theme/:post)
554
566
  # Step 4...
567
+ # FIXME dependencies?
555
568
  xlate cwd: @theme/:post, src: "generate.lt3", force: true,
556
569
  dst: remote/ahtml, copy: @theme/:post # , debug: true
570
+ # FIXME dependencies?
557
571
  xlate cwd: @theme/:post, src: "permalink.lt3",
558
572
  dst: remote/:permalink/ahtml # , debug: true
559
573
  copy_widget_html(view_name)
@@ -564,7 +578,13 @@ class RuneBlog
564
578
  def generate_post(draft)
565
579
  log!(enter: __method__, args: [draft], level: 1)
566
580
  views = _get_views(draft)
567
- views.each {|view| _handle_post(draft, view) }
581
+ views.each do |view|
582
+ unless self.view?(view)
583
+ puts "Warning: '#{view}' is not a view"
584
+ next
585
+ end
586
+ _handle_post(draft, view)
587
+ end
568
588
  rescue => err
569
589
  _tmp_error(err)
570
590
  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.50"
5
+ VERSION = "0.2.51"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
@@ -1,19 +1,24 @@
1
1
 
2
2
  LEXT = ".lt3"
3
3
 
4
- def stale?(src, dst, force = false)
4
+ def newer?(f1, f2)
5
+ File.mtime(f1) > File.mtime(f2)
6
+ end
7
+
8
+ def stale?(src, dst, deps, force = false)
5
9
  meh = File.new("/tmp/dammit-#{src.gsub(/\//, "-")}", "w")
6
10
  log!(enter: __method__, args: [src, dst], level: 3)
7
11
  raise "Source #{src} not found in #{Dir.pwd}" unless File.exist?(src)
8
12
  return true if force
9
13
  return true unless File.exist?(dst)
10
- return true if File.mtime(src) > File.mtime(dst)
14
+ return true if newer?(src, dst)
15
+ deps.each {|dep| return true if newer?(dep, dst) }
11
16
  return false
12
17
  end
13
18
 
14
19
  def xlate(cwd: Dir.pwd, src:,
15
20
  dst: (strip = true; src.sub(/.lt3$/,"")),
16
- copy: nil, debug: false, force: false)
21
+ deps: [], copy: nil, debug: false, force: false)
17
22
  src += LEXT unless src.end_with?(LEXT)
18
23
  dst += ".html" unless dst.end_with?(".html") || strip
19
24
  indent = " "*12
@@ -24,7 +29,7 @@ def xlate(cwd: Dir.pwd, src:,
24
29
  STDERR.puts "#{indent} from: #{caller[0]}"
25
30
  STDERR.puts "#{indent} copy: #{copy}" if copy
26
31
  end
27
- stale = stale?(src, dst, force)
32
+ stale = stale?(src, dst, deps, force)
28
33
  if stale
29
34
  rc = system("livetext #{src} >#{dst}")
30
35
  STDERR.puts "...completed (shell returned #{rc})" if debug
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.50
4
+ version: 0.2.51
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-10-22 00:00:00.000000000 Z
11
+ date: 2019-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext