runeblog 0.2.24 → 0.2.25

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: 707ca8bf9834f7ed3bf831fa47189203ed2815a069051bd65bde6640a98b9828
4
- data.tar.gz: 21ad77269fc5fe291cab102a71a252635b8be69b052b655a16820c2515f2e27b
3
+ metadata.gz: 4160901e4e8ca9580c110d5d0f907038d6e4c1395e7e7c0fbcf1096c2edc109b
4
+ data.tar.gz: 54231043df23b1ffe47d170b663d8c476fb23346cd4808162cc622034e8bc519
5
5
  SHA512:
6
- metadata.gz: 3e68f4e2d5865b12a6e2e384065e134ed13eb41f1136d4d4fd10f76f26ed695d3764ae7a9478b1b38bd753b44b453b9da2bd2215e02770ef1d5f01811aeb9e40
7
- data.tar.gz: 8d9cb531a9adbf9607f5d116940817ca6488fc7dfc4eecb18ea98fb945ec2fe129dba1c1111213286d77f367a128d34e318201dfe69cc649756fdc113a26732c
6
+ metadata.gz: '051840ed1ffacbb132573e80c9c50c46fd6f513ffa656f98a3a02e069ce8e33642c41b6173822c76637da10045e42e27a4c841a1d8845d4e88a96d671a4a5d9b'
7
+ data.tar.gz: 2a0d66f7b39c840d2ecf714c7b4d279c202423b009405b003451586154b31fa75494fd893a122c97b096380fe9597ba80ecf3e59dee7ac4dc84b6dac1030d636
data/empty_view.tgz CHANGED
Binary file
data/lib/global.rb CHANGED
@@ -30,6 +30,19 @@ def make_exception(sym, str)
30
30
  end
31
31
  end
32
32
 
33
+ def system!(str)
34
+ log!(enter: __method__, args: [str])
35
+ rc = system(str)
36
+ if rc
37
+ return rc
38
+ else
39
+ STDERR.puts "FAILED: #{str.inspect}"
40
+ STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
41
+ return rc
42
+ end
43
+ rc
44
+ end
45
+
33
46
  def prefix(num)
34
47
  log!(enter: __method__, args: [num])
35
48
  "#{'%04d' % num.to_i}"
data/lib/helpers-blog.rb CHANGED
@@ -8,14 +8,14 @@ module RuneBlog::Helpers
8
8
  def copy(src, dst)
9
9
  log!(enter: __method__, args: [src, dst])
10
10
  cmd = "cp #{src} #{dst} 2>/dev/null"
11
- rc = system(cmd)
11
+ rc = system!(cmd)
12
12
  puts " Failed: #{cmd} - from #{caller[0]}" unless rc
13
13
  end
14
14
 
15
15
  def copy!(src, dst)
16
16
  log!(enter: __method__, args: [src, dst])
17
17
  cmd = "cp -r #{src} #{dst} 2>/dev/null"
18
- rc = system(cmd)
18
+ rc = system!(cmd)
19
19
  puts " Failed: #{cmd} - from #{caller[0]}" unless rc
20
20
  end
21
21
 
@@ -133,7 +133,7 @@ end
133
133
  dir = dir.to_s # symbols allowed
134
134
  next if Dir.exist?(dir)
135
135
  cmd = "mkdir -p #{dir} >/dev/null"
136
- result = system(cmd)
136
+ result = system!(cmd)
137
137
  raise CantCreateDir(dir) unless result
138
138
  end
139
139
  end
data/lib/helpers-repl.rb CHANGED
@@ -197,7 +197,7 @@ module RuneBlog::REPL
197
197
  @title = grep.sub(/^.title /, "")
198
198
  @slug = @blog.make_slug(@title) # import (not impl)
199
199
  @fname = @slug + ".lt3"
200
- result = system("cp #{name} #@root/drafts/#@fname")
200
+ result = system!("cp #{name} #@root/drafts/#@fname")
201
201
  raise CantCopy(name, "#@root/drafts/#@fname") unless result
202
202
 
203
203
  edit_initial_post(@fname)
data/lib/liveblog.rb CHANGED
@@ -525,8 +525,14 @@ end
525
525
  # helper methods
526
526
  ##################
527
527
 
528
- def _html_body(file)
529
- file.puts "<html>\n <body>"
528
+ def _html_body(file, css = nil)
529
+ file.puts "<html>"
530
+ if css
531
+ file.puts " <head>"
532
+ file.puts " <style>\n#{css}\n </style>"
533
+ file.puts " </head>"
534
+ end
535
+ file.puts " <body>"
530
536
  yield
