cloudinary 1.20.0 → 1.23.0

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/lib/cloudinary.rb CHANGED
@@ -133,13 +133,33 @@ module Cloudinary
133
133
  #
134
134
  # @return [OpenStruct]
135
135
  def self.make_new_config(config_module)
136
- OpenStruct.new((YAML.load(ERB.new(IO.read(config_dir.join("cloudinary.yml"))).result)[config_env] rescue {})).tap do |config|
136
+ import_settings_from_file.tap do |config|
137
137
  config.extend(config_module)
138
138
  config.load_config_from_env
139
139
  end
140
140
  end
141
141
 
142
142
  private_class_method :make_new_config
143
+
144
+ # Import settings from yaml file
145
+ #
146
+ # @return [OpenStruct]
147
+ def self.import_settings_from_file
148
+ yaml_env_config = begin
149
+ yaml_source = ERB.new(IO.read(config_dir.join("cloudinary.yml"))).result
150
+ yaml_config = if YAML.respond_to?(:safe_load)
151
+ YAML.safe_load(yaml_source, aliases: true)
152
+ else
153
+ YAML.load(yaml_source)
154
+ end
155
+ yaml_config[config_env]
156
+ rescue StandardError
157
+ {}
158
+ end
159
+ OpenStruct.new(yaml_env_config)
160
+ end
161
+
162
+ private_class_method :import_settings_from_file
143
163
  end
144
164
  # Prevent require loop if included after Rails is already initialized.
145
165
  require "cloudinary/helper" if defined?(::ActionView::Base)
@@ -802,7 +802,7 @@ var slice = [].slice,
802
802
  function TextLayer(options) {
803
803
  var keys;
804
804
  TextLayer.__super__.constructor.call(this, options);
805
- keys = ["resourceType", "resourceType", "fontFamily", "fontSize", "fontWeight", "fontStyle", "textDecoration", "textAlign", "stroke", "letterSpacing", "lineSpacing", "fontHinting", "fontAntialiasing", "text"];
805
+ keys = ["resourceType", "resourceType", "fontFamily", "fontSize", "fontWeight", "fontStyle", "textDecoration", "textAlign", "stroke", "letterSpacing", "lineSpacing", "fontHinting", "fontAntialiasing", "text", "textStyle"];
806
806
  if (options != null) {
807
807
  keys.forEach((function(_this) {
808
808
  return function(key) {
@@ -886,6 +886,11 @@ var slice = [].slice,
886
886
  return this;
887
887
  };
888
888
 
889
+ TextLayer.prototype.textStyle = function(textStyle) {
890
+ this.options.textStyle = textStyle;
891
+ return this;
892
+ };
893
+
889
894
 
890
895
  /**
891
896
  * generate the string representation of the layer
@@ -921,6 +926,10 @@ var slice = [].slice,
921
926
  };
922
927
 
923
928
  TextLayer.prototype.textStyleIdentifier = function() {
929
+ // Note: if a text-style argument is provided as a whole, it overrides everything else, no mix and match.
930
+ if (!Util.isEmpty(this.options.textStyle)) {
931
+ return this.options.textStyle;
932
+ }
924
933
  var components;
925
934
  components = [];
926
935
  if (this.options.fontWeight !== "normal") {
@@ -4302,12 +4311,20 @@ var slice = [].slice,
4302
4311
  switch (false) {
4303
4312
  case !/w_auto:breakpoints/.test(dataSrc):
4304
4313
  requiredWidth = maxWidth(containerWidth, tag);
4305
- dataSrc = dataSrc.replace(/w_auto:breakpoints([_0-9]*)(:[0-9]+)?/, "w_auto:breakpoints$1:" + requiredWidth);
4314
+ if (requiredWidth) {
4315
+ dataSrc = dataSrc.replace(/w_auto:breakpoints([_0-9]*)(:[0-9]+)?/, "w_auto:breakpoints$1:" + requiredWidth);
4316
+ } else {
4317
+ setUrl = false;
4318
+ }
4306
4319
  break;
4307
4320
  case !(match = /w_auto(:(\d+))?/.exec(dataSrc)):
4308
4321
  requiredWidth = applyBreakpoints.call(this, tag, containerWidth, match[2], options);
4309
4322
  requiredWidth = maxWidth(requiredWidth, tag);
4310
- dataSrc = dataSrc.replace(/w_auto[^,\/]*/g, "w_" + requiredWidth);
4323
+ if (requiredWidth) {
4324
+ dataSrc = dataSrc.replace(/w_auto[^,\/]*/g, "w_" + requiredWidth);
4325
+ } else {
4326
+ setUrl = false;
4327
+ }
4311
4328
  }
4312
4329
  Util.removeAttribute(tag, 'width');
4313
4330
  if (!options.responsive_preserve_height) {
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.20.0
4
+ version: 1.23.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nadav Soferman
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2021-03-26 00:00:00.000000000 Z
13
+ date: 2022-04-05 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: aws_cf_signer
@@ -276,7 +276,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
276
276
  - !ruby/object:Gem::Version
277
277
  version: '0'
278
278
  requirements: []
279
- rubygems_version: 3.1.2
279
+ rubyforge_project: cloudinary
280
+ rubygems_version: 2.7.6
280
281
  signing_key:
281
282
  specification_version: 4
282
283
  summary: Client library for easily using the Cloudinary service