runeblog 0.2.91 → 0.2.92

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: 27cc38e2e368d435cd84531411f2e929a0bb629d4fcc3d05714db84c5a55a777
4
- data.tar.gz: e7508aa230cac2adfddb9e7f9bd9175da281b801924ae567fee8315deb10de3a
3
+ metadata.gz: 5a01afc10ad3439db402e06d8c0d5674d247485fe82c63c29160ca70d8e43a6d
4
+ data.tar.gz: 50df27f119a4df78b1c366dc119e4b84c8fb45a9707a02d43e1e20e8caa32e01
5
5
  SHA512:
6
- metadata.gz: 27b4e7dcdc6d9a1b3bd82d6c1733267f21656d2efa8ad7f13667152bf09b9eab52ad4adc5aba330d4e0e3a2a8c7a79093d12a39b9dcdd0f6595ca0e0a419e364
7
- data.tar.gz: 1034eb0b04e9c33a855be6fcdee7ee86408b9a65d4570db8416d4c4ae248137561261168c7cf941dfe86000be65da9375804b3b01f28d11889ce1fdfe76efaf8
6
+ metadata.gz: 8f3ffe63bab275d26f14c516f24b48c127fc8bd4a661c32b17528a9d0bd399a85294fbb33af24436984a0dfe749d7a7651acc37b096819a71dbb763375d2ef3f
7
+ data.tar.gz: 6ee5c12a07c7f493b71352ca0aa0bd633810222efda55e19925ed8dc71b4ee42a27b58a352bfce2d1bd815768513c9e9c6216178278995f26cf2188aae8bca93
data/bin/blog CHANGED
@@ -146,7 +146,10 @@ end
146
146
 
147
147
  major, minor = RUBY_VERSION.split(".").values_at(0,1)
148
148
  ver = major.to_i*10 + minor.to_i
149
- abort "Need Ruby 2.4 or greater" unless ver >= 24
149
+ unless ver >= 24
150
+ RubyText.stop
151
+ abort "Need Ruby 2.4 or greater"
152
+ end
150
153
 
151
154
  include RuneBlog::Helpers # for try_read_config
152
155
 
@@ -29,7 +29,7 @@ post.date.size 15px
29
29
  publish.user root
30
30
  publish.server rubyhacker.com
31
31
  publish.docroot /var/www/
32
- publish.path around_austin
32
+ publish.path stuff
33
33
  publish.proto http
34
34
  .end
35
35
 
@@ -6,19 +6,19 @@
6
6
  . likely be the place.
7
7
  . --------------------------------------------------
8
8
 
9
- .mixin liveblog
10
- . ^ get rid of this later
11
-
12
9
  .post 0
13
10
 
14
- .title The new amphitheatre is overrated
11
+ .title This is my title
15
12
  .pubdate 2019-07-09
16
- .views around_austin
13
+ .views stuff
17
14
  .tags
18
15
 
19
16
  .teaser
20
- It used to be that all major concerts played the Erwin Center.
21
-
17
+ This is only a short excerpt from the top of the blog post.
22
18
  .end
23
- Now, depending on what you consider "major," blah blah blah...
19
+
20
+ And now we continue the post.
21
+ Do we have anything to say?
22
+
23
+ Apparently not much.
24
24
 
@@ -9,7 +9,7 @@ class ::RuneBlog::Widget
9
9
  def initialize(repo)
10
10
  @blog = repo
11
11
  @datafile = input = "list.data"
12
- @lines = File.readlines(input)
12
+ @lines = _get_data(@datafile)
13
13
  end
14
14
 
15
15
  def build
@@ -7,7 +7,7 @@ class ::RuneBlog::Widget
7
7
  def initialize(repo)
8
8
  @blog = repo
9
9
  @datafile = "list.data"
10
- lines = File.readlines(@datafile)
10
+ lines = _get_data(@datafile)
11
11
  @data = lines.map {|line| line.chomp.split(/, */) }
12
12
  end
13
13
 
@@ -9,7 +9,7 @@ class ::RuneBlog::Widget
9
9
  def initialize(repo)
10
10
  @blog = repo
11
11
  @datafile = "list.data"
12
- @lines = File.readlines(@datafile)
12
+ @lines = _get_data(@datafile)
13
13
  @data = @lines.map {|x| x.chomp.split(/, */, 2) }
14
14
  end
15
15
 
@@ -7,7 +7,7 @@ class ::RuneBlog::Widget
7
7
  def initialize(repo)
8
8
  @blog = repo
9
9
  @datafile = "list.data"
10
- @lines = File.exist?(@datafile) ? File.readlines(@datafile) : []
10
+ @lines = _get_data?(@datafile)
11
11
  end
12
12
 
13
13
  def _html_body(file, css = nil) # FIXME
@@ -5,6 +5,23 @@ require 'processing'
5
5
 
6
6
  module RuneBlog::Helpers
7
7
 
8
+ def _get_data?(file) # File need not exist
9
+ if File.exist?(file)
10
+ _get_data(file)
11
+ else
12
+ []
13
+ end
14
+ end
15
+
16
+ def _get_data(file)
17
+ lines = File.readlines(file)
18
+ lines.reject! {|line| line[0] == "-" } # allow rejection of lines
19
+ lines = lines.map do |line|
20
+ line.sub(/ *# .*$/, "") # allow trailing comments
21
+ end
22
+ lines
23
+ end
24
+
8
25
  def copy(src, dst)
9
26
  log!(enter: __method__, args: [src, dst], level: 2)
10
27
  cmd = "cp #{src} #{dst} 2>/dev/null"
@@ -100,13 +117,13 @@ module RuneBlog::Helpers
100
117
  end
101
118
  end
102
119
 
103
- def get_views # read from filesystem
120
+ def retrieve_views # read from filesystem
104
121
  log!(enter: __method__, level: 3)
105
122
  dirs = subdirs("#@root/views/").sort
106
123
  dirs.map {|name| RuneBlog::View.new(name) }
107
124
  end
108
125
 
109
- def write_repo_config(root: "#{Dir.pwd}/.blogs", view: "#{root}/data/VIEW", editor: "/usr/local/bin/vim")
126
+ def write_repo_config(root: "#{Dir.pwd}/.blogs", view: File.read("#{root}/data/VIEW").chomp, editor: "/usr/local/bin/vim")
110
127
  File.write(root + "/data/ROOT", root + "\n")
111
128
  File.write(root + "/data/VIEW", view.to_s + "\n")
112
129
  File.write(root + "/data/EDITOR", editor + "\n")
@@ -86,9 +86,9 @@ end
86
86
 
87
87
  def _read_navbar_data
88
88
  vdir = @blog.root/:views/@blog.view
89
- dir = vdir/"themes/standard/banner/"
89
+ dir = vdir/"themes/standard/banner/navbar/"
90
90
  datafile = dir/"list.data"
91
- File.readlines(datafile)
91
+ _get_data(datafile)
92
92
  end
93
93
 
94
94
  def banner
@@ -100,6 +100,9 @@ def banner
100
100
  navbar = nil
101
101
  vdir = @blog.root/:views/@blog.view
102
102
  lines = _body.to_a
103
+ TTY.puts "-"*30
104
+ lines.each {|x| TTY.puts x }
105
+ TTY.puts "-"*30
103
106
 
104
107
  lines.each do |line|
105
108
  count += 1
@@ -343,7 +346,7 @@ def pin
343
346
  pinned.each do |pinview|
344
347
  dir = @blog.root/:views/pinview/"themes/standard/widgets/pinned/"
345
348
  datafile = dir/"list.data"
346
- pins = File.exist?(datafile) ? File.readlines(datafile) : []
349
+ pins = _get_data?(datafile)
347
350
  pins << "#{@meta.num} #{@meta.title}\n"
348
351
  pins.uniq!
349
352
  File.open(datafile, "w") {|out| pins.each {|pin| out.puts pin } }
@@ -114,7 +114,7 @@ module RuneBlog::REPL
114
114
  dir = @blog.view.dir/"themes/standard/widgets/pages"
115
115
  # Assume child files already generated (and list.data??)
116
116
  data = dir/"list.data"
117
- lines = File.readlines(data)
117
+ lines = _get_data?(data)
118
118
  hash = {}
119
119
  lines.each do |line|
120
120
  url, name = line.chomp.split(",")
@@ -229,6 +229,7 @@ module RuneBlog::REPL
229
229
  debug "Starting cmd_rebuild..."
230
230
  reset_output
231
231
  puts unless testing
232
+ TTY.puts "rebuilding #{@blog.view.inspect}"
232
233
  @blog.generate_view(@blog.view)
233
234
  @blog.generate_index(@blog.view)
234
235
  @out
@@ -90,10 +90,13 @@ class RuneBlog
90
90
  self.class.blog = self # Weird. Like a singleton - dumbass circular dependency?
91
91
 
92
92
  @root = Dir.pwd/root_rel
93
- copy_data(:config, @root/:data)
93
+ copy_data(:config, @root/:data) unless File.exist?(@root/"data/VIEW")
94
94
  write_repo_config(root: @root)
95
95
  get_repo_config
96
- @views = get_views
96
+ @views = retrieve_views
97
+ puts @views.inspect
98
+ system("cat #@root/data/VIEW")
99
+ self.view = File.read(@root/"data/VIEW").chomp
97
100
  md = Dir.pwd.match(%r[.*/views/(.*?)/])
98
101
  if md
99
102
  @view_name = md[1]
@@ -460,6 +463,7 @@ class RuneBlog
460
463
 
461
464
  def generate_view(view) # huh?
462
465
  log!(enter: __method__, args: [view])
466
+ puts "gv: view = #{view}"
463
467
  vdir = @root/:views/view
464
468
  @theme = @root/:views/view/:themes/:standard
465
469
  depend = [vdir/"remote/etc/blog.css.lt3", @theme/"global.lt3",
@@ -3,7 +3,7 @@ if !defined?(RuneBlog::Path)
3
3
  # if ! (Object.constants.include?(:RuneBlog) && RuneBlog.constants.include?(:Path))
4
4
 
5
5
  class RuneBlog
6
- VERSION = "0.2.91"
6
+ VERSION = "0.2.92"
7
7
 
8
8
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
9
9
  Path = File.dirname(path)
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.91
4
+ version: 0.2.92
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-19 00:00:00.000000000 Z
11
+ date: 2019-12-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext