lib/hoe.rb in hoe-1.10.0 vs lib/hoe.rb in hoe-1.11.0

- old
+ new

@@ -128,11 +128,11 @@ # This will set the +Gem::Specification+ platform to the one indicated in # +FORCE_PLATFORM+ (instead of default Gem::Platform::CURRENT) # class Hoe - VERSION = '1.10.0' + VERSION = '1.11.0' GEMURL = URI.parse 'http://gems.rubyforge.org' # for namespace :deps below ruby_prefix = Config::CONFIG['prefix'] sitelibdir = Config::CONFIG['sitelibdir'] @@ -238,15 +238,20 @@ # .txt files are automatically included (excluding the obvious). attr_accessor :extra_rdoc_files ## - # Optional: flay threshold to determine threshold failure. [default: 200] + # Optional: flay threshold to determine threshold failure. [default: 1200-100] attr_accessor :flay_threshold ## + # Optional: flog threshold to determine threshold failure. [default: 1500-200] + + attr_accessor :flog_threshold + + ## # Optional: The filename for the project history. [default: History.txt] attr_accessor :history_file ## @@ -379,10 +384,19 @@ def missing name warn "** #{name} is missing or in the wrong format for auto-intuiting." warn " run `sow blah` and look at its text files" end + def timebomb n, m, finis = '2010-04-01', start = '2009-03-14' + finis = Time.parse finis + start = Time.parse start + rest = (finis - Time.now) + full = (finis - start) + + ((n - m) * rest / full).to_i + m + end + def initialize(name, version) # :nodoc: self.name = name self.version = version # Defaults @@ -393,11 +407,12 @@ self.description_sections = %w(description) self.email = [] self.extra_deps = [] self.extra_dev_deps = [] self.extra_rdoc_files = [] - self.flay_threshold = 200 + self.flay_threshold = timebomb 1200, 100 # 80% of average :( + self.flog_threshold = timebomb 1500, 1000 # 80% of average :( self.history_file = "History.txt" self.multiruby_skip = [] self.need_tar = true self.need_zip = false self.post_install_message = nil @@ -562,29 +577,22 @@ rescue LoadError # skip end begin + require 'flay' require 'flay_task' FlayTask.new :flay, self.flay_threshold rescue LoadError # skip end - desc "Analyze code complexity." - task :flog do - print "lib : " - sh "flog -s lib" - - if File.directory? "test" then - print "test: " - sh "flog -s test" - end - - if File.directory? "spec" then - print "spec: " - sh "flog -s spec" - end + begin + require 'flog' + require 'flog_task' + FlogTask.new :flog, self.flog_threshold + rescue LoadError + # skip end ############################################################ # Packaging and Installing