runeblog 0.2.73 → 0.2.74

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: 0afccf0c622078eba670e387c4fec271552c9b2d289c25b1f325a266d94da6c7
4
- data.tar.gz: 3cea7d0e10b8e393d2845b10c4d466f54bbfc92f1ea326eec4ee42ad8fba3927
3
+ metadata.gz: a66a7e9938f682fe72d0a6f693cad408fffbeb93f34da1f91732548d879211cf
4
+ data.tar.gz: c2beeb6b86e7d08926bca781d6adca2560f7413501319295abf23a194ee6e039
5
5
  SHA512:
6
- metadata.gz: e69baf6404c61da8028502b554008a663ec405c359707d9a33f103dd47f17b0e9a00482f09a32cb2e52c5457fe9904177db067b2592b7021ef1ddf0a5c15b698
7
- data.tar.gz: d6942079ebdcb48d948b938bf06377caa55eabe7ea3b4de6566ed0586b83920e6c51fee272d7e35e38cb7f00e812a20cc3b0a2c66252ca03e66bcf6cc5df9337
6
+ metadata.gz: dd1d9d4a194f2f28683e20fbf027b87f3f27e4ced5c16e21c1e7e292dceacc75f87f718b6abe018e46e37c3645c32c107e3e24a4e1c5fb14aa5c38925198dbb1
7
+ data.tar.gz: 2d4ce56d3dd5d97b168692d984706ac941fa6f5a3daf3f227dfd42023ae1c7a5c734692eed321e8752eb4eca601809c5e5d350ff58851be6cb12feca84ec933a
@@ -39,6 +39,7 @@ def system!(str, show: false)
39
39
  else
40
40
  STDERR.puts "FAILED: #{str.inspect}"
41
41
  STDERR.puts "\ncaller = \n#{caller.join("\n ")}\n"
42
+ exit
42
43
  return rc
43
44
  end
44
45
  rc
@@ -21,13 +21,13 @@ module RuneBlog::Helpers
21
21
 
22
22
  def get_repo_config
23
23
  log!(enter: __method__, level: 3)
24
- @editor = File.read(".blogs/data/EDITOR").chomp
25
- @current_view = File.read(".blogs/data/VIEW").chomp
26
- @root = File.read(".blogs/data/ROOT").chomp
24
+ @editor = File.read("#@root/data/EDITOR").chomp
25
+ @current_view = File.read("#@root/data/VIEW").chomp
26
+ @root = File.read("#@root/data/ROOT").chomp
27
27
  rescue => err
28
- puts "Can't read config: #{err}"
29
- puts err.backtrace.join("\n")
30
- puts "dir = #{Dir.pwd}"
28
+ STDERR.puts "Can't read config: #{err}"
29
+ STDERR.puts err.backtrace.join("\n")
30
+ STDERR.puts "dir = #{Dir.pwd}"
31
31
  end
32
32
 
33
33
  def copy_data(tag, dest)
@@ -80,12 +80,11 @@ module RuneBlog::Helpers
80
80
 
81
81
  def get_views # read from filesystem
82
82
  log!(enter: __method__, level: 3)
83
- dirs = subdirs("#@root + "/" + views/").sort
83
+ dirs = subdirs("#@root/views/").sort
84
84
  dirs.map {|name| RuneBlog::View.new(name) }
85
85
  end
86
86
 
87
- def write_repo_config(root: "#{Dir.pwd}/.blogs", view: "#{root}/data/VIEW", editor: "#{root}/data/EDITOR")
88
- p root
87
+ def write_repo_config(root: "#{Dir.pwd}/.blogs", view: "[no view]", editor: "/usr/local/bin/vim")
89
88
  File.write(root + "/data/ROOT", root + "\n")
90
89
  File.write(root + "/data/VIEW", view.to_s + "\n")
91
90
  File.write(root + "/data/EDITOR", editor + "\n")
@@ -9,11 +9,9 @@ require 'xlate'
9
9
 
10
10
 
11
11
  def init_liveblog # FIXME - a lot of this logic sucks
12
- here = Dir.pwd
13
- dir = here
14
- # loop { dir = Dir.pwd; break if File.exist?("config"); Dir.chdir("..") }
15
- Dir.chdir(here) # here??? or dir??
16
- @blog = RuneBlog.new(dir)
12
+ dir = Dir.pwd.sub(/\.blogs.*/, "")
13
+ @blog = nil
14
+ Dir.chdir(dir) { @blog = RuneBlog.new }
17
15
  @root = @blog.root
18
16
  @view = @blog.view
19
17
  @view_name = @blog.view.name unless @view.nil?
@@ -118,7 +116,6 @@ def banner
118
116
  str2 << " <td colspan=#{span}><img src=#{image} #{width} height=#{high}></img></td>" + "\n"
