lib/repl.rb in runeblog-0.3.19 vs lib/repl.rb in runeblog-0.3.20
- old
+ new
@@ -211,10 +211,11 @@
orig = @blog.root/:drafts/draft
postdir = @blog.root/:posts/draft.sub(/.lt3$/, "")
content = postdir/"/guts.html"
next if fresh?(orig, content)
+# puts "Calling generate_post(#{orig})"
@blog.generate_post(orig) # rebuild post
Dir.chdir(postdir) do
meta = @blog.read_metadata
num, title = meta.num, meta.title
num = '%4d' % num.to_s
@@ -225,13 +226,13 @@
def cmd_rebuild
debug "Starting cmd_rebuild..."
puts
regen_posts
- puts " Generating view"
+ puts " Generating view..."
@blog.generate_view(@blog.view)
- puts " Generating index"
+ puts " Generating index..."
@blog.generate_index(@blog.view)
puts " ...finished!"
rescue => err
_tmp_error(err)
end
@@ -254,10 +255,26 @@
end
end
end
def cmd_new_view(arg)
+ view_name = ask!(" Filename: ")
+ @blog.create_view(view_name) # call change_view??
+ title = ask!(" View title: ")
+ subtitle = ask!(" Subtitle : ")
+ domain = ask!(" Domain : ")
+
+ vfile = "#{@blog.root}/views/#{view_name}/settings/view.txt"
+ hash = {/VIEW_NAME/ => view_name,
+ /VIEW_TITLE/ => title,
+ /VIEW_SUBTITLE/ => subtitle,
+ /VIEW_DOMAIN/ => domain}
+ @blog.complete_file(vfile, nil, hash)
+ @blog.change_view(view_name)
+ end
+
+ def cmd_new_view_ORIG(arg)
if arg.nil?
arg = ask(fx("\nFilename: ", :bold))
puts
end
@blog.create_view(arg)
@@ -318,9 +335,10 @@
@blog.views.each do |v|
v = v.to_s
v = fx(v, :bold) if v == @blog.view.name
# FIXME: next 3 lines are crufty as hell
lines = File.readlines(@blog.root/"views/#{v}/settings/view.txt")
+ lines.map!(&:chomp)
lines = lines.select {|x| x =~ /^title / && x !~ /VIEW_/ }
title = lines.first.split(" ", 2)[1]
print " ", ('%15s' % v)
puts " ", fx(title, Black)
end