Feature #5638

Use Bundler (Gemfile) for gem management

Added by Alexey Palazhchenko almost 7 years ago. Updated about 5 years ago.

Status:ClosedStart date:2010-06-02
Priority:NormalDue date:
Assignee:Jean-Philippe Lang% Done:

80%

Category:Gems support
Target version:1.4.0
Resolution:Fixed

Description

Recently I faced two problems with Redmine:

  1. Some of my projects use 'test-unit' gem version 2.0.x. It's (sadly) not fully compatible with test-unit from Ruby distribution (1.x). Running tests against Redmine trunk raises "uninitialized constant Test::Unit::TestResult::TestResultFailureSupport (NameError)". That's annoying to uninstall and install this gem again.
  2. Many tests fails or puts warnings like "DEPRECATION WARNING: using %d in messages is deprecated; use {{count}} instead.. (called from interpolate at /Users/AlekSi/.rvm/gems/ree-1.8.7-2010.01/gems/activerecord-2.3.5/lib/active_record/i18n_interpolation_deprecation.rb:17)". This is due to new i18n library (0.4.0) loaded instead of version bundled with Rails 2.3.5.

Both problems was solved with Bundler. Check Gemfile in attached patch – it's simple and powerful.

bundler-for-redmine.patch Magnifier (120 KB) Alexey Palazhchenko, 2010-06-02 23:39

bundler-for-redmine-2.patch Magnifier (551 Bytes) Alexey Palazhchenko, 2010-06-18 08:26

redmine_with_bundler_1.0.patch.zip (128 KB) Etienne Massip, 2011-05-23 11:53

redmine_with_bundler_1.0.001.patch Magnifier (6.8 KB) Toshi MARUYAMA, 2011-06-13 16:03

redmine-bundler-20110618.diff Magnifier (9.77 KB) Toshi MARUYAMA, 2011-06-20 12:06

remove-vendored-gems.20110618.diff.gz (122 KB) Toshi MARUYAMA, 2011-06-20 12:06

redmine-bundler-20110618.mingw.diff Magnifier (589 Bytes) Toshi MARUYAMA, 2011-07-09 17:20

bundler-full-r6631.patch Magnifier (84.3 KB) Toshi MARUYAMA, 2011-08-25 13:59

bundler-20111019-full-r7628.diff Magnifier (14.1 KB) Toshi MARUYAMA, 2011-10-19 12:58

bundler-r8745.diff Magnifier (13 KB) Toshi MARUYAMA, 2012-02-01 09:28

bundler-r8759.diff Magnifier (13.1 KB) Toshi MARUYAMA, 2012-02-03 12:55

bundler-r8864.diff Magnifier (12.9 KB) Toshi MARUYAMA, 2012-02-13 11:08


Related issues

Related to Redmine - Defect #6324: requires_redmine_plugin should defer loading plugins if n... New 2010-09-07
Related to Redmine - Defect #8664: Internal Server Error when accessing specific mercurial r... New 2011-06-22
Related to Redmine - Defect #8582: RuntimeError (Your PostgreSQL connection does not support... Closed 2011-06-10
Related to Redmine - Defect #4787: Gannt to PNG - CJK (Chinese, Japanese and Korean) charac... Closed 2010-02-10
Related to Redmine - Defect #7969: Redmine dosn't work with sqlite3-ruby 1.3.3 Closed 2011-03-23
Related to Redmine - Feature #9208: Simplify the installation procedure on Windows Closed 2011-09-08
Duplicated by Redmine - Patch #8128: Bundler support Closed 2011-04-11

Associated revisions

Revision 6454
Added by Toshi MARUYAMA over 5 years ago

