Skip to content

Commit 9594d92

Browse files
committed
chore: add license + init doc
1 parent da0e7a6 commit 9594d92

24 files changed

+120
-17
lines changed

.credo.exs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
included: [
2525
"lib/",
2626
"src/",
27-
"test/",
2827
"web/",
2928
"apps/*/lib/",
3029
"apps/*/src/",

.formatter.exs

-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# Used by "mix format"
21
[
32
import_deps: [:ecto_sql, :ecto, :phoenix],
43
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
# Changelog

LICENSE.md

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# MIT License
2+
3+
Copyright (c) 2023 Stéphane Robino
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
6+
7+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
8+
9+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

+1-9
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,6 @@
11
# CloudStorage
22

3-
Direct upload backend.
4-
5-
**TODO:**
6-
7-
- [ ] Upload schema
8-
- [ ] Upload controller
9-
- [ ] Upload field type
10-
- [ ] Set up orphan tracking
11-
- [ ] Set up clean orphan uploads
3+
Direct upload with Elixir / Phoenix
124

135
## Installation
146

lib/cloud_storage.ex

+3
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,5 @@
11
defmodule CloudStorage do
2+
@moduledoc """
3+
# TODO
4+
"""
25
end

lib/cloud_storage/cleaner.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule CloudStorage.Cleaner do
2+
@moduledoc """
3+
# TODO
4+
"""
5+
26
alias CloudStorage.Uploads
37
use GenServer
48

lib/cloud_storage/router.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule CloudStorage.Router do
2+
@moduledoc """
3+
# TODO
4+
"""
5+
26
defmacro cloud_storage_routes(path, controller, options \\ []) do
37
quote bind_quoted: binding() do
48
import Phoenix.Router

lib/cloud_storage/storage.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule CloudStorage.Storage do
2+
@moduledoc """
3+
# TODO
4+
"""
5+
26
alias CloudStorage.Uploads.Upload
37

48
@callback presign_url(uploader :: module(), upload :: Upload.t()) ::

lib/cloud_storage/storage/s3.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule CloudStorage.Storage.S3 do
2+
@moduledoc """
3+
# TODO
4+
"""
5+
26
@behaviour CloudStorage.Storage
37

48
@impl true

lib/cloud_storage/synchronizer.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule CloudStorage.Synchronizer do
2+
@moduledoc """
3+
# TODO
4+
"""
5+
26
alias CloudStorage.Uploads
37
use GenServer
48

lib/cloud_storage/uploader.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule CloudStorage.Uploader do
2+
@moduledoc """
3+
### Usage
4+
5+
"""
26
@callback bucket() :: binary()
37
@callback storage() :: module()
48
@callback storage_dir(scope :: map()) :: binary()

lib/cloud_storage/uploader/controller.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
defmodule CloudStorage.Uploader.Controller do
2+
@moduledoc false
3+
24
import Phoenix.Controller
35
alias Inspect.Ecto.Changeset
46
alias CloudStorage.Storage
@@ -9,6 +11,8 @@ defmodule CloudStorage.Uploader.Controller do
911
defmacro __using__(_) do
1012
quote do
1113
defmodule Controller do
14+
@moduledoc false
15+
1216
@uploader __MODULE__ |> Module.split() |> Enum.drop(-1) |> Module.concat()
1317

1418
use Phoenix.Controller

lib/cloud_storage/uploader/store.ex

+2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
defmodule CloudStorage.Uploader.Store do
2+
@moduledoc false
3+
24
defmacro __using__(options) do
35
quote do
46
@options unquote(options)

lib/cloud_storage/uploader/type.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
defmodule CloudStorage.Uploader.Type do
2+
@moduledoc false
3+
24
defmacro __using__(_) do
35
quote do
46
defmodule Type do
7+
@moduledoc false
8+
59
use Ecto.Type
610

711
@uploader __MODULE__ |> Module.split() |> Enum.drop(-1) |> Module.concat()

lib/cloud_storage/uploads.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule CloudStorage.Uploads do
2+
@moduledoc """
3+
# TODO
4+
"""
5+
26
import Ecto.Query
37
alias Ecto.Multi
48
alias CloudStorage.Uploads.{DeleteLog, Log, Upload}

lib/cloud_storage/uploads/delete_log.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule CloudStorage.Uploads.DeleteLog do
2+
@moduledoc """
3+
# TODO
4+
"""
5+
26
use Ecto.Schema
37

48
@type t :: %__MODULE__{

lib/cloud_storage/uploads/log.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule CloudStorage.Uploads.Log do
2+
@moduledoc """
3+
# TODO
4+
"""
5+
26
use Ecto.Schema
37

48
@type t :: %__MODULE__{

lib/cloud_storage/uploads/upload.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule CloudStorage.Uploads.Upload do
2+
@moduledoc """
3+
# TODO
4+
"""
5+
26
use Ecto.Schema
37
import Ecto.Changeset
48

lib/cloud_storage/utils.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule CloudStorage.Utils do
2+
@moduledoc """
3+
# TODO
4+
"""
5+
26
def timestamp do
37
{{y, m, d}, {hh, mm, ss}} = :calendar.universal_time()
48
"#{y}#{pad(m)}#{pad(d)}#{pad(hh)}#{pad(mm)}#{pad(ss)}"

lib/mix/tasks/gen_upload.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule Mix.Tasks.CloudStorage.Gen.Upload do
2+
@moduledoc """
3+
# TODO
4+
"""
5+
26
use Mix.Task
37
import Mix.Generator
48
alias CloudStorage.Utils

lib/mix/tasks/install.ex

+4
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
11
defmodule Mix.Tasks.CloudStorage.Install do
2+
@moduledoc """
3+
# TODO
4+
"""
5+
26
use Mix.Task
37
import Mix.Generator
48
alias CloudStorage.Utils

mix.exs

+38-6
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
11
defmodule CloudStorage.MixProject do
22
use Mix.Project
33

4+
@source_url "https://github.com/StephaneRob/cloud-storage"
5+
@version "0.1.0"
6+
@elixir "~> 1.14"
7+
48
def project do
59
[
610
app: :cloud_storage,
7-
version: "0.1.0",
8-
elixir: "~> 1.14",
11+
version: @version,
12+
elixir: @elixir,
913
start_permanent: Mix.env() == :prod,
1014
elixirc_paths: elixirc_paths(Mix.env()),
1115
deps: deps(),
12-
aliases: aliases()
16+
docs: docs(),
17+
aliases: aliases(),
18+
package: package(),
19+
source_url: @source_url,
20+
description: "Direct upload cloud storage for Elixir application"
1321
]
1422
end
1523

16-
# Run "mix help compile.app" to learn about applications.
1724
def application do
1825
[
1926
extra_applications: [:logger],
@@ -30,7 +37,6 @@ defmodule CloudStorage.MixProject do
3037
]
3138
end
3239

33-
# Run "mix help deps" to learn about dependencies.
3440
defp deps do
3541
[
3642
{:ex_aws, "~> 2.1"},
@@ -41,7 +47,33 @@ defmodule CloudStorage.MixProject do
4147
{:jason, "~> 1.4.0"},
4248
{:postgrex, ">= 0.0.0"},
4349
{:credo, "~> 1.6", only: [:dev, :test], runtime: false},
44-
{:mock, "~> 0.3.0", only: :test}
50+
{:mock, "~> 0.3.0", only: :test},
51+
{:ex_doc, "~> 0.29.1", only: :dev, runtime: false}
52+
]
53+
end
54+
55+
defp package do
56+
[
57+
maintainers: ["Stéphane Robino"],
58+
licenses: ["MIT"],
59+
files: ~w(lib .formatter.exs mix.exs README.md LICENSE.md CHANGELOG.md),
60+
links: %{
61+
"Changelog" => "https://hexdocs.pm/cloud-storage/changelog.html",
62+
"GitHub" => @source_url
63+
}
64+
]
65+
end
66+
67+
def docs do
68+
[
69+
extras: [
70+
"LICENSE.md": [title: "License"],
71+
"README.md": [title: "Overview"]
72+
],
73+
main: "readme",
74+
source_url: @source_url,
75+
homepage_url: @source_url,
76+
formatters: ["html"]
4577
]
4678
end
4779
end

mix.lock

+6
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,21 @@
55
"credo": {:hex, :credo, "1.6.7", "323f5734350fd23a456f2688b9430e7d517afb313fbd38671b8a4449798a7854", [:mix], [{:bunt, "~> 0.2.1", [hex: :bunt, repo: "hexpm", optional: false]}, {:file_system, "~> 0.2.8", [hex: :file_system, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: false]}], "hexpm", "41e110bfb007f7eda7f897c10bf019ceab9a0b269ce79f015d54b0dcf4fc7dd3"},
66
"db_connection": {:hex, :db_connection, "2.4.3", "3b9aac9f27347ec65b271847e6baeb4443d8474289bd18c1d6f4de655b70c94d", [:mix], [{:connection, "~> 1.0", [hex: :connection, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "c127c15b0fa6cfb32eed07465e05da6c815b032508d4ed7c116122871df73c12"},
77
"decimal": {:hex, :decimal, "2.0.0", "a78296e617b0f5dd4c6caf57c714431347912ffb1d0842e998e9792b5642d697", [:mix], [], "hexpm", "34666e9c55dea81013e77d9d87370fe6cb6291d1ef32f46a1600230b1d44f577"},
8+
"earmark_parser": {:hex, :earmark_parser, "1.4.29", "149d50dcb3a93d9f3d6f3ecf18c918fb5a2d3c001b5d3305c926cddfbd33355b", [:mix], [], "hexpm", "4902af1b3eb139016aed210888748db8070b8125c2342ce3dcae4f38dcc63503"},
89
"ecto": {:hex, :ecto, "3.9.2", "017db3bc786ff64271108522c01a5d3f6ba0aea5c84912cfb0dd73bf13684108", [:mix], [{:decimal, "~> 1.6 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "21466d5177e09e55289ac7eade579a642578242c7a3a9f91ad5c6583337a9d15"},
910
"ecto_sql": {:hex, :ecto_sql, "3.9.1", "9bd5894eecc53d5b39d0c95180d4466aff00e10679e13a5cfa725f6f85c03c22", [:mix], [{:db_connection, "~> 2.4.1 or ~> 2.5", [hex: :db_connection, repo: "hexpm", optional: false]}, {:ecto, "~> 3.9.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:myxql, "~> 0.6.0", [hex: :myxql, repo: "hexpm", optional: true]}, {:postgrex, "~> 0.16.0 or ~> 1.0", [hex: :postgrex, repo: "hexpm", optional: true]}, {:tds, "~> 2.1.1 or ~> 2.2", [hex: :tds, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.0 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "5fd470a4fff2e829bbf9dcceb7f3f9f6d1e49b4241e802f614de6b8b67c51118"},
1011
"ex_aws": {:hex, :ex_aws, "2.4.1", "d1dc8965d1dc1c939dd4570e37f9f1d21e047e4ecd4f9373dc89cd4e45dce5ef", [:mix], [{:configparser_ex, "~> 4.0", [hex: :configparser_ex, repo: "hexpm", optional: true]}, {:hackney, "~> 1.16", [hex: :hackney, repo: "hexpm", optional: true]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: true]}, {:jsx, "~> 2.8 or ~> 3.0", [hex: :jsx, repo: "hexpm", optional: true]}, {:mime, "~> 1.2 or ~> 2.0", [hex: :mime, repo: "hexpm", optional: false]}, {:sweet_xml, "~> 0.7", [hex: :sweet_xml, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4.3 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "803387db51b4e91be4bf0110ba999003ec6103de7028b808ee9b01f28dbb9eee"},
1112
"ex_aws_s3": {:hex, :ex_aws_s3, "2.3.3", "61412e524616ea31d3f31675d8bc4c73f277e367dee0ae8245610446f9b778aa", [:mix], [{:ex_aws, "~> 2.0", [hex: :ex_aws, repo: "hexpm", optional: false]}, {:sweet_xml, ">= 0.0.0", [hex: :sweet_xml, repo: "hexpm", optional: true]}], "hexpm", "0044f0b6f9ce925666021eafd630de64c2b3404d79c85245cc7c8a9a32d7f104"},
13+
"ex_doc": {:hex, :ex_doc, "0.29.1", "b1c652fa5f92ee9cf15c75271168027f92039b3877094290a75abcaac82a9f77", [:mix], [{:earmark_parser, "~> 1.4.19", [hex: :earmark_parser, repo: "hexpm", optional: false]}, {:makeup_elixir, "~> 0.14", [hex: :makeup_elixir, repo: "hexpm", optional: false]}, {:makeup_erlang, "~> 0.1", [hex: :makeup_erlang, repo: "hexpm", optional: false]}], "hexpm", "b7745fa6374a36daf484e2a2012274950e084815b936b1319aeebcf7809574f6"},
1214
"file_system": {:hex, :file_system, "0.2.10", "fb082005a9cd1711c05b5248710f8826b02d7d1784e7c3451f9c1231d4fc162d", [:mix], [], "hexpm", "41195edbfb562a593726eda3b3e8b103a309b733ad25f3d642ba49696bf715dc"},
1315
"jason": {:hex, :jason, "1.4.0", "e855647bc964a44e2f67df589ccf49105ae039d4179db7f6271dfd3843dc27e6", [:mix], [{:decimal, "~> 1.0 or ~> 2.0", [hex: :decimal, repo: "hexpm", optional: true]}], "hexpm", "79a3791085b2a0f743ca04cec0f7be26443738779d09302e01318f97bdb82121"},
16+
"makeup": {:hex, :makeup, "1.1.0", "6b67c8bc2882a6b6a445859952a602afc1a41c2e08379ca057c0f525366fc3ca", [:mix], [{:nimble_parsec, "~> 1.2.2 or ~> 1.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "0a45ed501f4a8897f580eabf99a2e5234ea3e75a4373c8a52824f6e873be57a6"},
17+
"makeup_elixir": {:hex, :makeup_elixir, "0.16.0", "f8c570a0d33f8039513fbccaf7108c5d750f47d8defd44088371191b76492b0b", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}, {:nimble_parsec, "~> 1.2.3", [hex: :nimble_parsec, repo: "hexpm", optional: false]}], "hexpm", "28b2cbdc13960a46ae9a8858c4bebdec3c9a6d7b4b9e7f4ed1502f8159f338e7"},
18+
"makeup_erlang": {:hex, :makeup_erlang, "0.1.1", "3fcb7f09eb9d98dc4d208f49cc955a34218fc41ff6b84df7c75b3e6e533cc65f", [:mix], [{:makeup, "~> 1.0", [hex: :makeup, repo: "hexpm", optional: false]}], "hexpm", "174d0809e98a4ef0b3309256cbf97101c6ec01c4ab0b23e926a9e17df2077cbb"},
1419
"meck": {:hex, :meck, "0.9.2", "85ccbab053f1db86c7ca240e9fc718170ee5bda03810a6292b5306bf31bae5f5", [:rebar3], [], "hexpm", "81344f561357dc40a8344afa53767c32669153355b626ea9fcbc8da6b3045826"},
1520
"mime": {:hex, :mime, "2.0.3", "3676436d3d1f7b81b5a2d2bd8405f412c677558c81b1c92be58c00562bb59095", [:mix], [], "hexpm", "27a30bf0db44d25eecba73755acf4068cbfe26a4372f9eb3e4ea3a45956bff6b"},
1621
"mock": {:hex, :mock, "0.3.7", "75b3bbf1466d7e486ea2052a73c6e062c6256fb429d6797999ab02fa32f29e03", [:mix], [{:meck, "~> 0.9.2", [hex: :meck, repo: "hexpm", optional: false]}], "hexpm", "4da49a4609e41fd99b7836945c26f373623ea968cfb6282742bcb94440cf7e5c"},
22+
"nimble_parsec": {:hex, :nimble_parsec, "1.2.3", "244836e6e3f1200c7f30cb56733fd808744eca61fd182f731eac4af635cc6d0b", [:mix], [], "hexpm", "c8d789e39b9131acf7b99291e93dae60ab48ef14a7ee9d58c6964f59efb570b0"},
1723
"phoenix": {:hex, :phoenix, "1.6.15", "0a1d96bbc10747fd83525370d691953cdb6f3ccbac61aa01b4acb012474b047d", [:mix], [{:castore, ">= 0.0.0", [hex: :castore, repo: "hexpm", optional: false]}, {:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 2.0", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:phoenix_view, "~> 1.0 or ~> 2.0", [hex: :phoenix_view, repo: "hexpm", optional: false]}, {:plug, "~> 1.10", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 2.2", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:plug_crypto, "~> 1.2", [hex: :plug_crypto, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4 or ~> 1.0", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm", "d70ab9fbf6b394755ea88b644d34d79d8b146e490973151f248cacd122d20672"},
1824
"phoenix_html": {:hex, :phoenix_html, "3.2.0", "1c1219d4b6cb22ac72f12f73dc5fad6c7563104d083f711c3fcd8551a1f4ae11", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: true]}], "hexpm", "36ec97ba56d25c0136ef1992c37957e4246b649d620958a1f9fa86165f8bc54f"},
1925
"phoenix_pubsub": {:hex, :phoenix_pubsub, "2.1.1", "ba04e489ef03763bf28a17eb2eaddc2c20c6d217e2150a61e3298b0f4c2012b5", [:mix], [], "hexpm", "81367c6d1eea5878ad726be80808eb5a787a23dee699f96e72b1109c57cdd8d9"},

0 commit comments

Comments
 (0)