runeblog 0.0.87 → 0.0.88

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
  SHA1:
3
- metadata.gz: 78b5f9479c76a98657e37683acc6c1ff61a8778c
4
- data.tar.gz: 06714e9fac6d6e52c45961e9cf5ccdba773ee5ab
3
+ metadata.gz: 2485c69bacdd96352549d7d688d98292a3b841e5
4
+ data.tar.gz: 3fbda2ec8152df0927ba9906a80bb1cdb8414de7
5
5
  SHA512:
6
- metadata.gz: e0d20ae7638af5393715a609649216f881d78c7294e794023ebc6066de22524b575a1ae7c6bd9b011be7f3a45a4e009ec46eadf71b74e1bad4f14d6838f48043
7
- data.tar.gz: 7cf97dd85e1e258194a880243452abe327535f9325bc403863482079b866b8c0c09c4c1a5e00fbd77b73847b156d8b0dcf0b64568c72430d665c8f8e419f97f7
6
+ metadata.gz: 931274a4e11996a5ad5aefc614097fb22be07cdd3fe3773413e348a353f601af01af8b106b69f5fd0ab99772a111ffc25edebb40d59e3f3bb7d62c56105abf80
7
+ data.tar.gz: 1103e5ee904ed6410264418bb1d3d92854e3d6d4a85a84b33126dbcfb7dfdda691fe9025f2156561d18ca9099cb9da564ae29319b25dbb3d9ed14c73dd01fe36
@@ -44,7 +44,7 @@ PostTemplate = <<-'TEXT' # interpolate later
44
44
  .teaser
45
45
  #{@meta.teaser}
46
46
  .end
47
- #{@meta.remainder}
47
+ #{@meta.body}
48
48
  TEXT
49
49
 
50
50
 
@@ -13,6 +13,22 @@ class RuneBlog::Post
13
13
  result
14
14
  end
15
15
 
16
+ def self.load(post)
17
+ # FIXME weird logic here
18
+ raise "RuneBlog.blog is not set!" if RuneBlog.blog.nil?
19
+ pdir = RuneBlog.blog.view.dir + "/" + post
20
+ meta = nil
21
+ Dir.chdir(pdir) do
22
+ meta = read_config("metadata.txt")
23
+ meta.date = Date.parse(meta.date)
24
+ meta.views = meta.views.split
25
+ meta.tags = meta.tags.split
26
+ meta.teaser = File.read("teaser.txt")
27
+ meta.body = File.read("body.txt")
28
+ end
29
+ meta
30
+ end
31
+
16
32
  def initialize(meta, view_name)
17
33
  # FIXME weird logic here
18
34
  raise "RuneBlog.blog is not set!" if RuneBlog.blog.nil?
@@ -53,17 +69,15 @@ class RuneBlog::Post
53
69
  end
54
70
  rescue => err
55
71
  p err
56
- err.backtrace.each {|x| puts x }
57
- # error(err)
72
+ puts err.backtrace
58
73
  end
59
74
 
60
75
  private
61
76
 
62
77
  def create_post_subtree(vdir)
63
78
  create_dir("assets")
64
- dump(@meta.to_yaml, "metadata.yaml")
65
- dump(@meta.teaser, "teaser.txt")
66
- dump(@meta.remainder, "remainder.txt")
79
+ # dump(@meta.to_yaml, "metadata.yaml")
80
+ write_metadata(@meta)
67
81
  template = RuneBlog::Default::TeaserTemplate # FIXME template into custom dir?
68
82
  text = interpolate(template)
69
83
  dump(text, "index.html") # FIXME write_index ?
@@ -79,4 +93,26 @@ class RuneBlog::Post
79
93
  def tag(num)
80
94
  "#{'%04d' % num}"
81
95
  end
96
+
97
+ def write_metadata(meta)
98
+ fname2 = "metadata.txt"
99
+ hash = meta.to_h
100
+
101
+ File.write("teaser.txt", hash[:teaser])
102
+ File.write("body.txt", hash[:body])
103
+ hash.delete(:teaser)
104
+ hash.delete(:body)
105
+
106
+ hash[:views] = hash[:views].join(" ")
107
+ hash[:tags] = hash[:tags].join(" ")
108
+
109
+ fields = [:title, :date, :pubdate, :views, :tags]
110
+
111
+ f2 = File.new(fname2, "w")
112
+ fields.each do |fld|
113
+ f2.puts "#{fld}: #{hash[fld]}"
114
+ end
115
+ f2.close
116
+ end
117
+
82
118
  end
