Skip to content

Commit bb30820

Browse files
Migrate to GitHub Actions
1 parent 9afff31 commit bb30820

File tree

15 files changed

+411
-150
lines changed

15 files changed

+411
-150
lines changed

.github/workflows/ci.yml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
name: CI
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
strategy:
9+
fail-fast: false
10+
matrix:
11+
scala-version: ['2.11.8', '2.12.8']
12+
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up JDK 8 with SBT cache
18+
uses: actions/setup-java@v4
19+
with:
20+
distribution: 'temurin'
21+
java-version: '8'
22+
cache: 'sbt'
23+
24+
- name: Install SBT and jq
25+
run: |
26+
sudo apt-get update
27+
sudo apt-get install -y apt-transport-https curl gnupg jq
28+
echo "deb https://repo.scala-sbt.org/scalasbt/debian all main" | sudo tee /etc/apt/sources.list.d/sbt.list
29+
curl -sL "https://keyserver.ubuntu.com/pks/lookup?op=get&search=0x2EE0EA64E40A89B84B2DF73499E82A75642AC823" | sudo apt-key add
30+
sudo apt-get update
31+
sudo apt-get install -y sbt
32+
33+
- name: Set CLOUDINARY_URL
34+
run: |
35+
export CLOUDINARY_URL=$(bash tools/get_test_cloud.sh)
36+
echo "cloud_name: $(echo $CLOUDINARY_URL | cut -d'@' -f2)"
37+
echo "CLOUDINARY_URL=$CLOUDINARY_URL" >> $GITHUB_ENV
38+
39+
- name: Run tests
40+
run: sbt ++${{ matrix.scala-version }} test
41+
env:
42+
CLOUDINARY_URL: ${{ env.CLOUDINARY_URL }}

.travis.yml

Lines changed: 0 additions & 15 deletions
This file was deleted.

