From 04783ef8de93a52fa1fa8290b5b136cb8830bdcc Mon Sep 17 00:00:00 2001 From: Andy Meneely Date: Mon, 5 Jan 2015 22:01:15 -0500 Subject: [PATCH] Add and document basic rakefile --- CHANGELOG.md | 1 + README.md | 13 +++++++++++++ Rakefile | 3 ++- lib/squib/project_template/Rakefile | 7 +++++++ 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 lib/squib/project_template/Rakefile diff --git a/CHANGELOG.md b/CHANGELOG.md index bee0326..ccb32d5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # Squib CHANGELOG * Added `showcase` feature to create a fancy-looking 3D reflection to showcase your cards. Documented, tested, and added a sample for it. +* Added a basic Rakefile, documented in README. ## v0.1.0 * Added `save_sheet` command that saves a range into PNG sheets, complete with trim, gap, margin, columns, and sometimes automagically computed rows. See samples/saves.rb. diff --git a/README.md b/README.md index 9b2a9ab..2fe3a55 100644 --- a/README.md +++ b/README.md @@ -76,6 +76,7 @@ About the other files: * `_output` is the directory where your built files will go. Can easily be changed, of course. * `.gitignore` and `gitkeep.txt` are for if you are using Git. See {file:README.md#Source_control Source control}. (Feel free to remove these if you are not using Git.) * `ABOUT.md` and `PHP NOTES.md` are Markdown files for posting. Not used by Squib, but there by convention. + * `Rakefile` is a basic build file. Not required but handy - see {file:README.md#Rakefile Rakefile} # Learning Squib @@ -309,6 +310,18 @@ If you want to make a deck that has some portrait and some landscape cards, I re {include:file:samples/portrait-landscape.rb} +## Rakefile + +New Squib projects come with a basic Rakefile. At this stage, it's basically just a shortcut for `ruby deck.rb` or whatever. But, even so this Rakefile has some advantages: + +* If you're in a subdirectory at the time, `rake` will simply traverse up an `cd` to the proper directory so you don't get rogue `_output` directories +* If you find yourself building multiple decks, you can make your own tasks for each one individually, or all (e.g. `rake marketing`) +* Don't need the `require squib` at the top of your code (although that breaks `ruby deck.rb`, so it's probably a bad idea) + +Here's what's included in a `squib new` command: + +{include:file:lib/squib/project_template/Rakefile} + # Development Squib is currently in pre-release alpha, so the API is still maturing. I do change my mind about the names and meaning of things at this stage. If you are using Squib, however, I'd love to hear about it! Feel free to [file a bug or feature request](https://github.com/andymeneely/squib/issues). diff --git a/Rakefile b/Rakefile index 614d4be..108c9e1 100644 --- a/Rakefile +++ b/Rakefile @@ -2,9 +2,10 @@ require 'bundler/gem_tasks' require 'rspec/core/rake_task' require 'yard' -RSpec::Core::RakeTask.new(:spec) task default: [:install, :spec] +RSpec::Core::RakeTask.new(:spec) + YARD::Rake::YardocTask.new(:doc) do |t| t.files = ['lib/**/*.rb', 'samples/**/*.rb'] # optional #t.options = ['--any', '--extra', '--opts'] # optional diff --git a/lib/squib/project_template/Rakefile b/lib/squib/project_template/Rakefile new file mode 100644 index 0000000..8085388 --- /dev/null +++ b/lib/squib/project_template/Rakefile @@ -0,0 +1,7 @@ +require 'squib' + +task default: [:deck] + +task :deck do + load 'deck.rb' +end