Sha256: 2dbcaa6e0cf23a2279abbd9337cb63a23175679cad7d65743ae700c857dbf0f9

Contents?: true

Size: 791 Bytes

Versions: 1

Compression:

Stored size: 791 Bytes

Contents

# Copyright:: (c) Autotelik Media Ltd 2016
# Author ::   Tom Statter
# License::   MIT.
#
module DataShift

  module ThorBehavior

    include DataShift::Logging

    def start_connections

      if File.exist?(File.expand_path('config/environment.rb'))
        begin
          require File.expand_path('config/environment.rb')
        rescue => e
          logger.error("Failed to initialise ActiveRecord : #{e.message}")
          raise ConnectionError, "Failed to initialise ActiveRecord : #{e.message}"
        end

      else
        raise PathError, 'Are you a RAILS Project ? No config/environment.rb found - cannot initialise ActiveRecord'
        # TODO: make this more robust ? e.g what about when using active record but not in Rails app, Sinatra etc
      end
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datashift-0.40.3 lib/tasks/thor_behaviour.rb