-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.rb
54 lines (42 loc) · 1.24 KB
/
init.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
# Require needed libraries
%w{ httpclient json logger fileutils }.each do |lib|
begin
require lib
rescue
puts "#{lib} not found, please install it with `gem install #{lib}`"
end
end
#require 'active_support/core_ext/object/blank'
require 'uv_storage'
# begin
require 'carrierwave'
# rescue => e
# puts 'Carrierwave not loaded.'
# end
# Configure CarrierWave if present
if defined?(CarrierWave)
puts 'Configuring CarrierWave'
require 'carrierwave/storage/abstract'
require 'carrierwave/storage/uv'
CarrierWave.config[:storage_engines].update(:uv_storage => "CarrierWave::Storage::Uv")
CarrierWave.config[:use_cache] = true
CarrierWave.config[:cache_to_cache_dir] = true
end
# Load the correct model for the used database backend
if defined?(ActiveRecord)
require 'uv_storage/orm/active_record'
require 'uv_storage/file_mapping'
Uv::Storage.orm = Uv::Storage::Orm::ActiveRecord
end
if defined?(DataMapper)
require 'uv_storage/orm/data_mapper'
Uv::Storage.orm = Uv::Storage::Orm::DataMapper
end
if defined?(Sequel)
require 'uv_storage/orm/active_record'
Uv::Storage.orm = Uv::Storage::Orm::Sequel
end
if defined?(Mongoid)
require 'uv_storage/orm/mongoid'
Uv::Storage.orm = Uv::Storage::Orm::Mongoid
end