プロジェクト

全般

プロフィール

Vote #73900

完了

Allow plugins to put gems inside PluginGemfile

Admin Redmine さんが3年以上前に追加. 3年以上前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
Plugin API_20
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
20
version_id:
81
issue_org_id:
14030
author_id:
44912
assigned_to_id:
1188
comments:
8
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

Having plugins put their gem requirements in Gemfile means that doing anything which involves Bundler inside the plugin directory (eg @rake redmine:plugins:test@) breaks.

Could Redmine's own Gemfile be changed so that it looks for files names, say, @PluginGemfile@ as well?


journals

To clarify -- Bundler sees a Gemfile in the current directory (/path/to/redmine/plugins/redmine_foo), and assumes that it is the root of the project, which is not the case.
--------------------------------------------------------------------------------
Obviously you shouldn't run redmine rake tasks directly inside plugins. Bundler is not broken inside plugins per se. As plugins cannot run without redmine core, commands should be run from redmine core and optionnally limit effects to a specific plugin (with @NAME=redmine_foo for instance@).

Renaming things in a non-standard fashion would break plugins possible integration as rubygems which is not better I think.
--------------------------------------------------------------------------------
At the moment you shouldn't, but it would certainly be nice (and be less confusing for plugin authors) to be able to.

I don't see how it would break possible integration with rubygems -- it certainly wouldn't be the first gemfile to not be called Gemfile:

* @bundle install@ has a @--gemfile=FILE@ switch to allow you to use files with different names.
* Here: https://github.com/grosser/fast_gettext/tree/master/gemfiles is an example of a repository which contains multiple Gemfiles so that CI tests can be run against each set of gems.
--------------------------------------------------------------------------------
Yes, you're right, I spoke too soon. Only gemspec is required for rubygems integration, some gems don't even have a Gemfile and it works well.

I'd love to hear Jean-Philippe thoughts on this point.
--------------------------------------------------------------------------------
OK for loading @PluginGemfile@. @Gemfile@ should still be loaded if it exists for compatibility.
--------------------------------------------------------------------------------
I think this Issue can be closed, since the Gemfile also loads Gemfiles of plugins, right?
--------------------------------------------------------------------------------
@Robin: not really, the requested feature is actually to be able to avoid the "Gemfile" file which has a specific meaning for bundler, so you could run bundler commands inside plugins without having bundler cry.

The feature was added in r13337.
--------------------------------------------------------------------------------
I am currently facing a similar problem.

* I'm working on a Redmine plugin, mainly adding tests.
** Plugin location: plugins/toggl2redmine - it's detected correctly.
* I wish to use Pry for debugging while I write my tests.
* Here's what I've tried:
** Created a Gemfile in the root of my plugin and ran `bundle install` in Redmine root.
** Created a PluginGemfile in the root of my plugin and ran `bundle install` in Redmine root.
** Installed "pry" globally with "gem install pry"

None of the above seem to make "pry" available in my test. Nothing works, except when I add "pry" directly into "REDMINE/Gemfile".

I add some "puts" in that Gemfile and found that the `Dir.glob` block that tries to load the plugin gemfiles is actually detecting my plugin's Gemfile or PluginGemfile correctly, but just that pry is not installed even after "eval_gemfile". Am I missing something? Here's how my Gemfile looks:

<pre>
# frozen_string_literal: true

source 'https://rubygems.org'

# I've also tried specifying a version, but the results are the same.
gem 'pry', group: [:development, :test]
</pre>

I've also tried doing a `Bundler.require(*Rails.groups)` in my `test_helper.rb`. Nothing works :(

h2. Update: It works!

Finally, I think I figured it out. Since the plugin Gemfile is included from within a main Gemfile, it does not need a "source". So, removing the "source" line fixes the problem.
--------------------------------------------------------------------------------

Admin Redmine さんが3年以上前に更新

  • カテゴリPlugin API_20 にセット
  • 対象バージョン2.6.0_81 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0