runeblog 0.3.34 → 0.3.35

Sign up to get free protection for your applications and to get access to all the features.
Files changed (191) hide show
  1. checksums.yaml +4 -4
  2. data/data/global.lt3 +3 -3
  3. data/empty_view/global.lt3 +20 -0
  4. data/empty_view/themes/standard/banner/top.lt3 +1 -1
  5. data/empty_view/themes/standard/blog/generate.lt3 +1 -1
  6. data/empty_view/themes/standard/etc/blog.css.lt3 +1 -1
  7. data/empty_view/themes/standard/post/generate.lt3 +1 -1
  8. data/empty_view/themes/standard/post/permalink.lt3 +1 -1
  9. data/lib/exceptions.rb +2 -0
  10. data/lib/helpers-blog.rb +3 -3
  11. data/lib/liveblog.rb +24 -24
  12. data/lib/lowlevel.rb +35 -0
  13. data/lib/menus.rb +2 -2
  14. data/lib/processing.rb +3 -17
  15. data/lib/publish.rb +3 -6
  16. data/lib/repl.rb +3 -5
  17. data/lib/runeblog.rb +94 -21
  18. data/lib/runeblog_version.rb +6 -2
  19. data/lib/view.rb +9 -3
  20. data/runeblog.gemspec +4 -2
  21. data/test/.blogs/data/EDITOR +1 -0
  22. data/test/.blogs/data/ROOT +1 -0
  23. data/test/.blogs/data/VERSION +2 -0
  24. data/test/.blogs/data/VIEW +1 -0
  25. data/test/.blogs/data/features.txt +18 -0
  26. data/test/.blogs/data/global.lt3 +20 -0
  27. data/test/.blogs/data/sequence +1 -0
  28. data/test/.blogs/data/universal.lt3 +20 -0
  29. data/test/.blogs/views/around_austin/assets/austin-pano.jpg +0 -0
  30. data/test/.blogs/views/around_austin/assets/back-icon.png +0 -0
  31. data/test/.blogs/views/around_austin/assets/reddit-logo.png +0 -0
  32. data/test/.blogs/views/around_austin/assets/sky2.jpg +0 -0
  33. data/test/.blogs/views/around_austin/config/exper/2svg.lt3 +38 -0
  34. data/test/.blogs/views/around_austin/config/exper/gen_svg.rb +60 -0
  35. data/test/.blogs/views/around_austin/config/exper/meta.html +10 -0
  36. data/test/.blogs/views/around_austin/config/exper/s2.html +25 -0
  37. data/test/.blogs/views/around_austin/config/exper/varmint.rb +50 -0
  38. data/test/.blogs/views/around_austin/config/facebook/credentials.txt +7 -0
  39. data/test/.blogs/views/around_austin/config/facebook/facebook.rb +42 -0
  40. data/test/.blogs/views/around_austin/config/facebook/fb.html +10 -0
  41. data/test/.blogs/views/around_austin/config/facebook/fb.js.lt3 +15 -0
  42. data/test/.blogs/views/around_austin/config/reddit/credentials.txt +6 -0
  43. data/test/.blogs/views/around_austin/config/reddit/notes.txt +4 -0
  44. data/test/.blogs/views/around_austin/config/reddit/reddit_post_url.py +34 -0
  45. data/test/.blogs/views/around_austin/config/reddit/redpost.rb +38 -0
  46. data/test/.blogs/views/around_austin/config/twitter/credentials.txt +3 -0
  47. data/test/.blogs/views/around_austin/config/twitter/tw.html +12 -0
  48. data/test/.blogs/views/around_austin/config/twitter/tw.js +5 -0
  49. data/test/.blogs/views/around_austin/config/twitter/twitter.rb +35 -0
  50. data/test/.blogs/views/around_austin/data/GIT_IS_DUMB +0 -0
  51. data/test/.blogs/views/around_austin/global.lt3 +20 -0
  52. data/test/.blogs/views/around_austin/last_published +1 -0
  53. data/test/.blogs/views/around_austin/posts/GIT_IS_DUMB +1 -0
  54. data/test/.blogs/views/around_austin/remote/assets/GIT_IS_DUMB +1 -0
  55. data/test/.blogs/views/around_austin/remote/banner/navbar/GIT_IS_DUMB +0 -0
  56. data/test/.blogs/views/around_austin/remote/etc/GIT_IS_DUMB +1 -0
  57. data/test/.blogs/views/around_austin/remote/permalink/GIT_IS_DUMB +1 -0
  58. data/test/.blogs/views/around_austin/remote/widgets/ad/GIT_IS_DUMB +2 -0
  59. data/test/.blogs/views/around_austin/remote/widgets/links/GIT_IS_DUMB +2 -0
  60. data/test/.blogs/views/around_austin/remote/widgets/news/GIT_IS_DUMB +2 -0
  61. data/test/.blogs/views/around_austin/remote/widgets/pages/GIT_IS_DUMB +2 -0
  62. data/test/.blogs/views/around_austin/remote/widgets/pinned/GIT_IS_DUMB +2 -0
  63. data/test/.blogs/views/around_austin/settings/features.txt +18 -0
  64. data/test/.blogs/views/around_austin/settings/publish.txt +5 -0
  65. data/test/.blogs/views/around_austin/settings/recent.txt +11 -0
  66. data/test/.blogs/views/around_austin/settings/view.txt +4 -0
  67. data/test/.blogs/views/around_austin/themes/standard/README +59 -0
  68. data/test/.blogs/views/around_austin/themes/standard/banner/banner.lt3 +5 -0
  69. data/test/.blogs/views/around_austin/themes/standard/banner/navbar/about.lt3 +18 -0
  70. data/test/.blogs/views/around_austin/themes/standard/banner/navbar/contact.lt3 +18 -0
  71. data/test/.blogs/views/around_austin/themes/standard/banner/navbar/faq.lt3 +1 -0
  72. data/test/.blogs/views/around_austin/themes/standard/banner/navbar/list.data +3 -0
  73. data/test/.blogs/views/around_austin/themes/standard/banner/top.lt3 +20 -0
  74. data/test/.blogs/views/around_austin/themes/standard/blog/generate.lt3 +21 -0
  75. data/test/.blogs/views/around_austin/themes/standard/blog/head.lt3 +16 -0
  76. data/test/.blogs/views/around_austin/themes/standard/blog/index.lt3 +16 -0
  77. data/test/.blogs/views/around_austin/themes/standard/blog/post_entry.lt3 +21 -0
  78. data/test/.blogs/views/around_austin/themes/standard/etc/blog.css.lt3 +62 -0
  79. data/test/.blogs/views/around_austin/themes/standard/etc/externals.lt3 +24 -0
  80. data/test/.blogs/views/around_austin/themes/standard/etc/favicon.ico +0 -0
  81. data/test/.blogs/views/around_austin/themes/standard/etc/github.css +209 -0
  82. data/test/.blogs/views/around_austin/themes/standard/etc/misc.js +20 -0
  83. data/test/.blogs/views/around_austin/themes/standard/global.lt3 +20 -0
  84. data/test/.blogs/views/around_austin/themes/standard/post/generate.lt3 +39 -0
  85. data/test/.blogs/views/around_austin/themes/standard/post/head.lt3 +7 -0
  86. data/test/.blogs/views/around_austin/themes/standard/post/index.lt3 +24 -0
  87. data/test/.blogs/views/around_austin/themes/standard/post/permalink.lt3 +31 -0
  88. data/test/.blogs/views/around_austin/widgets/README +4 -0
  89. data/test/.blogs/views/around_austin/widgets/bydates/README +2 -0
  90. data/test/.blogs/views/around_austin/widgets/bydates/bydates.rb +18 -0
  91. data/test/.blogs/views/around_austin/widgets/bydates/card.css +1 -0
  92. data/test/.blogs/views/around_austin/widgets/bydates/custom.rb +1 -0
  93. data/test/.blogs/views/around_austin/widgets/bydates/main.css +2 -0
  94. data/test/.blogs/views/around_austin/widgets/links/README +2 -0
  95. data/test/.blogs/views/around_austin/widgets/links/card.css +1 -0
  96. data/test/.blogs/views/around_austin/widgets/links/custom.rb +1 -0
  97. data/test/.blogs/views/around_austin/widgets/links/links.rb +90 -0
  98. data/test/.blogs/views/around_austin/widgets/links/list.data +3 -0
  99. data/test/.blogs/views/around_austin/widgets/links/main.css +2 -0
  100. data/test/.blogs/views/around_austin/widgets/news/README +2 -0
  101. data/test/.blogs/views/around_austin/widgets/news/card.css +1 -0
  102. data/test/.blogs/views/around_austin/widgets/news/custom.rb +1 -0
  103. data/test/.blogs/views/around_austin/widgets/news/list.data +4 -0
  104. data/test/.blogs/views/around_austin/widgets/news/main.css +2 -0
  105. data/test/.blogs/views/around_austin/widgets/news/news.rb +88 -0
  106. data/test/.blogs/views/around_austin/widgets/pages/README +2 -0
  107. data/test/.blogs/views/around_austin/widgets/pages/card.css +1 -0
  108. data/test/.blogs/views/around_austin/widgets/pages/custom.rb +1 -0
  109. data/test/.blogs/views/around_austin/widgets/pages/disclaim.lt3 +10 -0
  110. data/test/.blogs/views/around_austin/widgets/pages/faq.lt3 +41 -0
  111. data/test/.blogs/views/around_austin/widgets/pages/like-dislike.lt3 +11 -0
  112. data/test/.blogs/views/around_austin/widgets/pages/list.data +4 -0
  113. data/test/.blogs/views/around_austin/widgets/pages/local.rb +0 -0
  114. data/test/.blogs/views/around_austin/widgets/pages/main.css +2 -0
  115. data/test/.blogs/views/around_austin/widgets/pages/other-stuff.lt3 +10 -0
  116. data/test/.blogs/views/around_austin/widgets/pages/pages.rb +130 -0
  117. data/test/.blogs/views/around_austin/widgets/pinned/README +2 -0
  118. data/test/.blogs/views/around_austin/widgets/pinned/card.css +1 -0
  119. data/test/.blogs/views/around_austin/widgets/pinned/custom.rb +1 -0
  120. data/test/.blogs/views/around_austin/widgets/pinned/main.css +2 -0
  121. data/test/.blogs/views/around_austin/widgets/pinned/pinned.rb +111 -0
  122. data/test/.blogs/views/around_austin/widgets/search/README +2 -0
  123. data/test/.blogs/views/around_austin/widgets/search/card.css +1 -0
  124. data/test/.blogs/views/around_austin/widgets/search/custom.rb +1 -0
  125. data/test/.blogs/views/around_austin/widgets/search/main.css +2 -0
  126. data/test/.blogs/views/around_austin/widgets/search/search.rb +18 -0
  127. data/test/.blogs/views/around_austin/widgets/sitemap/README +2 -0
  128. data/test/.blogs/views/around_austin/widgets/sitemap/card.css +1 -0
  129. data/test/.blogs/views/around_austin/widgets/sitemap/custom.rb +1 -0
  130. data/test/.blogs/views/around_austin/widgets/sitemap/main.css +2 -0
  131. data/test/.blogs/views/around_austin/widgets/sitemap/sitemap.rb +18 -0
  132. data/test/.blogs/views/around_austin/widgets/tag-cloud/OLD-example.lt3 +12 -0
  133. data/test/.blogs/views/around_austin/widgets/tag-cloud/README +2 -0
  134. data/test/.blogs/views/around_austin/widgets/tag-cloud/card.css +1 -0
  135. data/test/.blogs/views/around_austin/widgets/tag-cloud/custom.rb +1 -0
  136. data/test/.blogs/views/around_austin/widgets/tag-cloud/main.css +2 -0
  137. data/test/.blogs/views/around_austin/widgets/tag-cloud/tag-cloud.lt3 +3 -0
  138. data/test/.blogs/views/around_austin/widgets/tag-cloud/tag-cloud.rb +18 -0
  139. data/test/.blogs/widgets/README +4 -0
  140. data/test/.blogs/widgets/bydates/README +2 -0
  141. data/test/.blogs/widgets/bydates/bydates.rb +18 -0
  142. data/test/.blogs/widgets/bydates/card.css +1 -0
  143. data/test/.blogs/widgets/bydates/custom.rb +1 -0
  144. data/test/.blogs/widgets/bydates/main.css +2 -0
  145. data/test/.blogs/widgets/links/README +2 -0
  146. data/test/.blogs/widgets/links/card.css +1 -0
  147. data/test/.blogs/widgets/links/custom.rb +1 -0
  148. data/test/.blogs/widgets/links/links.rb +90 -0
  149. data/test/.blogs/widgets/links/list.data +3 -0
  150. data/test/.blogs/widgets/links/main.css +2 -0
  151. data/test/.blogs/widgets/news/README +2 -0
  152. data/test/.blogs/widgets/news/card.css +1 -0
  153. data/test/.blogs/widgets/news/custom.rb +1 -0
  154. data/test/.blogs/widgets/news/list.data +4 -0
  155. data/test/.blogs/widgets/news/main.css +2 -0
  156. data/test/.blogs/widgets/news/news.rb +88 -0
  157. data/test/.blogs/widgets/pages/README +2 -0
  158. data/test/.blogs/widgets/pages/card.css +1 -0
  159. data/test/.blogs/widgets/pages/custom.rb +1 -0
  160. data/test/.blogs/widgets/pages/disclaim.lt3 +10 -0
  161. data/test/.blogs/widgets/pages/faq.lt3 +41 -0
  162. data/test/.blogs/widgets/pages/like-dislike.lt3 +11 -0
  163. data/test/.blogs/widgets/pages/list.data +4 -0
  164. data/test/.blogs/widgets/pages/local.rb +0 -0
  165. data/test/.blogs/widgets/pages/main.css +2 -0
  166. data/test/.blogs/widgets/pages/other-stuff.lt3 +10 -0
  167. data/test/.blogs/widgets/pages/pages.rb +130 -0
  168. data/test/.blogs/widgets/pinned/README +2 -0
  169. data/test/.blogs/widgets/pinned/card.css +1 -0
  170. data/test/.blogs/widgets/pinned/custom.rb +1 -0
  171. data/test/.blogs/widgets/pinned/main.css +2 -0
  172. data/test/.blogs/widgets/pinned/pinned.rb +111 -0
  173. data/test/.blogs/widgets/search/README +2 -0
  174. data/test/.blogs/widgets/search/card.css +1 -0
  175. data/test/.blogs/widgets/search/custom.rb +1 -0
  176. data/test/.blogs/widgets/search/main.css +2 -0
  177. data/test/.blogs/widgets/search/search.rb +18 -0
  178. data/test/.blogs/widgets/sitemap/README +2 -0
  179. data/test/.blogs/widgets/sitemap/card.css +1 -0
  180. data/test/.blogs/widgets/sitemap/custom.rb +1 -0
  181. data/test/.blogs/widgets/sitemap/main.css +2 -0
  182. data/test/.blogs/widgets/sitemap/sitemap.rb +18 -0
  183. data/test/.blogs/widgets/tag-cloud/OLD-example.lt3 +12 -0
  184. data/test/.blogs/widgets/tag-cloud/README +2 -0
  185. data/test/.blogs/widgets/tag-cloud/card.css +1 -0
  186. data/test/.blogs/widgets/tag-cloud/custom.rb +1 -0
  187. data/test/.blogs/widgets/tag-cloud/main.css +2 -0
  188. data/test/.blogs/widgets/tag-cloud/tag-cloud.lt3 +3 -0
  189. data/test/.blogs/widgets/tag-cloud/tag-cloud.rb +18 -0
  190. data/test/austin.rb +8 -3
  191. metadata +176 -6
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b835a9fea2fa013b708dd9b6f99b411f34517fe6a04f27c130b4fbf3f802881
4
- data.tar.gz: 818099d61bdfa21031f7e6c13580536b64cdbd27ab2e69c196fccb4c765bd135
3
+ metadata.gz: 5db993b1031cd1ce5d6e443be8de9f0bb5b7e3272e5cf5c731aac464f517088b
4
+ data.tar.gz: a5d2f603c30b05a064daa82ebadf9e51757f91bcd31c5a05cdd696c72b4bf828
5
5
  SHA512:
6
- metadata.gz: e87e7985ebb4302986520fe593d16bca67cc03f2be97b821c3a0ca5f5f0eda172df6509b148eacc701f85cc86a3199e24876d40d0648c9ad5f8248034caeaa4d
7
- data.tar.gz: 8b764722bae84a9bc73b3aadbae80599b3cd69252f4f83b7e208bde3b6aadb8cd183d0fb806e5985b77fcc0b75f80abe22dbe813615ca08eb5f5de3dcbcd53bd
6
+ metadata.gz: 15ea7ea4d1aa5f436fd2f8a736150d5289e4a3cc5d461514352aa3fc16b826f9853283c4c0989cb54f145570fdad3c974be6012c5bcec5822a27725869a4a931
7
+ data.tar.gz: ce8f9f2a6d5a5429b9f3c11edc3449e2b3c85ce290e76ed8fd0486972edf3147324c46bced9b891743db35f7928ea522615a7f22dd3f2cec56ef10bf2554c341
data/data/global.lt3 CHANGED
@@ -3,11 +3,11 @@
3
3
  . <variable> <value>
4
4
  . --------------------------------------------------
5
5
 
6
- .variables view ../settings/view.txt
6
+ .variables view ../../settings/view.txt
7
7
 
8
- .variables recent ../settings/recent.txt
8
+ .variables recent ../../settings/recent.txt
9
9
 
