Putting together a basic squib new command

This commit is contained in:
Andy Meneely
2014-07-20 00:17:05 -04:00
parent a6eed0ad3d
commit b64e88ed0e
11 changed files with 78 additions and 13 deletions
+23
View File
@@ -0,0 +1,23 @@
module Squib
module Commands
class New
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
+2
View File
@@ -0,0 +1,2 @@
_output
+19
View File
@@ -0,0 +1,19 @@
My Awesome Game
===============
Check out my awesome game!
Objective
---------
Gameplay
--------
Ending the Game
---------------
+3
View File
@@ -0,0 +1,3 @@
source 'https://rubygems.org'
gem 'squib'
+4
View File
@@ -0,0 +1,4 @@
Print and Play Notes
====================
Fill this out to give tips on how to play this with print and play.
+6
View File
@@ -0,0 +1,6 @@
require 'squib'
Squib::Deck.new(cards: 3) do
text str: "Hello, World!"
save format: :png
end