Permalink
Browse files

Warning when plugin gets installed

avoids the 'topic' output entirely if no plugins need to be installed
  • Loading branch information...
wuputah committed Mar 6, 2012
1 parent 82f02b7 commit d7c34a97297fa644003ea4946abf2216056b6558
Showing with 12 additions and 4 deletions.
  1. +12 −4 lib/language_pack/rails2.rb
@@ -55,22 +55,30 @@ def plugin_root
# vendors all the plugins into the slug
def install_plugins
- topic "Rails plugin injection"
- plugins.each { |plugin| install_plugin(plugin) }
+ plugins_to_install = plugins.select { |plugin| install_plugin?(plugin) }
+ unless plugins_to_install.empty?
+ topic "Rails plugin injection"
+ plugins_to_install.each { |plugin| install_plugin(plugin) }
+ end
end
# vendors an individual plugin
# @param [String] name of the plugin
def install_plugin(name)
+ puts "Injecting #{name}; add #{name} to your Gemfile to avoid plugin injection"
plugin_dir = "vendor/plugins/#{name}"
- return if File.exist?(plugin_dir) || gem_is_bundled?(name)
- puts "Injecting #{name}"
FileUtils.mkdir_p plugin_dir
Dir.chdir(plugin_dir) do |dir|
run("curl #{VENDOR_URL}/#{name}.tgz -s -o - | tar xzf -")
end
end
+ # determines if a particular plugin should be installed
+ # @param [String] name of the plugin
+ def install_plugin?(name)
+ plugin_dir = "vendor/plugins/#{name}"
+ !File.exist?(plugin_dir) && !gem_is_bundled?(name)
+ end
# most rails apps need a database
# @return [Array] shared database addon

0 comments on commit d7c34a9

Please sign in to comment.