lib/amiba/page.rb in amiba-0.0.8 vs lib/amiba/page.rb in amiba-0.0.9
- old
+ new
@@ -19,10 +19,11 @@
class_option :state, :default => "draft"
class_option :author, :default => Etc.getpwnam(ENV["USER"])["gecos"].split(",")[0]
def init_source
@source = Amiba::Source::Page.new(name, format, options, Templates.send(format.to_sym))
+ @entry = Amiba::Source::PageEntry.new(@source)
end
def should_not_exist
unless @source.new?
raise Thor::Error.new("Error:A page called '#{name}' has already been created.")
@@ -38,14 +39,18 @@
def save_page
@source.save do |filename, file_data|
create_file filename, file_data
end
+ @entry.save do |filename, file_data|
+ create_file filename, file_data
+ end
end
def add_to_git
add_and_commit @source.filename
+ add_and_commit @entry.filename
end
end
# Thor task to mark a page published.
@@ -125,10 +130,10 @@
# Hate this - will deprecate as soon as I think of a more elegant solution
class Templates
class << self
def haml
- "%h1 Title\n%p Body\n"
+ "= content\n"
end
def markdown
"# Title #\nBody\n"
end