cloudinary 1.0.27 → 1.0.28

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.
data/.gitignore CHANGED
@@ -2,3 +2,4 @@ pkg
2
2
  .project
3
3
  .rvmrc
4
4
  assets/
5
+ vendor/assets/
data/Rakefile CHANGED
@@ -2,7 +2,9 @@ require 'bundler'
2
2
  Bundler::GemHelper.install_tasks
3
3
 
4
4
  task :fetch_assets do
5
- system "/bin/rm -rf assets; mkdir -p assets; cd assets; curl -L https://github.com/cloudinary/cloudinary_js/tarball/master | tar zxvf - --strip=1"
5
+ system "/bin/rm -rf vendor/assets; mkdir -p vendor/assets; cd vendor/assets; curl -L https://github.com/cloudinary/cloudinary_js/tarball/master | tar zxvf - --strip=1"
6
+ system "mkdir -p vendor/assets/javascripts; mv vendor/assets/js vendor/assets/javascripts/cloudinary"
7
+ File.open("vendor/assets/javascripts/cloudinary/index.js", "w"){|f| f.puts "//= require_tree ."}
6
8
  end
7
9
 
8
10
  task :build=>:fetch_assets
data/cloudinary.gemspec CHANGED
@@ -13,7 +13,7 @@ Gem::Specification.new do |s|
13
13
 
14
14
  s.rubyforge_project = "cloudinary"
15
15
 
16
- s.files = `git ls-files`.split("\n") + Dir.glob("assets/*/*")
16
+ s.files = `git ls-files`.split("\n") + Dir.glob("vendor/assets/javascripts/*/*") + Dir.glob("vendor/assets/html/*")
17
17
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
@@ -32,13 +32,20 @@ module Cloudinary::CarrierWave
32
32
  if args.first && !args.first.is_a?(Hash)
33
33
  super
34
34
  else
35
- return super if self.blank?
35
+ if self.blank?
36
+ url = self.default_url
37
+ return url if !url.blank?
38
+ public_id = self.default_public_id
39
+ return nil if public_id.nil?
40
+ else
41
+ public_id = self.full_public_id
42
+ end
36
43
  options = args.extract_options!
37
44
  options = self.transformation.merge(options) if self.version_name.present?
38
- Cloudinary::Utils.cloudinary_url(self.full_public_id, {:format=>self.format}.merge(options))
45
+ Cloudinary::Utils.cloudinary_url(public_id, {:format=>self.format}.merge(options))
39
46
  end
40
47
  end
41
-
48
+
42
49
  def full_public_id
43
50
  return nil if self.blank?
44
51
  return self.my_public_id if self.stored_version.blank?
@@ -49,6 +56,11 @@ module Cloudinary::CarrierWave
49
56
  return nil if self.blank?
50
57
  return [self.full_public_id, self.format].join(".")
51
58
  end
59
+
60
+ # default public_id to use if no uploaded file. Override with public_id of an uploaded image if you want a default image.
61
+ def default_public_id
62
+ nil
63
+ end
52
64
 
53
65
  # public_id to use for uploaded file. Can be overridden by caller. Random public_id will be used otherwise.
54
66
  def public_id
@@ -109,7 +109,11 @@ module CloudinaryHelper
109
109
  CLOUDINARY_JS_CONFIG_PARAMS = [:api_key, :cloud_name, :private_cdn, :secure_distribution, :cdn_subdomain]
110
110
  def cloudinary_js_config
111
111
  params = {}
112
- CLOUDINARY_JS_CONFIG_PARAMS.each{|param| params[param] = Cloudinary.config.send(param)}
112
+ CLOUDINARY_JS_CONFIG_PARAMS.each do
113
+ |param|
114
+ value = Cloudinary.config.send(param)
115
+ params[param] = value if !value.nil?
116
+ end
113
117
  content_tag("script", "$.cloudinary.config(#{params.to_json});".html_safe, :type=>"text/javascript")
114
118
  end
115
119
 
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.0.27"
3
+ VERSION = "1.0.28"
4
4
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cloudinary
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.27
5
+ version: 1.0.28
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nadav Soferman
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2012-06-26 00:00:00 +03:00
15
+ date: 2012-07-03 00:00:00 +03:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency
@@ -76,12 +76,12 @@ files:
76
76
  - lib/tasks/cloudinary.rake
77
77
  - spec/spec_helper.rb
78
78
  - spec/utils_spec.rb
79
- - assets/html/cloudinary_cors.html
80
- - assets/js/jquery.cloudinary.js
81
- - assets/js/jquery.fileupload.js
82
- - assets/js/jquery.iframe-transport.js
83
- - assets/js/jquery.ui.widget.js
84
- - assets/test/SpecRunner.html
79
+ - vendor/assets/javascripts/cloudinary/index.js
80
+ - vendor/assets/javascripts/cloudinary/jquery.cloudinary.js
81
+ - vendor/assets/javascripts/cloudinary/jquery.fileupload.js
82
+ - vendor/assets/javascripts/cloudinary/jquery.iframe-transport.js
83
+ - vendor/assets/javascripts/cloudinary/jquery.ui.widget.js
84
+ - vendor/assets/html/cloudinary_cors.html
85
85
  has_rdoc: true
86
86
  homepage: http://cloudinary.com
87
87
  licenses: []