Sha256: 64058207c959965b01c65694624355f0cad2c285b27fc13bdd699a5db2ef23bd
Contents?: true
Size: 1.06 KB
Versions: 1
Compression:
Stored size: 1.06 KB
Contents
require "thor" require 'active_support/core_ext/string/inflections' module Schreihals class Cli < Thor include Thor::Actions source_root(File.expand_path('../../templates', __FILE__)) desc "create NAME", "Creates a new Schreihals blog." method_option :git, :aliases => "-g", :default => false, :desc => "Initialize a git repository in your blog's directory." method_option :bundle, :aliases => "-b", :default => false, :desc => "Run 'bundle install' after generating your new blog." def create(name) @name = name self.destination_root = name directory 'new_blog', '.' post('My First Post') in_root do run "bundle" if options[:bundle] run "git init" if options[:git] end end desc "post TITLE", "Creates a new blog post." def post(title) @title = title @date = Date.today.strftime("%Y-%m-%d") @slug = title.downcase.gsub(/ +/,'-') @text = "Type your post body here." template 'new-post.md.tt', "posts/#{@date}-#{@slug}.md" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
schreihals-0.0.3 | lib/schreihals/cli.rb |