cloudinary 1.9.1 → 1.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/ISSUE_TEMPLATE/bug_report.md +42 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +21 -0
- data/.github/pull_request_template.md +24 -0
- data/.gitignore +7 -1
- data/.travis.yml +15 -8
- data/CHANGELOG.md +261 -0
- data/README.md +3 -0
- data/Rakefile +3 -45
- data/cloudinary.gemspec +27 -20
- data/lib/active_storage/blob_key.rb +20 -0
- data/lib/active_storage/service/cloudinary_service.rb +249 -0
- data/lib/cloudinary.rb +53 -63
- data/lib/cloudinary/account_api.rb +231 -0
- data/lib/cloudinary/account_config.rb +30 -0
- data/lib/cloudinary/api.rb +228 -71
- data/lib/cloudinary/auth_token.rb +10 -4
- data/lib/cloudinary/base_api.rb +79 -0
- data/lib/cloudinary/base_config.rb +70 -0
- data/lib/cloudinary/cache.rb +38 -0
- data/lib/cloudinary/cache/breakpoints_cache.rb +31 -0
- data/lib/cloudinary/cache/key_value_cache_adapter.rb +25 -0
- data/lib/cloudinary/cache/rails_cache_adapter.rb +34 -0
- data/lib/cloudinary/cache/storage/rails_cache_storage.rb +5 -0
- data/lib/cloudinary/carrier_wave.rb +4 -2
- data/lib/cloudinary/carrier_wave/remote.rb +3 -2
- data/lib/cloudinary/carrier_wave/storage.rb +2 -1
- data/lib/cloudinary/{controller.rb → cloudinary_controller.rb} +3 -5
- data/lib/cloudinary/config.rb +43 -0
- data/lib/cloudinary/helper.rb +77 -7
- data/lib/cloudinary/migrator.rb +3 -1
- data/lib/cloudinary/railtie.rb +7 -3
- data/lib/cloudinary/responsive.rb +111 -0
- data/lib/cloudinary/uploader.rb +67 -15
- data/lib/cloudinary/utils.rb +324 -54
- data/lib/cloudinary/version.rb +1 -1
- data/lib/cloudinary/video_helper.rb +96 -22
- data/lib/tasks/cloudinary/fetch_assets.rake +48 -0
- data/lib/tasks/{cloudinary.rake → cloudinary/sync_static.rake} +0 -0
- data/tools/allocate_test_cloud.sh +9 -0
- data/tools/get_test_cloud.sh +9 -0
- data/tools/update_version +220 -0
- data/vendor/assets/javascripts/cloudinary/jquery.cloudinary.js +51 -13
- data/vendor/assets/javascripts/cloudinary/jquery.fileupload.js +24 -4
- data/vendor/assets/javascripts/cloudinary/jquery.ui.widget.js +741 -561
- data/vendor/assets/javascripts/cloudinary/load-image.all.min.js +1 -1
- metadata +92 -67
- data/spec/access_control_spec.rb +0 -99
- data/spec/api_spec.rb +0 -545
- data/spec/archive_spec.rb +0 -129
- data/spec/auth_token_spec.rb +0 -79
- data/spec/cloudinary_helper_spec.rb +0 -190
- data/spec/cloudinary_spec.rb +0 -32
- data/spec/data/sync_static/app/assets/javascripts/1.coffee +0 -1
- data/spec/data/sync_static/app/assets/javascripts/1.js +0 -1
- data/spec/data/sync_static/app/assets/stylesheets/1.css +0 -3
- data/spec/docx.docx +0 -0
- data/spec/favicon.ico +0 -0
- data/spec/logo.png +0 -0
- data/spec/rake_spec.rb +0 -160
- data/spec/sample_asset_file.tsv +0 -4
- data/spec/search_spec.rb +0 -109
- data/spec/spec_helper.rb +0 -245
- data/spec/storage_spec.rb +0 -44
- data/spec/streaminig_profiles_api_spec.rb +0 -74
- data/spec/support/helpers/temp_file_helpers.rb +0 -22
- data/spec/support/shared_contexts/rake.rb +0 -19
- data/spec/uploader_spec.rb +0 -363
- data/spec/utils_methods_spec.rb +0 -54
- data/spec/utils_spec.rb +0 -906
- data/spec/video_tag_spec.rb +0 -251
- data/spec/video_url_spec.rb +0 -164
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9b641514503d45c3a6c4e8ba5ed87f0f5b8e521260eda789212543be5ccf77a1
|
4
|
+
data.tar.gz: 0f65e99aa08e446f01d783af5284a1265aaa4f28a1e95c284addd30beb36ec8c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 191f627013b5f97fca44e748fd1c4631f9af58a69680b02fdc6b4604e2ddf31216542fcb88e2d1daa825c0ff22a138f2c7d0b41d4895a69cc1b7eaa42a1ab16a
|
7
|
+
data.tar.gz: 8a5abe09f562e188e1e6d43d05f462939c62c4070ac50e93c3acaf876998e651aa2fc50775a10c5fb324d388fac9d599c5fe0e60480cdbbebeb7eedf699057e8
|
@@ -0,0 +1,42 @@
|
|
1
|
+
---
|
2
|
+
name: Bug report
|
3
|
+
about: Bug report for Cloudinary Ruby SDK
|
4
|
+
title: ''
|
5
|
+
labels: ''
|
6
|
+
assignees: const-cloudinary
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
## Bug report for Cloudinary Ruby SDK
|
11
|
+
Before proceeding, please update to latest version and test if the issue persists
|
12
|
+
|
13
|
+
## Describe the bug in a sentence or two.
|
14
|
+
…
|
15
|
+
|
16
|
+
## Issue Type (Can be multiple)
|
17
|
+
[ ] Build - Can’t install or import the SDK
|
18
|
+
[ ] Performance - Performance issues
|
19
|
+
[ ] Behaviour - Functions aren’t working as expected (Such as generate URL)
|
20
|
+
[ ] Documentation - Inconsistency between the docs and behaviour
|
21
|
+
[ ] Other (Specify)
|
22
|
+
|
23
|
+
## Steps to reproduce
|
24
|
+
… if applicable
|
25
|
+
|
26
|
+
## Error screenshots or Stack Trace (if applicable)
|
27
|
+
…
|
28
|
+
|
29
|
+
## Operating System
|
30
|
+
[ ] Linux
|
31
|
+
[ ] Windows
|
32
|
+
[ ] OSX
|
33
|
+
[ ] All
|
34
|
+
|
35
|
+
## Environment and Libraries (fill in the version numbers)
|
36
|
+
Cloudinary Ruby SDK version - 0.0.0
|
37
|
+
Ruby Version - 0.0.0
|
38
|
+
Rails Version - 0.0.0
|
39
|
+
Other Libraries (Carrierwave, ActiveStorage, etc) - 0.0.0
|
40
|
+
|
41
|
+
## Repository
|
42
|
+
If possible, please provide a link to a reproducible repository that showcases the problem
|
@@ -0,0 +1,21 @@
|
|
1
|
+
---
|
2
|
+
name: Feature request
|
3
|
+
about: Feature request for Cloudinary Ruby SDK
|
4
|
+
title: ''
|
5
|
+
labels: ''
|
6
|
+
assignees: const-cloudinary
|
7
|
+
|
8
|
+
---
|
9
|
+
|
10
|
+
## Feature request for Cloudinary Ruby SDK
|
11
|
+
…(If your feature is for other SDKs, please request them there)
|
12
|
+
|
13
|
+
|
14
|
+
## Explain your use case
|
15
|
+
… (A high level explanation of why you need this feature)
|
16
|
+
|
17
|
+
## Describe the problem you’re trying to solve
|
18
|
+
… (A more technical view of what you’d like to accomplish, and how this feature will help you achieve it)
|
19
|
+
|
20
|
+
## Do you have a proposed solution?
|
21
|
+
… (yes, no? Please elaborate if needed)
|
@@ -0,0 +1,24 @@
|
|
1
|
+
### Brief Summary of Changes
|
2
|
+
<!--
|
3
|
+
Provide some context as to what was changed, from an implementation standpoint.
|
4
|
+
-->
|
5
|
+
|
6
|
+
#### What does this PR address?
|
7
|
+
[ ] Gitub issue (Add reference - #XX)
|
8
|
+
[ ] Refactoring
|
9
|
+
[ ] New feature
|
10
|
+
[ ] Bug fix
|
11
|
+
[ ] Adds more tests
|
12
|
+
|
13
|
+
#### Are tests included?
|
14
|
+
[ ] Yes
|
15
|
+
[ ] No
|
16
|
+
|
17
|
+
#### Reviewer, Please Note:
|
18
|
+
<!--
|
19
|
+
List anything here that the reviewer should pay special attention to. This might
|
20
|
+
include, for example:
|
21
|
+
• Dependence on other PRs
|
22
|
+
• Reference to other Cloudinary SDKs
|
23
|
+
• Changes that seem arbitrary without further explanations
|
24
|
+
-->
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
@@ -1,12 +1,19 @@
|
|
1
1
|
language: ruby
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
matrix:
|
4
|
+
include:
|
5
|
+
- name: "Ruby 1.9"
|
6
|
+
dist: precise
|
7
|
+
rvm: 1.9.3
|
8
|
+
before_install:
|
9
|
+
- gem install bundler -v 1.17.3
|
10
|
+
- name: "Ruby 2.5.3"
|
11
|
+
dist: xenial
|
12
|
+
rvm: ruby-2.5.3
|
13
|
+
before_install:
|
14
|
+
- gem install bundler
|
5
15
|
|
6
|
-
|
7
|
-
|
8
|
-
-
|
9
|
-
env:
|
10
|
-
matrix:
|
11
|
-
secure: OTtg+CpNgfqJYqJk4rRZRvljss2p6nLTgBLrdUt/4hpSFLFueo0m7Jdu2zeEDPLEzMKo6zZlBp1/BPjCHtnjda7qpOQpMutEzD5EG60BG5LiMDsoAHL6apiL4zNUy8Sjcp/QslpKRozcYzogHjCnxM8RtSnW9wqiCehM5yivlj4JwU/e2x7XZGRbwW2jj4kr/BAdylYYftAaVOrl/3vqngE2tciq6YRL5GFR6o1L5ty435jsyDwEWAPs6vTLwJuEmPLJ4pEOVPOI08zOgVWKHyAWiCc7WYyBxKDmDUU9Xth922ko7nhptQUJeJuxh2dTvrPuTkibNzX1QLugX8RwzJ7pXG9iuhx14lmFbfZZtl+g2SEh5Hem5GFCVOlxpULuxZUKDcNwYURWwuoeBYpGOrOu7xn70o6cF3bNfenUJEl/ts1YgAZ/pcHmbeW95ovb+vTHj8uPk1J17FKOtXjbgblzYLwrl68ika1QfWJEYq1DcI7BT7AwsEeThPmvQ03y+lH8DrYQVprzTpjGICvMyMQSZdA8woXMeEFV0CzKew1+Q0JgjLpYDTQ6U51HEvzCZFTNoN2ZDdsdMRtkxmjBwgEQAY5+SA5icI6/uxAvloScl+7SnNiAhqyPaA2YlwZ/xhI8plvydkmK805Z1uZztGUNu0yn47FzGDC286RF/rI=
|
16
|
+
before_script: >
|
17
|
+
export CLOUDINARY_URL=$(bash tools/get_test_cloud.sh);
|
18
|
+
echo cloud_name: "$(echo $CLOUDINARY_URL | cut -d'@' -f2)"
|
12
19
|
script: bundle exec rspec
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,264 @@
|
|
1
|
+
1.20.0 / 2021-03-26
|
2
|
+
==================
|
3
|
+
|
4
|
+
New functionality and features
|
5
|
+
------------------------------
|
6
|
+
|
7
|
+
* Add support for `download_backedup_asset` helper method
|
8
|
+
* Add support for `filename_override` upload parameter
|
9
|
+
* Add support for `SHA-256` algorithm in auth signatures
|
10
|
+
|
11
|
+
Other Changes
|
12
|
+
-------------
|
13
|
+
|
14
|
+
* Fix `type` parameter support in ActiveStorage service
|
15
|
+
* Fix expression normalization in advanced cases
|
16
|
+
* Add test for context metadata as user variables
|
17
|
+
* Improve validation of auth token generation
|
18
|
+
|
19
|
+
|
20
|
+
1.19.0 / 2021-03-05
|
21
|
+
==================
|
22
|
+
|
23
|
+
New functionality and features
|
24
|
+
------------------------------
|
25
|
+
|
26
|
+
* Add Account Provisioning API
|
27
|
+
* Add support for `api_proxy` parameter
|
28
|
+
* Add support for `date` parameter in `usage` Admin API
|
29
|
+
|
30
|
+
Other Changes
|
31
|
+
-------------
|
32
|
+
|
33
|
+
* Fix direct upload of raw files
|
34
|
+
* Improve unit testing of add-ons
|
35
|
+
* Change test for `eval` upload parameter
|
36
|
+
* Bump vulnerable version of rubyzip
|
37
|
+
* Fix `cloudinary.gemspec` glob issue
|
38
|
+
|
39
|
+
1.18.1 / 2020-09-30
|
40
|
+
===================
|
41
|
+
|
42
|
+
* Update embedded `jquery.cloudinary.js` to fix ES5 compatibility issue
|
43
|
+
|
44
|
+
1.18.0 / 2020-09-27
|
45
|
+
===================
|
46
|
+
|
47
|
+
New functionality and features
|
48
|
+
------------------------------
|
49
|
+
* Add `download_folder` helper
|
50
|
+
* Add support for `sources` in `video` tag
|
51
|
+
* Add structured metadata to Admin and Upload API
|
52
|
+
|
53
|
+
Other Changes
|
54
|
+
-------------
|
55
|
+
* Fix download of a raw file in ActiveStorage
|
56
|
+
* Update embedded `jquery.cloudinary.js` to fix ES5 compatibility issue
|
57
|
+
|
58
|
+
1.17.1 / 2020-08-25
|
59
|
+
===================
|
60
|
+
|
61
|
+
* Fix options handling issue in SassC
|
62
|
+
|
63
|
+
1.17.0 / 2020-08-21
|
64
|
+
===================
|
65
|
+
|
66
|
+
New functionality and features
|
67
|
+
------------------------------
|
68
|
+
|
69
|
+
* Add support for `eval` upload parameter
|
70
|
+
* Add support for 32-char signature length
|
71
|
+
|
72
|
+
Other Changes
|
73
|
+
-------------
|
74
|
+
|
75
|
+
* Fix escaping of query string characters in CarrierWave integration
|
76
|
+
* Fix detection integration test
|
77
|
+
* Integrate with sub-account test service
|
78
|
+
* Add pull request template
|
79
|
+
|
80
|
+
1.16.1 / 2020-07-06
|
81
|
+
===================
|
82
|
+
|
83
|
+
* Detect data URLs with suffix in mime type
|
84
|
+
* Fix `Invalid regular expression` error in Safari
|
85
|
+
|
86
|
+
1.16.0 / 2020-06-29
|
87
|
+
===================
|
88
|
+
|
89
|
+
New functionality and features
|
90
|
+
------------------------------
|
91
|
+
|
92
|
+
* Add support for uploading `StringIO`
|
93
|
+
|
94
|
+
Other Changes
|
95
|
+
-------------
|
96
|
+
|
97
|
+
* Set default cache storage to `file` in `CarrierWave`
|
98
|
+
* Fix `normalize_expression` to ignore predefined variables
|
99
|
+
* Fix sample projects
|
100
|
+
|
101
|
+
1.15.0 / 2020-06-11
|
102
|
+
===================
|
103
|
+
|
104
|
+
New functionality and features
|
105
|
+
------------------------------
|
106
|
+
|
107
|
+
* Add support for `accessibility_analysis` parameter
|
108
|
+
|
109
|
+
Other Changes
|
110
|
+
-------------
|
111
|
+
* Fix `download` function in `Cloudinary::CarrierWave`
|
112
|
+
* Fix handling of empty value in `if` parameter
|
113
|
+
* Fix consumption of configuration from environment variables
|
114
|
+
|
115
|
+
1.14.0 / 2020-05-06
|
116
|
+
===================
|
117
|
+
|
118
|
+
New functionality and features
|
119
|
+
------------------------------
|
120
|
+
|
121
|
+
* Add support of global folder in ActiveStorage
|
122
|
+
* Add duration to conditions in video
|
123
|
+
|
124
|
+
Other Changes
|
125
|
+
-------------
|
126
|
+
|
127
|
+
* Fix `URI.unescape is obsolete` warning
|
128
|
+
* Fix lingering Rails 6 autoload warnings
|
129
|
+
* Fix Ruby 1.9 CI build
|
130
|
+
* Allow setting uploader timeout to `nil`
|
131
|
+
* Update link to CarrierWave integration
|
132
|
+
* Update issue templates
|
133
|
+
|
134
|
+
1.13.2 / 2020-01-19
|
135
|
+
===================
|
136
|
+
|
137
|
+
* Fix asset extension detection in active storage service `url` method
|
138
|
+
|
139
|
+
1.13.1 / 2019-11-24
|
140
|
+
===================
|
141
|
+
|
142
|
+
* Remove `test_files` from `gemspec`
|
143
|
+
* Remove redundant binary files from `active_storage` spec
|
144
|
+
* Fix `rspec` deprecation warnings in Rails 6
|
145
|
+
* Add test for uploading IO
|
146
|
+
|
147
|
+
1.13.0 / 2019-11-14
|
148
|
+
===================
|
149
|
+
|
150
|
+
New functionality and features
|
151
|
+
------------------------------
|
152
|
+
* Add `SassC` `cloudinary-url` function
|
153
|
+
|
154
|
+
Other Changes
|
155
|
+
-------------
|
156
|
+
|
157
|
+
* Fix ActiveStorage download not using `ssl` for `https`
|
158
|
+
* Fix resource type detection in ActiveStorage
|
159
|
+
* Fix `storage_type` instance method in `Cloudinary::CarrierWave` module
|
160
|
+
* Fix sample project, limit sqlite3 to a compatible version
|
161
|
+
|
162
|
+
1.12.0 / 2019-10-02
|
163
|
+
=============
|
164
|
+
|
165
|
+
New functionality and features
|
166
|
+
------------------------------
|
167
|
+
|
168
|
+
* Add Cloudinary service for ActiveStorage
|
169
|
+
* Add `create_folder` Admin API method
|
170
|
+
* Add `delete_folder` Admin API method
|
171
|
+
* Add `cinemagraph_analysis` to `upload`, `explicit` and `resource` API methods
|
172
|
+
* Add `font_antialiasing` and `font_hinting` text style parameters
|
173
|
+
* Add `derived_next_cursor` parameter to `resource` Admin API
|
174
|
+
* Add `next_cursor` and `max_results` for `root_folders` and `subfolders` Admin API functions
|
175
|
+
* Add `jpeg` to `IMAGE_FORMATS`
|
176
|
+
* Add `pow` transformation operator
|
177
|
+
* Add `force_version` to `cloudinary_url`
|
178
|
+
* Support per corner values for the `radius` transformation parameter
|
179
|
+
* Support using multiple resource types when generating archives
|
180
|
+
* Support Google Storage fetch URL
|
181
|
+
|
182
|
+
Other Changes
|
183
|
+
-------------
|
184
|
+
* Ensure `CLOUDINARY_URL` starts with `cloudinary://`
|
185
|
+
* Reduce memory usage in `Cloudinary::Utils.cloudinary_url`
|
186
|
+
* Encode URL in Admin API methods
|
187
|
+
* Fix base64 data validation
|
188
|
+
* Return `video` as the `resource_type` for audio files
|
189
|
+
* Add language and platform version for ruby/rails user agent
|
190
|
+
* Fix TravisCI configuration for ruby 1.9
|
191
|
+
|
192
|
+
|
193
|
+
1.11.1 / 2018-12-22
|
194
|
+
===================
|
195
|
+
|
196
|
+
* Merge pull request #330 from langsharpe/constant_nil_is_deprecated
|
197
|
+
* Replace `NIL` with `Nil` to fix ruby 2.4 deprecation warning
|
198
|
+
|
199
|
+
1.11.0 / 2018-12-12
|
200
|
+
===================
|
201
|
+
|
202
|
+
New functionality and features
|
203
|
+
------------------------------
|
204
|
+
|
205
|
+
* Support new parameters and values:
|
206
|
+
* `auto` keyword in the `start_offset`
|
207
|
+
* `art` artistic effect
|
208
|
+
* `fps`
|
209
|
+
* `quality_analysis`
|
210
|
+
* `quality_override`
|
211
|
+
* `pre` custom function transformation
|
212
|
+
* Add namespace to the cloudinary controller to avoiding conflicts (#319)
|
213
|
+
|
214
|
+
Other Changes
|
215
|
+
-------------
|
216
|
+
|
217
|
+
* Add "Join the Community"
|
218
|
+
* Merge pull request #290 from zenspider/fix_carrierwave_deps
|
219
|
+
* Fixed direct references to ::CarrierWave with `defined?` guards.
|
220
|
+
* Fix debugging output to use mutex so output isn't garbled.
|
221
|
+
|
222
|
+
1.10.1-rc / 2018-11-20
|
223
|
+
======================
|
224
|
+
|
225
|
+
* Fix transformation list test
|
226
|
+
* Fix detection test
|
227
|
+
* Remove encrypted variables from .travis.yml
|
228
|
+
* Update dependencies
|
229
|
+
* Support "pre" versions in update_version
|
230
|
+
|
231
|
+
1.10.0 / 2018-11-08
|
232
|
+
===================
|
233
|
+
|
234
|
+
New functionality and features
|
235
|
+
------------------------------
|
236
|
+
|
237
|
+
* Add the `custom_function` transformation parameter
|
238
|
+
* Add Picture and source tags
|
239
|
+
* Add `srcset` attribute to image tag
|
240
|
+
* Add support for overlays of type fetch
|
241
|
+
* Add breakpoints cache
|
242
|
+
|
243
|
+
Other Changes
|
244
|
+
-------------
|
245
|
+
|
246
|
+
* Add `update_version` script
|
247
|
+
* Fix transformations test
|
248
|
+
* Replace ruby list notation to support older ruby versions
|
249
|
+
* Refactor tests
|
250
|
+
* Replace REXML with Nokogiri
|
251
|
+
* Un-ignore the lib folder
|
252
|
+
* Ignore empty transformations when processing an array of transformations
|
253
|
+
* Restore configuration after each test
|
254
|
+
* Limit Rack version to fix compatibility issues with ruby 1.9.3
|
255
|
+
* Fix context escaping in call_context_api
|
256
|
+
* Fix uploadLarge to use X-Unique-Upload-Id
|
257
|
+
* Add test cases of OCR for upload and URL generation
|
258
|
+
* Add test case of conditional tags
|
259
|
+
* Fix expected result in cname with cdn_subdomain test
|
260
|
+
* Fix raw conversion test
|
261
|
+
* Raise exception when api-secret is missing in signed-url flow
|
1
262
|
|
2
263
|
1.9.1 / 2018-03-06
|
3
264
|
==================
|
data/README.md
CHANGED
@@ -266,6 +266,9 @@ Contact us [https://cloudinary.com/contact](https://cloudinary.com/contact)
|
|
266
266
|
|
267
267
|
Stay tuned for updates, tips and tutorials: [Blog](https://cloudinary.com/blog), [Twitter](https://twitter.com/cloudinary), [Facebook](https://www.facebook.com/Cloudinary).
|
268
268
|
|
269
|
+
## Join the Community ##########################################################
|
270
|
+
|
271
|
+
Impact the product, hear updates, test drive new features and more! Join [here](https://www.facebook.com/groups/CloudinaryCommunity).
|
269
272
|
|
270
273
|
## License #######################################################################
|
271
274
|
|
data/Rakefile
CHANGED
@@ -1,55 +1,13 @@
|
|
1
1
|
require 'bundler'
|
2
2
|
require 'fileutils'
|
3
|
-
require 'tmpdir'
|
4
|
-
require 'rest_client'
|
5
|
-
require 'json'
|
6
|
-
require 'rubygems/package'
|
7
|
-
|
8
3
|
require 'rspec/core/rake_task'
|
4
|
+
|
9
5
|
RSpec::Core::RakeTask.new(:spec)
|
10
6
|
task :default => :spec
|
11
7
|
|
12
8
|
Bundler::GemHelper.install_tasks
|
13
9
|
|
14
|
-
|
15
|
-
|
16
|
-
task :fetch_assets do
|
17
|
-
index_files = %w[jquery.ui.widget.js jquery.iframe-transport.js jquery.fileupload.js jquery.cloudinary.js]
|
18
|
-
processing_files = %w[canvas-to-blob.min.js load-image.all.min.js jquery.fileupload-process.js jquery.fileupload-image.js jquery.fileupload-validate.js]
|
19
|
-
files = index_files + processing_files
|
20
|
-
|
21
|
-
release = JSON(RestClient.get("https://api.github.com/repos/cloudinary/cloudinary_js/releases/latest"))
|
22
|
-
|
23
|
-
FileUtils.rm_rf 'vendor/assets'
|
24
|
-
html_folder = 'vendor/assets/html'
|
25
|
-
FileUtils.mkdir_p html_folder
|
26
|
-
js_folder = 'vendor/assets/javascripts/cloudinary'
|
27
|
-
FileUtils.mkdir_p js_folder
|
28
|
-
|
29
|
-
puts "Fetching cloudinary_js version #{release["tag_name"]}\n\n"
|
30
|
-
sio = StringIO.new(RestClient.get(release["tarball_url"]).body)
|
31
|
-
file =Zlib::GzipReader.new(sio)
|
32
|
-
tar = Gem::Package::TarReader.new(file)
|
33
|
-
tar.each_entry do |entry|
|
34
|
-
name = File.basename(entry.full_name)
|
35
|
-
if files.include? name
|
36
|
-
js_full_name = File.join(js_folder, name)
|
37
|
-
puts "Adding #{js_full_name}"
|
38
|
-
File.write js_full_name, entry.read
|
39
|
-
elsif name == 'cloudinary_cors.html'
|
40
|
-
html_full_name = File.join(html_folder, name)
|
41
|
-
puts "Adding #{html_full_name}"
|
42
|
-
File.write html_full_name, entry.read
|
43
|
-
end
|
44
|
-
end
|
45
|
-
puts "Creating 'index.js' and 'processing.js' files"
|
46
|
-
File.open("vendor/assets/javascripts/cloudinary/index.js", "w") do |f|
|
47
|
-
index_files.each { |name| f.puts "//= require ./#{name}" }
|
48
|
-
end
|
49
|
-
File.open("vendor/assets/javascripts/cloudinary/processing.js", "w") do |f|
|
50
|
-
processing_files.each { |name| f.puts "//= require ./#{name}" }
|
51
|
-
end
|
52
|
-
end
|
10
|
+
path = File.expand_path(__dir__)
|
11
|
+
Dir.glob("#{path}/lib/tasks/**/*.rake").each { |f| import f }
|
53
12
|
|
54
|
-
end
|
55
13
|
task :build => "cloudinary:fetch_assets"
|