sequel_paperclip 0.5.0 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.5.0
1
+ 0.5.1
@@ -89,7 +89,7 @@ module Sequel
89
89
  processor.pre_runs(model, src_path)
90
90
  options[:styles].each_pair do |style, style_options|
91
91
  tmp_file = Tempfile.new("paperclip")
92
- puts "processing #{name} for style #{style} with processor #{processor.name}"
92
+ Sequel::Plugins::Paperclip.logger.debug("processing #{name} for style #{style} with processor #{processor.name}")
93
93
  processor.run(style, style_options, tmp_file)
94
94
  @storage_updates << {
95
95
  :type => STORAGE_UPDATE_SAVE,
@@ -105,12 +105,12 @@ module Sequel
105
105
  @storage_updates.each do |update|
106
106
  case update[:type]
107
107
  when STORAGE_UPDATE_SAVE
108
- puts "saving #{update[:dst_path]} (#{update[:src_file].size} bytes)"
108
+ Sequel::Plugins::Paperclip.logger.debug("saving #{update[:dst_path]} (#{update[:src_file].size} bytes)")
109
109
  FileUtils.mkdir_p(File.dirname(update[:dst_path]))
110
110
  FileUtils.cp(update[:src_file].path, update[:dst_path])
111
111
  update[:src_file].close!
112
112
  when STORAGE_UPDATE_DELETE
113
- puts "deleting #{update[:path]}"
113
+ Sequel::Plugins::Paperclip.logger.debug("deleting #{update[:path]}")
114
114
  begin
115
115
  FileUtils.rm(update[:path])
116
116
  rescue Errno::ENOENT => error
@@ -15,6 +15,26 @@ module Sequel
15
15
  def self.configure(model, opts={}, &block)
16
16
  end
17
17
 
18
+ def self.logger
19
+ @logger ||= (rails_logger || default_logger)
20
+ end
21
+
22
+ def self.rails_logger
23
+ (defined?(Rails) && Rails.respond_to?(:logger) && Rails.logger) ||
24
+ (defined?(RAILS_DEFAULT_LOGGER) && RAILS_DEFAULT_LOGGER.respond_to?(:debug) && RAILS_DEFAULT_LOGGER)
25
+ end
26
+
27
+ def self.default_logger
28
+ require 'logger'
29
+ l = Logger.new(STDOUT)
30
+ l.level = Logger::INFO
31
+ l
32
+ end
33
+
34
+ def self.logger=(logger)
35
+ @logger = logger
36
+ end
37
+
18
38
  module ClassMethods
19
39
  def attachment(name, options)
20
40
  attr_accessor name
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{sequel_paperclip}
8
- s.version = "0.5.0"
8
+ s.version = "0.5.1"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Corin Langosch"]
12
- s.date = %q{2010-10-10}
12
+ s.date = %q{2010-11-18}
13
13
  s.description = %q{Sequel plugin which provides Paperclip (attachments, thumbnail resizing, etc.) functionality for model.}
14
14
  s.email = %q{info@netskin.com}
15
15
  s.extra_rdoc_files = [
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 5
8
- - 0
9
- version: 0.5.0
8
+ - 1
9
+ version: 0.5.1
10
10
  platform: ruby
11
11
  authors:
12
12
  - Corin Langosch
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-10 00:00:00 +01:00
17
+ date: 2010-11-18 00:00:00 +00:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency