Permalink
Browse files

Fix default arguments in method definitions for ruby 2.2

  • Loading branch information...
vrinek committed Jan 13, 2015
1 parent 05db934 commit c38119c6f9184610a862ed1aebf271d46e3dd2d0
@@ -8,18 +8,18 @@ module MySQL2Helper
# require 'logger'
# ActiveRecord::Base.logger = Logger.new(STDERR)
def config
def default_config
db_config['mysql2']
end
def create_db
establish_connection(config.merge(:database => nil))
establish_connection(default_config.merge(:database => nil))
ActiveRecord::Base.connection.drop_database config['database'] rescue nil
ActiveRecord::Base.connection.create_database config['database']
ActiveRecord::Base.connection.drop_database default_config['database'] rescue nil
ActiveRecord::Base.connection.create_database default_config['database']
end
def establish_connection config = config
def establish_connection(config = default_config)
ActiveRecord::Base.establish_connection config
end
@@ -7,18 +7,18 @@ module MySQLHelper
# require 'logger'
# ActiveRecord::Base.logger = Logger.new(STDERR)
def config
def default_config
db_config['mysql']
end
def create_db
establish_connection(config.merge(:database => nil))
establish_connection(default_config.merge(:database => nil))
ActiveRecord::Base.connection.drop_database config['database'] rescue nil
ActiveRecord::Base.connection.create_database config['database']
ActiveRecord::Base.connection.drop_database default_config['database'] rescue nil
ActiveRecord::Base.connection.create_database default_config['database']
end
def establish_connection config = config
def establish_connection(config = default_config)
ActiveRecord::Base.establish_connection config
end
@@ -6,22 +6,22 @@ module PostgreSQLHelper
# ActiveRecord::Base.logger = Logger.new(STDERR)
def config
def default_config
db_config['postgres']
end
def create_db
@encoding = config['encoding'] || ENV['CHARSET'] || 'utf8'
@encoding = default_config['encoding'] || ENV['CHARSET'] || 'utf8'
begin
establish_connection(config.merge('database' => 'postgres', 'schema_search_path' => 'public'))
ActiveRecord::Base.connection.create_database(config['database'], config.merge('encoding' => @encoding))
establish_connection(default_config.merge('database' => 'postgres', 'schema_search_path' => 'public'))
ActiveRecord::Base.connection.create_database(default_config['database'], default_config.merge('encoding' => @encoding))
rescue Exception => e
$stderr.puts e, *(e.backtrace)
$stderr.puts "Couldn't create database for #{config.inspect}"
$stderr.puts "Couldn't create database for #{default_config.inspect}"
end
end
def establish_connection config = config
def establish_connection(config = default_config)
ActiveRecord::Base.establish_connection(config)
end
@@ -6,21 +6,21 @@ module SQLite3Helper
# ActiveRecord::Base.logger = Logger.new(STDERR)
def config
def default_config
db_config['sqlite3']
end
def create_db
@encoding = config['encoding'] || ENV['CHARSET'] || 'utf8'
@encoding = default_config['encoding'] || ENV['CHARSET'] || 'utf8'
begin
establish_connection(config.merge('database' => 'sqlite3', 'schema_search_path' => 'public'))
establish_connection(default_config.merge('database' => 'sqlite3', 'schema_search_path' => 'public'))
rescue Exception => e
$stderr.puts e, *(e.backtrace)
$stderr.puts "Couldn't create database for #{config.inspect}"
$stderr.puts "Couldn't create database for #{default_config.inspect}"
end
end
def establish_connection config = config
def establish_connection(config = default_config)
ActiveRecord::Base.establish_connection(config)
end
@@ -5,21 +5,21 @@ module DataMapperSQLite3Helper
puts "DataMapper #{DataMapper::VERSION}, sqlite3"
def config
def default_config
db_config['sqlite3']
end
def create_db
@encoding = config['encoding'] || ENV['CHARSET'] || 'utf8'
@encoding = default_config['encoding'] || ENV['CHARSET'] || 'utf8'
begin
establish_connection(config.merge('database' => 'sqlite3', 'schema_search_path' => 'public'))
establish_connection(default_config.merge('database' => 'sqlite3', 'schema_search_path' => 'public'))
rescue Exception => e
$stderr.puts e, *(e.backtrace)
$stderr.puts "Couldn't create database for #{config.inspect}"
$stderr.puts "Couldn't create database for #{default_config.inspect}"
end
end
def establish_connection(config = config)
def establish_connection(config = default_config)
DataMapper.setup(:default, config)
end

0 comments on commit c38119c

Please sign in to comment.