Sha256: 1ca297778b663bf90533f367fcde026bdfefc088b10693bb9cb47c11f98f34ea

Contents?: true

Size: 990 Bytes

Versions: 7

Compression:

Stored size: 990 Bytes

Contents

require 'sequel'
require 'sqlite3'
require 'yaml'

Sequel.datetime_class = DateTime

module Taps
	def self.version_yml
		@@version_yml ||= YAML.load(File.read(File.dirname(__FILE__) + '/../../VERSION.yml'))
	end

	def self.version
		version = "#{version_yml[:major]}.#{version_yml[:minor]}.#{version_yml[:patch]}"
		version += ".#{version_yml[:build]}" if version_yml[:build]
		version
	end

	def self.compatible_version
		"#{version_yml[:major]}.#{version_yml[:minor]}"
	end

	def self.exiting=(val)
		@@exiting = val
	end

	def exiting?
		(@@exiting ||= false) == true
	end

	class Config
		class << self
			attr_accessor :taps_database_url
			attr_accessor :login, :password, :database_url, :remote_url
			attr_accessor :chunksize

			def verify_database_url(db_url=nil)
				db_url ||= self.database_url
				db = Sequel.connect(db_url)
				db.tables
				db.disconnect
			rescue Object => e
				puts "Failed to connect to database:\n  #{e.class} -> #{e}"
				exit 1
			end
		end
	end
end

Version data entries

7 entries across 7 versions & 2 rubygems

Version Path
taps-0.3.11 lib/taps/config.rb
dkastner-taps-0.3.11 lib/taps/config.rb
taps-0.3.10 lib/taps/config.rb
taps-0.3.9 lib/taps/config.rb
taps-0.3.8 lib/taps/config.rb
taps-0.3.7 lib/taps/config.rb
taps-0.3.6 lib/taps/config.rb