runeblog 0.2.52 → 0.2.53

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: fab29a6bc9b27d8b8390c07288d63a8d27c4131a47ddcecf5291e92a7877d1fa
4
- data.tar.gz: 7a782cc946f7d541491755d6c592defaf58df51772b2815801fbc2a27af303d9
3
+ metadata.gz: 1c84711a690b4971d21429ef66c4db28266d341b114bf509d4960567bee4cf8e
4
+ data.tar.gz: c3b4d53efe40ba4dfe0e662b20d4bba52d965b11c42f9f580c2063ca92f50aa3
5
5
  SHA512:
6
- metadata.gz: 56a454e863d21a642101e99de411f22cb2471b60d7f1575d1e6905d50273f3bbdf4ec1ac3a08bae55c5c41137588e0d4f12d388532cc61a369be232d5a2f226f
7
- data.tar.gz: 8a4598adc7ac76950e588890db7fbb62d7f024934df04f0c9aed44098296a7b6de5b1fe6f4de82289516eaba010d64554c46df4a711b272c87c9ed6d7ac55d78
6
+ metadata.gz: c883e358c02c48d38fb8dc647e6d70639d9f9fcc5362da5d672cb991a176c80cb1539bb41c839ce7894a438132e61e2ad50f2025c084dee3251329c6ad218676
7
+ data.tar.gz: 98e87ccae2538738ea5b43c0d1d8afbbd9069c8dea0502d24687b9a73b59f6da3ebb86878a1b86b07ba40b4fd921e9b816c2627dad2a140877ba0396ee5824f2
@@ -21,7 +21,8 @@ class RuneBlog::Post
21
21
  raise "Doesn't work right now"
22
22
  raise NoBlogAccessor if RuneBlog.blog.nil?
23
23
  # "post" is a slug
24
- pdir = RuneBlog.blog.view.dir/post
24
+ pdir = RuneBlog.blog.root/:drafts/post
25
+ puts "-- load: opening #{pdir}"
25
26
  meta = nil
26
27
  Dir.chdir(pdir) do
27
28
  meta = read_config("metadata.txt")
@@ -112,9 +113,76 @@ class RuneBlog::Post
112
113
  end
113
114
 
114
115
  class RuneBlog::ViewPost
115
- attr_reader :path, :nslug, :aslug, :title, :date,
116
- :teaser_text
116
+ attr_accessor :nslug, :aslug, :num, :view, :blog
117
+ attr_accessor :path, :title, :date, :teaser_text
118
+
119
+ def self.make(blog:, view:, nslug:)
120
+ raise "No numeric prefix on #{nslug}" unless nslug =~ /^\d{4}-/
121
+ raise "Not expecting an extension" if nslug.end_with?(".lt3") || nslug.end_with?(".html")
122
+ view = view.to_s
123
+ view.define_singleton_method :path do |subdir = ""|
124
+ str = blog.root/:views/view
125
+ str << "/#{subdir}" unless subdir.empty?
126
+ str
127
+ end
128
+ view.define_singleton_method :standard do |subdir = ""|
129
+ str = blog.root/:views/view/:themes/:standard
130
+ str << "/#{subdir}" unless subdir.empty?
131
+ str
132
+ end
133
+ view.define_singleton_method :postdir do |file = ""|
134
+ file = file.to_s
135
+ str = blog.root/:views/view/:posts/nslug
136
+ str = str/file unless file.empty?
137
+ str
138
+ end
139
+ view.define_singleton_method :remote do |dir: "", file: ""|
140
+ subdir = subdir.to_s
141
+ file = file.to_s
142
+ str = blog.root/:views/view/:remote
143
+ str = str/subdir unless subdir.empty?
144
+ str = str/file unless file.empty?
145
+ str
146
+ end
147
+ obj = RuneBlog::ViewPost.new(view, nslug)
148
+ obj.blog = blog
149
+ obj.view = view
150
+ obj.nslug = nslug
151
+ obj.aslug = nslug[5..-1]
152
+ obj.num = nslug[0..3]
153
+ obj
154
+ end
155
+
156
+ def repo(subdir = "")
157
+ subdir = subdir.to_s
158
+ unless subdir.empty?
159
+ raise "Expected 'posts' or 'drafts'" unless %w[posts drafts].include?(subdir)
160
+ end
161
+ str = blog.root
162
+ str = str/subdir unless subdir.empty?
163
+ str
164
+ end
165
+
166
+ alias root repo
167
+
168
+ def slug(num = true, ext = "")
169
+ ext = ext.to_s
170
+ str = ""
171
+ str << @num << "-" if num
172
+ str << @aslug
173
+ str << ext
174
+ str
175
+ end
117
176
 
177
+ =begin
178
+ aslug this-is-a-post
179
+ aslug_live this-is-a-post.lt3
180
+ aslug_html this-is-a-post.lt3
181
+ nslug 0001-this-is-a-post
182
+
183
+ slug(:num, ext = "")
184
+ =end
185
+
118
186
  def initialize(view, postdir)
119
187
  log!(enter: __method__, args: [view, postdir], level: 3)
120
188
  # Assumes already parsed/processed
@@ -122,7 +190,7 @@ class RuneBlog::ViewPost
122
190
  @path = postdir.dup
123
191
  @nslug = @path.split("/").last
124
192
  @aslug = @nslug[5..-1]
125
- fname = "#{postdir}/teaser.txt"
193
+ fname = "#{postdir}/teaser.txt" # ???
126
194
  @teaser_text = File.read(fname).chomp
127
195
  # FIXME dumb hacks...
128
196
  mdfile = postdir/"metadata.txt"
@@ -38,10 +38,10 @@ module RuneBlog::REPL
38
38
  end
39
39
 
40
40
  def cmd_config(arg, testing = false)
41
- list = ["global.lt3", "blog/generate.lt3", " head.lt3", " index.lt3",
42
- " post_entry.lt3", "etc/blog.css.lt3", " externals.lt3",
43
- "post/generate.lt3", " head.lt3", " index.lt3",
44
- " permalink.lt3"]
41
+ list = ["global.lt3", "blog/generate.lt3", ".... head.lt3", ".... index.lt3",
42
+ ".... post_entry.lt3", "etc/blog.css.lt3", "... externals.lt3",
43
+ "post/generate.lt3", ".... head.lt3", ".... index.lt3",
44
+ ".... permalink.lt3"]
45
45
  name = ["global.lt3", "blog/generate.lt3", "blog/head.lt3", "blog/index.lt3",
46
46
  "blog/post_entry.lt3", "etc/blog.css.lt3", "blog/externals.lt3",
47
47
  "post/generate.lt3", "post/head.lt3", "post/index.lt3",
@@ -345,7 +345,7 @@ puts "Got to #{__method__}"
345
345
  end
346
346
 
347
347
  file = files.first
348
- draft = "#{@blog.root}/drafts/#{file}"
348
+ draft = "#{file}" # FIXME ?
349
349
  result = edit_file(draft)
350
350
  @blog.generate_post(draft)
351
351
  rescue => err
@@ -482,7 +482,9 @@ puts(`ls -l #{@blog.root}/drafts`)
482
482
  puts "@fname = #@fname"
483
483
  puts "Pause..."
484
484
  gets
485
- @meta = @blog.process_post(@fname)
485
+ # post = Post.load(@slug)
486
+ draft = "#{@blog.root}/drafts/#@fname"
487
+ @meta = @blog.generate_post(draft)
486
488
  puts
487
489
  sleep 2
488
490
  end
@@ -1,5 +1,6 @@
1
1
  require 'date'
2
2
  require 'find'
3
+ require 'ostruct'
3
4
 
4
5
  require 'logging'
5
6
 
@@ -165,7 +166,7 @@ puts "-- dir = #{dir}\n pwd = #{Dir.pwd}\n @root = #@root"
165
166
  gets
166
167
  create_dirs(dir)
167
168
  # FIXME dependencies?
168
- xlate cwd: dir, src: @root/:drafts/sourcefile, debug: true
169
+ xlate cwd: dir, src: @root/:drafts/sourcefile # , debug: true
169
170
  # puts `ls -l #{dir}`
170
171
  _deploy_local(dir)
171
172
  rescue => err
@@ -394,7 +395,7 @@ gets
394
395
  meta = nil
395
396
  views = views + [self.view.to_s]
396
397
  views.uniq!
397
- Dir.chdir(@root/:posts) do
398
+ Dir.chdir(@root/"posts") do
398
399
  post = Post.create(title: title, teaser: teaser, body: body, pubdate: pubdate, views: views)
399
400
  post.edit unless testing
400
401
  post.build
@@ -408,17 +409,6 @@ gets
408
409
  def import_legacy_post(file, oldfile, testing = false)
409
410
  end
410
411
 
411
- def edit_initial_post(file, testing = false)
412
- log!(enter: __method__, args: [file, testing], level: 3)
413
- debug "=== edit_initial_post #{file.inspect} => #{file}"
414
- result = system!("#@editor #{file} +8") unless testing
415
- raise EditorProblem(file) unless result
416
- process_post(file)
417
- nil
418
- rescue => err
419
- error(err)
420
- end
421
-
422
412
  def posts
423
413
  log!(enter: __method__, level: 3)
424
414
  dir = self.view.dir/:posts
@@ -469,6 +459,7 @@ gets
469
459
  def _get_views(draft)
470
460
  log!(enter: __method__, args: [draft], level: 2)
471
461
  # FIXME dumb code
462
+ # view_line = File.readlines(self.root/:drafts/draft).grep(/^.views /)
472
463
  view_line = File.readlines(draft).grep(/^.views /)
473
464
  raise "More than one .views call!" if view_line.size > 1
474
465
  raise "No .views call!" if view_line.size < 1
@@ -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.52"
5
+ VERSION = "0.2.53"
6
6
 
7
7
  path = Gem.find_files("runeblog").grep(/runeblog-/).first
8
8
  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.52
4
+ version: 0.2.53
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-10-26 00:00:00.000000000 Z
11
+ date: 2019-10-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: livetext