runeblog 0.0.63 → 0.0.64

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/data/VERSION +1 -1
  3. data/lib/runeblog.rb +37 -7
  4. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: be9dde18efd8f52b1115c2c07337c594207c64c3
4
- data.tar.gz: 1c36e3cdf18c43de3dbb0867f60b9abdc0de8a09
3
+ metadata.gz: 257ad84648e005ad01f71886994183bd9f98ecb5
4
+ data.tar.gz: 06bfe5ebcdfdabc497bd47c9d6191c4a460f7e1f
5
5
  SHA512:
6
- metadata.gz: 97b396fc32bb61ce2d7e174cf9a65194d8222ecae94bb98a4fd7d15ca3a3c43ece1babe7e71d2f0cfc4451a33d3ad4b885bfe76ebbb2c79cee3d69773b718674
7
- data.tar.gz: 2b34bbd321ca613ae0cf1100ceed94998a284c553fd1128c73ea0a96451840f709a91d48fdcf22875680b1ab27dc4b95b2f73a9f3e2cd718917c8406e425a822
6
+ metadata.gz: 7aa6da6a32b8fe50b20c7b9ef64a28f5ff325c16a7eed7582ff08d9b116a0dd265961c00a1bd2745c8001bc07645a63ee02d01337b5766e36c6293d85933ec8e
7
+ data.tar.gz: 663840e9aa0f0b4a53a885ad8b460f9a7a18ba2dfae752ae03d90acd5dc58061fb79add1ae3787f31130baa09a2d1b66d85c2aa7ec29752d69230dabc8de5c90
data/data/VERSION CHANGED
@@ -1 +1 @@
1
- RuneBlog v 0.0.63 2018-09-20
1
+ RuneBlog v 0.0.64 2018-09-21
data/lib/runeblog.rb CHANGED
@@ -3,7 +3,7 @@ require 'yaml'
3
3
  require 'livetext'
4
4
 
5
5
  class RuneBlog
6
- VERSION = "0.0.63"
6
+ VERSION = "0.0.64"
7
7
 
8
8
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
9
9
  DefaultData = Path + "/../data"
@@ -148,12 +148,12 @@ EOS
148
148
  end
149
149
 
150
150
  def change_view(view)
151
- @view = view
151
+ @view = view # error checking?
152
152
  end
153
153
 
154
154
  def process_post(file)
155
155
  @main ||= Livetext.new
156
- @main.main.output = File.new("/tmp/WHOA","w")
156
+ @main.main.output = File.new("/tmp/WHOA","w") # FIXME srsly?
157
157
  path = @root + "/src/#{file}"
158
158
  @meta = @main.process_file(path, binding)
159
159
  raise "process_file returned nil" if @meta.nil?
@@ -167,10 +167,7 @@ EOS
167
167
  end
168
168
 
169
169
  def publish_post(meta)
170
- puts " #{colored_slug(meta.slug)}" rescue nil # puts(meta.slug) # FIXME
171
- # First gather the views
172
- views = meta.views
173
- views.each {|view| link_post_view(view) }
170
+ meta.views.each {|view| link_post_view(view) }
174
171
  # assets = find_all_assets(@meta.assets, views)
175
172
  nil
176
173
  rescue => err
@@ -254,6 +251,7 @@ EOS
254
251
  list = files_by_id(num)
255
252
  result = system("rm -rf #{list.join(' ')}")
256
253
  error_cant_delete(files) unless result
254
+ # FIXME - update index/etc
257
255
  end
258
256
 
259
257
  def post_exists?(num)
@@ -299,3 +297,35 @@ EOS
299
297
  end
300
298
 
301
299
  end
300
+
301
+ #######
302
+
303
+ class RuneBlog::Post
304
+
305
+ attr_reader :id, :title, :date, :views, :num, :slug
306
+
307
+ def self.files(num, root)
308
+ files = Find.find(root).to_a
309
+ result = files.grep(/#{tag(num)}-/)
310
+ result
311
+ end
312
+
313
+ def initialize(title, view)
314
+ @title = title
315
+ @view = view
316
+ @num, @slug = make_slug
317
+ end
318
+
319
+ private
320
+
321
+ def make_slug(postnum = nil)
322
+ postnum ||= RuneBlog.next_sequence
323
+ num = tag(postnum) # FIXME can do better
324
+ slug = @title.downcase.strip.gsub(' ', '-').gsub(/[^\w-]/, '')
325
+ [postnum, "#{num}-#{slug}"]
326
+ end
327
+
328
+ def tag(num)
329
+ "#{'%04d' % num}"
330
+ end
331
+ end
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.0.63
4
+ version: 0.0.64
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hal Fulton
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-09-20 00:00:00.000000000 Z
11
+ date: 2018-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext