diff --git a/app/models/dunlop/source_file_uploader.rb b/app/models/dunlop/source_file_uploader.rb index 4eb1bf3..39c3356 100644 --- a/app/models/dunlop/source_file_uploader.rb +++ b/app/models/dunlop/source_file_uploader.rb @@ -1,21 +1,23 @@ # encoding: utf-8 -class Dunlop::SourceFileUploader < CarrierWave::Uploader::Base +if defined?(CarrierWave) + class Dunlop::SourceFileUploader < CarrierWave::Uploader::Base - #storage :file + #storage :file - # Override the directory where uploaded files will be stored. - # This is a sensible default for uploaders that are meant to be mounted: - def store_dir - File.join( - Rails.application.config.file_storage_path, - model.class.to_s.underscore, - mounted_as.to_s, - model.id.to_s - ) - end + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + File.join( + Rails.application.config.file_storage_path, + model.class.to_s.underscore, + mounted_as.to_s, + model.id.to_s + ) + end - def original_filename - File.basename(path.to_s) + def original_filename + File.basename(path.to_s) + end end end diff --git a/app/models/dunlop/target_file_uploader.rb b/app/models/dunlop/target_file_uploader.rb index e6fcd17..3881e03 100644 --- a/app/models/dunlop/target_file_uploader.rb +++ b/app/models/dunlop/target_file_uploader.rb @@ -1,21 +1,22 @@ # encoding: utf-8 +if defined?(CarrierWave) + class Dunlop::TargetFileUploader < CarrierWave::Uploader::Base -class Dunlop::TargetFileUploader < CarrierWave::Uploader::Base + storage :file - storage :file + # Override the directory where uploaded files will be stored. + # This is a sensible default for uploaders that are meant to be mounted: + def store_dir + File.join( + Rails.application.config.file_storage_path, + model.class.to_s.underscore, + mounted_as.to_s, + model.id.to_s + ) + end - # Override the directory where uploaded files will be stored. - # This is a sensible default for uploaders that are meant to be mounted: - def store_dir - File.join( - Rails.application.config.file_storage_path, - model.class.to_s.underscore, - mounted_as.to_s, - model.id.to_s - ) - end - - def original_filename - File.basename(path.to_s) + def original_filename + File.basename(path.to_s) + end end end diff --git a/dunlop-core.gemspec b/dunlop-core.gemspec index 0ced135..23825ed 100644 --- a/dunlop-core.gemspec +++ b/dunlop-core.gemspec @@ -24,7 +24,6 @@ Gem::Specification.new do |s| s.add_dependency 'responders' s.add_dependency 'redcarpet' s.add_dependency 'state_machines-activerecord' - s.add_dependency 'carrierwave' s.add_dependency 'simple_form' s.add_dependency 'devise' s.add_dependency 'devise-token_authenticatable' diff --git a/lib/dunlop/engine.rb b/lib/dunlop/engine.rb index 40cf27f..49174ec 100644 --- a/lib/dunlop/engine.rb +++ b/lib/dunlop/engine.rb @@ -16,7 +16,6 @@ require 'ransack' require 'devise' require 'devise-token_authenticatable' require 'state_machines-activerecord' -require 'carrierwave' require 'simple_form' require 'redcarpet' require 'exception_notification' diff --git a/spec/dummy/config/environment.rb b/spec/dummy/config/environment.rb index b8b71e6..58beaf1 100644 --- a/spec/dummy/config/environment.rb +++ b/spec/dummy/config/environment.rb @@ -1,7 +1,7 @@ # Load the Rails application. require File.expand_path('../application', __FILE__) -require 'carrierwave/storage/fog' +#require 'carrierwave/storage/fog' # Initialize the Rails application. Rails.application.initialize!