cloudinary 1.0.31 → 1.0.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -13,8 +13,12 @@ module Cloudinary::CarrierWave
13
13
  base.send(:attr_accessor, :metadata)
14
14
  base.send(:attr_reader, :stored_version)
15
15
 
16
- override_in_versions(base, :blank?, :full_public_id)
16
+ override_in_versions(base, :blank?, :full_public_id, :all_versions_processors)
17
17
  end
18
+
19
+ def is_main_uploader?
20
+ self.class.version_names.blank?
21
+ end
18
22
 
19
23
  def retrieve_from_store!(identifier)
20
24
  if identifier.blank?
@@ -1,5 +1,15 @@
1
1
  module Cloudinary::CarrierWave
2
2
  module ClassMethods
3
+ def make_private
4
+ process :cloudinary_transformation=>{:type => :private}
5
+ process_all_versions :cloudinary_transformation=>{:type => :private}
6
+ end
7
+
8
+ def process_all_versions(*args)
9
+ @all_versions ||= Class.new(self)
10
+ @all_versions.process *args
11
+ end
12
+
3
13
  def eager
4
14
  process :eager => true
5
15
  end
@@ -42,14 +52,14 @@ module Cloudinary::CarrierWave
42
52
  end
43
53
 
44
54
  def set_or_yell(hash, attr, value)
45
- raise "conflicting transformation on #{attr} #{value}!=#{hash[attr]}" if hash[attr]
55
+ raise "conflicting transformation on #{attr} #{value}!=#{hash[attr]}" if hash[attr] && hash[attr] != value
46
56
  hash[attr] = value
47
57
  end
48
58
 
49
59
  def transformation
50
60
  return @transformation if @transformation
51
61
  @transformation = {}
52
- self.class.processors.each do
62
+ self.all_processors.each do
53
63
  |name, args|
54
64
  case name
55
65
  when :convert # Do nothing. This is handled by format
@@ -98,18 +108,28 @@ module Cloudinary::CarrierWave
98
108
  @transformation
99
109
  end
100
110
 
111
+ def all_versions_processors
112
+ all_versions = self.class.instance_variable_get('@all_versions')
113
+
114
+ all_versions ? all_versions.processors : []
115
+ end
116
+
117
+ def all_processors
118
+ (self.is_main_uploader? ? [] : all_versions_processors) + self.class.processors
119
+ end
120
+
101
121
  def eager
102
- @eager ||= self.class.processors.any?{|processor| processor[0] == :eager}
122
+ @eager ||= self.all_processors.any?{|processor| processor[0] == :eager}
103
123
  end
104
124
 
105
125
  def tags
106
- @tags ||= self.class.processors.select{|processor| processor[0] == :tags}.map(&:second).first
126
+ @tags ||= self.all_processors.select{|processor| processor[0] == :tags}.map(&:second).first
107
127
  raise "tags cannot be used in versions." if @tags.present? && self.version_name.present?
108
128
  @tags
109
129
  end
110
130
 
111
131
  def format
112
- format_processor = self.class.processors.find{|processor| processor[0] == :convert}
132
+ format_processor = self.all_processors.find{|processor| processor[0] == :convert}
113
133
  if format_processor
114
134
  # Explicit format is given
115
135
  return Array(format_processor[1]).first
@@ -1,7 +1,7 @@
1
1
  class Cloudinary::CarrierWave::Storage < ::CarrierWave::Storage::Abstract
2
2
  def store!(file)
3
3
  return if !uploader.enable_processing
4
- if uploader.class.version_names.blank?
4
+ if uploader.is_main_uploader?
5
5
  case file
6
6
  when Cloudinary::CarrierWave::PreloadedCloudinaryFile
7
7
  return store_cloudinary_version(file.version)
@@ -58,7 +58,7 @@ class Cloudinary::Uploader
58
58
  :type=>options[:type],
59
59
  :public_id=> public_id,
60
60
  :callback=> options[:callback],
61
- :eagar=>build_eager(options[:eager]),
61
+ :eager=>build_eager(options[:eager]),
62
62
  }
63
63
  end
64
64
  end
@@ -102,8 +102,11 @@ class Cloudinary::Utils
102
102
  end
103
103
  type ||= :upload
104
104
 
105
- source = "#{source}.#{format}" if !format.blank? && type != :fetch
106
- source = smart_escape(source) if [:fetch, :asset].include?(type)
105
+ if source.match(%r(^https?:/)i)
106
+ source = smart_escape(source)
107
+ elsif !format.blank?
108
+ source = "#{source}.#{format}"
109
+ end
107
110
 
108
111
  if cloud_name.start_with?("/")
109
112
  prefix = "/res" + cloud_name
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.0.31"
3
+ VERSION = "1.0.32"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cloudinary
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.31
4
+ version: 1.0.32
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2012-07-18 00:00:00.000000000 Z
14
+ date: 2012-07-26 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rest-client