Permalink
Browse files

+ Added deprecation warnings to Hoe#url and Hoe#url=. Already depreca…

…ted for 9 mo.

+ Switched internal usage of #url to #urls.
! Removed long deprecated Hoe.new { block }.
! Removed long deprecated handling of improper dependencies.

[git-p4: depot-paths = "//src/hoe/dev/": change = 7207]
  • Loading branch information...
1 parent 8d31b2d commit a74f48cf4b7450d65bf1ca3d208bd21f08c85ef2 @zenspider zenspider committed Mar 20, 2012
Showing with 23 additions and 30 deletions.
  1. +23 −29 lib/hoe.rb
  2. +0 −1 test/test_hoe.rb
View
@@ -91,7 +91,7 @@ class Hoe
include Rake::DSL if defined?(Rake::DSL)
# duh
- VERSION = '2.16.1'
+ VERSION = '3.0.0'
@@plugins = [:clean, :debug, :deps, :flay, :flog, :newb, :package,
:publish, :gemcutter, :signing, :test]
@@ -244,6 +244,11 @@ class Hoe
attr_accessor :url
+ require 'rubygems/deprecate'
+ extend Gem::Deprecate
+ deprecate :url, :urls, 2012, 6
+ deprecate :url=, :urls=, 2012, 6
+
##
# Optional: The urls of the project. This can be an array or
# (preferably) a hash. Auto-populates to the urls read from the
@@ -488,7 +493,14 @@ def define_spec
s.version = version if version
s.summary = summary
s.email = email
- s.homepage = Array(url).first
+ s.homepage = case urls
+ when Hash then
+ urls["home"] || urls.values.first
+ when Array then
+ urls
+ else
+ raise "unknown urls format: #{urls.inspect}"
+ end
s.rubyforge_project = rubyforge_name
s.description = description
s.files = manifest
@@ -562,9 +574,7 @@ def have_gem? name
end
##
- # Create a newly initialized hoe spec. If a block is given, yield on
- # it and finish post_initialize steps. This is deprecated behavior
- # and should be switched from Hoe.new to Hoe.spec.
+ # Create a newly initialized hoe spec.
def initialize name, version = nil # :nodoc:
self.name = name
@@ -585,7 +595,6 @@ def initialize name, version = nil # :nodoc:
self.summary = nil
self.summary_sentences = 1
self.test_globs = ['test/**/test_*.rb']
- self.url = nil
if manifest = read_manifest then
self.readme_file = manifest.grep(/^README\./).first
@@ -595,13 +604,7 @@ def initialize name, version = nil # :nodoc:
self.history_file ||= "History.txt"
self.readme_file ||= "README.txt"
- if block_given? then
- warn "Hoe.new {...} deprecated. Switch to Hoe.spec."
- Hoe.load_plugins
- self.activate_plugins
- yield self
- post_initialize
- end
+ abort "Hoe.new {...} removed. Switch to Hoe.spec." if block_given?
end
##
@@ -622,14 +625,6 @@ def intuit_values
self.urls ||= urls
self.description ||= desc
self.summary ||= summ
- self.url ||= case urls
- when Hash then
- urls["home"] || urls["repo"] || urls.values.first
- when Array then
- urls
- else
- raise "unknown urls format: #{urls.inspect}"
- end
else
missing readme_file
end
@@ -711,14 +706,13 @@ def missing name
# Normalize the dependencies.
def normalize_deps deps
- Array(deps).map { |o|
- if String === o then
- warn "WAR\NING: HOE DEPRECATION: Add '>= 0' to the '#{o}' dependency."
- [o, ">= 0"]
- else
- o
- end
- }
+ deps = Array(deps)
+
+ deps.each do |o|
+ abort "ERROR: Add '~> x.y' to the '#{o}' dependency." if String === o
+ end
+
+ deps
end
##
View
@@ -279,7 +279,6 @@ def test_possibly_better
"other" => "http://github.com/jbarnette/hoe-plugin-examples",
}
- assert_equal urls["home"], hoe.url
assert_equal urls, hoe.urls
text_files = files.grep(/txt$/).reject { |f| f =~ /template/ }

0 comments on commit a74f48c

Please sign in to comment.