Module: Refinery::Resources

Includes:
ActiveSupport::Configurable
Defined in:
resources/lib/refinery/resources.rb,
resources/lib/refinery/resources/engine.rb,
resources/lib/refinery/resources/dragonfly.rb,
resources/lib/refinery/resources/validators.rb,
resources/lib/refinery/resources/configuration.rb,
resources/lib/refinery/resources/validators/file_size_validator.rb

Defined Under Namespace

Modules: Dragonfly, Validators Classes: Engine

Class Method Summary collapse

Class Method Details

.custom_backend?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'resources/lib/refinery/resources/configuration.rb', line 57

def custom_backend?
  config.custom_backend_class.nil? ? Core.dragonfly_custom_backend? : config.custom_backend_class.present?
end

.custom_backend_classObject



61
62
63
# File 'resources/lib/refinery/resources/configuration.rb', line 61

def custom_backend_class
  config.custom_backend_class.nil? ? Core.dragonfly_custom_backend_class : config.custom_backend_class.constantize
end

.custom_backend_optsObject



65
66
67
# File 'resources/lib/refinery/resources/configuration.rb', line 65

def custom_backend_opts
  config.custom_backend_opts.presence || Core.dragonfly_custom_backend_opts
end

.datastore_root_pathObject



33
34
35
# File 'resources/lib/refinery/resources/configuration.rb', line 33

def datastore_root_path
  config.datastore_root_path || (Rails.root.join('public', 'system', 'refinery', 'resources').to_s if Rails.root)
end

.dragonfly_url_formatObject



25
26
27
28
29
30
31
# File 'resources/lib/refinery/resources/configuration.rb', line 25

def dragonfly_url_format
  if config.dragonfly_url_format.include?(':format')
    config.dragonfly_url_format.gsub!(':format', ':ext')
    Refinery.deprecate(':format option in Refinery::Resources dragonfly_url_format config', when: '3.1', replacement: ':ext option')
  end
  config.dragonfly_url_format
end

.factory_pathsObject



19
20
21
# File 'resources/lib/refinery/resources.rb', line 19

def factory_paths
  @factory_paths ||= [ root.join("spec/factories").to_s ]
end

.rootObject



15
16
17
# File 'resources/lib/refinery/resources.rb', line 15

def root
  @root ||= Pathname.new(File.expand_path('../../../', __FILE__))
end

.s3_access_key_idObject



45
46
47
# File 'resources/lib/refinery/resources/configuration.rb', line 45

def s3_access_key_id
  config.s3_access_key_id.presence || Core.s3_access_key_id
end

.s3_backendObject



37
38
39
# File 'resources/lib/refinery/resources/configuration.rb', line 37

def s3_backend
  config.s3_backend.nil? ? Core.s3_backend : config.s3_backend
end

.s3_bucket_nameObject



41
42
43
# File 'resources/lib/refinery/resources/configuration.rb', line 41

def s3_bucket_name
  config.s3_bucket_name.presence || Core.s3_bucket_name
end

.s3_regionObject



53
54
55
# File 'resources/lib/refinery/resources/configuration.rb', line 53

def s3_region
  config.s3_region.presence || Core.s3_region
end

.s3_secret_access_keyObject



49
50
51
# File 'resources/lib/refinery/resources/configuration.rb', line 49

def s3_secret_access_key
  config.s3_secret_access_key.presence || Core.s3_secret_access_key
end