10
- .variables publish ../settings/publish.txt
10
+ .variables publish ../../settings/publish.txt
11
11
 
12
12
  .variables
13
13
  host http://SITE
@@ -0,0 +1,20 @@
1
+ . --------------------------------------------------
2
+ . Global settings are stored here in the form
3
+ . <variable> <value>
4
+ . --------------------------------------------------
5
+
6
+ .variables view settings/view.txt
7
+
8
+ .variables recent settings/recent.txt
9
+
10
+ .variables publish settings/publish.txt
11
+
12
+ .variables
13
+ host http://SITE
14
+ charset utf-8
15
+ url http://SITE
16
+ locale en_US
17
+
18
+ font.family verdana
19
+ .end
20
+
@@ -1,4 +1,4 @@
1
- .include $ViewDir/data/global.lt3
1
+ .include $ViewDir/global.lt3
2
2
 
3
3
  <svg width="98%" height="120"
4
4
  viewBox="0 0 98% 100">
@@ -8,7 +8,7 @@
8
8
  <html>
9
9
  <!-- Generated from $File on $$date.
10
10
  Editing not recommended. -->
11
- $.include $ViewDir/data/global.lt3
11
+ $.include $ViewDir/global.lt3
12
12
  $.include blog/head.lt3
13
13
  <body>