119
117
  when "svg_title"
120
118
  stuff, hash = _svg_title(*data)
121
- STDERR.puts hash.inspect
122
119
  wide = hash["width"]
123
120
  str2 << " <td colspan=#{span} width=#{wide}>#{stuff}</td>" + "\n"
124
121
  when "text"
@@ -748,7 +745,7 @@ def navbar
748
745
  end
749
746
 
750
747
  def _make_navbar(orient = :horiz)
751
- vdir = @blog.view.dir
748
+ vdir = @root/:views/@blog.view
752
749
  title = _var(:blog)
753
750
 
754
751
  extra = ""
@@ -53,55 +53,48 @@ class RuneBlog
53
53
  puts "Error: See #{out}"
54
54
  end
55
55
 
56
- def self.create_new_blog_repo(root = ".blogs")
57
- log!(enter: __method__, args: [root])
58
- raise ArgumentError unless root.is_a?(String) && ! root.empty?
59
- root_dir = Dir.pwd/root
56
+ def self.create_new_blog_repo(root_rel = ".blogs")
57
+ log!(enter: __method__, args: [root_rel])
58
+ raise ArgumentError unless root_rel.is_a?(String) && ! root_rel.empty?
60
59
  self.blog = self # Weird. Like a singleton - dumbass circular dependency?
61
- root = Dir.pwd/root
62
- raise BlogRepoAlreadyExists if Dir.exist?(root)
63
- create_dirs(root)
64
- Dir.chdir(root) do
65
- create_dirs(:drafts, :views, :posts)
60
+ repo_root = Dir.pwd/root_rel
61
+ raise BlogRepoAlreadyExists if Dir.exist?(repo_root)
62
+ create_dirs(repo_root)
63
+ Dir.chdir(repo_root) do
64
+ create_dirs(:data, :drafts, :views, :posts)
66
65
  new_sequence
67
66
  end
68
- x = OpenStruct.new
69
- x.root, x.current_view, x.editor = root, "test_view", "/usr/bin/vim " # dumb - FIXME later
70
- write_config(x, root/ConfigFile)
71
- write_repo_config
72
- @blog = self.new(root)
67
+ copy_data(:config, repo_root/:data)
68
+ write_repo_config(root: repo_root)
69
+ @blog = self.new
73
70
  @blog
74
71
  rescue => err
75
- puts "Can't create blog repo: '#{root}' - #{err}"
72
+ puts "Can't create blog repo: '#{repo_root}' - #{err}"
76
73
  puts err.backtrace.join("\n")
77
74
  end
78
75
 
79
- def self.open(root = ".blogs")
80
- log!(enter: __method__, args: [root])
81
- # Crude - FIXME later - # What views are there? Publishing, etc.
76
+ def self.open(root_rel = ".blogs")
77
+ log!(enter: __method__, args: [root_rel])
82
78
  self.blog = self # Weird. Like a singleton - dumbass circular dependency?
83
- root = Dir.pwd/root
84
- blog = self.new(root)
79
+ blog = self.new(root_rel)
85
80
  rescue => err
86
81
  _tmp_error(err)
87
82
  end
88
83
 
89
- def initialize(root_dir = ".blogs") # always assumes existing blog
90
- log!(enter: "initialize", args: [root_dir])
91
- # Crude - FIXME later - # What views are there? Publishing, etc.
84
+ def initialize(root_rel = ".blogs") # always assumes existing blog
85
+ log!(enter: "initialize", args: [root_rel])
92
86
  self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
93
87
 
94
- @root = root_dir
95
- file = @root/ConfigFile
96
- errmsg = "No config file! file = #{file.inspect} dir = #{Dir.pwd}"
97
- raise errmsg unless File.exist?(file)
98
-
88
+ @root = Dir.pwd/root_rel
89
+ copy_data(:config, @root/:data)
90
+ write_repo_config(root: @root)
99
91
  get_repo_config
100
- @root, @view_name, @editor = read_config(file, :root, :current_view, :editor)
101
- md = Dir.pwd.match(%r[.*/views/(.*?)/])
102
- @view_name = md[1] if md
103
92
  @views = get_views
104
- @view = str2view(@view_name)
93
+ md = Dir.pwd.match(%r[.*/views/(.*?)/])
94
+ if md
95
+ @view_name = md[1]
96
+ @view = str2view(@view_name)
97
+ end
105
98
  @sequence = get_sequence
106
99
  @post_views = []
107
100
  @post_tags = []
@@ -228,15 +221,15 @@ class RuneBlog
228
221
 
229
222
  def viewdir(v = nil) # delete?
230
223
  log!(enter: __method__, args: [v], level: 3)
224
+ v ||= @view
231
225
  v = str2view(v) if v.is_a?(String)
