Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

add validation task

  • Loading branch information...
commit 1f96e57e68fb9a67623754ca7189d8951053f019 1 parent af66eef
Tom Preston-Werner mojombo authored
Showing with 13 additions and 1 deletion.
  1. +13 −1 Rakefile
14 Rakefile
View
@@ -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")
@@ -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
Please sign in to comment.
Something went wrong with that request. Please try again.