Skip to content
This repository

Skip plugins if gems #11

Merged
merged 3 commits into from 11 months ago

7 participants

Jonathan Dance Bjorn Neergaard Richard Schneeman Felipe Elias Philipp Michael Hale Keiko Oda Terence Lee
Jonathan Dance
Owner

Accidentally merged #10 but now its not. So a new pull request. Thanks Github.

Bjorn Neergaard

:+1:, bump!

Richard Schneeman
Owner

A few months no activity, any blockers or guidance on this PR? This PR needs a rebase.

Felipe Elias Philipp

This is super useful! The plugins warnings are really annoying :+1:

Michael Hale
Owner

:+1:

Keiko Oda
Owner

Any update for this PR?

Richard Schneeman
Owner

Needs a rebase. Should maybe warn if gems are absent. Having gems installed while using Rails3 should be best practice since we're requiring them for Rails4

Richard Schneeman
Owner

ping, would love this functionality. Can you rebase?

wuputah and others added some commits
Michael Hale
Owner

@schneems I forced pushed a rebased version of this. The previous HEAD was d7c34a9.

Richard Schneeman
Owner

Seems good, merging in!

Richard Schneeman schneems merged commit 58e3503 into from
Terence Lee
Owner
hone commented

We should probably clean the code up so rails 3 and 4 use the same branch before we release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 3 unique commits by 2 authors.

Aug 06, 2013
Jonathan Dance wuputah dont install plugins if plugins exist as gems f2f22b4
Jonathan Dance wuputah Warning when plugin gets installed
avoids the 'topic' output entirely if no plugins need to be installed
58db630
Michael Hale mikehale use if.any? 1a992a8
This page is out of date. Refresh to see the latest.

Showing 1 changed file with 11 additions and 5 deletions. Show diff stats Hide diff stats

  1. +11 5 lib/language_pack/rails2.rb
16 lib/language_pack/rails2.rb
@@ -67,9 +67,10 @@ def plugin_root
67 67 # vendors all the plugins into the slug
68 68 def install_plugins
69 69 instrument "rails2.install_plugins" do
70   - if plugins.any?
  70 + plugins_to_install = plugins.select { |plugin| install_plugin?(plugin) }
  71 + if plugins_to_install.any?
71 72 topic "Rails plugin injection"
72   - plugins.each { |plugin| install_plugin(plugin) }
  73 + plugins_to_install.each { |plugin| install_plugin(plugin) }
73 74 end
74 75 end
75 76 end
@@ -77,15 +78,21 @@ def install_plugins
77 78 # vendors an individual plugin
78 79 # @param [String] name of the plugin
79 80 def install_plugin(name)
  81 + puts "Injecting #{name}; add #{name} to your Gemfile to avoid plugin injection"
80 82 plugin_dir = "vendor/plugins/#{name}"
81   - return if File.exist?(plugin_dir)
82   - puts "Injecting #{name}"
83 83 FileUtils.mkdir_p plugin_dir
84 84 Dir.chdir(plugin_dir) do |dir|
85 85 run("curl #{VENDOR_URL}/#{name}.tgz -s -o - | tar xzf -")
86 86 end
87 87 end
88 88
  89 + # determines if a particular plugin should be installed
  90 + # @param [String] name of the plugin
  91 + def install_plugin?(name)
  92 + plugin_dir = "vendor/plugins/#{name}"
  93 + !File.exist?(plugin_dir) && !gem_is_bundled?(name)
  94 + end
  95 +
89 96 # most rails apps need a database
90 97 # @return [Array] shared database addon
91 98 def add_dev_database_addon
@@ -100,4 +107,3 @@ def setup_profiled
100 107 end
101 108
102 109 end
103   -

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.