Sha256: 9f49c02159164c86eb753e649cc6d0f2deca165c661f2b1355b5068eac8b5f7c
Contents?: true
Size: 653 Bytes
Versions: 3
Compression:
Stored size: 653 Bytes
Contents
require 'set' module Railblazer class AdapterDetection ADAPTERS = { 'mysql' => 'mysql', 'mysql2' => 'mysql2', 'pg' => 'postgresql' }.freeze attr_reader :gems def initialize minimal_gemfile @gems = minimal_gemfile.gems end def run ADAPTERS[adapter_gem] end private def adapter_gem adapter_gems = gems & ADAPTERS.keys.to_set raise "More than one adapter gem found in Gemfile! #{gems.to_a.join(', ')}" if adapter_gems.count > 1 raise "Unable to detect any database adapters in database.yml" if adapter_gems.empty? adapter_gems.first end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
railblazer-0.0.4 | lib/railblazer/adapter_detection.rb |
railblazer-0.0.3 | lib/railblazer/adapter_detection.rb |
railblazer-0.0.2 | lib/railblazer/adapter_detection.rb |