all repos — h3rald @ 3744f62a7962c3eb760513e052a6292b820870c7

The sources of https://h3rald.com

Added tasks to add articles, pages and projects.
* Closes #45.
h3rald h3rald@h3rald.com
Tue, 08 Sep 2009 12:13:48 +0200
commit

3744f62a7962c3eb760513e052a6292b820870c7

parent

3d13981c75fb928e48073963f93f47cad57ad814

2 files changed, 55 insertions(+), 0 deletions(-)

jump to
M README.textileREADME.textile

@@ -8,6 +8,7 @@ * mysql (Typo migration)

* sequel (Typo migration) * bb-ruby (BBCode filter) * builder (Feeds) +* haml (SASS filter) h3. Other
M tasks/site.raketasks/site.rake

@@ -82,6 +82,60 @@ write_archive_page dir, m[0], m[1].length

end end + task :article, :name do |t, args| + raise RuntimeError, "Name not specified" unless args[:name] + raise RuntimeError, "Article name can only contain letters, numbers and dashes" unless args[:name].match /^[a-zA-Z0-9-]+$/ + meta = {} + meta[:permalink] = args[:name] + meta[:title] = "" + meta[:tags] = [] + meta[:date] = Time.now + meta[:toc] = true + meta[:type] = 'article' + file = Pathname.new Dir.pwd/"content/articles/#{meta[:permalink]}.textile" + raise "File '#{file}' already exists!" if file.exist? + write_item file, meta, '' + end + + task :page, :name do |t, args| + raise RuntimeError, "Name not specified" unless args[:name] + raise RuntimeError, "Page name can only contain letters, numbers and dashes" unless args[:name].match /^[a-zA-Z0-9-]+$/ + meta = {} + meta[:permalink] = args[:name] + meta[:title] = "" + meta[:type] = 'page' + file = Pathname.new Dir.pwd/"content/#{meta[:permalink]}.textile" + raise "File '#{file}' already exists!" if file.exist? + write_item file, meta, '' + end + + task :project, :name do |t, args| + raise RuntimeError, "Name not specified" unless args[:name] + raise RuntimeError, "Project name can only contain letters, numbers and dashes" unless args[:name].match /^[a-zA-Z0-9-]+$/ + meta = {} + meta[:permalink] = args[:name] + meta[:title] = "" + meta[:github] = args[:name] + meta[:status] = "Active" + meta[:version] = "0.1.0" + meta[:type] = 'project' + meta[:links] = [{"Documentation" => "http://#{args[:name]}.rubyforge.org"}, + {"Download" => "http://rubyforge.org/projects/#{args[:name]}"}, + {"Source" => "http://github.com/h3rald/#{args[:name]}/tree/master"}, + {"Tracking" => "http://github.com/h3rald/#{args[:name]}/issues"}] + contents = %{ +<%= render 'project_data', :tag => '#{args[:name]}' %> + +h3. Installation + +h3. Usage + +<%= render 'project_updates', :tag => '#{args[:name]}' %> + } + file = Pathname.new Dir.pwd/"content/#{meta[:permalink]}.textile" + raise "File '#{file}' already exists!" if file.exist? + write_item file, meta, contents + end task :copy_resources do pwd = Pathname.new Dir.pwd