14
14
  $.include banner/banner.lt3
@@ -3,7 +3,7 @@
3
3
  . Most of the global CSS goes here
4
4
  . --------------------------------------------------
5
5
 
6
- .include $ViewDir/data/global.lt3
6
+ .include $ViewDir/global.lt3
7
7
 
8
8
  body { font-family: $font.family }
9
9
 
@@ -8,7 +8,7 @@
8
8
  <html>
9
9
  <!-- Generated from $File on $$date; editing not recommended. -->
10
10
 
11
- .include $ViewDir/data/global.lt3
11
+ .include $ViewDir/global.lt3
12
12
 
13
13
  .variables! post metadata.txt
14
14
 
@@ -12,7 +12,7 @@
12
12
  <!-- Editing this file is not recommended. -->
13
13
  <!-- It was generated from $File on $$date. -->
14
14
 
15
- .include $ViewDir/data/global.lt3
15
+ .include $ViewDir/global.lt3
16
16
 
17
17
  .head
18
18
  og:title $title
data/lib/exceptions.rb CHANGED
@@ -36,3 +36,5 @@ make_exception(:NoNumericPrefix, "No numeric prefix on slug '%1'")
36
36
  make_exception(:NoExtensionExpected, "No file extension expected on '%1'")
37
37
  make_exception(:FilenameHasBlank, "File '%1' contains a blank space.")
38
38
 
39
+ make_exception(:MissingGlobal, "File global.lt3 is missing.")
40
+
data/lib/helpers-blog.rb CHANGED
@@ -67,13 +67,13 @@ module RuneBlog::Helpers
67
67
  end
68
68
 
69
69
  def get_all_widgets(dest)
70
- wdir = RuneBlog::Path + "/widgets" # files kept inside gem
70
+ wdir = RuneBlog::Path + "/widgets" # files kept inside gem (or dev repo)
71
71
  copy!(wdir/"*", dest)
72
72
  end
73
73
 
74
74
  def get_widget(dest, widget: :all) # recursive
75
75
  wdir = ".blogs/widgets"
76
- wdir = RuneBlog::Path + "/widgets" # files kept inside gem
76
+ wdir = RuneBlog::Path + "/widgets" # files kept inside gem (or dev repo)
77
77
  if widget == :all
78
78
  copy!(wdir/"*", dest)
79
79
  else
@@ -82,7 +82,7 @@ module RuneBlog::Helpers
82
82
  end
83
83
 
84
84
  def copy_data(dest)
85
- data = RuneBlog::Path + "/../data" # files kept inside gem
85
+ data = RuneBlog::Path + "/../data" # files kept inside gem (or dev repo)
86
86
  files = %w[ROOT VIEW EDITOR universal.lt3 global.lt3 features.txt]
87
87
  files.each {|file| copy(data + "/" + file, dest) unless File.exist?(dest/file) }
88
88
  end
data/lib/liveblog.rb CHANGED
@@ -7,10 +7,6 @@ require 'runeblog'
7
7
  require 'pathmagic'
8
8
  require 'processing'
9
9
 
10
- # top = Livetext::Path + "/../plugin/liveblog/"
11
- # eval(File.read("#{top}/testing.rb"))
12
-
13
-
14
10
  def init_liveblog # FIXME - a lot of this logic sucks
15
11
  log!(enter: __method__)
16
12
  dir = Dir.pwd.sub(/\.blogs.*/, "")
@@ -65,27 +61,31 @@ def post
65
61
  api.out " <!-- Post number #{@meta.num} -->\n "
66
62
  end
67
63
 
68
- def _got_python?
69
- log!(enter: __method__)
70
- # Dumb - fix later - check up front as needed
71
- # Should also check for praw lib
72
- str = `which python3`
73
- str.length > 0
74
- end
64
+ ### reddit integration broke at their end...
75
65
 
