runeblog 0.2.46 → 0.2.47

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: c764956fc67556826d90815f706b69523817eaee26cf7ec32671794a65e15538
4
- data.tar.gz: 3fb1d9bcc3ae3802891378568b4ef729ceb757ace7b4a4efdee7aa3d8ba775d2
3
+ metadata.gz: e4cdb2c0546394c622e9a648273dde7865fc8e4dd6839776c175c406ff34dba1
4
+ data.tar.gz: b96eb0e7783607b91b3b23d435eff368cea9102caa8a9342901318008d3fd0f1
5
5
  SHA512:
6
- metadata.gz: f52c5f8975373cb2544126e3e7245bc37cf7e3c16a2417cdfb29a002f07e369ad0c8a50018b85665a8a20a21632af3094c9e41fa63f8065ca319acef1480322e
7
- data.tar.gz: 693309103d55a20a48984da73ecdf4c2544e9b950ea504ec54e895ab1bc68560cfad30eede26f8b30c622d9d47cd773f8424d05cf8fcca5dc6440f929420febe
6
+ metadata.gz: 1945c5f3667d6c25f74e5d7878be2cb22016588551cad9fd66949908640b18d1730cdb0463754df82bcd0ed58a8af4febf5e309fbf3f7afa62ab808f9f0e453d
7
+ data.tar.gz: 1a646b8c95822f3ed083e3a58b946efe79eda8babc23985d9e6bcd5fca1efbbe500e4b41f9fce3c54aaa41168616cbc1c2789e7984d13ff0048f2ccc2afc96eb
@@ -14,16 +14,18 @@
14
14
  .include blog/head.lt3
15
15
  <body>
16
16
 
17
+ .set color = #101035
18
+
17
19
  . FIXME
18
- <table width=100%>
20
+ <table width=100% bgcolor=$color>
19
21
  <tr>
20
- <td width=30% bgcolor=black>
22
+ <td width=30% bgcolor=$color>
21
23
  <div style="text-align: center; color: white">
22
24
  <h1>Around Austin</h1><br>
23
25
  The view from downtown...
24
26
  </div>
25
27
  </td>
26
- <td><img src=assets/sky2.jpg width=100%></img>
28
+ <td><img src=assets/austin-pano.jpg width=100%></img>
27
29
  </tr>
28
30
  </table>
29
31
 
@@ -30,48 +30,22 @@ def make_exception(sym, str)
30
30
  end
31
31
  end
32
32
 
33
- def system!(str, show: false)
34
- log!(enter: __method__, args: [str], level: 2)
35
- STDERR.puts str if show
36
- rc = system(str)
37
- if rc
38
- return rc
39
- else
40
- STDERR.puts "FAILED: #{str.inspect}"
41
- STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
42
- return rc
43
- end
44
- rc
45
- end
33
+ def system!(str, show: false)
34
+ log!(enter: __method__, args: [str], level: 2)
35
+ STDERR.puts str if show
36
+ rc = system(str)
37
+ if rc
38
+ return rc
39
+ else
40
+ STDERR.puts "FAILED: #{str.inspect}"
41
+ STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
42
+ return rc
43
+ end
44
+ rc
45
+ end
46
46
 
47
47
  def prefix(num)
48
48
  log!(enter: __method__, args: [num], level: 3)
49
49
  "#{'%04d' % num.to_i}"
50
50
  end
51
51
 
52
- def check_meta(meta, where = "")
53
- log!(enter: __method__, args: [meta, where], level: 3)
54
- str = "--- #{where}\n"
55
- str << "\ncheck_meta: \n" + caller.join("\n") + "\n meta = #{meta.inspect}\n"
56
- str << " title missing!\n" unless meta.title
57
- str << " title missing! (empty)" if meta.title && meta.title.empty?
58
- str << " num missing!\n" unless meta.num
59
- if str =~ /missing!/
60
- debug str
61
- raise str
62
- end
63
- end
64
-
65
- def verify(hash)
66
- log!(enter: __method__, args: [hash], level: 3)
67
- hash.each_pair do |expr, msg|
68
- puts "<< #{msg}" unless expr
69
- end
70
- end
71
-
72
- def assure(hash) # really the same as verify for now...
73
- log!(enter: __method__, args: [hash], level: 3)
74
- hash.each_pair do |expr, msg|
75
- puts "<< #{msg}" unless expr
76
- end
77
- end
@@ -19,22 +19,6 @@ module RuneBlog::Helpers
19
19
  puts " Failed: #{cmd} - from #{caller[0]}" unless rc
20
20
  end
21
21
 