README.md

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
[![Build Status](https://travis-ci.org/cloudinary/cloudinary_scala.svg)](https://travis-ci.org/cloudinary/cloudinary_scala)
1+
[![Build Status](https://github.com/cloudinary/cloudinary_scala/actions/workflows/ci.yml/badge.svg)](https://github.com/cloudinary/cloudinary_scala/actions)
22

33
> The Scala SDK is **deprecated** and is no longer maintained, with the exception of any high-priority regression bugs that may arise.
4-
>
4+
>
55
> We recommend that you use one of Cloudinary's many active and fully supported SDKs. For details and complete documentation on all available
66
[GitHub](https://github.com/search?o=desc&q=topic%3Acloudinary-sdk+org%3Acloudinary+fork%3Atrue&s=stars&type=Repositories), see our [Cloudinary SDK Guides](https://cloudinary.com/documentation/cloudinary_sdks).
77

88

99
Cloudinary
1010
==========
1111

12-
Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.
12+
Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.
1313

14-
Easily upload images to the cloud. Automatically perform smart image resizing, cropping and conversion without installing any complex software.
15-
Integrate Facebook or Twitter profile image extraction in a snap, in any dimension and style to match your website’s graphics requirements.
16-
Images are seamlessly delivered through a fast CDN, and much much more.
14+
Easily upload images to the cloud. Automatically perform smart image resizing, cropping and conversion without installing any complex software.
15+
Integrate Facebook or Twitter profile image extraction in a snap, in any dimension and style to match your website’s graphics requirements.
16+
Images are seamlessly delivered through a fast CDN, and much much more.
1717

1818
Cloudinary offers comprehensive APIs and administration capabilities and is easy to integrate with any web application, existing or new.
1919

20-
Cloudinary provides URL and HTTP based APIs that can be easily integrated with any Web development framework.
20+
Cloudinary provides URL and HTTP based APIs that can be easily integrated with any Web development framework.
2121

2222
For Scala, Cloudinary provides a library for simplifying the integration even further. A Scala Play plugin is provided as well.
2323

@@ -28,9 +28,9 @@ For Scala, Cloudinary provides a library for simplifying the integration even fu
2828
The Play 2.4 branch is not currently published to a Maven repository. To use it in your project you can run `sbt publishLocal`.
2929

3030
To use it, add the following dependency to your `build.sbt`:
31-
31+
3232
resolvers += Resolver.file("Local Ivy", file(Path.userHome + "/.ivy2/local"))(Resolver.ivyStylePatterns)
33-
33+
3434
libraryDependencies += "com.cloudinary" %% "cloudinary-core-scala" % "2.0.0"
3535

3636
If using the [Play 2.4](http://www.playframework.com/) you can add:
@@ -41,7 +41,7 @@ In your controller inject an instance of `CloudinaryResourceBuilder` and make su
4141

4242
```scala
4343
class PhotosController @Inject() (cloudinaryResourceBuilder: CloudinaryResourceBuilder) extends Controller {
44-
44+
4545
implicit val cld:com.cloudinary.Cloudinary = cloudinaryResourceBuilder.cld
4646
import cloudinaryResourceBuilder.preloadedFormatter
4747
..
@@ -53,15 +53,15 @@ To use it in a view or to use one of the included view helpers have your Twirl v
5353
```
5454
@(implicit cld:com.cloudinary.Cloudinary)
5555
...
56-
<img src="@url("officialchucknorrispage", Set('format -> "png", 'type -> "facebook",
56+
<img src="@url("officialchucknorrispage", Set('format -> "png", 'type -> "facebook",
5757
'transformation -> Transformation().h_(95).w_(95).c_("thumb").g_("face").e_("sepia").r_(20)./.a_(10)))">
5858
```
5959

6060
## Try it right away
6161

6262
Sign up for a [free account](https://cloudinary.com/users/register/free) so you can try out image transformations and seamless image delivery through CDN.
6363

64-
*Note: Replace `demo` in all the following examples with your Cloudinary's `cloud name`.*
64+
*Note: Replace `demo` in all the following examples with your Cloudinary's `cloud name`.*
6565

6666
Accessing an uploaded image with the `sample` public ID through a CDN:
6767

@@ -75,7 +75,7 @@ Generating a 150x100 version of the `sample` image and downloading it through a
7575

7676
![Sample 150x100](https://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill/sample.jpg "Sample 150x100")
7777

78-
Converting to a 150x100 PNG with rounded corners of 20 pixels:
78+
Converting to a 150x100 PNG with rounded corners of 20 pixels:
7979

8080
http://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill,r_20/sample.png
8181

@@ -84,12 +84,12 @@ Converting to a 150x100 PNG with rounded corners of 20 pixels:
8484
For plenty more transformation options, see our [image transformations documentation](http://cloudinary.com/documentation/image_transformations).
8585

8686
Generating a 120x90 thumbnail based on automatic face detection of the Facebook profile picture of Bill Clinton:
87-
87+
8888
http://res.cloudinary.com/demo/image/facebook/c_thumb,g_face,h_90,w_120/billclinton.jpg
89-
89+
9090
![Facebook 90x120](https://res.cloudinary.com/demo/image/facebook/c_thumb,g_face,h_90,w_120/billclinton.jpg "Facebook 90x200")
9191

92-
For more details, see our documentation for embedding [Facebook](http://cloudinary.com/documentation/facebook_profile_pictures) and [Twitter](http://cloudinary.com/documentation/twitter_profile_pictures) profile pictures.
92+
For more details, see our documentation for embedding [Facebook](http://cloudinary.com/documentation/facebook_profile_pictures) and [Twitter](http://cloudinary.com/documentation/twitter_profile_pictures) profile pictures.
9393

9494

9595
## Usage
@@ -98,14 +98,14 @@ For more details, see our documentation for embedding [Facebook](http://cloudina
9898

9999
#### When using the client library directly
100100

101-
Each request for building a URL of a remote cloud resource must have the `cloud_name` parameter set.
102-
Each request to our secure APIs (e.g., image uploads, eager sprite generation) must have the `api_key` and `api_secret` parameters set.
101+
Each request for building a URL of a remote cloud resource must have the `cloud_name` parameter set.
102+
Each request to our secure APIs (e.g., image uploads, eager sprite generation) must have the `api_key` and `api_secret` parameters set.
103103
See [API, URLs and access identifiers](http://cloudinary.com/documentation/api_and_access_identifiers) for more details.
104104

105-
Setting the `cloud_name`, `api_key` and `api_secret` parameters can be done either directly in each call to a Cloudinary method,
105+
Setting the `cloud_name`, `api_key` and `api_secret` parameters can be done either directly in each call to a Cloudinary method,
106106
by initializing the Cloudinary object, or by using the CLOUDINARY_URL environment variable / system property.
107107

108-
The entry point of the library is the Cloudinary object.
108+
The entry point of the library is the Cloudinary object.
109109

110110
```scala
111111
val cloudinary = new Cloudinary()
@@ -149,16 +149,16 @@ cloudinary.url().transformation(Transformation().width(100).height(150).
149149
generate("sample.jpg")
150150
```
151151

152-
Another example, emedding a smaller version of an uploaded image while generating a 90x90 face detection based thumbnail (note the shorter syntax):
152+
Another example, emedding a smaller version of an uploaded image while generating a 90x90 face detection based thumbnail (note the shorter syntax):
153153

154154
```scala
155155
cloudinary.url().transformation(Transformation().w_(90).h_(90).
156156
c_("thumb").g_("face")).
157157
generate("woman.jpg")
158158
```
159159

160-
You can provide either a Facebook name or a numeric ID of a Facebook profile or a fan page.
161-
160+
You can provide either a Facebook name or a numeric ID of a Facebook profile or a fan page.
161+
162162
Embedding a Facebook profile to match your graphic design is very simple:
163163

164164
```scala
@@ -167,7 +167,7 @@ cloudinary.url().type("facebook").
167167
crop("fill").gravity("north_west")).
168168
generate("billclinton.jpg")
169169
```
170-
170+
171171
Same goes for Twitter:
172172

173173
```scala
@@ -177,9 +177,9 @@ cloudinary.url().type("twitter_name").generate("billclinton.jpg")
177177
### Upload
178178

179179
Assuming you have your Cloudinary configuration parameters defined (`cloud_name`, `api_key`, `api_secret`), uploading to Cloudinary is very simple.
180-
181-
The following example uploads a local JPG to the cloud:
182-
180+
181+
The following example uploads a local JPG to the cloud:
182+
183183
```scala
184184
cloudinary.uploader().upload("my_picture.jpg")
185185
```
@@ -189,23 +189,23 @@ The uploaded image is assigned a randomly generated public ID. The image is imme
189189
```scala
190190
cloudinary.url().generate("abcfrmo8zul1mafopawefg.jpg")
191191
```
192-
192+
193193
http://res.cloudinary.com/demo/image/upload/abcfrmo8zul1mafopawefg.jpg
194194

195-
You can also specify your own public ID:
195+
You can also specify your own public ID:
196196

197197
```scala
198198
import com.cloudinary.parameters.UploadParameters
199199
import com.cloudinary.Implicits._
200200

201-
cloudinary.uploader().upload("http://www.example.com/image.jpg",
201+
cloudinary.uploader().upload("http://www.example.com/image.jpg",
202202
UploadParameters(publicId = "sample_remote"))
203203

204204
cloudinary.url().generate("sample_remote.jpg")
205205
```
206206

207207
http://res.cloudinary.com/demo/image/upload/sample_remote.jpg
208-
208+
209209
### Play Helpers
210210

211211
Import using:
@@ -219,10 +219,10 @@ Returns the URL to Cloudinary encoding transformation and URL options:
219219
Usage:
220220

221221
@url("sample", Set('transformation -> Transformation().width(100).height(100).crop("fill"), 'format -> "png"))
222-
222+
223223
# http://res.cloudinary.com/cloud_name/image/upload/c_fill,h_100,w_100/sample.png
224224

225-
225+
226226
## Additional resources ##########################################################
227227

228228
Additional resources are available at:

cloudinary-core/src/main/scala/com/cloudinary/Api.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ object Api {
1818
case object POST extends HttpMethod("POST")
1919
case object PUT extends HttpMethod("PUT")
2020
case object DELETE extends HttpMethod("DELETE")
21-
21+
2222
abstract class ListDirection(val dir:String)
2323
case object ASCENDING extends ListDirection("asc")
2424
case object DESCENDING extends ListDirection("desc")
@@ -205,7 +205,7 @@ class Api(implicit cloudinary: Cloudinary) {
205205

206206
def transformation(t: Transformation, nextCursor: Option[String] = None, maxResults: Option[Int] = None):Future[TransformationResponse] =
207207
transformationByName(t.generate, nextCursor, maxResults)
208-
208+
209209
def deleteTransformation(transformation: String):Future[TransformationUpdateResponse] = {
210210
callApi[TransformationUpdateResponse](Api.DELETE, "transformations" :: transformation :: Nil, Map());
211211
}

cloudinary-core/src/main/scala/com/cloudinary/HttpClient.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ object HttpClient {
8282

8383

8484

85-
}
85+
}

cloudinary-core/src/main/scala/com/cloudinary/Parameters.scala

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ trait ParamFactory {
2929
def apply(key:String, value: Any) = param(key, value)
3030

3131
def parameters: Map[String, _]
32-
32+
3333
type Self
3434
protected def factory: Map[String,_] => Self
3535
protected def param(key:String, value:Any):Self = factory(parameters + (key -> value))
36-
36+
3737
private def buildEager(transformations: Iterable[Transformation]): String =
3838
transformations.map {
3939
transformation: Transformation =>
@@ -74,7 +74,7 @@ trait UploadableResourceParams extends ParamFactory {
7474
def callback(value:String) = param("callback" , value)
7575
def format(value:String) = param("format" , value)
7676
def `type`(value:String) = param("type" , value)
77-
def eager(value:List[Transformation]) = param("eager" , Transformations(value))
77+
def eager(value:List[Transformation]) = param("eager" , Transformations(value))
7878
def notificationUrl(value:String) = param("notification_url" , value)
7979
def eagerNotificationUrl(value:String) = param("eager_notification_url" , value)
8080
def proxy(value:String) = param("proxy" , value)
@@ -109,14 +109,10 @@ case class UploadParameters(parameters: Map[String, _] = Map(), signed:Boolean =
109109
protected val factory = (p: Map[String, _]) => UploadParameters(p, signed)
110110
}
111111

112-
case class LargeUploadParameters(parameters: Map[String, _] = Map()) extends ParamFactory {
112+
case class LargeUploadParameters(parameters: Map[String, _] = Map(), signed: Boolean = true) extends UploadableResourceParams with UpdateableResourceParams {
113113
type Self = LargeUploadParameters
114-
protected val factory = LargeUploadParameters.apply _
115-
def `type`(value:String) = param("type" , value)
116-
def publicId(value:String) = param("public_id" , value)
117-
def backup(backup:Boolean) = param("backup" , backup)
114+
protected val factory = (p: Map[String, _]) => LargeUploadParameters(p, signed)
118115
def uploadId(value:String) = param("upload_id" , value)
119-
def tags(value:Set[String]) = param("tags" , StringSet(value))
120116
}
121117

122118
case class TextParameters(text: String,
@@ -168,4 +164,4 @@ object SearchParameters {
168164
renameTo("nextCursor", "next_cursor") orElse
169165
renameTo("withField", "with_field") orElse
170166
renameTo("sortBy", "sort_by"))
171-
}
167+
}

0 commit comments

Comments
 (0)