Skip to content

Commit

Permalink
add validation task
Browse files Browse the repository at this point in the history
  • Loading branch information
mojombo committed Apr 5, 2010
1 parent af66eef commit 1f96e57
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ task :build => :gemspec do
sh "mv #{gem_file} pkg"
end

task :gemspec do
task :gemspec => :validate do
# read spec file and split out manifest section
spec = File.read(gemspec_file)
head, manifest, tail = spec.split(" # = MANIFEST =\n")
Expand All @@ -128,3 +128,15 @@ task :gemspec do
File.open(gemspec_file, 'w') { |io| io.write(spec) }
puts "Updated #{gemspec_file}"
end

task :validate do
libfiles = Dir['lib/*'] - ["lib/#{NAME}.rb", "lib/#{NAME}"]
unless libfiles.empty?
puts "Directory `lib` should only contain a `#{NAME}.rb` file and `#{NAME}` dir."
exit!
end
unless Dir['VERSION*'].empty?
puts "A `VERSION` file at root level violates Gem best practices."
exit!
end
end

0 comments on commit 1f96e57

Please sign in to comment.