@@ -152,10 +152,10 @@ class RuneBlog
152
152
  result
153
153
  end
154
154
 
155
- # def create_new_post(title, testing = false, teaser = nil, remainder = nil)
155
+ # def create_new_post(title, testing = false, teaser = nil, body = nil)
156
156
  def create_new_post(meta, testing = false)
157
157
  meta.teaser ||= "Teaser goes here."
158
- meta.remainder ||= "Remainder of post goes here."
158
+ meta.body ||= "Remainder of post goes here."
159
159
  post = RuneBlog::Post.new(meta, @view.to_s)
160
160
  post.edit unless testing
161
161
  post.publish
@@ -222,7 +222,9 @@ class RuneBlog
222
222
  dir = vdir + @meta.slug + "/"
223
223
  create_dir(dir + "assets")
224
224
  Dir.chdir(dir) do
225
- dump(@meta.to_yaml, "metadata.yaml")
225
+ #? dump(@meta.to_yaml, "metadata.yaml")
226
+ dump(@meta.teaser, "teaser.txt")
227
+ dump(@meta.body, "body.txt")
226
228
  # FIXME make get_post_template method
227
229
  template = File.read("#{vdir}/custom/post_template.html")
228
230
  post = interpolate(template)
@@ -250,7 +252,17 @@ class RuneBlog
250
252
  @blogtail = interpolate(tail)
251
253
 
252
254
  # Output view
253
- posts.map! {|post| YAML.load(File.read("#{vdir}/#{post}/metadata.yaml")) }
255
+ #? posts.map! {|post| YAML.load(File.read("#{vdir}/#{post}/metadata.yaml")) }
256
+ posts.map! do |post|
257
+ meta = nil
258
+ pdir = vdir + "/" + post
259
+ Dir.chdir(pdir) do
260
+ meta = read_config("metadata.txt")
261
+ meta.teaser = File.read("teaser.txt")
262
+ meta.body = File.read("body.txt")
263
+ end
264
+ meta # block return
265
+ end
254
266
  File.open("#{vdir}/index.html", "w") do |f|
255
267
  f.puts @bloghead
256
268
  posts.each {|post| f.puts index_entry(view, post) }
@@ -258,6 +270,7 @@ class RuneBlog
258
270
  end
259
271
  rescue => err
260
272
  error(err)
273
+ exit
261
274
  end
262
275
 
263
276
  def relink
@@ -266,6 +279,7 @@ class RuneBlog
266
279
 
267
280
  def index_entry(view, meta)
268
281
  raise ArgumentError unless view.is_a?(String) || view.is_a?(RuneBlog::View)
282
+ meta.slug ||= make_slug(meta.title)
269
283
  # FIXME clean up and generalize
270
284
  ref = "#{view}/#{meta.slug}/index.html"
271
285
  <<-HTML
@@ -1,6 +1,6 @@
1
1
 
2
2
  class RuneBlog
3
- VERSION = "0.0.87"
3
+ VERSION = "0.0.88"
4
4
 
5
5
  Path = File.expand_path(File.join(File.dirname(__FILE__)))
6
6
  end
@@ -190,6 +190,8 @@ class TestREPL < Minitest::Test
190
190
  system("ruby test/make_blog.rb") # This is hellish, I admit
191
191
  end
192
192
 
193
+ if File.exist?("testing.deploy")
194
+
193
195
  def test_016_can_deploy
194
196
  x = OpenStruct.new
195
197
  x.user, x.server, x.docroot, x.docroot, x.path, x.proto =
@@ -219,6 +221,8 @@ class TestREPL < Minitest::Test
219
221
  assert result.nil?, "Expected to detect login error (bad server)"
220
222
  end
221
223
 
224
+ end
225
+
222
226
  # later tests...
223
227
  # new view asks for deployment info and writes it
224
228
  # (how to mimic user input? test some other way?)
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.87
4
+ version: 0.0.88
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-10-21 00:00:00.000000000 Z
11
+ date: 2018-10-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext