Sha256: 707e217a0a8bb3f5b1296a3f0de6b2630f9bda75644724120a1fedeb0edd6d0d
Contents?: true
Size: 736 Bytes
Versions: 2
Compression:
Stored size: 736 Bytes
Contents
require 'fileutils' class NewCommand attr_accessor :dir def initialize(dir) @dir = dir.to_s end def execute FileUtils.mkdir_p([ "#{ @dir }/_drafts", "#{ @dir }/_includes", "#{ @dir }/_layouts", "#{ @dir }/_pages", "#{ @dir }/_posts", "#{ @dir }/_site" ]) blog_name = 'My First Blog' tagline = 'A short description of my blog' desc = 'Site description' new_file("_config.yml", "---\nsite:\n name: #{ blog_name }\n tagline: #{ tagline }\n description: #{ desc }") end private def new_file(filename, contents) new_post_file = File.new("#{ @dir }/#{ filename }", 'w') new_post_file.write(contents) new_post_file.close end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ignoramos-1.0.1 | lib/commands/new_command.rb |
ignoramos-1.0.0 | lib/commands/new_command.rb |