22
- # def get_root
23
- # log!(enter: __method__)
24
- # if $_blog
25
- # if $_blog.root
26
- # puts "0. Returned: #{$_blog.root}/"
27
- # return $_blog.root + "/"
28
- # else
29
- # puts "1. Returned: ./"
30
- # return "./"
31
- # end
32
- # else
33
- # puts "2. Returned: ./"
34
- # return "./"
35
- # end
36
- # end
37
-
38
22
  def read_config(file, *syms)
39
23
  log!(enter: __method__, args: [file, *syms], level: 3)
40
24
  lines = File.readlines(file).map(&:chomp)
@@ -67,18 +51,6 @@ module RuneBlog::Helpers
67
51
  vals
68
52
  end
69
53
 
70
- # def put_config(root:, view:"test_view", editor: "/usr/local/bin/vim")
71
- # log!(enter: __method__, args: [root, view, editor])
72
- # Dir.mkdir(root) unless Dir.exist?(root)
73
- # Dir.chdir(root) do
74
- # File.open("config", "w") do |cfg|
75
- # cfg.puts "root: #{root}"
76
- # cfg.puts "current_view: #{view}"
77
- # cfg.puts "editor: #{editor}"
78
- # end
79
- # end
80
- # end
81
-
82
54
  def write_config(obj, file)
83
55
  log!(enter: __method__, args: [obj, file], level: 2)
84
56
  hash = obj.to_h
@@ -155,7 +127,6 @@ module RuneBlog::Helpers
155
127
  log!(enter: __method__, args: [obj, name], level: 3)
156
128
  File.write(name, obj)
157
129
  end
158
-
159
130
  end
160
131
 
161
132
  def dump(obj, name) # FIXME scope
@@ -11,7 +11,7 @@ class RuneBlog::Post
11
11
 
12
12
  def self.files(num, root)
13
13
  log!(enter: __method__, args: [num, root], level: 3)
