Created
January 31, 2014 02:32
-
-
Save tarynsauer/8725668 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace :generate do | |
desc "Add new spec file" | |
task :spec do | |
unless ENV.has_key?('NAME') | |
raise "Must specify spec file name, e.g., rake generate:spec NAME=craftsman_profile" | |
end | |
spec_path = "spec/" + ENV['NAME'].downcase + "_spec.rb" | |
if File.exist?(spec_path) | |
raise "ERROR: Spec file '#{spec_path}' already exists." | |
end | |
puts "Creating #{spec_path}" | |
File.open(spec_path, 'w+') do |f| | |
f.write("require 'spec_helper'") | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment