Skip to content

Commit

Permalink
Merge pull request #5 from elixir-waffle/feature/2019-08-28-fix-warnings
Browse files Browse the repository at this point in the history
 add documentation for local development setup
  • Loading branch information
achempion authored Aug 29, 2019
2 parents 0466622 + cc93511 commit 977319a
Show file tree
Hide file tree
Showing 5 changed files with 50 additions and 3 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Browse the readme below, or jump to [a full example](#full-example).
- [URL Generation](#url-generation)
- [Alternate S3 configuration example](#alternate-s3-configuration-example)
- [Full example](#full-example)
- [Development](/documentation/development.md)

## Installation

Expand Down
9 changes: 9 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
version: "2.4"
services:
waffle:
build:
context: .
dockerfile: Dockerfile.codeship
command: tail -f /dev/null
volumes:
- .:/srv/app:cached
38 changes: 38 additions & 0 deletions documentation/development.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Development

Development documentation with instructions how to setup the project for local development.

## Preliminary

* Docker

```sh
# screen 1
$ docker-compose up

# screen 2
$ docker-compose exec waffle sh
$ > mix deps.get
```

## Run tests

### Tests without S3 integration
```sh
$ mix test
```

### Tests with S3 integration

AWS S3 setup
- create a new user with FullS3Access
- copy `key_id` and `secret`
- create a new backet with *public access*
- comment the `s3` exlusion inside `test/test_helper.exs`

```sh
$ export WAFFLE_TEST_BUCKET=
$ export WAFFLE_TEST_S3_KEY=
$ export WAFFLE_TEST_S3_SECRET=
$ mix test
```
4 changes: 2 additions & 2 deletions lib/mix/tasks/g.ex
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ defmodule Mix.Tasks.Waffle do
end

defp generate_uploader_file(model_name, project_module_name, path) do
model_destination = Path.join(System.cwd(), "#{path}/#{underscore(model_name)}.ex")
model_destination = Path.join(File.cwd!, "#{path}/#{underscore(model_name)}.ex")
create_uploader(model_name, project_module_name, model_destination)
end

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

Expand Down
1 change: 0 additions & 1 deletion lib/waffle/storage/s3.ex
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ defmodule Waffle.Storage.S3 do
destination_dir = definition.storage_dir(version, {file, scope})
s3_bucket = s3_bucket(definition)
s3_key = Path.join(destination_dir, file.file_name)
asset_host = asset_host(definition)
acl = definition.acl(version, {file, scope})

s3_options =
Expand Down

0 comments on commit 977319a

Please sign in to comment.