Sha256: a3a9965efee0c65a4e1c27a6b59a9e133977ddf5b9df6985c2c3960d27400f03
Contents?: true
Size: 883 Bytes
Versions: 4
Compression:
Stored size: 883 Bytes
Contents
require 'toto' @config = Toto::Config::Defaults task :default => :new desc "Create a new article." task :new do title = ask('Title: ') slug = title.empty?? nil : title.strip.slugize article = {'title' => title, 'date' => Time.now.strftime("%d/%m/%Y")}.to_yaml article << "\n" article << "Once upon a time...\n\n" path = "#{Toto::Paths[:articles]}/#{Time.now.strftime("%Y-%m-%d")}#{'-' + slug if slug}.#{@config[:ext]}" unless File.exist? path File.open(path, "w") do |file| file.write article end toto "an article was created for you at #{path}." else toto "I can't create the article, #{path} already exists." end end desc "Publish my blog." task :publish do toto "publishing your article(s)..." `git push heroku master` end def toto msg puts "\n toto ~ #{msg}\n\n" end def ask message print message STDIN.gets.chomp end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
allegro-0.0.0pre3 | lib/template/Rakefile |
allegro-0.0.0pre2 | lib/template/Rakefile |
allegro-0.0.0pre1 | lib/template/Rakefile |
allegro-0.0.0pre | lib/template/Rakefile |