76
- def _reddit_post_url(vdir, date, title, url)
77
- log!(enter: __method__)
78
- _got_python?
79
- tmpfile = "/tmp/reddit-post-url.txt"
80
- File.open(tmpfile, "w") do |tmp|
81
- tmp.puts "[#{date}] #{title}"
82
- tmp.puts url
83
- end
84
- rid = nil
85
- Dir.chdir(vdir/:config) { rid = `python3 reddit/reddit_post_url.py` }
86
- system("rm #{tmpfile}")
87
- rid # returns reddit id
66
+ def _got_python?
67
+ log!(enter: __method__)
68
+ # Dumb - fix later - check up front as needed
69
+ # Should also check for praw lib
70
+ str = `which python3`
71
+ str.length > 0
72
+ end
73
+
74
+ def _reddit_post_url(vdir, date, title, url)
75
+ log!(enter: __method__)
76
+ _got_python?
77
+ tmpfile = "/tmp/reddit-post-url.txt"
78
+ File.open(tmpfile, "w") do |tmp|
79
+ tmp.puts "[#{date}] #{title}"
80
+ tmp.puts url
88
81
  end
82
+ rid = nil
83
+ Dir.chdir(vdir/:config) { rid = `python3 reddit/reddit_post_url.py` }
84
+ system("rm #{tmpfile}")
85
+ rid # returns reddit id
86
+ end
87
+
88
+ ### ...end of reddit piece
89
89
 
90
90
  def post_toolbar
91
91
  log!(enter: __method__)
@@ -197,7 +197,7 @@ def banner
197
197
  count += 1
198
198
  tag, *data = line.split
199
199
  data ||= []
200
- deps = [@blog.view.globals[:ViewDir]/:data/"global.lt3"]
200
+ deps = [@blog.view.globals[:ViewDir]/"global.lt3"]
201
201
  case tag
202
202
  when "width"; wide = data[0]
203
203
  when "height"; high = data[0]
data/lib/lowlevel.rb CHANGED
@@ -1,3 +1,38 @@
1
+ def whence(back = 0)
2
+ file, line, inmeth = caller[back].split(":")
3
+ meth = inmeth[4..-2]
4
+ [file, line, meth]
5
+ end
6
+
7
+ def checkpoint(msg = nil)
8
+ file, line, meth = whence(1)
9
+ print "--- "
10
+ if msg
11
+ puts msg
12
+ print " "
13
+ end
14
+ puts "#{meth} #{line} in #{file}"
15
+ end
16
+
17
+ def warning(err)
18
+ file, line, meth = whence(2) # 2 = skip rescue
19
+ puts "Error in #{meth} in #{file} (non-fatal?)"
20
+ puts " err = #{err.inspect}"
21
+ puts " #{err.backtrace[0]}" if err.respond_to?(:backtrace)
22
+ puts
23
+ end
24
+
25
+ def fatal(err)
26
+ file, line, meth = whence(2) # 2 = skip rescue
27
+ puts "Error in #{meth} in #{file}"
28
+ puts "WTF??"
29
+ puts " err = #{err.inspect}"
30
+ if err.respond_to?(:backtrace)
31
+ context = err.backtrace.map {|x| " " + x + "\n" }
32
+ puts context
33
+ end
34
+ abort "Terminated."
35
+ end
1
36
 
2
37
  def _tmp_error(err)
3
38
  STDERR.puts err
data/lib/menus.rb CHANGED
@@ -51,7 +51,8 @@ def edit_post_index
51
51
  end
52
52
 
53
53
  def edit_view_global
54
- edit_file("#@data/global.lt3")
54
+ # CHANGED redefining "global" location
55
+ edit_file("global.lt3")
55
56
  end
56
57
 
57
58
  def edit_settings_view
@@ -93,7 +94,6 @@ end
93
94
  # dir = @blog.view.dir/"themes/standard/"
94
95
 
95
96
  @std = "themes/standard"
96
- @data = "." # CHANGED
97
97
 
