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

- old
+ new

@@ -72,10 +72,12 @@ # # ==== Optional # # * clean_globs - An array of file patterns to delete on clean. # * extra_deps - An array of rubygem dependencies. +# * need_tar - Should package create a tarball? [default: true] +# * need_zip - Should package create a zipfile? [default: false] # * 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] # @@ -85,11 +87,11 @@ # * PREFIX - Used to specify a custom install location (for rake install). # * RUBY_DEBUG - Used to add extra flags to RUBY_FLAGS. # * RUBY_FLAGS - Used to specify flags to ruby [has smart default]. class Hoe - VERSION = '1.1.3' + VERSION = '1.1.4' rubyprefix = Config::CONFIG['prefix'] sitelibdir = Config::CONFIG['sitelibdir'] PREFIX = ENV['PREFIX'] || rubyprefix @@ -102,11 +104,11 @@ RUBY_FLAGS = ENV['RUBY_FLAGS'] || "-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, :rdoc_pattern, :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, :need_tar, :need_zip, :rdoc_pattern, :rubyforge_name, :spec, :spec_extras, :summary, :test_files, :test_globs, :url, :version def initialize(name, version) self.name = name self.version = version @@ -121,10 +123,12 @@ 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 = {} + self.need_tar = true + self.need_zip = false if name == 'hoe' then extra_deps << ['rake'] extra_deps << ['rubyforge', '>= 0.3.1'] else @@ -182,27 +186,33 @@ extra_deps.each do |dep| s.add_dependency(*dep) end - spec_extras.each do |msg, val| - s.send "#{msg}=", val - end - s.files = File.read("Manifest.txt").split s.executables = s.files.grep(/bin/) { |f| File.basename(f) } s.bindir = "bin" - dirs = Dir['{lib,ext,test}'] + dirs = Dir['{lib,ext}'] s.require_paths = dirs unless dirs.empty? s.has_rdoc = true if test ?f, "test/test_all.rb" then s.test_file = "test/test_all.rb" else s.test_files = Dir[*test_globs] end + + # Do any extra stuff the user wants + spec_extras.each do |msg, val| + case val + when Proc + val.call(s.send(msg)) + else + s.send "#{msg}=", val + end + end end desc 'Show information about the gem.' task :debug_gem do puts spec.to_ruby @@ -211,10 +221,11 @@ self.lib_files = spec.files.grep(/^lib/) self.bin_files = spec.files.grep(/^bin/) self.test_files = spec.files.grep(/^test/) Rake::GemPackageTask.new spec do |pkg| - pkg.need_tar = true + pkg.need_tar = @need_tar + pkg.need_zip = @need_zip end desc 'Install the package. Uses PREFIX and RUBYLIB' task :install do [