Use Bundler for gem management (#5638).

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8904 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2012-02-19 14:30:46 +00:00
parent 37575f27fe
commit 9315039e0a
9 changed files with 140 additions and 53 deletions

78
Gemfile Normal file
View File

@ -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

View File

@ -5,9 +5,6 @@
# Example: # Example:
# #
# config.log_level = :debug # 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"
# ... # ...
# #

View File

@ -41,6 +41,11 @@ module Rails
class Boot class Boot
def run def run
load_initializer 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) Rails::Initializer.run(:set_load_path)
end end
end end

View File

@ -4,9 +4,6 @@
# you don't control web/app server and can't set it the proper way # you don't control web/app server and can't set it the proper way
# ENV['RAILS_ENV'] ||= 'production' # 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 # Bootstrap the Rails environment, frameworks, and default configuration
require File.join(File.dirname(__FILE__), 'boot') require File.join(File.dirname(__FILE__), 'boot')
@ -54,9 +51,6 @@ Rails::Initializer.run do |config|
# It will automatically turn deliveries on # It will automatically turn deliveries on
config.action_mailer.perform_deliveries = false 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 # Load any local configuration that is kept out of source control
# (e.g. gems, patches). # (e.g. gems, patches).
if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb')) if File.exists?(File.join(File.dirname(__FILE__), 'additional_environment.rb'))

View File

@ -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 # 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.action_controller.allow_forgery_protection = false
config.gem "shoulda", :version => "~> 2.10.3"
config.gem "edavis10-object_daddy", :lib => "object_daddy"
config.gem "mocha"

20
config/preinitializer.rb Normal file
View File

@ -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

View File

@ -1,24 +1,15 @@
== Redmine installation == Redmine installation
Redmine - project management software Redmine - project management software
Copyright (C) 2006-2011 Jean-Philippe Lang Copyright (C) 2006-2012 Jean-Philippe Lang
http://www.redmine.org/ http://www.redmine.org/
== Requirements == Requirements
* Ruby 1.8.6 or 1.8.7 * Ruby 1.8.6 or 1.8.7
* RubyGems
* RubyGems 1.3.7 * Bundler >= 1.0.21
* 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
* A database: * A database:
* MySQL (tested with MySQL 5.1) * MySQL (tested with MySQL 5.1)
@ -26,44 +17,48 @@ http://www.redmine.org/
* SQLite3 (tested with SQLite 3.6) * SQLite3 (tested with SQLite 3.6)
Optional: Optional:
* SCM binaries (e.g. svn), for repository browsing (must be available in PATH) * SCM binaries (e.g. svn, git...), for repository browsing (must be available in PATH)
* RMagick (to enable Gantt export to png images) * ImageMagick (to enable Gantt export to png images)
* Ruby OpenID Library >= version 2 (to enable OpenID support)
== Installation == Installation
1. Uncompress the program archive 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
3. Configure the database parameters in config/database.yml 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
4. Configure the database parameters in config/database.yml
for the "production" environment (default database is MySQL) 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 Redmine stores session data in cookies by default, which requires
a secret to be generated. Under the application main directory run: a secret to be generated. Under the application main directory run:
rake generate_session_store rake generate_session_store
5. Create the database structure 6. Create the database structure
Under the application main directory run: Under the application main directory run:
rake db:migrate RAILS_ENV="production" rake db:migrate RAILS_ENV="production"
It will create all the tables and an administrator account. 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 The user who runs Redmine must have write permission on the following
subdirectories: files, log, tmp & public/plugin_assets (create the last subdirectories: files, log, tmp & public/plugin_assets.
two if they are not yet present).
Assuming you run Redmine with a user named "redmine": 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 chown -R redmine:redmine files log tmp public/plugin_assets
sudo chmod -R 755 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: Under the main application directory run:
ruby script/server -e production ruby script/server -e production
@ -71,7 +66,7 @@ Optional:
Once WEBrick has started, point your browser to http://localhost:3000/ Once WEBrick has started, point your browser to http://localhost:3000/
You should now see the application welcome page. 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 login: admin
password: admin password: admin

View File

@ -1,8 +1,9 @@
Installing gems for testing Installing gems for testing
=========================== ===========================
Run `rake gems RAILS_ENV=test` to list the required gems. Run Remove your .bundle/config if you've already installed Redmine without
`rake gems:install RAILS_ENV=test` to install any missing gems. the test dependencies.
Then, run `bundle install`.
Running Tests Running Tests
============= =============

View File

@ -1,7 +1,7 @@
== Redmine upgrade == Redmine upgrade
Redmine - project management software Redmine - project management software
Copyright (C) 2006-2011 Jean-Philippe Lang Copyright (C) 2006-2012 Jean-Philippe Lang
http://www.redmine.org/ 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 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 Redmine stores session data in cookies by default, which requires
a secret to be generated. Under the new application directory run: 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. 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 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 need to upgrade the plugin migrations before running the plugin migrations
@ -43,21 +50,15 @@ http://www.redmine.org/
migrations using: migrations using:
rake db:migrate_plugins RAILS_ENV="production" rake db:migrate_plugins RAILS_ENV="production"
7. Clean up 8. Clear the cache and the existing sessions by running:
Clear the cache and the existing sessions by running:
rake tmp:cache:clear rake tmp:cache:clear
rake tmp:sessions:clear rake tmp:sessions:clear
8. Restart the application server (e.g. mongrel, thin, passenger) 9. Restart the application server (e.g. mongrel, thin, passenger)
9. Finally go to "Administration -> Roles & permissions" to check/set permissions 10. Finally go to "Administration -> Roles & permissions" to check/set permissions
for new features, if any for new features, if any
== Notes
* Rails 2.3.14 is required for versions 1.3.x.
== References == References
* http://www.redmine.org/wiki/redmine/RedmineUpgrade * http://www.redmine.org/wiki/redmine/RedmineUpgrade