lib/hoe.rb in hoe-1.1.2 vs lib/hoe.rb in hoe-1.1.3

- old
+ new

@@ -30,24 +30,29 @@ # # # add other tasks here # # === Tasks Provided: # -# * audit - Run ZenTest against the package -# * clean - Clean up all the extras -# * debug_gem - Show information about the gem -# * default - Run the default tasks -# * docs - Build the docs HTML Files -# * install - Install the package. Uses PREFIX and RUBYLIB -# * install_gem - Install the package as a gem. -# * multi - Run the test suite using multiruby -# * package - Build all the packages -# * publish_docs - Publish RDoc to RubyForge -# * release - Package and upload the release to RubyForge -# * test - Run the test suite. Use FILTER to add to the command line. -# * uninstall - Uninstall the package. -# * upload - Upload RDoc to RubyForge +# * announce - Generate email announcement file and post to rubyforge. +# * audit - Run ZenTest against the package +# * check_manifest - Verify the manifest +# * clean - Clean up all the extras +# * debug_gem - Show information about the gem. +# * default - Run the default tasks +# * docs - Build the docs HTML Files +# * email - Generate email announcement file. +# * install - Install the package. Uses PREFIX and RUBYLIB +# * install_gem - Install the package as a gem +# * multi - Run the test suite using multiruby +# * package - Build all the packages +# * post_news - Post announcement to rubyforge. +# * publish_docs - Publish RDoc to RubyForge +# * release - Package and upload the release to rubyforge. +# * ridocs - Generate ri locally for testing +# * test - Run the test suite. Use FILTER to add to the command line. +# * test_deps - Show which test files fail when run alone. +# * uninstall - Uninstall the package. # # === Attributes # # The attributes that you can provide inside the new block above are: # @@ -66,24 +71,25 @@ # * url - The url of the project. # # ==== Optional # # * clean_globs - An array of file patterns to delete on clean. -# * test_globs - An array of test file patterns [default: test/**/test_*.rb] # * extra_deps - An array of rubygem dependencies. +# * rdoc_pattern - A regexp to match documentation files against the manifest. # * rubyforge_name - The name of the rubyforge project. [default: name.downcase] # * spec_extras - A hash of extra values to set in the gemspec. +# * test_globs - An array of test file patterns [default: test/**/test_*.rb] # # === Environment Variables # +# * FILTER - Used to add flags to test_unit (e.g., -n test_borked) # * PREFIX - Used to specify a custom install location (for rake install). -# * RUBY_FLAGS - Used to specify flags to ruby [has smart default]. # * RUBY_DEBUG - Used to add extra flags to RUBY_FLAGS. -# * FILTER - Used to add flags to test_unit (e.g., -n test_borked) +# * RUBY_FLAGS - Used to specify flags to ruby [has smart default]. class Hoe - VERSION = '1.1.2' + VERSION = '1.1.3' rubyprefix = Config::CONFIG['prefix'] sitelibdir = Config::CONFIG['sitelibdir'] PREFIX = ENV['PREFIX'] || rubyprefix @@ -92,15 +98,15 @@ else File.join(PREFIX, sitelibdir[rubyprefix.size..-1]) end RUBY_DEBUG = ENV['RUBY_DEBUG'] RUBY_FLAGS = ENV['RUBY_FLAGS'] || - "-w -I#{%w(lib bin test).join(File::PATH_SEPARATOR)}" + + "-w -I#{%w(lib ext bin test).join(File::PATH_SEPARATOR)}" + (RUBY_DEBUG ? " #{RUBY_DEBUG}" : '') FILTER = ENV['FILTER'] # for tests (eg FILTER="-n test_blah") - attr_accessor :author, :bin_files, :changes, :clean_globs, :description, :email, :extra_deps, :lib_files, :name, :rubyforge_name, :spec, :spec_extras, :summary, :test_files, :test_globs, :url, :version + attr_accessor :author, :bin_files, :changes, :clean_globs, :description, :email, :extra_deps, :lib_files, :name, :rdoc_pattern, :rubyforge_name, :spec, :spec_extras, :summary, :test_files, :test_globs, :url, :version def initialize(name, version) self.name = name self.version = version @@ -112,16 +118,17 @@ self.clean_globs = %w(diff diff.txt email.txt ri *.gem **/*~) self.test_globs = ['test/**/test_*.rb'] self.changes = "#{author} is too lazy to write a changeset" self.description = "#{author} is too lazy to write a description" self.summary = "#{author} is too lazy to write a summary" + self.rdoc_pattern = /^(lib|bin)|txt$/ self.extra_deps = [] self.spec_extras = {} if name == 'hoe' then extra_deps << ['rake'] - extra_deps << ['rubyforge', '>= 0.3.0'] + extra_deps << ['rubyforge', '>= 0.3.1'] else extra_deps << ['hoe', ">= #{VERSION}"] end yield self if block_given? @@ -136,10 +143,21 @@ desc 'Run the test suite. Use FILTER to add to the command line.' task :test do run_tests end + desc 'Show which test files fail when run alone.' + task :test_deps do + tests = Dir["test/**/test_*.rb"] + Dir["test/**/*_test.rb"] + + tests.each do |test| + if not system "ruby -Ibin:lib:test #{test} &> /dev/null" then + puts "Dependency Issues: #{test}" + end + end + end + desc 'Run the test suite using multiruby' task :multi do run_tests :multi end @@ -172,24 +190,29 @@ s.files = File.read("Manifest.txt").split s.executables = s.files.grep(/bin/) { |f| File.basename(f) } s.bindir = "bin" - dirs = Dir['{lib,test}'] + dirs = Dir['{lib,ext,test}'] s.require_paths = dirs unless dirs.empty? s.has_rdoc = true - s.test_suite_file = "test/test_all.rb" if test ?f, "test/test_all.rb" + + if test ?f, "test/test_all.rb" then + s.test_file = "test/test_all.rb" + else + s.test_files = Dir[*test_globs] + end end desc 'Show information about the gem.' task :debug_gem do puts spec.to_ruby end self.lib_files = spec.files.grep(/^lib/) self.bin_files = spec.files.grep(/^bin/) - self.test_files = %w(test/test_sexp_processor.rb) # for ruby_to_c's tests. + self.test_files = spec.files.grep(/^test/) Rake::GemPackageTask.new spec do |pkg| pkg.need_tar = true end @@ -258,11 +281,11 @@ Rake::RDocTask.new(:docs) do |rd| rd.main = "README.txt" rd.options << '-d' if RUBY_PLATFORM !~ /win32/ and `which dot` =~ /\/dot/ rd.rdoc_dir = 'doc' - files = spec.files.grep(/^(lib|bin)|txt$/) + files = spec.files.grep(rdoc_pattern) files -= ['Manifest.txt'] rd.rdoc_files.push(*files) title = "#{name}-#{version} Documentation" title = "#{rubyforge_name}'s " + title if rubyforge_name != title @@ -369,11 +392,11 @@ def run_tests(multi=false) # :nodoc: msg = multi ? :sh : :ruby cmd = if test ?f, 'test/test_all.rb' then "#{RUBY_FLAGS} test/test_all.rb #{FILTER}" else - tests = test_globs.map {|g| Dir.glob(g)}.flatten << 'test/unit' + tests = test_globs.map { |g| Dir.glob(g) }.flatten << 'test/unit' tests.map! {|f| %Q(require "#{f}")} "#{RUBY_FLAGS} -e '#{tests.join("; ")}' #{FILTER}" end cmd = "multiruby #{cmd}" if multi send msg, cmd @@ -391,6 +414,11 @@ end end class ::Rake::SshDirPublisher # :nodoc: attr_reader :host, :remote_dir, :local_dir +end + +if $0 == __FILE__ then + out = `rake -T | egrep -v "redocs|repackage|clobber|trunk"` + puts out.gsub(/\#/, '-').gsub(/^rake /, '# * ') end