From 1aabefe8e5890202c60f091ea2b73aa5aba536b9 Mon Sep 17 00:00:00 2001 From: Dusty Mabe Date: Wed, 20 Jul 2016 23:47:05 -0400 Subject: [PATCH] add comments to the Rakefile to make it understandable --- README.md | 2 +- Rakefile | 33 ++++++++++++++++++++++++++++----- test/libvirt/README.txt | 2 +- test/virtualbox/README.txt | 2 +- 4 files changed, 31 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 87b3647..cc84266 100644 --- a/README.md +++ b/README.md @@ -205,7 +205,7 @@ $ gem install bundler && bundle install $ bundle exec rake -T # Run Cucumber tests -$ bundle exec rake features +$ bundle exec rake featuretests # Build the gem (gets generated in the 'pkg' directory $ bundle exec rake build diff --git a/Rakefile b/Rakefile index a300d6d..b447171 100644 --- a/Rakefile +++ b/Rakefile @@ -1,15 +1,38 @@ +# A Rakefile is like a Makefile for ruby + +# bundler/gem_tasks provides functionality like: +# bundle exec rake build +# bundle exec rake install +# bundle exec rake release +# require 'bundler/gem_tasks' -require 'rake/clean' + +# cucumber/rake/task provides us with an easy way to call cucumber require 'cucumber/rake/task' -CLOBBER.include('pkg') +# rake/clean provides CLEAN/CLOBBER +# http://www.virtuouscode.com/2014/04/28/rake-part-6-clean-and-clobber/ +# CLEAN - list to let rake know what files can be cleaned up after build +# CLOBBER - list to let rake know what files are final products of the build +# +require 'rake/clean' + + +# Add the build dir to the list of items to clean up CLEAN.include('build') +# We want to keep the build artifacts in the pkg dir +CLOBBER.include('pkg') + +# Define a Rake::Task that will do initialization for us +# See http://www.ultrasaurus.com/2009/12/creating-a-custom-rake-task/ task :init do FileUtils.mkdir_p 'build' end -# Cucumber acceptance test task -Cucumber::Rake::Task.new(:features) -task :features => :init +# Create new Cucumber::Rake::Task that will run Cucumber tests +Cucumber::Rake::Task.new(:featuretests) + +# Define Rake::Task dependency - run :init before :featuretests +task :featuretests => :init diff --git a/test/libvirt/README.txt b/test/libvirt/README.txt index 8fc794c..ad03582 100644 --- a/test/libvirt/README.txt +++ b/test/libvirt/README.txt @@ -12,4 +12,4 @@ and then: cd /sharedfolder/code/github.com/dustymabe/vagrant-sshfs/ gem install bundler bundle install -bundle exec rake features +bundle exec rake featuretests diff --git a/test/virtualbox/README.txt b/test/virtualbox/README.txt index 8f27a8d..c68026e 100644 --- a/test/virtualbox/README.txt +++ b/test/virtualbox/README.txt @@ -14,4 +14,4 @@ and then: cd /sharedfolder/code/github.com/dustymabe/vagrant-sshfs/ gem install bundler bundle install -bundle exec rake features +bundle exec rake featuretests