Sha256: da7f052acbaa6ba4ae86bfb55d0e96e0b6329c84fc5d438c8fa278f9d05f9936
Contents?: true
Size: 896 Bytes
Versions: 22
Compression:
Stored size: 896 Bytes
Contents
require 'eucalypt/blog/namespaces/blog/__base__' module Eucalypt module Generators class Blog < Thor::Group def article(urltitle:) urltitle = Inflect.route(urltitle) dt = Hash.new dt[:full] = Time.now.strftime("%Y-%m-%d %H:%M:%S") dt[:date] = dt[:full].split(' ').first # Assets path generation asset_base = File.join 'app', 'assets', 'blog' asset_path = File.join asset_base, dt[:date].gsub(?-,?/), urltitle empty_directory(asset_path) # Markdown file and path generation article_base = File.join 'app', 'views', 'blog', 'markdown' article_path = File.join article_base, dt[:date].gsub(?-,?/), "#{urltitle}.md" config = {datetime: dt[:full], date: dt[:date], urltitle: urltitle} template File.join('views', 'article_md.tt'), article_path, config end end end end
Version data entries
22 entries across 22 versions & 1 rubygems