98
98
  Menu.top_config = {
99
99
  "View: generator" => proc { edit_blog_generate },
data/lib/processing.rb CHANGED
@@ -69,30 +69,16 @@ def preprocess(cwd: Dir.pwd, src:,
69
69
  puts "#{sp} -- ^ Already up to date!" if debug && ! stale
70
70
  end
71
71
  rescue => err
72
- msg = err.to_s
73
- msg << err.backtrace.join("\n") if err.respond_to?(:backtrace)
74
- STDERR.puts msg
75
- STDERR.flush
76
- log!(str: msg)
72
+ fatal(err)
77
73
  end
78
74
 
79
- # glv 2 - No such file or directory @ rb_check_realpath_internal - /Users/Hal/.blogs/views/computing/themes/standard/settings/view.txt
80
-
81
75
  def get_live_vars(src)
82
76
  dir, base = File.dirname(src), File.basename(src)
83
- # puts "glv 1: src = #{src.inspect} dir,base = #{dir.inspect}, #{base.inspect}"
84
77
  live = Livetext.customize(call: [".nopara"])
85
- puts "glv 2: cd #{dir} xform #{base}\n "
86
- # HAL9000:~ Hal$ find .blogs/views/computing/ -name global.lt3
87
- # .blogs/views/computing//themes/standard/global.lt3
88
- # HAL9000:~ Hal$ find .blogs/views/computing/ -name view.txt
89
- # .blogs/views/computing//settings/view.txt
90
78
  Dir.chdir(dir) { live.xform_file(base) }
91
79
  live
92
- rescue => e
93
- puts e
94
- puts $!
95
- gets
80
+ rescue => err
81
+ fatal(err)
96
82
  end
97
83
 
98
84
  end
data/lib/publish.rb CHANGED
@@ -14,15 +14,12 @@ class RuneBlog::Publishing
14
14
  def initialize(view)
15
15
  log!(enter: __method__, args: [view.to_s])
16
16
  @blog = RuneBlog.blog
17
- dir = @blog.root/:views/view/"themes/standard/"
17
+ # CHANGED redefining "global" location
18
+ dir = @blog.root/:views/view # /"themes/standard/"
18
19
  gfile = dir/"global.lt3"
19
- there = File.exist?(gfile)
20
- puts "Pub#init 0 gfile = $ gfile.inspect} exist = #{there}"
21
- return unless File.exist?(gfile) # FIXME Hackish as hell
20
+ raise MissingGlobal unless File.exist?(gfile)
22
21
 
23
- # puts "Pub#init 1"
24
22
  live = get_live_vars(gfile)
25
- # puts "Pub#init 2 - vars = #{live.vars.inspect}\n "
26
23
  @user = live.vars["publish.user"]
27
24
  @server = live.vars["publish.server"]
28
25
  @docroot = live.vars["publish.docroot"]
data/lib/repl.rb CHANGED
@@ -269,7 +269,7 @@ log! str: "=== ...finished!"
269
269
 
270
270
  # move to helpers
271
271
  def modify_view_global(view_name)
272
- gfile = "#{@blog.root}/views/#{view_name}/data/global.lt3"
272
+ gfile = "#{@blog.root}/views/#{view_name}/global.lt3"
273
273
  lines = File.readlines(gfile).map(&:chomp)
274
274
  vars = <<~EOF
275
275
  .variables
@@ -311,12 +311,10 @@ log! str: "=== ...finished!"
311
311
  end
312
312
  @blog.create_view(arg)
313
313
  lines = File.read("#{@blog.root}/data/global.lt3")
314
- # File.write("#{@blog.root}/views/#{@blog.view}/themes/standard/global.lt3",
315
- File.write("#{@blog.root}/views/#{@blog.view}/data/global.lt3",
314
+ File.write("#{@blog.root}/views/#{@blog.view}/global.lt3",
316
315
  text.gsub(/VIEW_NAME/, @blog.view.to_s))
317
316
  vim_params = '-c ":set hlsearch" -c ":hi Search ctermfg=2 ctermbg=6" +/"\(VIEW_.*\|SITE.*\)"'
318
- # edit_file(@blog.view.dir/"themes/standard/global.lt3", vim: vim_params)
319
- edit_file(@blog.view.dir/"data/global.lt3", vim: vim_params)
317
+ edit_file(@blog.view.dir/"global.lt3", vim: vim_params)
320
318
  @blog.change_view(arg)
321
319
  rescue ViewAlreadyExists
322
320
  puts 'Blog already exists'
data/lib/runeblog.rb CHANGED
@@ -73,8 +73,9 @@ class RuneBlog
73
73
  def RuneBlog.post_template(num: 0, title: "No title", date: nil, view: "test_view",
74
74
  teaser: "No teaser", body: "No body", tags: ["untagged"],
75
75
  views: [], back: "javascript:history.go(-1)", home: "no url")
76
- log!(enter: __method__, args: [num, title, date, view, teaser, body, tags, views, back, home], level: 3)
77
- viewlist = (views + [view.to_s]).join(" ").uniq
76
+ arglist = [num, title, date, view, teaser, body, tags, views, back, home]
77
+ log!(enter: __method__, args: arglist, level: 3)
78
+ viewlist = (views + [view.to_s]).uniq.join(" ")
78
79
  taglist = ".tags " + tags.join(" ")
79
80
 
80
81
  <<~TEXT
@@ -91,7 +92,14 @@ class RuneBlog
91
92
  #{body}
92
93
  TEXT
93
94
  end
94
-
95
+ rescue => err
96
+ puts "Error in #{__method__} in #{__FILE__}
97
+ puts " #{err.inspect}"
98
+ if err.respond_to?(:backtrace)
99
+ context = err.backtrace.map {|x| " " + x}.join("\n")
100
+ puts context
101
+ end
102
+ abort "\nTerminated."
95
103
  end
96
104
 
97
105
  def self.create_new_blog_repo(root_rel = ".blogs")
@@ -152,6 +160,9 @@ class RuneBlog
152
160
  @sequence, @post_views, @post_tags = get_sequence, [], []
153
161
  get_repo_config
154
162
  read_features
163
+ rescue => err
164
+ puts "Error: #{__method__} - #{err.inspect}\n#{err.backtrace.join("\n")}\n "
165
+ abort "Terminated."
155
166
  end
156
167
 
157
168
  def complete_file(name, vars, hash)
@@ -165,6 +176,12 @@ class RuneBlog
165
176
 
166
177
  hash.each_pair {|key, var| text.gsub!(key, vars[var]) }
167
178
  File.write(name, text)
179
+ rescue => err
180
+ puts "Error in #{__method__} in #{__FILE__}
181
+ puts " #{err.inspect}"
182
+ context = err.backtrace.map {|x| " " + x}.join("\n")
183
+ puts context
184
+ abort "\nTerminated."
168
185
  end
169
186
 
170
187
  def _generate_settings(view = nil)
@@ -203,6 +220,14 @@ class RuneBlog
203
220
  # recent.txt - SKIP THIS?
204
221
  complete_file(settings/"recent.txt", {})
205
222
  end
223
+ rescue => err
224
+ puts "Error in #{__method__} in #{__FILE__}
225
+ puts " #{err.inspect}"
226
+ if err.respond_to?(:backtrace)
227
+ context = err.backtrace.map {|x| " " + x}.join("\n")
228
+ puts context
229
+ end
230
+ abort "\nTerminated."
206
231
  end
207
232
 
208
233
  def _generate_global
@@ -215,6 +240,14 @@ class RuneBlog
215
240
  /LOCALE/ => :locale}
216
241
  complete_file(gfile, vars, hash)
217
242
  _generate_settings
243
+ rescue => err
244
+ puts "Error in #{__method__} in #{__FILE__}
245
+ puts " #{err.inspect}"
246
+ if err.respond_to?(:backtrace)
247
+ context = err.backtrace.map {|x| " " + x}.join("\n")
248
+ puts context
249
+ end
250
+ abort "\nTerminated."
218
251
  end
219
252
 
220
253
  # FIXME reconcile with _get_draft data
@@ -225,6 +258,14 @@ class RuneBlog
225
258
  meta.tags = meta.tags.split
226
259
  RuneBlog.blog.post = meta
227
260
  meta
261
+ rescue => err
262
+ puts "Error in #{__method__} in #{__FILE__}
263
+ puts " #{err.inspect}"
264
+ if err.respond_to?(:backtrace)
265
+ context = err.backtrace.map {|x| " " + x}.join("\n")
266
+ puts context
267
+ end
268
+ abort "\nTerminated."
228
269
  end
229
270
 
230
271
  def _deploy_local(dir)
@@ -346,12 +387,21 @@ class RuneBlog
346
387
  File.write(@root/"data/VIEW", view_name)
347
388
  @views << view # all views
348
389
  view
390
+ rescue => err
391
+ puts "Error in #{__method__} in #{__FILE__}
392
+ puts " #{err.inspect}"
393
+ if err.respond_to?(:backtrace)
394
+ context = err.backtrace.map {|x| " " + x}.join("\n")
395
+ puts context
396
+ end
397
+ abort "\nTerminated."
349
398
  end
350
399
 
351
400
  def make_empty_view_tree(view_name)
352
401
  log!(enter: __method__, args: [view_name], level: 2)
353
402
  Dir.chdir(@root) do
354
403
  cmd = "cp -r #{RuneBlog::Path}/../empty_view views/#{view_name}"
404
+ puts "#{__method__}: cmd = #{cmd.inspect}"
355
405
  system!(cmd)
356
406
  cmd = "cp -r widgets views/#{view_name}"
357
407
  system!(cmd)
@@ -373,9 +423,10 @@ class RuneBlog
373
423
  log!(enter: __method__, args: [view_name], level: 2)
374
424
  make_empty_view_tree(view_name)
375
425
  add_view(view_name)
426
+ # FIXME - fundamentally illogical?? what is "global" really?
427
+ src, dst = "#@root/data/global.lt3", "#@root/views/#{view_name}/global.lt3"
428
+ system("cp #{src} #{dst}")
376
429
  mark_last_published("Initial creation")
377
- # system("cp #@root/data/global.lt3 #@root/views/#{view_name}/themes/standard/global.lt3")
378
- system("cp #@root/data/global.lt3 #@root/views/#{view_name}/data/global.lt3")
379
430
  @view.get_globals(true)
380
431
  rescue => err
381
432
  _tmp_error(err)
@@ -534,6 +585,14 @@ class RuneBlog
534
585
  end
535
586
  # curr_drafts
536
587
  list.sort
588
+ rescue => err
589
+ puts "Error in #{__method__} in #{__FILE__}
590
+ puts " #{err.inspect}"
591
+ if err.respond_to?(:backtrace)
592
+ context = err.backtrace.map {|x| " " + x}.join("\n")
593
+ puts context
594
+ end
595
+ abort "\nTerminated."
537
596
  end
538
597
 
539
598
  def all_drafts
@@ -541,6 +600,14 @@ class RuneBlog
541
600
  dir = @root/:drafts
542
601
  drafts = Dir.entries(dir).grep(/^\d{4}.*/)
543
602
  drafts.sort
603
+ rescue => err
604
+ puts "Error in #{__method__} in #{__FILE__}
605
+ puts " #{err.inspect}"
606
+ if err.respond_to?(:backtrace)
607
+ context = err.backtrace.map {|x| " " + x}.join("\n")
608
+ puts context
609
+ end
610
+ abort "\nTerminated."
544
611
  end
545
612
 
546
613
  def change_view(view)
@@ -549,6 +616,14 @@ class RuneBlog
549
616
  File.write(@root/"data/VIEW", view)
550
617
  # write_repo_config
551
618
  self.view = view # error checking?
619
+ rescue => err
620
+ puts "Error in #{__method__} in #{__FILE__}
621
+ puts " #{err.inspect}"
622
+ if err.respond_to?(:backtrace)
623
+ context = err.backtrace.map {|x| " " + x}.join("\n")
624
+ puts context
625
+ end
626
+ abort "\nTerminated."
552
627
  end
553
628
 
554
629
  def generate_index(view)
@@ -565,8 +640,9 @@ class RuneBlog
565
640
  log!(enter: __method__, args: [view])
566
641
  vdir = @root/:views/view
567
642
  @theme = @root/:views/view/:themes/:standard
568
- @data = @root/:views/view/:data
569
- depend = [vdir/"remote/etc/blog.css.lt3", @data/"global.lt3",
643
+ # CHANGED - redefining "global"
644
+ # depend = [vdir/"remote/etc/blog.css.lt3", @theme/"global.lt3",
645
+ depend = [vdir/"remote/etc/blog.css.lt3", vdir/"global.lt3",
570
646
  @theme/"blog/head.lt3",
571
647
  # @theme/"navbar/navbar.lt3",
572
648
  @theme/"blog/index.lt3"] # FIXME what about assets?
@@ -580,9 +656,13 @@ class RuneBlog
580
656
  # rebuild widgets?
581
657
  copy_widget_html(view)
582
658
  rescue => err
583
- STDERR.puts err
584
- STDERR.puts err.backtrace.join("\n")
585
- # _tmp_error(err)
659
+ puts "Error in #{__method__} in #{__FILE__}
660
+ puts " #{err.inspect}"
661
+ if err.respond_to?(:backtrace)
662
+ context = err.backtrace.map {|x| " " + x}.join("\n")
663
+ puts context
664
+ end
665
+ abort "\nTerminated."
586
666
  end
587
667
 
588
668
  def _get_views(draft)
@@ -642,25 +722,19 @@ class RuneBlog
642
722
 
643
723
  def copy_widget_html(view)
644
724
  log!(enter: __method__, level: 2)
645
- log! str: "=== cwh cp 1"
646
725
  vdir = @root/:views/view
647
726
  remote = vdir/:remote
648
727
  wdir = vdir/:widgets
649
728
  widgets = Dir[wdir/"*"].select {|w| File.directory?(w) }
650
- log! str: "=== cwh cp 2"
651
729
  widgets.each do |w|
652
730
  dir = File.basename(w)
653
731
  rem = w.sub(/widgets/, "remote/widgets")
654
- log! str: "=== cwh cp 3 w = #{w.inspect}"
655
732
  create_dirs(rem)
656
733
  files = Dir[w/"*"]
657
734
  # files = files.select {|x| x =~ /(html|css)$/ }
658
735
  tag = File.basename(w)
659
- log! str: "=== cwh cp 4 tag = #{tag.inspect}"
660
- files.each {|file| system!("cp #{file} #{rem}", show: true) }
661
- log! str: "=== cwh cp 5 tag was #{tag.inspect}"
736
+ files.each {|file| system!("cp #{file} #{rem}") } # , show: true) }
662
737
  end
663
- log! str: "=== cwh cp 6"
664
738
  rescue => err
665
739
  _tmp_error(err)
666
740
  end
@@ -681,10 +755,9 @@ log! str: "=== cwh cp 6"
681
755
 
682
756
  create_dirs(pdraft) # Step 1...
683
757
  @view.globals ||= {}
684
- args = {cwd: pdraft, src: draft, debug: true, dst: "guts.html",
685
- mix: "liveblog", vars: @view.globals}
758
+ # args = {cwd: pdraft, src: draft, dst: "guts.html",
759
+ # mix: "liveblog", vars: @view.globals}
686
760
  preprocess cwd: pdraft, src: draft, # FIXME dependencies?
687
- debug: true,
688
761
  dst: "guts.html", mix: "liveblog", vars: @view.globals
689
762
  hash = _post_metadata(draft, pdraft)
690
763
  hash[:CurrentPost] = pmeta
@@ -693,7 +766,7 @@ args = {cwd: pdraft, src: draft, debug: true, dst: "guts.html",
693
766
  copy(pdraft/"guts.html", vposts/nslug) # Step 3...
694
767
  # Step 4...
695
768
  preprocess cwd: pmeta, src: "../../themes/standard/post/generate.lt3",
696
- force: true, vars: hash, debug: true,
769
+ force: true, vars: hash,
697
770
  dst: remote/ahtml, call: ".nopara"
698
771
  FileUtils.rm_f(remote/"published")
699
772
  timelog("Generated", remote/"history")
@@ -1,10 +1,14 @@
1
1
  if !defined?(RuneBlog::Path)
2
2
 
3
+ require 'pathname'
4
+
3
5
  class RuneBlog
4
- VERSION = "0.3.34"
6
+ VERSION = "0.3.35"
5
7
 
6
8
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
7
- Path = File.dirname(path)
9
+ path ||= Pathname(__FILE__).realpath.dirname.to_s
10
+
11
+ Path = File.dirname(path) # inside gem or dev repo
8
12
  end
9
13
 
10
14
  # skeleton
data/lib/view.rb CHANGED
@@ -12,10 +12,11 @@ class RuneBlog::View
12
12
  @blog = RuneBlog.blog
13
13
  @name = name
14
14
  @publisher = RuneBlog::Publishing.new(name)
15
- # puts "view #{name}: pub = #{@publisher.inspect}"
16
15
  @can_publish = true # FIXME
17
16
  # @blog.view = self # NOOOO??
18
17
  get_globals
18
+ rescue => err
19
+ fatal(err)
19
20
  end
20
21
 
21
22
  def dump_globals_stderr
@@ -30,21 +31,26 @@ class RuneBlog::View
30
31
  end
31
32
  STDERR.puts
32
33
  log!(str: "")
34
+ rescue => err
35
+ fatal(err)
33
36
  end
34
37
 
35
38
  def get_globals(force = false)
36
39
  return if @globals && !force
37
40
 
38
- # gfile = @blog.root/"views/#@name/themes/standard/global.lt3"
39
- gfile = @blog.root/"views/#@name/data/global.lt3"
41
+ gfile = @blog.root/"views/#@name/global.lt3"
40
42
  return unless File.exist?(gfile) # Hackish!! how is View.new called from create_view??
41
43
 
42
44
  live = Livetext.customize(call: ".nopara")
45
+ checkpoint "Error here? gfile = #{gfile}"
43
46
  live.xform_file(gfile)
47
+ checkpoint "After xform"
44
48
  live.setvar("ViewDir", @blog.root/:views/@name)
45
49
  live.setvar("View", @name)
46
50
  @globals = live.vars
47
51
  # dump_globals_stderr
52
+ rescue => err
53
+ fatal(err)
48
54
  end
49
55
 
50
56
  def dir
data/runeblog.gemspec CHANGED
@@ -7,6 +7,8 @@ require "runeblog_version"
7
7
 
8
8
  Gem.post_install do |spec|
9
9
  Dir.chdir(RuneBlog::Path)
10
+ # FIXME - depends on livetext being installed
11
+ # How to deal with this??
10
12
  system("livetext -i liveblog.rb")
11
13
  system("livetext -i code_rouge.rb")
12
14
  end
@@ -21,8 +23,8 @@ spec = Gem::Specification.new do |s|
21
23
  s.authors = ["Hal Fulton"]
22
24
  s.email = 'rubyhacker@gmail.com'
23
25
  s.executables << "blog"
24
- s.add_runtime_dependency 'livetext', '~> 0.9', '>= 0.9.43'
25
- s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.23'
26
+ s.add_runtime_dependency 'livetext', '~> 0.9', '>= 0.9.44'
27
+ s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.27'
26
28
  s.add_runtime_dependency 'rouge', '~> 3.25', '>= 3.25.0'
27
29
 
28
30
  s.add_development_dependency 'minitest', '~> 5.10', '>= 5.10.0'
@@ -0,0 +1 @@
1
+ /usr/local/bin/vim