lib/runeblog.rb in runeblog-0.0.58 vs lib/runeblog.rb in runeblog-0.0.59
- old
+ new
@@ -1,11 +1,11 @@
require 'find'
require 'yaml'
require 'livetext'
class RuneBlog
- VERSION = "0.0.58"
+ VERSION = "0.0.59"
Path = File.expand_path(File.join(File.dirname(__FILE__)))
DefaultData = Path + "/../data"
BlogHeaderPath = DefaultData + "/custom/blog_header.html"
@@ -52,9 +52,24 @@
@root + "/views/#{v}/"
end
def self.exist?
File.exist?(".blog")
+ end
+
+ def create_view(name)
+ raise "view #{arg} already exists" if self.views.include?(arg)
+
+ dir = @root + "/views/" + arg + "/"
+ create_dir(dir + 'custom')
+ create_dir(dir + 'assets')
+ File.open(dir + "deploy", "w") { } # FIXME
+
+ # Something more like this? RuneBlog.new_view(arg)
+ File.write(dir + "custom/blog_header.html", RuneBlog::BlogHeader)
+ File.write(dir + "custom/blog_trailer.html", RuneBlog::BlogTrailer)
+ File.write(dir + "last_deployed", "Initial creation")
+ self.views << arg
end
def create_new_post(title, view=nil)
view ||= @view
date = Time.now.strftime("%Y-%m-%d")