Skip to content

Commit 52602bf

Browse files
committed
move project to a new repository and change name to Waffle
1 parent e2871e0 commit 52602bf

File tree

27 files changed

+222
-220
lines changed

27 files changed

+222
-220
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
erl_crash.dump
44
*.ez
55
.DS_Store
6-
/arctest
6+
/waffletest
77
/doc

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Changelog
22

3+
## v0.0.1 (2019-08-25)
4+
* Move project to a new repository and change name to `Waffle`
5+
36
## v0.11.0 (2018-10-04)
47
* (Dependency) `:httpoison` removed in favor of `:hackney`
58
* (Enhancement) Proper generator file location for Phoenix 1.3+
@@ -122,8 +125,8 @@ Since `erlcloud` has been removed from `arc`, you must also remove it from your
122125
```elixir
123126
# BEFORE
124127
config :arc,
125-
access_key_id: "###",
126-
secret_access_key: "###",
128+
access_key_id: "###",
129+
secret_access_key: "###",
127130
bucket: "uploads"
128131

129132
#AFTER

ISSUE_TEMPLATE.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
### Precheck
33
44
* Before submitting an issue, please do a quick search and make sure the bug has not yet been reported
5-
* Ensure that this issue is related to the Arc library and not one of the dependencies listed in mix.exs (Ecto, Plug, etc.)
5+
* Ensure that this issue is related to the Waffle library and not one of the dependencies listed in mix.exs (Ecto, Plug, etc.)
66
77
-->
88

99
### Environment
1010

1111
* Elixir version (elixir -v):
12-
* Arc version (mix deps):
13-
* Arc dependencies when applicable (mix deps):
12+
* Waffle version (mix deps):
13+
* Waffle dependencies when applicable (mix deps):
1414
* Operating system:
1515

1616
### Expected behavior

README.md

Lines changed: 44 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,7 @@
1-
Arc
1+
Waffle
22
===
33

4-
[![Build Status](https://semaphoreci.com/api/v1/projects/7fc62b34-c895-475e-a3a6-671fefd0c017/480818/badge.svg)](https://semaphoreci.com/stavro/arc)
5-
6-
Arc is a flexible file upload library for Elixir with straightforward integrations for Amazon S3 and ImageMagick.
4+
Waffle is a flexible file upload library for Elixir with straightforward integrations for Amazon S3 and ImageMagick.
75

86
Browse the readme below, or jump to [a full example](#full-example).
97

@@ -42,7 +40,7 @@ Add the latest stable release to your `mix.exs` file, along with the required de
4240
```elixir
4341
defp deps do
4442
[
45-
arc: "~> 0.11.0",
43+
waffle: "~> 0.0.1",
4644

4745
# If using Amazon S3:
4846
ex_aws: "~> 2.0",
@@ -58,18 +56,18 @@ Then run `mix deps.get` in your shell to fetch the dependencies.
5856

5957
### Configuration
6058

61-
Arc expects certain properties to be configured at the application level:
59+
Waffle expects certain properties to be configured at the application level:
6260

6361
```elixir
64-
config :arc,
65-
storage: Arc.Storage.S3, # or Arc.Storage.Local
62+
config :waffle,
63+
storage: Waffle.Storage.S3, # or Waffle.Storage.Local
6664
bucket: {:system, "AWS_S3_BUCKET"} # if using Amazon S3
6765
```
6866

6967
Along with any configuration necessary for ExAws.
7068

7169
### Storage Providers
72-
Arc ships with integrations for Local Storage and S3. Alternative storage providers may be supported by the community:
70+
Waffle ships with integrations for Local Storage and S3. Alternative storage providers may be supported by the community:
7371

7472
* **Rackspace** - https://github.com/lokalebasen/arc_rackspace
7573
* **Manta** - https://github.com/onyxrev/arc_manta
@@ -79,14 +77,14 @@ Arc ships with integrations for Local Storage and S3. Alternative storage provi
7977

8078
### Usage with Ecto
8179

82-
Arc comes with a companion package for use with Ecto. If you intend to use Arc with Ecto, it is highly recommended you also add the [`arc_ecto`](https://github.com/stavro/arc_ecto) dependency. Benefits include:
80+
Waffle comes with a companion package for use with Ecto. If you intend to use Waffle with Ecto, it is highly recommended you also add the [`waffle_ecto`](https://github.com/stavro/waffle_ecto) dependency. Benefits include:
8381

8482
* Changeset integration
8583
* Versioned urls for cache busting (`.../thumb.png?v=63601457477`)
8684

8785
# Getting Started: Defining your Upload
8886

89-
Arc requires a **definition module** which contains the relevant configuration to store and retrieve your files.
87+
Waffle requires a **definition module** which contains the relevant configuration to store and retrieve your files.
9088

9189
This definition module contains relevant functions to determine:
9290
* Optional transformations of the uploaded file
@@ -98,7 +96,7 @@ This definition module contains relevant functions to determine:
9896
To start off, generate an attachment definition:
9997

10098
```bash
101-
mix arc.g avatar
99+
mix waffle.g avatar
102100
```
103101

104102
This should give you a basic file in:
@@ -111,7 +109,7 @@ Check this file for descriptions of configurable options.
111109

112110
## Basics
113111

114-
There are two supported use-cases of Arc currently:
112+
There are two supported use-cases of Waffle currently:
115113

116114
1. As a general file store, or
117115
2. As an attachment to another model (the attached model is referred to as a `scope`)
@@ -152,7 +150,7 @@ This scope will be available throughout the definition module to be used as an i
152150

153151
## Transformations
154152

155-
Arc can be used to facilitate transformations of uploaded files via any system executable. Some common operations you may want to take on uploaded files include resizing an uploaded avatar with ImageMagick or extracting a still image from a video with FFmpeg.
153+
Waffle can be used to facilitate transformations of uploaded files via any system executable. Some common operations you may want to take on uploaded files include resizing an uploaded avatar with ImageMagick or extracting a still image from a video with FFmpeg.
156154

157155
To transform an image, the definition module must define a `transform/2` function which accepts a version atom and a tuple consisting of the uploaded file and corresponding scope.
158156

@@ -165,15 +163,15 @@ This transform handler accepts the version atom, as well as the file/scope argum
165163

166164
### ImageMagick transformations
167165

168-
As images are one of the most commonly uploaded filetypes, Arc has a recommended integration with ImageMagick's `convert` tool for manipulation of images. Each upload definition may specify as many versions as desired, along with the corresponding transformation for each version.
166+
As images are one of the most commonly uploaded filetypes, Waffle has a recommended integration with ImageMagick's `convert` tool for manipulation of images. Each upload definition may specify as many versions as desired, along with the corresponding transformation for each version.
169167

170168
The expected return value of a `transform` function call must either be `:noaction`, in which case the original file will be stored as-is, `:skip`, in which case nothing will be stored, or `{:convert, transformation}` in which the original file will be processed via ImageMagick's `convert` tool with the corresponding transformation parameters.
171169

172170
The following example stores the original file, as well as a squared 100x100 thumbnail version which is stripped of comments (eg, GPS coordinates):
173171

174172
```elixir
175173
defmodule Avatar do
176-
use Arc.Definition
174+
use Waffle.Definition
177175

178176
@versions [:original, :thumb]
179177

@@ -195,7 +193,7 @@ Other examples:
195193

196194
For more information on defining your transformation, please consult [ImageMagick's convert documentation](http://www.imagemagick.org/script/convert.php).
197195

198-
> **Note**: Keep this transformation function simple and deterministic based on the version, file name, and scope object. The `transform` function is subsequently called during URL generation, and the transformation is scanned for the output file format. As such, if you conditionally format the image as a `png` or `jpg` depending on the time of day, you will be displeased with the result of Arc's URL generation.
196+
> **Note**: Keep this transformation function simple and deterministic based on the version, file name, and scope object. The `transform` function is subsequently called during URL generation, and the transformation is scanned for the output file format. As such, if you conditionally format the image as a `png` or `jpg` depending on the time of day, you will be displeased with the result of Waffle's URL generation.
199197
200198
> **System Resources**: If you are accepting arbitrary uploads on a public site, it may be prudent to add system resource limits to prevent overloading your system resources from malicious or nefarious files. Since all processing is done directly in ImageMagick, you may pass in system resource restrictions through the [-limit](http://www.imagemagick.org/script/command-line-options.php#limit) flag. One such example might be: `-limit area 10MB -limit disk 100MB`.
201199
@@ -212,16 +210,16 @@ Common transformations of uploaded videos can be also defined through your defin
212210
```
213211

214212
### Complex Transformations
215-
`Arc` requires the output of your transformation to be located at a predetermined path. However, the transformation may be done completely outside of `Arc`. For fine-grained transformations, you should create an executable wrapper in your $PATH (eg. bash script) which takes these proper arguments, runs your transformation, and then moves the file into the correct location.
213+
`Waffle` requires the output of your transformation to be located at a predetermined path. However, the transformation may be done completely outside of `Waffle`. For fine-grained transformations, you should create an executable wrapper in your $PATH (eg. bash script) which takes these proper arguments, runs your transformation, and then moves the file into the correct location.
216214

217215
For example, to use `soffice` to convert a doc to an html file, you should place the following bash script in your $PATH:
218216

219217
```bash
220218
#!/usr/bin/env sh
221219

222-
# `soffice` doesn't allow for output file path option, and arc can't find the
220+
# `soffice` doesn't allow for output file path option, and waffle can't find the
223221
# temporary file to process and copy. This script has a similar argument list as
224-
# what arc expects. See https://github.com/stavro/arc/issues/77.
222+
# what waffle expects. See https://github.com/stavro/arc/issues/77.
225223

226224
set -e
227225
set -o pipefail
@@ -262,24 +260,24 @@ If you specify multiple versions in your definition module, each version is proc
262260
If you wish to change the time allocated to version transformation and storage, you may add a configuration parameter:
263261

264262
```elixir
265-
config :arc,
263+
config :waffle,
266264
:version_timeout, 15_000 # milliseconds
267265
```
268266

269267
To disable asynchronous processing, add `@async false` to your upload definition.
270268

271269
## Storage of files
272270

273-
Arc currently supports Amazon S3 and local destinations for file uploads.
271+
Waffle currently supports Amazon S3 and local destinations for file uploads.
274272

275273
### Local Configuration
276274

277-
To store your attachments locally, override the `__storage` function in your definition module to `Arc.Storage.Local`. You may wish to optionally override the storage directory as well, as outlined below.
275+
To store your attachments locally, override the `__storage` function in your definition module to `Waffle.Storage.Local`. You may wish to optionally override the storage directory as well, as outlined below.
278276

279277
```elixir
280278
defmodule Avatar do
281-
use Arc.Definition
282-
def __storage, do: Arc.Storage.Local # Add this
279+
use Waffle.Definition
280+
def __storage, do: Waffle.Storage.Local # Add this
283281
end
284282
```
285283

@@ -290,14 +288,14 @@ end
290288
To store your attachments in Amazon S3, you'll need to provide a bucket destination in your application config:
291289

292290
```elixir
293-
config :arc,
291+
config :waffle,
294292
bucket: "uploads"
295293
```
296294

297295
You may also set the bucket from an environment variable:
298296

299297
```elixir
300-
config :arc,
298+
config :waffle,
301299
bucket: {:system, "S3_BUCKET"}
302300
```
303301

@@ -317,10 +315,10 @@ This means it will first look for the AWS standard AWS_ACCESS_KEY_ID and AWS_SEC
317315

318316
**Configuration Option**
319317

320-
* `arc[:storage_dir]` - The storage directory to place files. Defaults to `uploads`, but can be overwritten via configuration options `:storage_dir`
318+
* `waffle[:storage_dir]` - The storage directory to place files. Defaults to `uploads`, but can be overwritten via configuration options `:storage_dir`
321319

322320
```elixir
323-
config :arc,
321+
config :waffle,
324322
storage_dir: "my/dir"
325323
```
326324

@@ -339,7 +337,7 @@ end
339337
340338
### Specify multiple buckets
341339

342-
Arc lets you specify a bucket on a per definition basis. In case you want to use
340+
Waffle lets you specify a bucket on a per definition basis. In case you want to use
343341
multiple buckets, you can specify a bucket in the uploader definition file
344342
like this:
345343

@@ -349,7 +347,7 @@ def bucket, do: :some_custom_bucket_name
349347

350348
### Specify multiple asset hosts
351349

352-
Arc lets you specify an asset host on a per definition basis. In case you want to use
350+
Waffle lets you specify an asset host on a per definition basis. In case you want to use
353351
multiple hosts, you can specify an asset_host in the uploader definition file
354352
like this:
355353

@@ -359,7 +357,7 @@ def asset_host, do: "https://example.com"
359357

360358
### Access Control Permissions
361359

362-
Arc defaults all uploads to `private`. In cases where it is desired to have your uploads public, you may set the ACL at the module level (which applies to all versions):
360+
Waffle defaults all uploads to `private`. In cases where it is desired to have your uploads public, you may set the ACL at the module level (which applies to all versions):
363361

364362
```elixir
365363
@acl :public_read
@@ -411,11 +409,11 @@ end
411409

412410
While storing files on S3 (rather than your harddrive) eliminates some malicious attack vectors, it is strongly encouraged to validate the extensions of uploaded files as well.
413411

414-
Arc delegates validation to a `validate/1` function with a tuple of the file and scope. As an example, to validate that an uploaded file conforms to popular image formats, you may use:
412+
Waffle delegates validation to a `validate/1` function with a tuple of the file and scope. As an example, to validate that an uploaded file conforms to popular image formats, you may use:
415413

416414
```elixir
417415
defmodule Avatar do
418-
use Arc.Definition
416+
use Waffle.Definition
419417
@extension_whitelist ~w(.jpg .jpeg .gif .png)
420418

421419
def validate({file, _}) do
@@ -450,7 +448,7 @@ def filename(version, _), do: version
450448

451449
## Object Deletion
452450

453-
After an object is stored through Arc, you may optionally remove it. To remove a stored object, pass the same path identifier and scope from which you stored the object.
451+
After an object is stored through Waffle, you may optionally remove it. To remove a stored object, pass the same path identifier and scope from which you stored the object.
454452

455453
Example:
456454

@@ -474,7 +472,7 @@ user = Repo.get!(User, 1)
474472

475473
Saving your files is only the first half of any decent storage solution. Straightforward access to your uploaded files is equally as important as storing them in the first place.
476474

477-
Often times you will want to regain access to the stored files. As such, `Arc` facilitates the generation of urls.
475+
Often times you will want to regain access to the stored files. As such, `Waffle` facilitates the generation of urls.
478476

479477
```elixir
480478
# Given some user record
@@ -497,7 +495,7 @@ Avatar.urls({"selfie.png", user}) #=> %{original: "https://.../original.png", th
497495

498496
**Default url**
499497

500-
In cases where a placeholder image is desired when an uploaded file is not present, Arc allows the definition of a default image to be returned gracefully when requested with a `nil` file.
498+
In cases where a placeholder image is desired when an uploaded file is not present, Waffle allows the definition of a default image to be returned gracefully when requested with a `nil` file.
501499

502500
```elixir
503501
def default_url(version) do
@@ -517,7 +515,7 @@ To use this style of url generation, your bucket name must be DNS compliant.
517515
This can be enabled with:
518516

519517
```elixir
520-
config :arc,
518+
config :waffle,
521519
virtual_host: true
522520
```
523521

@@ -531,16 +529,16 @@ You may optionally specify an asset host rather than using the default `bucket.s
531529
In your application configuration, you'll need to provide an `asset_host` value:
532530

533531
```elixir
534-
config :arc,
532+
config :waffle,
535533
asset_host: "https://d3gav2egqolk5.cloudfront.net", # For a value known during compilation
536534
asset_host: {:system, "ASSET_HOST"} # For a value not known until runtime
537535
```
538536

539537
### Alternate S3 configuration example
540-
If you are using a region other than US-Standard, it is necessary to specify the correct configuration for `ex_aws`. A full example configuration for both arc and ex_aws is as follows:
538+
If you are using a region other than US-Standard, it is necessary to specify the correct configuration for `ex_aws`. A full example configuration for both waffle and ex_aws is as follows:
541539

542540
```
543-
config :arc,
541+
config :waffle,
544542
bucket: "my-frankfurt-bucket"
545543
546544
config :ex_aws,
@@ -561,7 +559,7 @@ config :ex_aws,
561559

562560
```elixir
563561
defmodule Avatar do
564-
use Arc.Definition
562+
use Waffle.Definition
565563

566564
@versions [:original, :thumb]
567565
@extension_whitelist ~w(.jpg .jpeg .gif .png)
@@ -617,14 +615,15 @@ Open source contributions are welcome. All pull requests must have correspondin
617615

618616
To execute all tests locally, make sure the following system environment variables are set prior to running tests (if you wish to test `s3_test.exs`)
619617

620-
* `ARC_TEST_BUCKET`
621-
* `ARC_TEST_S3_KEY`
622-
* `ARC_TEST_S3_SECRET`
618+
* `WAFFLE_TEST_BUCKET`
619+
* `WAFFLE_TEST_S3_KEY`
620+
* `WAFFLE_TEST_S3_SECRET`
623621

624622
Then execute `mix test`.
625623

626624
## License
627625

626+
Copyright 2019 Boris Kuznetsov
628627
Copyright 2015 Sean Stavropoulos
629628

630629
Licensed under the Apache License, Version 2.0 (the "License");

config/config.exs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
use Mix.Config
22

3-
config :arc,
4-
storage: Arc.Storage.S3
3+
config :waffle,
4+
storage: Waffle.Storage.S3

lib/arc.ex

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

lib/arc/definition.ex

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

0 commit comments

Comments
 (0)