Module: Coupler
- Defined in:
- lib/coupler.rb,
lib/coupler/base.rb,
lib/coupler/logger.rb,
lib/coupler/models.rb,
lib/coupler/runner.rb,
lib/coupler/helpers.rb,
lib/coupler/database.rb,
lib/coupler/scheduler.rb,
lib/coupler/extensions.rb,
lib/coupler/models/job.rb,
lib/coupler/models/field.rb,
lib/coupler/data_uploader.rb,
lib/coupler/import_buffer.rb,
lib/coupler/models/import.rb,
lib/coupler/models/jobify.rb,
lib/coupler/models/result.rb,
lib/coupler/models/matcher.rb,
lib/coupler/models/project.rb,
lib/coupler/extensions/jobs.rb,
lib/coupler/models/resource.rb,
lib/coupler/models/scenario.rb,
lib/coupler/models/comparison.rb,
lib/coupler/models/connection.rb,
lib/coupler/extensions/imports.rb,
lib/coupler/extensions/results.rb,
lib/coupler/models/transformer.rb,
lib/coupler/extensions/matchers.rb,
lib/coupler/extensions/projects.rb,
lib/coupler/models/common_model.rb,
lib/coupler/models/notification.rb,
lib/coupler/extensions/resources.rb,
lib/coupler/extensions/scenarios.rb,
lib/coupler/extensions/exceptions.rb,
lib/coupler/models/transformation.rb,
lib/coupler/extensions/connections.rb,
lib/coupler/models/scenario/runner.rb,
lib/coupler/extensions/transformers.rb,
lib/coupler/extensions/notifications.rb,
lib/coupler/models/transformer/runner.rb,
lib/coupler/extensions/transformations.rb
Overview
# Sequel will automatically include these as needed require ‘jdbc/mysql’ require ‘jdbc/h2’
Defined Under Namespace
Modules: Extensions, Helpers, Models
Classes: Base, DataUploader, ImportBuffer, Logger, Runner, Scheduler
Constant Summary
collapse
- Database =
Sequel.connect(Coupler.connection_string('coupler'), :loggers => [Coupler::Logger.instance], :max_connections => 20)
Class Method Summary
collapse
Class Method Details
.connection_string(dbname) ⇒ Object
40
41
42
|
# File 'lib/coupler.rb', line 40
def self.connection_string(dbname)
"jdbc:h2:#{db_path(dbname)};IGNORECASE=TRUE"
end
|
.data_path ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
# File 'lib/coupler.rb', line 52
def self.data_path
if !defined? @data_path
dir =
if ENV['COUPLER_HOME']
ENV['COUPLER_HOME']
else
case Config::CONFIG['host_os']
when /mswin|windows/i
File.join(ENV['APPDATA'], "coupler")
else
if ENV['HOME']
File.join(ENV['HOME'], ".coupler")
else
raise "Can't figure out where Coupler lives! Try setting the COUPLER_HOME environment variable"
end
end
end
if !File.exist?(dir)
begin
Dir.mkdir(dir)
rescue SystemCallError
raise "Can't create Coupler directory (#{dir})! Is the parent directory accessible?"
end
end
if !File.writable?(dir)
raise "Coupler directory (#{dir}) is not writable!"
end
@data_path = File.expand_path(dir)
end
@data_path
end
|
.db_path(dbname) ⇒ Object
36
37
38
|
# File 'lib/coupler.rb', line 36
def self.db_path(dbname)
File.join(data_path, 'db', environment.to_s, dbname)
end
|
.environment ⇒ Object
32
33
34
|
# File 'lib/coupler.rb', line 32
def self.environment
@environment ||= ENV['COUPLER_ENV'] || :production
end
|
.log_path ⇒ Object
48
49
50
|
# File 'lib/coupler.rb', line 48
def self.log_path
@log_path ||= File.join(data_path, 'log')
end
|
.upload_path ⇒ Object
44
45
46
|
# File 'lib/coupler.rb', line 44
def self.upload_path
@upload_path ||= File.join(data_path, 'uploads', environment.to_s)
end
|