jburdeezy/playtest — pull request #18 by armahillo (2014-01-19 17:10:27+00:00)
Title: Command line options now added

Basic command line parsing available, using OptParser. (I tried using GLI but it seemed like overkill for this right now). CLI options are below. I also refactored the template class into two subclasses -- HtmlTemplate and PdfTemplate, encapsulating the filetype-specific functionality into each, and doing some faux-polymorphism with their "render" method. The "html" static file in the import/ folder is gone after I realized I wasn't using it in the Template class at all. That may be worth re-adding at a later date, idk. Console output is now conditional on a "Verbose" flag (see below). All specs have been updated and pass, with 2 pending for when I can figure out how to test Prawn.

CLI Options:

-v | --verbose : display console output while running

-c CARDYAML | --cards CARDYAML : defaults to "import/cards.yml", the YAML file it will use for reference

-o OUTPUT | --output OUTPUT : the file to export to. Defaults to "export/rendered_XXXXXX.ext" where XXXX is the microtime and ext is the output extension (defaults to PDF)

-s CSSFILE | --stylesheet CSSFILE : The css file to use when doing HTML output, optional. Defaults to "import/default.css"

CLI USAGE EXAMPLES:
Super basic: ./playtest.rb
Super basic, verbose: ./playtest.rb -v
Custom YAML input: ./playtest.rb -c "import/cards.yml"
HTML output: ./playtest.rb -o "export/foo.html"
Super tweaked: ./playtest.rb -v -c "/path/to/my/cards.yml" -o "/path/to/my/export/new_cards.pdf"