Sha256: 61639af3525d3a945d7a87cb9f09d5a2cd49a4e1e49fa2f3f59e868194ad249f
Contents?: true
Size: 1.3 KB
Versions: 20
Compression:
Stored size: 1.3 KB
Contents
require 'fileutils' module Squib # Squib's command-line options module Commands # Generate a new Squib project into a fresh directory. # # Provides conventions for using Git (you are using version control, right??). # Also provides some basic layout and config files to start from, along with templates for instructions and other notes you don't want to forget. # # # @example # squib new foo-blasters # cd foo-blasters # ruby deck.rb # git init # git add . # git commit -m "Starting my cool new game using Squib!" # # @api public class New # :nodoc: # @api private def process(args) raise ArgumentError.new('Please specify a path.') if args.empty? new_project_path = File.expand_path(args.join(' '), Dir.pwd) template_path = File.expand_path('../project_template', File.dirname(__FILE__)) FileUtils.mkdir_p new_project_path if !Dir["#{new_project_path}/**/*"].empty? $stderr.puts "#{new_project_path} exists and is not empty. Doing nothing and quitting." else Dir.chdir(new_project_path) do FileUtils.cp_r template_path + '/.', new_project_path end end end end end end
Version data entries
20 entries across 20 versions & 1 rubygems