runeblog 0.3.23 → 0.3.24

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: e8c5908c63aea98d2cc29ab782e11b83361d3d866bda7d0c902afb1cfdc70226
4
- data.tar.gz: 7740ee4f471a6addeaea6a48394e02aa53ae30be129b9761d1b1b9eb316de7a3
3
+ metadata.gz: fcf07214d034b5091d1b1b0910aee40fe46b8c735c33451fd364eaf57621084f
4
+ data.tar.gz: 7b6bab92b5a4a1835de24650c721f62aac77d0a36405877871b5db98198ba976
5
5
  SHA512:
6
- metadata.gz: 9421dacd34f38911af55054966a341563a70f791bc5fc080f949ad9f1724ae32b15b8163b30985546e3666a127ab87b3a33b731a31a21bf546c832011d006245
7
- data.tar.gz: c1571f0a8f8109bc9ce3603142bb8f4b02117606aada8f8931eb9ec6e694ffe094ca2218ce618f37011ceea2da5291edfa8e83f9d7fa64e743bb8dd0483a31f1
6
+ metadata.gz: 14d8f4233ae7a9e8aaa91f9f9c9bb725d821f852ccfcaee2a493074743ed8ac3d830e334dda9b1367bea2951e04b5ddb78987a9f11130adaadb0af26a0ea39d1
7
+ data.tar.gz: 3c2904ff1064fb28dd1885f2e58f640287a9c8e3527d379eb573e2a950753bdbe01d0b206e5060d7bbbd0d28880c92c43435721b0693c27658cc08862abc02ad
data/bin/blog CHANGED
@@ -107,7 +107,11 @@ def mainloop
107
107
  puts "Don't understand '#{cmd.inspect}'\n "
108
108
  end
109
109
  rescue => err
110
- puts err.to_s
110
+ log!(str: err.to_s)
111
+ log!(str: err.backtrace.join("\n")) if err.respond_to?(:backtrace)
112
+ puts "Current dir = #{Dir.pwd}"
113
+ puts err
114
+ puts err.backtrace.join("\n")
111
115
  puts "Pausing..."; gets
112
116
  end
113
117
 
@@ -197,7 +201,7 @@ def create_new_repo?
197
201
  get_started if new_repo
198
202
  rescue => err
199
203
  STDERR.puts "Error - #{err.to_s}"
200
- STDERR.puts err.backtrace
204
+ STDERR.puts err.backtrace if err.respond_to?(:backtrace)
201
205
  end
202
206
 
203
207
  def print_intro
@@ -3,8 +3,6 @@
3
3
  . Most of the global CSS goes here
4
4
  . --------------------------------------------------
5
5
 
6
- .say Inside $File in $FileDir: view/dir = $View $ViewDir
7
-
8
6
  .include $ViewDir/data/global.lt3
9
7
 
10
8
  body { font-family: $font.family }
@@ -3,6 +3,7 @@
3
3
  STDERR.puts err
4
4
  STDERR.puts err.backtrace.join("\n") if err.respond_to?(:backtrace)
5
5
  log!(str: "#{err} - see also stderr.out")
6
+ log!(str: err.backtrace.join("\n")) if err.respond_to?(:backtrace)
6
7
  return
7
8
 
8
9
  out = "/tmp/blog#{rand(100)}.txt"
@@ -114,7 +115,7 @@
114
115
  puts err.backtrace.join("\n")
115
116
  end
116
117
 
117
- def find_item(list)
118
+ def find_item(list, &block)
118
119
  log!(enter: __method__, args: [list], level: 2)
119
120
  list2 = list.select(&block)
120
121
  exactly_one(list2, list.join("/"))
@@ -129,7 +130,7 @@
129
130
  [n, item]
130
131
  end
131
132
 
132
- def exactly_one(list, tag = nil)
133
+ def exactly_one(list, tag = nil, &block)
133
134
  log!(enter: __method__, args: [list], level: 2)
134
135
  list2 = list.select(&block)
135
136
  raise "List: Zero instances #{"- #{tag}" if tag}" if list.empty?
