stavro / arc

:paperclip: Flexible file upload and attachment library for Elixir
1.17k stars 211 forks source link

Warnings during compilation on ELixir 1.8.0-otp-21.2.2 #276

Open OvermindDL1 opened 5 years ago

OvermindDL1 commented 5 years ago

Environment

Elixir 1.8.0 (compiled with Erlang/OTP 21)

* Arc version (mix deps): `arc 0.11.0 (Hex package) (mix)`
* Arc dependencies when applicable (mix deps): `arc_ecto 0.11.1 (Hex package) (mix)` (not applicable however)
* Operating system: RedHat Linux

### Expected behavior

Compiles cleanly

### Actual behavior

Gives these warnings:
```elixir
==> arc
Compiling 14 files (.ex)
warning: variable "asset_host" is unused (if the variable is not meant to be used, prefix it with an underscore)
  lib/arc/storage/s3.ex:9

warning: System.cwd/0 is deprecated. Use File.cwd/0 instead
Found at 2 locations:
  lib/mix/tasks/g.ex:49
  lib/mix/tasks/g.ex:55

warning: function ExAws.request/1 is undefined (module ExAws is not available)
Found at 3 locations:
  lib/arc/storage/s3.ex:30
  lib/arc/storage/s3.ex:45
  lib/arc/storage/s3.ex:57

warning: function ExAws.Config.new/2 is undefined (module ExAws.Config is not available)
  lib/arc/storage/s3.ex:82

warning: function ExAws.S3.delete_object/2 is undefined (module ExAws.S3 is not available)
  lib/arc/storage/s3.ex:29

warning: function ExAws.S3.presigned_url/5 is undefined (module ExAws.S3 is not available)
  lib/arc/storage/s3.ex:85

warning: function ExAws.S3.put_object/4 is undefined (module ExAws.S3 is not available)
  lib/arc/storage/s3.ex:44

warning: function ExAws.S3.upload/4 is undefined (module ExAws.S3 is not available)
  lib/arc/storage/s3.ex:56

warning: function ExAws.S3.Upload.stream_file/1 is undefined (module ExAws.S3.Upload is not available)
  lib/arc/storage/s3.ex:55

Generated arc app

First it seems that when the S3 functionality is not needed then it shouldn't be compiled in. Simply wrapping the modules with an if test of if the ExAws module is found or not along with an optional dependency on it so ExAws gets compiled first will fix 'most' of those. Another is an unused binding big and a deprecation.