Make use of Gemfile groups to avoid changes to Gemfile.lock after 'bundle install'.

This commit is contained in:
Thorsten Eckel 2016-08-30 12:00:04 +02:00
parent 0e5724ca0b
commit ef3b018293
2 changed files with 11 additions and 30 deletions

32
Gemfile
View file

@ -11,8 +11,10 @@ gem 'activerecord-session_store'
gem 'json'
# Gems used only for assets and not required
# in production environments by default.
# Supported DBs
gem 'mysql2', '~> 0.3.20', group: :mysql
gem 'pg', group: :postgres
group :assets do
gem 'sass-rails' #, github: 'rails/sass-rails'
gem 'coffee-rails'
@ -57,33 +59,8 @@ gem 'libv8'
gem 'execjs'
gem 'therubyracer'
# Include database gems for the adapters found in the database
# configuration file, thanks to redmine, taken from https://github.com/redmine/redmine/blob/master/Gemfile
require 'erb'
require 'yaml'
database_file = File.join(File.dirname(__FILE__), 'config/database.yml')
if File.exist?(database_file)
database_config = YAML.load(ERB.new(IO.read(database_file)).result)
adapters = database_config.values.map { |c| c['adapter'] }.compact.uniq
if adapters.any?
adapters.each do |adapter|
case adapter
when 'mysql2'
gem 'mysql2', '~> 0.3.20'
when /postgresql/
gem 'pg'
when /sqlite3/
gem 'sqlite3'
else
warn("Unknown database adapter `#{adapter}` found in config/database.yml, use Gemfile.local to load your own database gems")
end
end
else
warn('No adapter found in config/database.yml, please configure it first')
end
else
warn('Please configure your config/database.yml first')
end
gem 'net-ldap'
@ -128,7 +105,6 @@ group :development, :test do
gem 'pre-commit'
gem 'rubocop'
gem 'coffeelint'
end
gem 'puma'

View file

@ -27,8 +27,13 @@ Getting Started
```
zammad@shell> cd zammad
zammad@shell> gem install rails
zammad@shell> bundle install
zammad@shell> gem install bundler
# For PostgreSQL (note, the option says "without ... mysql")
zammad@shell> bundle install --without test development mysql
# For MySQL (note, the option says "without ... postgres")
zammad@shell> bundle install --without test development postgres
```
3. Configure your databases