232
226
  raise ArgumentError unless v.nil? || v.is_a?(RuneBlog::View)
233
- v ||= @view
234
227
  return @root/:views/v
235
228
  end
236
229
 
237
230
  def self.exist?
238
231
  log!(enter: __method__, level: 3)
239
- Dir.exist?(DotDir) && File.exist?(DotDir/ConfigFile)
232
+ Dir.exist?(DotDir)
240
233
  end
241
234
 
242
235
  def mark_last_published(str)
@@ -247,7 +240,8 @@ class RuneBlog
247
240
  def add_view(view_name)
248
241
  log!(enter: __method__, args: [view_name], level: 2)
249
242
  view = RuneBlog::View.new(view_name)
250
- @view = view # current view
243
+ self.view = view # current view
244
+ File.write(@root/"data/VIEW", view_name)
251
245
  @views << view # all views
252
246
  view
253
247
  end
@@ -276,7 +270,6 @@ class RuneBlog
276
270
 
277
271
  def create_view(view_name)
278
272
  log!(enter: __method__, args: [view_name], level: 2)
279
- check_valid_new_view(view_name)
280
273
  make_empty_view_tree(view_name)
281
274
  add_view(view_name)
282
275
  mark_last_published("Initial creation")
@@ -325,11 +318,8 @@ class RuneBlog
325
318
  text = nil
326
319
  @theme = @view.dir/"themes/standard"
327
320
  post_entry_name = @theme/"blog/post_entry.lt3"
328
- # STDERR.puts "-- @pename = #{post_entry_name}"
329
- # STDERR.puts "-- @pe = #{@_post_entry.inspect}"
330
321
  depend = [post_entry_name]
331
322
  xlate src: post_entry_name, dst: "/tmp/post_entry.html" # , deps: depend # , debug: true
332
- # STDERR.puts "-- xlate result: #{`ls -l /tmp/post_entry.html`}"
333
323
  @_post_entry ||= File.read("/tmp/post_entry.html")
334
324
  vp = post_lookup(id)
335
325
  nslug, aslug, title, date, teaser_text =
@@ -422,10 +412,8 @@ class RuneBlog
422
412
  def change_view(view)
423
413
  log!(enter: __method__, args: [view], level: 3)
424
414
  raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
425
- x = OpenStruct.new
426
- x.root, x.current_view, x.editor = @root, view.to_s, @editor # dumb - FIXME later
427
- copy_data(:config, @root/:data)
428
- write_config(x, @root/ConfigFile)
415
+ File.write(@root/"data/VIEW", view)
416
+ # write_repo_config
429
417
  self.view = view # error checking?
430
418
  end
431
419
 
@@ -448,13 +436,15 @@ class RuneBlog
448
436
  # @theme/"navbar/navbar.lt3",
449
437
  @theme/"blog/index.lt3"] # FIXME what about assets?
450
438
  xlate cwd: vdir/"themes/standard/etc", deps: depend,
451
- src: "blog.css.lt3", copy: vdir/"remote/etc/blog.css" # , debug: true
439
+ src: "blog.css.lt3", copy: vdir/"remote/etc/" # , debug: true
452
440
  xlate cwd: vdir/"themes/standard", deps: depend, force: true,
453
441
  src: "blog/generate.lt3", dst: vdir/:remote/"index.html"
454
442
  copy("#{vdir}/assets/*", "#{vdir}/remote/assets/")
455
443
  copy_widget_html(view)
456
444
  rescue => err
457
- _tmp_error(err)
445
+ STDERR.puts err
446
+ STDERR.puts err.backtrace.join("\n")
447
+ # _tmp_error(err)
458
448
  end
459
449
 
460
450
  def _get_views(draft)
@@ -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.73"
5
+ VERSION = "0.2.74"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  Path = File.dirname(path)
@@ -14,6 +14,7 @@ class RuneBlog::View
14
14
  @name = name
15
15
  @publisher = RuneBlog::Publishing.new(name)
16
16
  @can_publish = true # FIXME
17
+ @blog.view = self
17
18
  end
18
19
 
19
20
  def dir
@@ -45,7 +45,7 @@ def xlate(cwd: Dir.pwd, src:,
45
45
  dst: (strip = true; File.basename(src).sub(/.lt3$/,"")),
46
46
  deps: [], copy: nil, debug: false, force: false)
47
47
  src += LEXT unless src.end_with?(LEXT)
48
- dst += ".html" unless (dst.end_with?(".html")) # || strip)
48
+ dst += ".html" unless (dst.end_with?(".html") || strip)
49
49
  indent = " "*12
50
50
  Dir.chdir(cwd) do
51
51
  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.73
4
+ version: 0.2.74
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-12-04 00:00:00.000000000 Z
11
+ date: 2019-12-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext