lib/runeblog.rb in runeblog-0.2.52 vs lib/runeblog.rb in runeblog-0.2.53

- old
+ new

@@ -1,7 +1,8 @@ require 'date' require 'find' +require 'ostruct' require 'logging' require 'runeblog_version' require 'global' @@ -163,11 +164,11 @@ # puts "sourcefile = #{sourcefile}" puts "-- dir = #{dir}\n pwd = #{Dir.pwd}\n @root = #@root" gets create_dirs(dir) # FIXME dependencies? - xlate cwd: dir, src: @root/:drafts/sourcefile, debug: true + xlate cwd: dir, src: @root/:drafts/sourcefile # , debug: true # puts `ls -l #{dir}` _deploy_local(dir) rescue => err _tmp_error(err) end @@ -392,11 +393,11 @@ pubdate: Time.now.strftime("%Y-%m-%d"), views: []) log!(enter: __method__, args: [title, testing, teaser, body, views], level: 1, stderr: true) meta = nil views = views + [self.view.to_s] views.uniq! - Dir.chdir(@root/:posts) do + Dir.chdir(@root/"posts") do post = Post.create(title: title, teaser: teaser, body: body, pubdate: pubdate, views: views) post.edit unless testing post.build meta = post.meta end @@ -406,21 +407,10 @@ end def import_legacy_post(file, oldfile, testing = false) end - def edit_initial_post(file, testing = false) - log!(enter: __method__, args: [file, testing], level: 3) - debug "=== edit_initial_post #{file.inspect} => #{file}" - result = system!("#@editor #{file} +8") unless testing - raise EditorProblem(file) unless result - process_post(file) - nil - rescue => err - error(err) - end - def posts log!(enter: __method__, level: 3) dir = self.view.dir/:posts posts = Dir.entries(dir).grep(/^\d{4}/) posts @@ -467,9 +457,10 @@ end def _get_views(draft) log!(enter: __method__, args: [draft], level: 2) # FIXME dumb code +# view_line = File.readlines(self.root/:drafts/draft).grep(/^.views /) view_line = File.readlines(draft).grep(/^.views /) raise "More than one .views call!" if view_line.size > 1 raise "No .views call!" if view_line.size < 1 view_line = view_line.first views = view_line[7..-1].split