add bundler generates files to .gitignore and .hgignore (#5638).

Contributed by Gregor Schmidt.

Revision 6455
Added by Toshi MARUYAMA over 5 years ago

add Gemfile.local to .gitignore and .hgignore (#5638).

Contributed by Holger Just.

Revision 6456
Added by Toshi MARUYAMA over 5 years ago

add bundler generates files to svn:ignore (#5638).

  • .bundle
  • Gemfile.lock

Contributed by Gregor Schmidt.

Revision 6457
Added by Toshi MARUYAMA over 5 years ago

add Gemfile.local to svn:ignore (#5638).

Contributed by Holger Just.

Revision 8904
Added by Jean-Philippe Lang about 5 years ago

Use Bundler for gem management (#5638).

Revision 8905
Added by Jean-Philippe Lang about 5 years ago

Removed vendored gems (#5638).

Revision 8906
Added by Jean-Philippe Lang about 5 years ago

Removed faster_csv from lib (#5638).

History

#1 Updated by Alexey Palazhchenko almost 7 years ago

Second patch updates minimal bundler version, unsticks it and fixes typo in comment. Should be applied after first patch.

#2 Updated by Holger Just almost 7 years ago

According to real-life statements Yehuda Katz on the most recent RUG::B meeting, even he would not recommend bundler for Rails 2.3.5 projects. It will be properly supported and recommended in Rails 3.0 (with an upgrade path via 2.3.8, see #5603), but I would strongly advise on not using bundler today for Redmine. It's a pain in the ass today.

#3 Updated by Alexey Palazhchenko almost 7 years ago

Holger, may you please be more specific? Why do you against bundler today? Does this patch broke something for you? What the pain?

As for me this patch fixed practical problems, simplified plugins installation process and didn't broke anything.

#4 Updated by Konstantin Haase almost 7 years ago

The main issue is that Bundler + additional Rails/Redmine plugins don't play well at all, as you will be back to manual dependency resolution. Though it does indeed fix the i18n issue. Note that moving to Rails 2.3.8 would, too. I myself simply use another RVM gemset for Redmine development.

Note that RVM and Bundler interfere for some people, which was a concern raised in the Redmine IRC channel (or so I was told0. This is mainly caused by both meddling with the GEM_HOME and GEM_PATH environment variables. Although some people seem to still have issues with using both Bundler and RVM simultaneously, I did not run into any related issues since Bundler 0.9, since both projects are now written in a manner so that they are aware of each other.

#5 Updated by Alexey Palazhchenko almost 7 years ago

Yeah, there were problems with RVM and bundler, but there are no now. RVM gemsets are more buggy (at least for me), and I definitely don't want to use RVM on production server, where I happened to have two different Rails apps. Bundler is a rescue for me.

Proposed patch loads Gemfiles from plugins, if there are any. Redmine developers may stick with specific gem version for patch releases, and upgrade gems with minor and major releases. I believe this will make plugins developers (like me) life easier.

#6 Updated by Eric Davis almost 7 years ago

  • Priority changed from High to Normal

Since Bundler is still pre 1.0 and the Bundler team has make it clear that they have the right to make breaking changes at any time, using Bundler for Redmine is not an option yet. After Bundler reaches 1.0 and has stabilized, we can look into using it with Redmine (along with Rails 3).

#7 Updated by Konstantin Haase almost 7 years ago

Though in that case switching to Bundler on trunk would be an option, as the 1.0 release will probably be done earlier than Redmine's.

#8 Updated by Eric Davis almost 7 years ago

Konstantin Haase wrote:

Though in that case switching to Bundler on trunk would be an option, as the 1.0 release will probably be done earlier than Redmine's.

Redmine's 1.0 RC will be in two weeks. We have already stopped feature development and are fixing the last set of bugs. I think Redmine 1.1 will be released this winter and there's a good chance it will be able to support Rails 3 and Bundler.

#9 Updated by Konstantin Haase almost 7 years ago

Eric Davis wrote:

Konstantin Haase wrote:

Though in that case switching to Bundler on trunk would be an option, as the 1.0 release will probably be done earlier than Redmine's.

Redmine's 1.0 RC will be in two weeks. We have already stopped feature development and are fixing the last set of bugs. I think Redmine 1.1 will be released this winter and there's a good chance it will be able to support Rails 3 and Bundler.

Oh. Ok, my bad.

#10 Updated by Alexey Palazhchenko almost 7 years ago

Per discussion in IRC: target version is 1.1.

#11 Updated by Wayne E. Seguin almost 7 years ago

'RVM gemsets are more buggy'

This should most definitely not be the case in the latest RVM. All known bugs related to gemset usage have been fixed. I have worked closely with the Bundler team to ensure that RVM gemsets and Bundler 0.9.26+ work very well together.

'I definitely don't want to use RVM on production server'

I find this statement amusing since RVM was developed for the purpose of production servers.

~Wayne

#12 Updated by Jean-Baptiste Barth about 6 years ago

Bundler is now 1.0 and stable, and doesn't use .bundle/ directory anymore, so it might be use-able even with rails 2.3.5 I think. It would be far better than actual manual installs, rake gems:install, and hacks on i18n... Please let us know if anybody has an objection.

#13 Updated by Toshi MARUYAMA about 6 years ago

  • Category set to Gems support

#14 Updated by Etienne Massip almost 6 years ago

Patch updated (includes 'pg' as rails db adapter).

#16 Updated by Etienne Massip almost 6 years ago

  • Target version set to Candidate for next major release

#17 Updated by Terence Mill almost 6 years ago

related to chili#290

#18 Updated by Toshi MARUYAMA almost 6 years ago

This is additional patch for redmine_with_bundler_1.0.patch.zip from https://www.chiliproject.org/issues/290

I pushed my bitbucket mercurial repository.
https://bitbucket.org/marutosi/redmine-bundler

$ hg clone -U https://bitbucket.org/marutosi/redmine-bundler
$ cd redmine-bundler
$ hg update -r tip
$ LANG=C hg parent
changeset:   4970:5a35cd650de1
branch:      redmine-bundler
tag:         tip
user:        XXXXXXXXXXXXXXX
date:        Fri May 13 09:17:29 2011 -0700
summary:     [#290] Only print the plugin Gemfile messages when $DEBUG is set

You can download sources, too.

#19 Updated by Etienne Massip almost 6 years ago

I've also seen a FR talking about externalizing ruby-ldap.

#20 Updated by Toshi MARUYAMA almost 6 years ago

I pushed my github repository branch.
https://github.com/marutosi/redmine/commits/redmine-bundler

$ git log -n1 | cat
commit 311610f795f4e134940509dcdb463bed9d3210de
Author: XXXXXXXXXX
Date:   Fri May 13 09:17:29 2011 -0700

    [#290] Only print the plugin Gemfile messages when $DEBUG is set

    --HG--
    branch : redmine-bundler-hg-git

#22 Updated by Jiron Bach almost 6 years ago

I have an error message when I start my local application like below: /usr/local/lib/ruby/gems/1.9.1/gems/railties-3.0.6/lib/rails/plugin.rb:22:in `inherited': You cannot inherit from Rails::Plugin (RuntimeError). It looks like this message is related to the engine. I asked RubyML about this, it says "there might be a risk that the primary function of 'plugin' which properly works in 2.3 would not be operational in 3.0 engine. In short, I believe the regression occurs in 3.0 in this part. Thus, it is a trend to wait until 3.1 which has the perfect engine function is released". How do you treat this engine? Do you wait until 3.1 release? I do not know how to compile, so need to have your advise on this.

#23 Updated by Toshi MARUYAMA over 5 years ago

I give up to install on Mingw Ruby 1.8.6.

$ ruby --version
ruby 1.8.6 (2010-02-04 patchlevel 398) [i386-mingw32]

$ bundle install
Fetching source index for http://rubygems.org/
Fetching source index for http://rubygems.org/
Fetching source index for http://rubygems.org/
Installing rake (0.9.2)
Using activesupport (2.3.11)
Installing rack (1.1.2)
Using actionpack (2.3.11)
Using actionmailer (2.3.11)
Using activerecord (2.3.11)
Using activeresource (2.3.11)
Using bundler (1.0.15)
Installing coderay (0.9.8)
Using edavis10-object_daddy (0.4.3)
Installing hoe (2.10.0) r:/Ruby186/lib/ruby/site_ruby/1.8/rubygems/installer.rb:
170:in `install': hoe requires RubyGems version >= 1.4. Try 'gem update --system' to update RubyGems itself. (Gem::InstallError)
        from r:/Ruby186/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/source.rb:101:in `install'
        from r:/Ruby186/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
        from r:/Ruby186/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/source.rb:91:in `install'
        from r:/Ruby186/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:58:in `run'
        from r:/Ruby186/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
        from r:/Ruby186/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/installer.rb:57:in `run'
        from r:/Ruby186/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
        from r:/Ruby186/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/spec_set.rb:12:in `each'
         ... 7 levels...
        from r:/Ruby186/lib/ruby/gems/1.8/gems/bundler-1.0.15/lib/bundler/vendor/thor/base.rb:389:in `start'
        from r:/Ruby186/lib/ruby/gems/1.8/gems/bundler-1.0.15/bin/bundle:13
        from r:/Ruby186/bin/bundle:19:in `load'
        from r:/Ruby186/bin/bundle:19

$ gem update --system
Updating RubyGems
Updating rubygems-update
ERROR:  Error installing rubygems-update:
        rubygems-update requires Ruby version >= 1.8.7.
ERROR:  While executing gem ... (NoMethodError)
    undefined method `version' for nil:NilClass

#24 Updated by Toshi MARUYAMA over 5 years ago

This is an additional patch for mingw to redmine-bundler-20110618.diff

I don't install rmagick on Windows, so I need to run "bundle install --without=rmagick".
I can boot Redmine on SQLite3.
I don't install MySQL nor PostgreSQL on Windows.

#27 Updated by Etienne Massip over 5 years ago

Do you plan to merge these changes to your github rails-3.1 branch ?

#28 Updated by Toshi MARUYAMA over 5 years ago

Etienne Massip wrote:

Do you plan to merge these changes to your github rails-3.1 branch ?

Rails-3.1 branch has already these revisions excluding csv.
Renaming view files (.rhtml to .html.erb) is too hard to merge.
But, I will merge later.

#29 Updated by Toshi MARUYAMA over 5 years ago

This is the full patch for r7628.

After applying this patch, you need to delete vendor/gems and lib/faster_csv.rb.

I pushed following repositories.

Git: Mercurial: Changes from note 26.
  • remove coderay version from Gemfile
  • minor change of mingw
  • use rmagick on only Linux Ruby 1.8 (mri_18)
    • It is difficut to install it with bundler on Windows

#30 Updated by Toshi MARUYAMA about 5 years ago

  • Tracker changed from Patch to Feature

#33 Updated by Toshi MARUYAMA about 5 years ago

This is a full patch for r8864.

Changes:

SQLite3 1.2 on Windows Mingw Ruby 1.8.7 have problems.
https://www.chiliproject.org/issues/864

On r8864, following error raises in adding repository.

TypeError in RepositoriesController#new

can't convert String into Array

R:/redmine/app/controllers/repositories_controller.rb:39:in `&'
R:/redmine/app/controllers/repositories_controller.rb:39:in `new'

SQLite3 1.3 is used on both of Mingw Ruby 1.8 and Ruby 1.9.

I pushed following repositories.

Git:

Mercurial:

#34 Updated by Jean-Philippe Lang about 5 years ago

  • Status changed from New to Closed
  • Assignee set to Jean-Philippe Lang
  • Target version changed from Candidate for next major release to 1.4.0
  • Resolution set to Fixed

Redmine now uses Bundler.

Toshi MARUYAMA wrote:

SQLite3 1.2 on Windows Mingw Ruby 1.8.7 have problems.
https://www.chiliproject.org/issues/864

On r8864, following error raises in adding repository.

[...]

SQLite3 1.3 is used on both of Mingw Ruby 1.8 and Ruby 1.9.

This doesn't seem to be related to SQLite3 1.3 but to the latest ruby1.8.7 release. Random failures (including the one you mention) occur with ruby-1.8.7-p358 and mysql.
See error 7 in: http://www.redmine.org/builds/build_trunk-1.8.7-mysql_1489.html
I wanted to upgrade the CI server but it's back to p249...

#35 Updated by Jean-Philippe Lang about 5 years ago

Jean-Philippe Lang wrote:

Random failures (including the one you mention) occur with ruby-1.8.7-p358 and mysql.

Fixed in r8909.

#36 Updated by Ivan Cenov about 5 years ago

I have troubles after this issue and opened a theme in the Help forum: http://www.redmine.org/boards/2/topics/29070. I need help so as to proceed with Redmine.

Also available in: Atom PDF