14
- files = Find.find(root).to_a
14
+ files = ::Find.find(root).to_a
15
15
  result = files.grep(/#{prefix(num)}-/)
16
16
  result
17
17
  end
@@ -22,7 +22,6 @@ class RuneBlog::Post
22
22
  raise NoBlogAccessor if RuneBlog.blog.nil?
23
23
  # "post" is a slug
24
24
  pdir = RuneBlog.blog.view.dir/post
25
- verify(Dir.exist?(pdir) => "Directory #{pdir} not found")
26
25
  meta = nil
27
26
  Dir.chdir(pdir) do
28
27
  meta = read_config("metadata.txt")
@@ -73,7 +72,6 @@ class RuneBlog::Post
73
72
  post.meta.title, post.meta.teaser, post.meta.body, post.meta.pubdate =
74
73
  title, teaser, body, pubdate
75
74
  post.meta.views = [post.blog.view.to_s] + views
76
- # STDERR.puts "Post.create: views = #{views.inspect}"
77
75
  post.meta.tags = []
78
76
  post.blog.make_slug(post.meta) # adds to meta
79
77
 
@@ -93,7 +91,6 @@ class RuneBlog::Post
93
91
 
94
92
  def edit
95
93
  log!(enter: __method__)
96
- verify(File.exist?(@draft) => "File #{@draft} not found")
97
94
  result = system!("vi #@draft +8") # TODO improve this
98
95
  raise EditorProblem(draft) unless result
99
96
  nil
@@ -43,7 +43,6 @@ class RuneBlog::Publishing
43
43
  dir = @docroot/@path
44
44
  view_name = @blog.view.name
45
45
  viewpath = dir # /view_name
46
- # result = system!("ssh #@user@#@server -x mkdir -p #{viewpath}")
47
46
  result = system!("ssh #@user@#@server -x mkdir -p #{viewpath}/assets")
48
47
  files.each do |file|
49
48
  dest = "#@user@#@server:" + dir # /view_name
@@ -7,7 +7,6 @@ make_exception(:PublishError, "Error during publishing")
7
7
  make_exception(:EditorProblem, "Could not edit $1")
8
8
 
9
9
  module RuneBlog::REPL
10
-
11
10
  def edit_file(file)
12
11
  result = system!("#{@blog.editor} #{file}")
13
12
  raise EditorProblem(file) unless result
@@ -200,7 +199,6 @@ module RuneBlog::REPL
200
199
  end
201
200
 
202
201
  def cmd_remove_post(arg, testing = false)
203
- puts "arg = #{arg.inspect} is a #{arg.class}"
204
202
  reset_output
205
203
  args = arg.split
206
204
  args.each do |x|
@@ -212,14 +210,12 @@ puts "arg = #{arg.inspect} is a #{arg.class}"
212
210
  @out
213
211
  end
214
212
 
215
- #-- FIXME affects linking, building, publishing...
216
-
217
213
  def cmd_edit_post(arg, testing = false)
218
214
  reset_output
219
215
  id = get_integer(arg)
220
216
  # Simplify this
221
217
  tag = "#{'%04d' % id}"
222
- files = Find.find(@blog.root+"/drafts").to_a
218
+ files = ::Find.find(@blog.root+"/drafts").to_a
223
219
  files = files.grep(/#{tag}-.*lt3/)
224
220
  files = files.map {|f| File.basename(f) }
225
221
  if files.size > 1
@@ -385,6 +381,5 @@ puts "arg = #{arg.inspect} is a #{arg.class}"
385
381
  puts unless testing
386
382
  @out
387
383
  end
388
-
389
384
  end
390
385
 
@@ -1,4 +1,5 @@
1
1
  require 'date'
2
+ require 'find'
2
3
 
3
4
  require 'logging'
4
5
 
@@ -63,7 +64,6 @@ class RuneBlog
63
64
  create_dirs(:drafts, :views, :posts)
64
65
  new_sequence
65
66
  end
66
- # put_config(root: root)
67
67
  x = OpenStruct.new
68
68
  x.root, x.current_view, x.editor = root, "test_view", "/usr/bin/vim " # dumb - FIXME later
69
69
  write_config(x, root/ConfigFile)
@@ -252,8 +252,6 @@ class RuneBlog
252
252
  log!(enter: __method__, args: [view_name], level: 2)
253
253
  check_valid_new_view(view_name)
254
254
  make_empty_view_tree(view_name)
255
- # STDERR.puts "Made empty tree!"
256
- # system("bash")
257
255
  add_view(view_name)
258
256
  mark_last_published("Initial creation")
259
257
  end
@@ -396,15 +394,12 @@ class RuneBlog
396
394
 
397
395
  def generate_view(view) # huh?
398
396
  log!(enter: __method__, args: [view])
399
- # generate_index(view) # recent posts (recent.html)
400
397
  vdir = @root/:views/view
401
398
  @theme = @root/:views/view/:themes/:standard
402
399
  xlate cwd: vdir/"themes/standard/etc",
403
400
  src: "blog.css.lt3", copy: vdir/"remote/etc/blog.css" # , debug: true
404
401
  xlate cwd: vdir/"themes/standard",
405
402
  src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
406
- # generate_index(view) # recent posts (recent.html)
407
- # ^ HERE
408
403
  copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
409
404
  rescue => err
410
405
  puts err
@@ -450,6 +445,7 @@ class RuneBlog
450
445
  longdate = ::Date.parse(date).strftime("%B %e, %Y")
451
446
  title = _retrieve_metadata(:title)
452
447
  tags = _retrieve_metadata(:tags)
448
+ # FIXME simplify
453
449
  vars = <<~LIVE
454
450
  .set post.num = #{pnum}
455
451
  .heredoc post.aslug
@@ -484,9 +480,7 @@ class RuneBlog
484
480
  create_dirs(rem)
485
481
  files = Dir[w/"*"]
486
482
  files = files.select {|x| x =~ /(html|css)$/ }
487
- # files.each {|f| STDERR.puts " #{f.inspect}" }
488
483
  tag = File.basename(w)
489
- # STDERR.puts "--- tag: #{tag.inspect}"
490
484
  files.each {|file| system!("cp #{file} #{rem}", show: (tag == "zzz")) }
491
485
  end
492
486
  end
@@ -523,32 +517,7 @@ class RuneBlog
523
517
  def generate_post(draft)
524
518
  log!(enter: __method__, args: [draft], level: 1)
525
519
  views = _get_views(draft)
526
- views.each do |view|
527
- _handle_post(draft, view)
528
- # generate_view(view) # FIXME leads to inefficiency?
529
- # ^ HERE
530
- end
531
- end
532
-
533
- def OLD_index_entry(view, meta)
534
- log!(enter: __method__, args: [view, meta])
535
- debug "=== index_entry #{view.to_s.inspect} #{meta.num} #{meta.title.inspect}"
536
- check_meta(meta, "index_entry1")
537
- raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
538
- check_meta(meta, "index_entry2")
539
- self.make_slug(meta)
540
- check_meta(meta, "index_entry3")
541
- # FIXME clean up and generalize
542
- ref = view/meta.slug/"index.html"
543
- <<-HTML
544
- <font size=-1>#{meta.date}&nbsp;&nbsp;</font> <br>
545
- <font size=+2 color=blue><a href=../#{ref} style="text-decoration: none">#{meta.title}</font></a>
546
- <br>
547
- <font size=+1>#{meta.teaser}&nbsp;&nbsp;</font>
548
- <a href=../#{ref} style="text-decoration: none">Read more...</a>
549
- <br>
550
- <hr>
551
- HTML
520
+ views.each {|view| _handle_post(draft, view) }
552
521
  end
553
522
 
554
523
  def rebuild_post(file)
@@ -615,6 +584,5 @@ class RuneBlog
615
584
  meta.slug = str
616
585
  str
617
586
  end
618
-
619
587
  end
620
588
 
@@ -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.46"
5
+ VERSION = "0.2.47"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
@@ -59,6 +59,5 @@ class RuneBlog::View
59
59
  rescue
60
60
  true
61
61
  end
62
-
63
62
  end
64
63
 
@@ -1,42 +1,42 @@
1
1
 
2
2
  LEXT = ".lt3"
3
3
 
4
- def stale?(src, dst, force = false)
5
- log!(enter: __method__, args: [src, dst], level: 3)
6
- raise "Source #{src} not found in #{Dir.pwd}" unless File.exist?(src)
7
- return true if force
8
- return true unless File.exist?(dst)
9
- return true if File.mtime(src) > File.mtime(dst)
10
- return false
11
- end
4
+ def stale?(src, dst, force = false)
5
+ log!(enter: __method__, args: [src, dst], level: 3)
6
+ raise "Source #{src} not found in #{Dir.pwd}" unless File.exist?(src)
7
+ return true if force
8
+ return true unless File.exist?(dst)
9
+ return true if File.mtime(src) > File.mtime(dst)
10
+ return false
11
+ end
12
12
 
13
- def xlate(cwd: Dir.pwd, src:,
14
- dst: (strip = true; src.sub(/.lt3$/,"")),
15
- copy: nil, debug: false, force: false)
16
- src += LEXT unless src.end_with?(LEXT)
17
- dst += ".html" unless dst.end_with?(".html") || strip
18
- indent = " "*12
19
- Dir.chdir(cwd) do
20
- if debug
21
- STDERR.puts "#{indent} -- xlate #{src} >#{dst}"
22
- STDERR.puts "#{indent} in: #{Dir.pwd}"
23
- STDERR.puts "#{indent} from: #{caller[0]}"
24
- STDERR.puts "#{indent} copy: #{copy}" if copy
25
- end
26
- if stale?(src, dst, force)
27
- # do nothing
28
- else
29
- STDERR.puts "#{indent} -- ^ Already up to date!" if debug
30
- return
31
- end
32
- rc = system("livetext #{src} >#{dst}")
33
- STDERR.puts "...completed (shell returned #{rc})" if debug
34
- system!("cp #{dst} #{copy}") if copy
13
+ def xlate(cwd: Dir.pwd, src:,
14
+ dst: (strip = true; src.sub(/.lt3$/,"")),
15
+ copy: nil, debug: false, force: false)
16
+ src += LEXT unless src.end_with?(LEXT)
17
+ dst += ".html" unless dst.end_with?(".html") || strip
18
+ indent = " "*12
19
+ Dir.chdir(cwd) do
20
+ if debug
21
+ STDERR.puts "#{indent} -- xlate #{src} >#{dst}"
22
+ STDERR.puts "#{indent} in: #{Dir.pwd}"
23
+ STDERR.puts "#{indent} from: #{caller[0]}"
24
+ STDERR.puts "#{indent} copy: #{copy}" if copy
25
+ end
26
+ if stale?(src, dst, force)
27
+ # do nothing
28
+ else
29
+ STDERR.puts "#{indent} -- ^ Already up to date!" if debug
30
+ return
35
31
  end
32
+ rc = system("livetext #{src} >#{dst}")
33
+ STDERR.puts "...completed (shell returned #{rc})" if debug
34
+ system!("cp #{dst} #{copy}") if copy
36
35
  end
36
+ end
37
37
 
38
- def xlate!(cwd: Dir.pwd, src:, copy: nil, debug: false, force: false)
39
- output = "/tmp/xlate-#{File.basename(src).sub(/.lt3$/, "")}"
40
- xlate cwd: cwd, src: src, dst: output, debug: debug, force: force
41
- File.read(output + ".html") # return all content as string
42
- end
38
+ def xlate!(cwd: Dir.pwd, src:, copy: nil, debug: false, force: false)
39
+ output = "/tmp/xlate-#{File.basename(src).sub(/.lt3$/, "")}"
40
+ xlate cwd: cwd, src: src, dst: output, debug: debug, force: force
41
+ File.read(output + ".html") # return all content as string
42
+ end
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.46
4
+ version: 0.2.47
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-17 00:00:00.000000000 Z
11
+ date: 2019-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -62,6 +62,7 @@ files:
62
62
  - "./runeblog.gemspec"
63
63
  - bin/blog
64
64
  - bin/mkwidget
65
+ - empty_view/assets/austin-pano.jpg
65
66
  - empty_view/assets/sky2.jpg
66
67
  - empty_view/remote/assets/GIT_IS_DUMB
67
68
  - empty_view/remote/etc/GIT_IS_DUMB