Skip to content

Instantly share code, notes, and snippets.

@tarynsauer
Created January 31, 2014 02:32
Show Gist options
  • Save tarynsauer/8725668 to your computer and use it in GitHub Desktop.
Save tarynsauer/8725668 to your computer and use it in GitHub Desktop.
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