Sha256: 3042cb5c08894fec25649391e5ede0c7f95c23711c26ab73d2bd299092a55d1a
Contents?: true
Size: 1.14 KB
Versions: 12
Compression:
Stored size: 1.14 KB
Contents
require 'find' module Octopress class Scaffold attr_reader :path, :force def initialize(args, options) @path = File.expand_path(args.join(" "), Dir.pwd) @force = !!options['force'] @blank = !!options['blank'] end def write if !@force && File.exist?(File.join(path, '_templates')) abort "Some files already exist. Use --force to overwrite." end FileUtils.cp_r(File.join(scaffold_path, '.'), path) puts "Added Octopress scaffold:" puts scaffold_file_list.green end def local_path pwd = File.join(Dir.pwd, '') path.sub(pwd, '') end def scaffold_path Octopress.gem_dir('scaffold') end # Returns a list of def scaffold_files Find.find(scaffold_path).to_a.reject do |file| file == scaffold_path end end def scaffold_file_list scaffold_files.map do |file| name = file.sub(File.join(scaffold_path, ''), '') name = name.gsub(/[^\/]+\//, ' ') if File.directory?(file) name = File.join(name, '') end " + " + name end.join("\n") end end end
Version data entries
12 entries across 12 versions & 1 rubygems