Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

! Added activate_plugin_deps phase to plugin loading.

+ Reworked all the plugins to use activate_XXX_deps, as necessary.
- Fixed isolate setup for the racc plugin
[git-p4: depot-paths = "//src/hoe/dev/": change = 7206]
  • Loading branch information...
commit 8d31b2dd615084de090ce0fe57388bf910cb6cec 1 parent 3125f54
@zenspider zenspider authored
View
15 README.txt
@@ -249,11 +249,16 @@ their projects.
==== Initialization
When your hoe-spec is instantiated, it extends itself all known plugin
-modules. This adds the method bodies to the hoe-spec and allows for the plugin
-to work as part of the spec itself. Once that is over, activated plugins have
-their **optional** define `initialize_#{plugin}` methods called. This lets
-them set needed instance variables to default values. Finally, the hoe-spec
-block is evaluated so that project specific values can override the defaults.
+modules. This adds the method bodies to the hoe-spec and allows for
+the plugin to work as part of the spec itself. Once that is over,
+activated plugins have their **optional** `initialize_#{plugin}`
+methods called followed by their **optional**
+`activate_#{plugin}_deps` methods called. This lets them set needed
+instance variables to default values and declare any gem dependencies
+needed.. Finally, the hoe-spec block is evaluated so that project
+specific values can override the defaults.
+
+See "Hoe Plugin Loading Sequence" in hoe.rb for full details.
==== Task Definition
View
30 lib/hoe.rb
@@ -68,6 +68,23 @@
# # ...
# end
# end
+#
+# === Hoe Plugin Loading Sequence
+#
+# Hoe.spec
+# Hoe.load_plugins
+# require
+# activate_plugins
+# extend plugin_module
+# initialize_plugins
+# initialize_XXX
+# activate_plugin_deps
+# activate_XXX_deps
+# yield spec
+# post_initialize
+# define_spec # gemspec, not hoespec
+# load_plugin_tasks
+# add_dependencies
class Hoe
@@ -375,6 +392,11 @@ def activate_plugins
self.extend Hoe.const_get(name)
end
+ initialize_plugins
+ activate_plugin_deps
+ end
+
+ def initialize_plugins
Hoe.plugins.each do |plugin|
msg = "initialize_#{plugin}"
warn msg if $DEBUG
@@ -382,6 +404,14 @@ def activate_plugins
end
end
+ def activate_plugin_deps
+ Hoe.plugins.each do |plugin|
+ msg = "activate_#{plugin}_deps"
+ 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.
View
3  lib/hoe/compiler.rb
@@ -27,8 +27,11 @@ def initialize_compiler
self.spec_extras = { :extensions => ["ext/#{self.name}/extconf.rb"] }
clean_globs << "lib/#{self.name}/*.{so,bundle,dll}"
+ end
+ def activate_compiler_deps
dependency "rake-compiler", "~> 0.7", :development
+ gem "rake-compiler", "~> 0.7"
end
##
View
6 lib/hoe/inline.rb
@@ -19,11 +19,13 @@
module Hoe::Inline
def initialize_inline
- dependency "RubyInline", "~> 3.9"
-
clean_globs << File.expand_path("~/.ruby_inline")
end
+ def activate_inline_deps
+ dependency "RubyInline", "~> 3.9"
+ end
+
##
# Define tasks for plugin.
View
32 lib/hoe/publish.rb
@@ -96,19 +96,8 @@ def initialize_publish
self.rsync_args ||= '-av -O --delete'
end
- def make_rdoc_cmd(*extra_args)
- title = "#{name}-#{version} Documentation"
- title = "#{rubyforge_name}'s #{title}" if rubyforge_name != name
- rdoc = Gem.bin_wrapper "rdoc"
-
- %W[#{rdoc}
- --title #{title}
- -o #{local_rdoc_dir}
- ] +
- spec.rdoc_options +
- extra_args +
- spec.require_paths +
- spec.extra_rdoc_files
+ def activate_publish_deps
+ dependency "rdoc", "~> 3.10", :developer if need_rdoc
end
##
@@ -116,8 +105,6 @@ def make_rdoc_cmd(*extra_args)
def define_publish_tasks
if need_rdoc then
- dependency "rdoc", "~> 3.10", :developer
-
task :isolate # ensure it exists
desc "Generate rdoc"
@@ -198,6 +185,21 @@ def define_publish_tasks
task :announce => [:post_blog, :publish_on_announce ]
end
+ def make_rdoc_cmd(*extra_args)
+ title = "#{name}-#{version} Documentation"
+ title = "#{rubyforge_name}'s #{title}" if rubyforge_name != name
+ rdoc = Gem.bin_wrapper "rdoc"
+
+ %W[#{rdoc}
+ --title #{title}
+ -o #{local_rdoc_dir}
+ ] +
+ spec.rdoc_options +
+ extra_args +
+ spec.require_paths +
+ spec.extra_rdoc_files
+ end
+
def post_blog_zenweb site
dir = site["path"]
View
8 lib/hoe/racc.rb
@@ -42,7 +42,9 @@ def initialize_racc
# -l = no-line-convert (they don't ever line up anyhow)
self.racc_flags ||= "-v -l"
self.rex_flags ||= "--independent"
+ end
+ def define_racc_deps
dependency 'racc', '~> 1.4.6', :development
end
@@ -75,11 +77,13 @@ def define_racc_tasks
end
end
+ task :isolate # stub task
+
desc "build the parser" unless parser_files.empty?
- task :parser
+ task :parser => :isolate
desc "build the lexer" unless lexer_files.empty?
- task :lexer
+ task :lexer => :isolate
task :parser => parser_files
task :lexer => lexer_files
View
2  lib/hoe/rcov.rb
@@ -6,7 +6,7 @@
# rcov:: Analyze code coverage with tests
module Hoe::RCov
- def initialize_rcov
+ def activate_rcov_deps
dependency "rcov", "~> 0.9", :development
end
Please sign in to comment.
Something went wrong with that request. Please try again.