Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

add validation task

  • Loading branch information...
commit 1f96e57e68fb9a67623754ca7189d8951053f019 1 parent af66eef
Tom Preston-Werner mojombo authored

Showing 1 changed file with 13 additions and 1 deletion. Show diff stats Hide diff stats

  1. +13 1 Rakefile
14 Rakefile
@@ -104,7 +104,7 @@ task :build => :gemspec do
104 104 sh "mv #{gem_file} pkg"
105 105 end
106 106
107   -task :gemspec do
  107 +task :gemspec => :validate do
108 108 # read spec file and split out manifest section
109 109 spec = File.read(gemspec_file)
110 110 head, manifest, tail = spec.split(" # = MANIFEST =\n")
@@ -128,3 +128,15 @@ task :gemspec do
128 128 File.open(gemspec_file, 'w') { |io| io.write(spec) }
129 129 puts "Updated #{gemspec_file}"
130 130 end
  131 +
  132 +task :validate do
  133 + libfiles = Dir['lib/*'] - ["lib/#{NAME}.rb", "lib/#{NAME}"]
  134 + unless libfiles.empty?
  135 + puts "Directory `lib` should only contain a `#{NAME}.rb` file and `#{NAME}` dir."
  136 + exit!
  137 + end
  138 + unless Dir['VERSION*'].empty?
  139 + puts "A `VERSION` file at root level violates Gem best practices."
  140 + exit!
  141 + end
  142 +end

0 comments on commit 1f96e57

Please sign in to comment.
Something went wrong with that request. Please try again.