Skip to content

Commit 977319a

Browse files
authored
Merge pull request #5 from elixir-waffle/feature/2019-08-28-fix-warnings
add documentation for local development setup
2 parents 0466622 + cc93511 commit 977319a

File tree

5 files changed

+50
-3
lines changed

5 files changed

+50
-3
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Browse the readme below, or jump to [a full example](#full-example).
3434
- [URL Generation](#url-generation)
3535
- [Alternate S3 configuration example](#alternate-s3-configuration-example)
3636
- [Full example](#full-example)
37+
- [Development](/documentation/development.md)
3738

3839
## Installation
3940

docker-compose.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
version: "2.4"
2+
services:
3+
waffle:
4+
build:
5+
context: .
6+
dockerfile: Dockerfile.codeship
7+
command: tail -f /dev/null
8+
volumes:
9+
- .:/srv/app:cached

documentation/development.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Development
2+
3+
Development documentation with instructions how to setup the project for local development.
4+
5+
## Preliminary
6+
7+
* Docker
8+
9+
```sh
10+
# screen 1
11+
$ docker-compose up
12+
13+
# screen 2
14+
$ docker-compose exec waffle sh
15+
$ > mix deps.get
16+
```
17+
18+
## Run tests
19+
20+
### Tests without S3 integration
21+
```sh
22+
$ mix test
23+
```
24+
25+
### Tests with S3 integration
26+
27+
AWS S3 setup
28+
- create a new user with FullS3Access
29+
- copy `key_id` and `secret`
30+
- create a new backet with *public access*
31+
- comment the `s3` exlusion inside `test/test_helper.exs`
32+
33+
```sh
34+
$ export WAFFLE_TEST_BUCKET=
35+
$ export WAFFLE_TEST_S3_KEY=
36+
$ export WAFFLE_TEST_S3_SECRET=
37+
$ mix test
38+
```

lib/mix/tasks/g.ex

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,13 +46,13 @@ defmodule Mix.Tasks.Waffle do
4646
end
4747

4848
defp generate_uploader_file(model_name, project_module_name, path) do
49-
model_destination = Path.join(System.cwd(), "#{path}/#{underscore(model_name)}.ex")
49+
model_destination = Path.join(File.cwd!, "#{path}/#{underscore(model_name)}.ex")
5050
create_uploader(model_name, project_module_name, model_destination)
5151
end
5252

5353
defp generate_phx_uploader_file(model_name, project_module_name) do
5454
app_name = Mix.Project.config[:app]
55-
model_destination = Path.join(System.cwd(), "/lib/#{app_name}_web/uploaders/#{underscore(model_name)}.ex")
55+
model_destination = Path.join(File.cwd!, "/lib/#{app_name}_web/uploaders/#{underscore(model_name)}.ex")
5656
create_uploader(model_name, project_module_name, model_destination)
5757
end
5858

lib/waffle/storage/s3.ex

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ defmodule Waffle.Storage.S3 do
66
destination_dir = definition.storage_dir(version, {file, scope})
77
s3_bucket = s3_bucket(definition)
88
s3_key = Path.join(destination_dir, file.file_name)
9-
asset_host = asset_host(definition)
109
acl = definition.acl(version, {file, scope})
1110

1211
s3_options =

0 commit comments

Comments
 (0)