diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-19 14:30:46 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-02-19 14:30:46 +0000 |
commit | 9315039e0a95b0234b7736f359fc039550f45e08 (patch) | |
tree | a96bd2888004e027b5e460066c3e8e42d8e6e559 | |
parent | 37575f27feb19396671e6760b578265f841de733 (diff) | |
download | redmine-9315039e0a95b0234b7736f359fc039550f45e08.tar.gz redmine-9315039e0a95b0234b7736f359fc039550f45e08.zip |
Use Bundler for gem management (#5638).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8904 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | Gemfile | 78 | ||||
-rw-r--r-- | config/additional_environment.rb.example | 3 | ||||
-rw-r--r-- | config/boot.rb | 5 | ||||
-rw-r--r-- | config/environment.rb | 6 | ||||
-rw-r--r-- | config/environments/test.rb | 4 | ||||
-rw-r--r-- | config/preinitializer.rb | 20 | ||||
-rw-r--r-- | doc/INSTALL | 45 | ||||
-rw-r--r-- | doc/RUNNING_TESTS | 5 | ||||
-rw-r--r-- | doc/UPGRADING | 27 |
9 files changed, 140 insertions, 53 deletions
diff --git a/Gemfile b/Gemfile new file mode 100644 index 000000000..19b33b898 --- /dev/null +++ b/Gemfile @@ -0,0 +1,78 @@ +source :rubygems + +gem "rails", "2.3.14" +gem "i18n", "~> 0.4.2" +gem "coderay", "~> 1.0.0" + +# Optional gem for LDAP authentication +group :ldap do + gem "net-ldap", "~> 0.2.2" +end + +# Optional gem for OpenID authentication +group :openid do + gem "ruby-openid", "~> 2.1.4", :require => "openid" +end + +# Optional gem for exporting the gantt to a PNG file +group :rmagick do + # RMagick 2 supports ruby 1.9 + # RMagick 1 would be fine for ruby 1.8 but Bundler does not support + # different requirements for the same gem on different platforms + gem "rmagick", ">= 2.0.0" +end + +# Database gems +platforms :mri, :mingw do + group :postgresql do + gem "pg", "~> 0.9.0" + end + + group :sqlite do + gem "sqlite3" + end +end + +platforms :mri_18, :mingw_18 do + group :mysql do + gem "mysql" + end +end + +platforms :mri_19, :mingw_19 do + group :mysql do + gem "mysql2", "~> 0.2.7" + end +end + +platforms :jruby do + gem "jruby-openssl" + + group :mysql do + gem "activerecord-jdbcmysql-adapter" + end + + group :postgresql do + gem "activerecord-jdbcpostgresql-adapter" + end + + group :sqlite do + gem "activerecord-jdbcsqlite3-adapter" + end +end + +group :development do + gem "rdoc", ">= 2.4.2" +end + +group :test do + gem "shoulda", "~> 2.10.3" + gem "edavis10-object_daddy", :require => "object_daddy" + gem "mocha" +end + +# Load plugins' Gemfiles +Dir.glob File.expand_path("../vendor/plugins/*/Gemfile", __FILE__) do |file| + puts "Loading #{file} ..." if $DEBUG # `ruby -d` or `bundle -v` + instance_eval File.read(file) +end diff --git a/config/additional_environment.rb.example b/config/additional_environment.rb.example index c50c37631..2a317a396 100644 --- a/config/additional_environment.rb.example +++ b/config/additional_environment.rb.example @@ -5,9 +5,6 @@ # Example: # # config.log_level = :debug -# config.gem "example_plugin", :lib => false -# config.gem "timesheet_plugin", :lib => false, :version => '0.5.0' -# config.gem "aws-s3", :lib => "aws/s3" # ... # diff --git a/config/boot.rb b/config/boot.rb index 6ca837c82..cfc60f758 100644 --- a/config/boot.rb +++ b/config/boot.rb @@ -41,6 +41,11 @@ module Rails class Boot def run load_initializer + Rails::Initializer.class_eval do + def load_gems + @bundler_loaded ||= Bundler.require :default, Rails.env + end + end Rails::Initializer.run(:set_load_path) end end diff --git a/config/environment.rb b/config/environment.rb index 27f6972ea..3da0fe490 100644 --- a/config/environment.rb +++ b/config/environment.rb @@ -4,9 +4,6 @@ # you don't control web/app server and can't set it the proper way # ENV['RAILS_ENV'] ||= 'production' -# Specifies gem version of Rails to use when vendor/rails is not present -RAILS_GEM_VERSION = '2.3.14' unless defined? RAILS_GEM_VERSION - # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot') @@ -54,9 +51,6 @@ Rails::Initializer.run do |config| # It will automatically turn deliveries on config.action_mailer.perform_deliveries = false - config.gem 'coderay', :version => '~>1.0.0' - config.gem 'net-ldap', :version => '~>0.2.2' - # Load any local configuration that is kept out of source control # (e.g. gems, patches). if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb')) diff --git a/config/environments/test.rb b/config/environments/test.rb index 79ee6af96..4ce45527a 100644 --- a/config/environments/test.rb +++ b/config/environments/test.rb @@ -23,7 +23,3 @@ config.action_controller.session = { # Skip protect_from_forgery in requests http://m.onkey.org/2007/9/28/csrf-protection-for-your-existing-rails-application config.action_controller.allow_forgery_protection = false - -config.gem "shoulda", :version => "~> 2.10.3" -config.gem "edavis10-object_daddy", :lib => "object_daddy" -config.gem "mocha" diff --git a/config/preinitializer.rb b/config/preinitializer.rb new file mode 100644 index 000000000..bece2b5d7 --- /dev/null +++ b/config/preinitializer.rb @@ -0,0 +1,20 @@ +begin + require "rubygems" + require "bundler" +rescue LoadError + $stderr.puts "Redmine requires Bundler. Please install it with `gem install bundler`." + exit 1 +end + +if Gem::Version.new(Bundler::VERSION) < Gem::Version.new("1.0.21") + $stderr.puts "Redmine requires Bundler 1.0.21 (you're using #{Bundler::VERSION}).\nPlease install a newer version with `gem install bundler`." + exit 1 +end + +begin + ENV["BUNDLE_GEMFILE"] ||= File.expand_path("../../Gemfile", __FILE__) + Bundler.setup +rescue Bundler::GemNotFound + $stderr.puts "Some gems may need to be installed or updated. Please run `bundle install`." + exit 1 +end diff --git a/doc/INSTALL b/doc/INSTALL index e9ae32b95..f8b6babc2 100644 --- a/doc/INSTALL +++ b/doc/INSTALL @@ -1,24 +1,15 @@ == Redmine installation Redmine - project management software -Copyright (C) 2006-2011 Jean-Philippe Lang +Copyright (C) 2006-2012 Jean-Philippe Lang http://www.redmine.org/ == Requirements * Ruby 1.8.6 or 1.8.7 - -* RubyGems 1.3.7 - -* Ruby on Rails 2.3.14 (official downloadable Redmine releases are packaged with - the appropriate Rails version) - -* Rack 1.1.2 gem - -* Rake 0.9.2 gem - -* I18n 0.4.2 gem +* RubyGems +* Bundler >= 1.0.21 * A database: * MySQL (tested with MySQL 5.1) @@ -26,44 +17,48 @@ http://www.redmine.org/ * SQLite3 (tested with SQLite 3.6) Optional: -* SCM binaries (e.g. svn), for repository browsing (must be available in PATH) -* RMagick (to enable Gantt export to png images) -* Ruby OpenID Library >= version 2 (to enable OpenID support) +* SCM binaries (e.g. svn, git...), for repository browsing (must be available in PATH) +* ImageMagick (to enable Gantt export to png images) == Installation 1. Uncompress the program archive -2. Create an empty database: "redmine" for example +2. Install the required gems by running: + bundle install --without development test + + If ImageMagick is not installed on your system, you should skip the installation + of the rmagick gem using: + bundle install --without development test rmagick + +3. Create an empty utf8 encoded database: "redmine" for example -3. Configure the database parameters in config/database.yml +4. Configure the database parameters in config/database.yml for the "production" environment (default database is MySQL) -4. Generate a session store secret +5. Generate a session store secret Redmine stores session data in cookies by default, which requires a secret to be generated. Under the application main directory run: rake generate_session_store -5. Create the database structure +6. Create the database structure Under the application main directory run: rake db:migrate RAILS_ENV="production" It will create all the tables and an administrator account. -6. Setting up permissions (Windows users have to skip this section) +7. Setting up permissions (Windows users have to skip this section) The user who runs Redmine must have write permission on the following - subdirectories: files, log, tmp & public/plugin_assets (create the last - two if they are not yet present). + subdirectories: files, log, tmp & public/plugin_assets. Assuming you run Redmine with a user named "redmine": - mkdir tmp public/plugin_assets sudo chown -R redmine:redmine files log tmp public/plugin_assets sudo chmod -R 755 files log tmp public/plugin_assets -7. Test the installation by running the WEBrick web server +8. Test the installation by running the WEBrick web server Under the main application directory run: ruby script/server -e production @@ -71,7 +66,7 @@ Optional: Once WEBrick has started, point your browser to http://localhost:3000/ You should now see the application welcome page. -8. Use the default administrator account to log in: +9. Use the default administrator account to log in: login: admin password: admin diff --git a/doc/RUNNING_TESTS b/doc/RUNNING_TESTS index 3386e6f31..40448a949 100644 --- a/doc/RUNNING_TESTS +++ b/doc/RUNNING_TESTS @@ -1,8 +1,9 @@ Installing gems for testing =========================== -Run `rake gems RAILS_ENV=test` to list the required gems. Run -`rake gems:install RAILS_ENV=test` to install any missing gems. +Remove your .bundle/config if you've already installed Redmine without +the test dependencies. +Then, run `bundle install`. Running Tests ============= diff --git a/doc/UPGRADING b/doc/UPGRADING index e1dafa879..ceaf55749 100644 --- a/doc/UPGRADING +++ b/doc/UPGRADING @@ -1,7 +1,7 @@ == Redmine upgrade Redmine - project management software -Copyright (C) 2006-2011 Jean-Philippe Lang +Copyright (C) 2006-2012 Jean-Philippe Lang http://www.redmine.org/ @@ -20,7 +20,14 @@ http://www.redmine.org/ 4. Copy the folders of the installed plugins and themes into new installation -5. Generate a session store secret +5. Install the required gems by running: + bundle install --without development test + + If ImageMagick is not installed on your system, you should skip the installation + of the rmagick gem using: + bundle install --without development test rmagick + +6. Generate a session store secret Redmine stores session data in cookies by default, which requires a secret to be generated. Under the new application directory run: @@ -28,7 +35,7 @@ http://www.redmine.org/ DO NOT REPLACE OR EDIT ANY OTHER FILES. -6. Migrate your database +7. Migrate your database If you are upgrading to Rails 2.3.14 as part of this migration, you need to upgrade the plugin migrations before running the plugin migrations @@ -43,20 +50,14 @@ http://www.redmine.org/ migrations using: rake db:migrate_plugins RAILS_ENV="production" -7. Clean up - - Clear the cache and the existing sessions by running: +8. Clear the cache and the existing sessions by running: rake tmp:cache:clear rake tmp:sessions:clear -8. Restart the application server (e.g. mongrel, thin, passenger) - -9. Finally go to "Administration -> Roles & permissions" to check/set permissions - for new features, if any - -== Notes +9. Restart the application server (e.g. mongrel, thin, passenger) -* Rails 2.3.14 is required for versions 1.3.x. +10. Finally go to "Administration -> Roles & permissions" to check/set permissions + for new features, if any == References |