@@ -32,9 +32,8 @@ def preprocess(cwd: Dir.pwd, src:,
32
32
  dst += ".html" unless dst.end_with?(".html")
33
33
  end
34
34
  sp = " "*12
35
- # STDERR.puts "=== ls -l #{cwd} = "
36
- # STDERR.puts `ls -l #{cwd}`
37
- # STDERR.puts "=== going into #{cwd}"
35
+
36
+
38
37
 
39
38
  Dir.chdir(cwd) do
40
39
  if debug
@@ -45,23 +44,25 @@ def preprocess(cwd: Dir.pwd, src:,
45
44
  STDERR.puts "#{sp} from: #{caller[0]}"
46
45
  STDERR.puts "#{sp} copy: #{copy}" if copy
47
46
  STDERR.puts "#{sp} vars: #{vars.inspect}" unless vars == {}
47
+ STDERR.flush
48
48
  end
49
49
  stale = stale?(src, dst, deps, force)
50
+ STDERR.puts <<~EOF if debug
51
+ STALE = #{stale}
52
+ cwd = #{cwd.inspect}
53
+ src = #{src.inspect}
54
+ dst = #{dst.inspect}
55
+ strip = #{strip.inspect}
56
+ deps = #{deps.inspect}
57
+ copy = #{copy.inspect}
58
+ debug = #{debug.inspect}
59
+ force = #{force.inspect}
60
+ mix = #{mix.inspect}
61
+ call = #{call.inspect}
62
+ vars = #{vars.inspect}
63
+ EOF
50
64
  if stale
51
65
  live = Livetext.customize(mix: "liveblog", call: call, vars: vars)
52
- STDERR.puts <<~EOF
53
- cwd = #{cwd.inspect}
54
- src = #{src.inspect}
55
- dst = #{dst.inspect}
56
- strip = #{strip.inspect}
57
- deps = #{deps.inspect}
58
- copy = #{copy.inspect}
59
- debug = #{debug.inspect}
60
- force = #{force.inspect}
61
- mix = #{mix.inspect}
62
- call = #{call.inspect}
63
- vars = #{vars.inspect}
64
- EOF
65
66
  log!(str: "Calling xform_file... src = #{src} pwd = #{Dir.pwd}")
66
67
  out = live.xform_file(src)
67
68
  File.write(dst, out)
@@ -69,6 +70,12 @@ def preprocess(cwd: Dir.pwd, src:,
69
70
  end
70
71
  puts "#{sp} -- ^ Already up to date!" if debug && ! stale
71
72
  end
73
+ rescue => err
74
+ msg = err.to_s
75
+ msg << err.backtrace.join("\n") if err.respond_to?(:backtrace)
76
+ STDERR.puts msg
77
+ STDERR.flush
78
+ log!(str: msg)
72
79
  end
73
80
 
74
81
  def get_live_vars(src)
@@ -176,7 +176,10 @@ module RuneBlog::REPL
176
176
  result = system!("open #{local}")
177
177
  raise CantOpen(local) unless result
178
178
  rescue => err
179
- _tmp_error(err)
179
+ msg = err.to_s
180
+ msg << "\n" << err.backtrace.join("\n") if err.respond_to?(:backtrace)
181
+ puts msg
182
+ log!(str: msg)
180
183
  end
181
184
 
182
185
  def cmd_publish
@@ -415,6 +418,7 @@ log! str: "cv Setting to #{name.inspect}"
415
418
  base = draft.sub(/.lt3$/, "")
416
419
  dir = @blog.root/:posts/base
417
420
  meta = nil
421
+ puts "Trying chdir into #{dir}..."
418
422
  Dir.chdir(dir) { meta = @blog.read_metadata }
419
423
  num, title = meta.num, meta.title
420
424
  num = '%4d' % num.to_s
@@ -150,7 +150,7 @@ class RuneBlog
150
150
  rescue => err
151
151
  puts "Error - see stdout.txt"
152
152
  STDERR.puts err.inspect
153
- STDERR.puts err.backtrace
153
+ STDERR.puts err&.backtrace
154
154
  sleep 3
155
155
  end
156
156
 
@@ -690,39 +690,31 @@ log! str: "=== cwh cp 6"
690
690
  @theme = @root/:views/view_name/:themes/:standard
691
691
  pmeta = @root/:views/view_name/:posts/nslug
692
692
 
693
- log! str: "=== hpost cp 1"
694
693
 
695
694
  create_dirs(pdraft) # Step 1...
696
- log! str: "=== hpost cp 2"
695
+ @view.globals ||= {}
696
+ args = {cwd: pdraft, src: draft, debug: true, dst: "guts.html",
697
+ mix: "liveblog", vars: @view.globals}
697
698
  preprocess cwd: pdraft, src: draft, # FIXME dependencies?
698
- dst: "guts.html", mix: "liveblog", vars: (@view.globals || {})
699
- log! str: "=== hpost cp 3"
699
+ debug: true,
700
+ dst: "guts.html", mix: "liveblog", vars: @view.globals
700
701
  hash = _post_metadata(draft, pdraft)
701
- log! str: "=== hpost cp 4"
702
702
  hash[:CurrentPost] = pmeta
703
703
  vposts = @root/:views/view_name/:posts # Step 2...
704
- # 5.times { STDERR.puts }
705
- # STDERR.puts "-- hpost:"
706
- # hash.each_pair {|k,v| STDERR.puts " #{k}: #{v}" if k.is_a? Symbol }
707
- # 5.times { STDERR.puts }
708
704
  copy!(pdraft, vposts) # ??
709
705
  copy(pdraft/"guts.html", vposts/nslug) # Step 3...
710
706
  # Step 4...
711
- # preprocess cwd: @theme/:post, src: "generate.lt3",
712
- log! str: "=== hpost cp 5"
713
- # @view.dump_globals_stderr
714
707
  preprocess cwd: pmeta, src: "../../themes/standard/post/generate.lt3",
715
708
  force: true, vars: hash, debug: true,
716
709
  dst: remote/ahtml, call: ".nopara"
717
- log! str: "=== hpost cp 6"
718
710
  FileUtils.rm_f(remote/"published")
719
- log! str: "=== hpost cp 7"
720
711
  timelog("Generated", remote/"history")
721
712
  copy_widget_html(view_name)
722
- log! str: "=== hpost cp 8"
723
713
  rescue => err
724
- log! str: "=== hpost cp 9"
725
- _tmp_error(err)
714
+ puts "Error - see stdout.txt"
715
+ STDERR.puts err.inspect
716
+ STDERR.puts err&.backtrace
717
+ # _tmp_error(err)
726
718
  # puts err.backtrace.join("\n")
727
719
  end
728
720
 
@@ -734,11 +726,10 @@ log! str: "=== hpost cp 9"
734
726
 
735
727
  def generate_post(draft, force = false)
736
728
  log!(enter: __method__, args: [draft], level: 1)
737
- log! str: "=== gpost cp 1"
738
729
  views = _get_views(draft)
739
- log! str: "=== gpost cp 2"
740
- views.each {|view| _handle_post(draft, view) }
741
- log! str: "=== gpost cp 3"
730
+ views.each do |view|
731
+ _handle_post(draft, view)
732
+ end
742
733
  # For current view:
743
734
  slug = File.basename(draft).sub(/.lt3$/, "")
744
735
  postdir = self.view.dir/"remote/post/"/slug
@@ -1,7 +1,7 @@
1
1
  if !defined?(RuneBlog::Path)
2
2
 
3
3
  class RuneBlog
4
- VERSION = "0.3.23"
4
+ VERSION = "0.3.24"
5
5
 
6
6
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
7
7
  Path = File.dirname(path)
@@ -8,6 +8,7 @@ require "runeblog_version"
8
8
  Gem.post_install do |spec|
9
9
  Dir.chdir(RuneBlog::Path)
10
10
  system("livetext -i liveblog.rb")
11
+ system("livetext -i code_rouge.rb")
11
12
  end
12
13
 
13
14
  spec = Gem::Specification.new do |s|
@@ -20,8 +21,9 @@ spec = Gem::Specification.new do |s|
20
21
  s.authors = ["Hal Fulton"]
21
22
  s.email = 'rubyhacker@gmail.com'
22
23
  s.executables << "blog"
23
- s.add_runtime_dependency 'livetext', '~> 0.9', '>= 0.9.09'
24
- s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.23'
24
+ s.add_runtime_dependency 'livetext', '~> 0.9', '>= 0.9.09'
25
+ s.add_runtime_dependency 'rubytext', '~> 0.1', '>= 0.1.23'
26
+ s.add_runtime_dependency 'rouge', '~> 3.25', '>= 3.25.0'
25
27
 
26
28
  s.add_development_dependency 'minitest', '~> 5.10', '>= 5.10.0'
27
29
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: runeblog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.23
4
+ version: 0.3.24
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
@@ -50,6 +50,26 @@ dependencies:
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
52
  version: 0.1.23
53
+ - !ruby/object:Gem::Dependency
54
+ name: rouge
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - ">="
58
+ - !ruby/object:Gem::Version
59
+ version: 3.25.0
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '3.25'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: 3.25.0
70
+ - - "~>"
71
+ - !ruby/object:Gem::Version
72
+ version: '3.25'
53
73
  - !ruby/object:Gem::Dependency
54
74
  name: minitest
55
75
  requirement: !ruby/object:Gem::Requirement