11 changed files with 78 additions and 13 deletions
@ -1,2 +1,19 @@
|
||||
#!/usr/bin/env ruby |
||||
require 'squib' |
||||
require 'mercenary' |
||||
|
||||
Mercenary.program(:squib) do |p| |
||||
p.version Squib::VERSION |
||||
p.description "A Ruby DSL for prototyping card games" |
||||
p.syntax "squib <subcommand> [options]" |
||||
|
||||
p.command(:new) do |c| |
||||
c.syntax "new PATH" |
||||
c.description "Creates a new Squib project scaffolding in PATH. Must be a new directory or already empty." |
||||
|
||||
c.action do |args, options| |
||||
Squib::Commands::New.new.process(args) |
||||
end |
||||
end |
||||
|
||||
end |
||||
@ -1,14 +1,4 @@
|
||||
require 'logger' |
||||
|
||||
module Squib |
||||
|
||||
def logger |
||||
@logger ||= Logger.new(STDOUT) |
||||
end |
||||
module_function :logger |
||||
|
||||
end |
||||
|
||||
require 'squib/version' |
||||
require 'squib/commands/new' |
||||
require 'squib/deck' |
||||
require 'squib/card' |
||||
|
||||
require 'squib/card' |
||||
@ -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 |
||||
@ -0,0 +1,19 @@
|
||||
My Awesome Game |
||||
=============== |
||||
|
||||
Check out my awesome game! |
||||
|
||||
|
||||
Objective |
||||
--------- |
||||
|
||||
|
||||
|
||||
Gameplay |
||||
-------- |
||||
|
||||
|
||||
|
||||
Ending the Game |
||||
--------------- |
||||
|
||||
@ -0,0 +1,3 @@
|
||||
source 'https://rubygems.org' |
||||
|
||||
gem 'squib' |
||||
@ -0,0 +1,4 @@
|
||||
Print and Play Notes |
||||
==================== |
||||
|
||||
Fill this out to give tips on how to play this with print and play. |
||||
@ -0,0 +1,6 @@
|
||||
require 'squib' |
||||
|
||||
Squib::Deck.new(cards: 3) do |
||||
text str: "Hello, World!" |
||||
save format: :png |
||||
end |
||||
Loading…
Reference in new issue