531
537
  file.puts " </body>\n</html>"
532
538
  end
@@ -607,7 +613,8 @@ def _write_main(mainfile, pairs, card_title, tag)
607
613
  when ["no", true] # CAN'T iframe, local file (possible?)
608
614
  url_ref = _blank(file)
609
615
  end
610
- f.puts %[<a style="text-decoration: none; font-size: 24px" #{url_ref}>#{title}</a> <br>]
616
+ css = "color: #8888FF; text-decoration: none; font-size: 24px; font-family: verdana"
617
+ f.puts %[<a style="#{css}" #{url_ref}>#{title}</a> <br>]
611
618
  end
612
619
  end
613
620
  end
data/lib/post.rb CHANGED
@@ -93,7 +93,7 @@ class RuneBlog::Post
93
93
  def edit
94
94
  log!(enter: __method__)
95
95
  verify(File.exist?(@draft) => "File #{@draft} not found")
96
- result = system("vi #@draft +8") # TODO improve this
96
+ result = system!("vi #@draft +8") # TODO improve this
97
97
  raise EditorProblem(draft) unless result
98
98
  nil
99
99
  rescue => err
@@ -136,7 +136,7 @@ class RuneBlog::ViewPost
136
136
  vdir = @root/:views/view
137
137
  dir = vdir/:posts/noext + "/"
138
138
  Dir.mkdir(dir) unless Dir.exist?(dir)
139
- system("cp #{draft} #{dir}")
139
+ system!("cp #{draft} #{dir}")
140
140
  viewdir, slugdir, aslug = vdir, dir, noext[5..-1]
141
141
  theme = viewdir/:themes/:standard
142
142
  [noext, viewdir, slugdir, aslug, theme]
data/lib/repl.rb CHANGED
@@ -9,7 +9,7 @@ make_exception(:EditorProblem, "Could not edit $1")
9
9
  module RuneBlog::REPL
10
10
 
11
11
  def edit_file(file)
12
- result = system("#{@blog.editor} #{file}")
12
+ result = system!("#{@blog.editor} #{file}")
13
13
  raise EditorProblem(file) unless result
14
14
  sleep 0.1
15
15
  STDSCR.clear
@@ -18,7 +18,7 @@ module RuneBlog::REPL
18
18
  def cmd_quit(arg, testing = false)
19
19
  check_empty(arg)
20
20
  RubyText.stop
21
- system("tput clear")
21
+ system!("tput clear")
22
22
  exit
23
23
  end
24
24
 
@@ -66,7 +66,7 @@ module RuneBlog::REPL
66
66
  def cmd_import(arg, testing = false)
67
67
  check_empty(arg)
68
68
  files = ask("\n File(s) = ")
69
- system("cp #{files} #{@blog.root}/views/#{@blog.view.name}/assets/")
69
+ system!("cp #{files} #{@blog.root}/views/#{@blog.view.name}/assets/")
70
70
  end
71
71
 
72
72
  def cmd_browse(arg, testing = false)
@@ -78,7 +78,7 @@ module RuneBlog::REPL
78
78
  puts "\n Publish first."
79
79
  return @out
80
80
  end
81
- result = system("open '#{url}'")
81
+ result = system!("open '#{url}'")
82
82
  raise CantOpen(url) unless result
83
83
  return @out
84
84
  end
@@ -87,7 +87,7 @@ module RuneBlog::REPL
87
87
  reset_output
88
88
  check_empty(arg)
89
89
  local = @blog.view.local_index
90
- result = system("open #{local}")
90
+ result = system!("open #{local}")
91
91
  raise CantOpen(local) unless result
92
92
  @out
93
93
  end
@@ -334,7 +334,7 @@ module RuneBlog::REPL
334
334
 
335
335
  def cmd_ssh(arg, testing = false)
336
336
  pub = @blog.view.publisher
337
- system("ssh #{pub.user}@#{pub.server}")
337
+ system!("ssh #{pub.user}@#{pub.server}")
338
338
  end
339
339
 
340
340
  def cmd_INVALID(arg, testing = false)
data/lib/runeblog.rb CHANGED
@@ -61,7 +61,7 @@ class RuneBlog
61
61
  raise BlogRepoAlreadyExists if Dir.exist?(root)
62
62
  create_dirs(root)
63
63
  Dir.chdir(root) do
64
- system("cp #{RuneBlog::Path}/../empty_view.tgz .")
64
+ system!("cp #{RuneBlog::Path}/../empty_view.tgz .")
65
65
  create_dirs(:drafts, :views, :posts)
66
66
  new_sequence
67
67
  end
@@ -107,7 +107,7 @@ class RuneBlog
107
107
  # views = File.readlines("metadata.txt").grep(/^views: /).first[7..-1].split
108
108
  views = _retrieve_metadata(:views)
109
109
  STDERR.puts "---- deploy: views = #{views.inspect}"
110
- views.each {|v| system("cp *html #@root/views/#{v}/remote") }
110
+ views.each {|v| system!("cp *html #@root/views/#{v}/remote") }
111
111
  end
112
112
  end
113
113
 
@@ -249,8 +249,8 @@ STDERR.puts "--- retrieve: key = #{key.inspect}"
249
249
  Dir.chdir(@root) do
250
250
  cmd1 = "tar zxvf empty_view.tgz >/dev/null 2>&1"
251
251
  cmd2 = "cp -r empty_view views/#{view_name}"
252
- system(cmd1)
253
- system(cmd2)
252
+ system!(cmd1)
253
+ system!(cmd2)
254
254
  end
255
255
  end
256
256
 
@@ -280,7 +280,7 @@ STDERR.puts "--- retrieve: key = #{key.inspect}"
280
280
  raise ArgumentError unless name.is_a?(String) && ! name.empty?
281
281
  if force
282
282
  vname = @root/:views/name
283
- system("rm -rf #{vname}")
283
+ system!("rm -rf #{vname}")
284
284
  @views -= [str2view(name)]
285
285
  end
286
286
  end
@@ -313,15 +313,16 @@ STDERR.puts "--- retrieve: key = #{key.inspect}"
313
313
  id = slug.to_i
314
314
  text = nil
315
315
  post_entry_name = @theme/"blog/post_entry.lt3"
316
- @_post_entry ||= File.read(post_entry_name)
316
+ xlate src: post_entry_name, dst: "/tmp/post_entry.html", debug: true
317
+ @_post_entry ||= File.read("/tmp/post_entry.html")
317
318
  vp = post_lookup(id)
318
319
  nslug, aslug, title, date, teaser_text =
319
320
  vp.nslug, vp.aslug, vp.title, vp.date, vp.teaser_text
320
321
  path = vp.path
321
322
  url = aslug + ".html"
322
- date = ::Date.parse(date)
323
- date = date.strftime("%B %e<br>%Y")
324
- text = interpolate(@_post_entry, binding)
323
+ date = ::Date.parse(date)
324
+ date = date.strftime("%B %e<br>%Y")
325
+ text = interpolate(@_post_entry, binding)
325
326
  text
326
327
  end
327
328
 
@@ -370,7 +371,7 @@ STDERR.puts "--- retrieve: key = #{key.inspect}"
370
371
  log!(enter: __method__, args: [file, testing])
371
372
  debug "=== edit_initial_post #{file.inspect} => #{sourcefile}"
372
373
  sourcefile = @root/:drafts/file
373
- result = system("#@editor #{sourcefile} +8") unless testing
374
+ result = system!("#@editor #{sourcefile} +8") unless testing
374
375
  raise EditorProblem(sourcefile) unless result
375
376
  process_post(sourcefile)
376
377
  nil
@@ -435,7 +436,7 @@ STDERR.puts "--- retrieve: key = #{key.inspect}"
435
436
  vdir = @root/:views/view
436
437
  dir = vdir/:posts/noext
437
438
  Dir.mkdir(dir) unless Dir.exist?(dir)
438
- system("cp #{draft} #{dir}")
439
+ system!("cp #{draft} #{dir}")
439
440
  viewdir, slugdir, aslug = vdir, dir, noext[5..-1]
440
441
  theme = viewdir/:themes/:standard
441
442
  [noext, viewdir, slugdir, aslug, theme]
@@ -446,8 +447,8 @@ STDERR.puts "--- retrieve: key = #{key.inspect}"
446
447
  Dir.chdir(pdraft) do
447
448
  excerpt = File.read("teaser.txt")
448
449
  title = _retrieve_metadata(:title)
449
- vars = %[.set title="#{title.chomp}"\n] +
450
- %[.set teaser="#{excerpt.chomp}"]
450
+ vars = %[.heredoc title\n"#{title.chomp}"\n.end\n] +
451
+ %[.heredoc teaser\n"#{excerpt.chomp}"\n.end\n]
451
452
  File.open(pdraft/"vars.lt3", "w") {|f| f.puts vars }
452
453
  end
453
454
  end
@@ -464,7 +465,7 @@ STDERR.puts "--- retrieve: key = #{key.inspect}"
464
465
  create_dirs(rem)
465
466
  files = Dir[w/"*"]
466
467
  next unless files.any? {|x| x =~ /html$/ }
467
- system("cp #{w}/*html #{rem}")
468
+ system!("cp #{w}/*html #{rem}")
468
469
  end
469
470
  end
470
471
 
@@ -557,7 +558,7 @@ STDERR.puts "--- retrieve: key = #{key.inspect}"
557
558
  dest = list.map {|f| f.sub(/(?<num>\d{4}-)/, "_\\k<num>") }
558
559
  list.each.with_index do |src, i|
559
560
  cmd = "mv #{src} #{dest[i]} 2>/dev/null"
560
- system(cmd)
561
+ system!(cmd)
561
562
  end
562
563
  # FIXME - update index/etc
563
564
  true
@@ -573,7 +574,7 @@ STDERR.puts "--- retrieve: key = #{key.inspect}"
573
574
  dest = list.map {|f| f.sub(/_(?<num>\d{4}-)/, "\\k<num>") }
574
575
  list.each.with_index do |src, i|
575
576
  cmd = "mv #{src} #{dest[i]} 2>/dev/null"
576
- system(cmd)
577
+ system!(cmd)
577
578
  end
578
579
  # FIXME - update index/etc
579
580
  true
@@ -583,7 +584,7 @@ STDERR.puts "--- retrieve: key = #{key.inspect}"
583
584
  log!(enter: __method__, args: [num])
584
585
  raise ArgumentError unless num.is_a?(Integer)
585
586
  tag = prefix(num)
586
- system("rm -rf #@root/drafts/#{tag}-*")
587
+ system!("rm -rf #@root/drafts/#{tag}-*")
587
588
  end
588
589
 
589
590
  def make_slug(meta)
@@ -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.24"
5
+ VERSION = "0.2.25"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
data/lib/xlate.rb CHANGED
@@ -29,9 +29,9 @@ LEXT = ".lt3"
29
29
  STDERR.puts "#{indent} -- ^ Already up to date!" if debug
30
30
  return
31
31
  end
32
- rc = system("livetext #{src} >#{dst}")
32
+ rc = system!("livetext #{src} >#{dst}")
33
33
  STDERR.puts "...completed (shell returned #{rc})" if debug
34
- system("cp #{dst} #{copy}") if copy
34
+ system!("cp #{dst} #{copy}") if copy
35
35
  end
36
36
  end
37
37
 
data/runeblog.gemspec CHANGED
@@ -20,7 +20,7 @@ spec = Gem::Specification.new do |s|
20
20
  s.authors = ["Hal Fulton"]
21
21
  s.email = 'rubyhacker@gmail.com'
22
22
  s.executables << "blog"
23
- s.add_runtime_dependency 'livetext', '~> 0.8', '>= 0.8.93'
23
+ s.add_runtime_dependency 'livetext', '~> 0.8', '>= 0.8.94'
24
24
  s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.16'
25
25
 
26
26
  # Files...
data/test/make_blog.rb CHANGED
@@ -10,21 +10,29 @@ require 'global'
10
10
  require 'runeblog'
11
11
  require 'repl'
12
12
 
13
+ def bold(str)
14
+ "\e[1m#{str}\e[0m"
15
+ end
16
+
13
17
  def getch
14
18
  # sleep 5
15
19
  end
16
20
 
17
21
  def debug(str = "")
18
- STDERR.puts "#{Time.now.strftime("%H:%M:%S")} #{str}"
22
+ t = Time.now
23
+ time = t.to_f.to_s
24
+ n = time.index(".")
25
+ msec = time[n..-1]
26
+ time = t.strftime("%H:%M:%S") + msec
27
+ STDERR.puts "#{'%-16s' % time} #{str}"
19
28
  end
20
29
 
21
30
  def make_post(x, title, teaser, body, views=[])
22
- debug " make_post '#{title}'"
23
- # print "."
31
+ debug " make_post #{bold(title)}"
24
32
  x.create_new_post(title, true, teaser: teaser, body: body, other_views: views)
25
33
  views.each do |view|
26
34
  debug
27
- debug "** generate_index #{view}"
35
+ debug "** generate_index #{bold(view)}"
28
36
  x.generate_index(view)
29
37
  end # recent.html
30
38
  end
@@ -44,21 +52,16 @@ system("rm -rf .blogs")
44
52
  RuneBlog.create_new_blog_repo(".blogs")
45
53
  x = RuneBlog.new(".blogs")
46
54
 
47
- debug("create_view: around_austin")
55
+ debug("create_view: #{bold('around_austin')}")
48
56
  x.create_view("around_austin") # FIXME remember view title!
49
57
 
50
- # Hack:
51
- if File.exist?("publish")
52
- system("cp publish .blogs/views/around_austin/publish")
53
- end
54
-
55
- debug("create_view: computing")
58
+ debug("create_view: #{bold('computing')}")
56
59
  x.create_view("computing")
57
60
 
58
- debug("create_view: music")
61
+ debug("create_view: #{bold('music')}")
59
62
  x.create_view("music")
60
63
 
61
- debug("-- change_view: around_austin")
64
+ debug("-- change_view: #{bold('around_austin')}")
62
65
  x.change_view("around_austin") # 1 2 7 8 9
63
66
 
64
67
  make_post(x, "What's at Stubbs...", <<-EXCERPT, <<-BODY, ["music"])
@@ -73,7 +76,7 @@ EXCERPT
73
76
  Now, depending on what you consider "major," blah blah blah...
74
77
  BODY
75
78
 
76
- debug("-- change_view: computing")
79
+ debug("-- change_view: #{bold('computing')}")
77
80
  x.change_view("computing") # 3 5 6
78
81
 
79
82
  make_post(x, "Elixir Conf coming up...", <<-EXCERPT, <<-BODY)
@@ -83,7 +86,7 @@ I mean, unless the previous one was the last one ever, which I don't expect to
83
86
  happen for a couple of decades.
84
87
  BODY
85
88
 
86
- debug("-- change_view: music")
89
+ debug("-- change_view: #{bold('music')}")
87
90
  x.change_view("music") # 4 10
88
91
 
89
92
  make_post(x, "Does indie still matter?", <<-EXCERPT, <<-BODY)
@@ -92,7 +95,7 @@ EXCERPT
92
95
  And more about indie music.
93
96
  BODY
94
97
 
95
- debug("-- change_view: computing")
98
+ debug("-- change_view: #{bold('computing')}")
96
99
  x.change_view("computing")
97
100
 
98
101
  make_post(x, "The genius of Scenic", <<-EXCERPT, <<-BODY)
@@ -107,11 +110,11 @@ EXCERPT
107
110
  But that day hasn't come yet.
108
111
  BODY
109
112
 
110
- debug("-- change_view: around_austin")
113
+ debug("-- change_view: #{bold('around_austin')}")
111
114
  x.change_view("around_austin")
112
115
 
113
116
  make_post(x, "The graffiti wall", <<-EXCERPT, <<-BODY)
114
- RIP Hope Gallery
117
+ RIP, Hope Gallery
115
118
  EXCERPT
116
119
  It's been a while since I was there. They say it was torn down
117
120
  while I wasn't looking.
@@ -124,12 +127,12 @@ Blah blah Waller Creek blah blah...
124
127
  BODY
125
128
 
126
129
  make_post(x, "Life on Sabine Street", <<-EXCERPT, <<-BODY)
127
- It's like Pooh Corner (except not).
130
+ It's like Pooh Corner, except not.
128
131
  EXCERPT
129
132
  This is about Sabine St, blah blah lorem ipsum dolor...
130
133
  BODY
131
134
 
132
- debug("-- change_view: music")
135
+ debug("-- change_view: #{bold('music')}")
133
136
  x.change_view("music")
134
137
 
135
138
  make_post(x, "Remember Modest Mouse?", <<-EXCERPT, <<-BODY, ["around_austin"])
@@ -140,7 +143,7 @@ in 2005.
140
143
  BODY
141
144
 
142
145
  debug
143
- debug("** generate_view: around_austin")
146
+ debug("** generate_view: #{bold('around_austin')}")
144
147
  x.generate_view("around_austin")
145
148
 
146
149
  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.24
4
+ version: 0.2.25
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-07 00:00:00.000000000 Z
11
+ date: 2019-10-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '0.8'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 0.8.93
22
+ version: 0.8.94
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,7 +29,7 @@ dependencies:
29
29
  version: '0.8'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 0.8.93
32
+ version: 0.8.94
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: rubytext
35
35
  requirement: !ruby/object:Gem::Requirement