lib/hoe.rb in hoe-2.9.1 vs lib/hoe.rb in hoe-2.9.2

- old
+ new

@@ -1,10 +1,16 @@ # -*- ruby -*- require 'rubygems' require 'rake' require 'rake/testtask' + +begin + require 'psych' +rescue LoadError + # do nothing +end require 'yaml' require 'hoe/rake' ## @@ -55,12 +61,15 @@ # # ... # end # end class Hoe + + include Rake::DSL if defined?(Rake::DSL) + # duh - VERSION = '2.9.1' + VERSION = '2.9.2' @@plugins = [:clean, :debug, :deps, :flay, :flog, :newb, :package, :publish, :rcov, :gemcutter, :signing, :test] ## @@ -229,12 +238,13 @@ # It is called at the end of hoe.rb def self.load_plugins plugins = Hoe.plugins @found ||= {} @loaded ||= {} + @files ||= Gem.find_files "hoe/*.rb" - Gem.find_files("hoe/*.rb").reverse.each do |path| + @files.reverse.each do |path| @found[File.basename(path, ".rb").intern] = path end :keep_doing_this while @found.map { |name, plugin| next unless plugins.include? name @@ -304,33 +314,47 @@ ## # Activate plugin modules and add them to the current instance. def activate_plugins - plugins = Hoe.plugins - with_config do |config, _| config_plugins = config['plugins'] break unless config_plugins - plugins += config_plugins.map { |plugin| plugin.intern } + Hoe.plugins.concat config_plugins.map { |plugin| plugin.intern } end - Hoe.load_plugins plugins + Hoe.load_plugins Hoe.plugins names = Hoe.constants.map { |s| s.to_s } names.reject! { |n| n =~ /^[A-Z_]+$/ } names.each do |name| - next unless plugins.include? name.downcase.intern + next unless Hoe.plugins.include? name.downcase.intern warn "extend #{name}" if $DEBUG self.extend Hoe.const_get(name) end Hoe.plugins.each do |plugin| msg = "initialize_#{plugin}" warn msg if $DEBUG send msg if self.respond_to? msg end + end + + ## + # Add a dependency declaration to your spec. Pass :dev to + # +type+ for developer dependencies. + + def dependency name, version, type = :runtime + ary = case type + when :runtime then + extra_deps + when :dev, :development, :developer then + extra_dev_deps + else + raise "Unknown dependency type: #{type}" + end + ary << [name, version] end ## # Add standard and user defined dependencies to the spec.