Skip to content

Misc doc changes #87

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .formatter.exs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# Used by "mix format"
[
inputs: ["mix.exs", "{config,lib,test}/**/*.{ex,exs}"]
inputs: ["{mix,.formatter}.exs", "{config,lib,test}/**/*.{ex,exs}"]
]
29 changes: 18 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,31 +1,38 @@
# The directory Mix will write compiled artifacts to.
/_build
/_build/

# If you run "mix test --cover", coverage assets end up here.
cover
/cover/

# The directory Mix downloads your dependencies sources to.
deps
/deps/

# Where 3rd-party dependencies like ExDoc output generated docs.
doc
docs
# Where third-party dependencies like ExDoc output generated docs.
/doc/

# Ignore .fetch files in case you like to edit your project deps locally.
/.fetch

# If the VM crashes, it generates a dump, let's ignore it too.
erl_crash.dump

# Also ignore archive artifacts (built via "mix archive.build").
*.ez

# vim swap files
# Ignore package tarball (built via "mix hex.build").
triplex-*.tar

# Temporary files, for example, from tests.
/tmp/

# Vim swap files.
*.swp

# mac files
# macOS files.
.DS_Store

# ctags file
# ctags file.
tags

tmp

# Idea config file.
.idea
1 change: 1 addition & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
elixir 1.7
erlang 21.0
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

### MyXQL Support

- I created a support for myxql package and mariaex package was removed,
to use this update you will need to add the myxql package e.g `{:myxql, "~> 0.3.0"}`
in your `mix.exs` file.

## 1.3.0
## v1.3.0 (2019-05-31)

### Bug fixes

Expand Down Expand Up @@ -59,7 +64,7 @@ end)
For more details about these function check the online documentation for `Triplex.create/1,2`
and `Triplex.create_schema/1,2,3`.

## 1.3.0-rc.1
## v1.3.0-rc.1 (2019-03-07)

### Bug fixes

Expand All @@ -69,7 +74,7 @@ and `Triplex.create_schema/1,2,3`.

- docker-compose configuration that allows easy setup for test databases.

## 1.3.0-rc.0
## v1.3.0-rc.0 (2019-03-03)

### Added

Expand Down
2 changes: 1 addition & 1 deletion LICENSE → LICENSE.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MIT License
# The MIT License

Copyright (c) 2017 ateliware

Expand Down
47 changes: 31 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
# Triplex

[![Build Status](https://travis-ci.org/ateliware/triplex.svg?branch=master)](https://travis-ci.org/ateliware/triplex)
[![Version](http://img.shields.io/hexpm/v/triplex.svg?style=flat)](https://hex.pm/packages/triplex)
[![Downloads](https://img.shields.io/hexpm/dt/triplex.svg)](https://hex.pm/packages/triplex)
[![Coverage Status](https://coveralls.io/repos/github/ateliware/triplex/badge.svg?branch=master)](https://coveralls.io/github/ateliware/triplex?branch=master)
[![Code Climate](https://img.shields.io/codeclimate/github/ateliware/triplex.svg)](https://codeclimate.com/github/ateliware/triplex)
[![Module Version](https://img.shields.io/hexpm/v/triplex.svg)](https://hex.pm/packages/triplex)
[![Hex Docs](https://img.shields.io/badge/hex-docs-lightgreen.svg)](https://hexdocs.pm/triplex/)
[![Inline docs](http://inch-ci.org/github/ateliware/triplex.svg?branch=master&style=flat)](http://inch-ci.org/github/ateliware/triplex)
[![Total Download](https://img.shields.io/hexpm/dt/triplex.svg)](https://hex.pm/packages/triplex)
[![License](https://img.shields.io/hexpm/l/triplex.svg)](https://github.com/ateliware/triplex/blob/master/LICENSE)
[![Last Updated](https://img.shields.io/github/last-commit/ateliware/triplex.svg)](https://github.com/ateliware/triplex/commits/master)

A simple and effective way to build multitenant applications on top of Ecto.

Expand All @@ -19,19 +21,19 @@ Triplex leverages database data segregation techniques (such as [Postgres schema

1. Add `triplex` to your list of dependencies in `mix.exs`:

```elixir
def deps do
[
{:triplex, "~> 1.3.0"},
]
end
```
```elixir
def deps do
[
{:triplex, "~> 1.3.0"},
]
end
```

2. Run in your shell:

```bash
mix deps.get
```
```bash
mix deps.get
```


## Configuration
Expand All @@ -46,15 +48,21 @@ In MySQL, each tenant will have its own MySQL database.
Triplex uses a table called `tenants` in the main Repo to keep track of the different tenants.
Generate the migration that will create the table by running:

mix triplex.mysql.install
```bash
mix triplex.mysql.install
```

And then create the table:

mix ecto.migrate
```bash
mix ecto.migrate
```

Otherwise, if you wish to skip this behavior, configure Triplex to use the default `information_schema.schemata` table:

config :triplex, tenant_table: :"information_schema.schemata"
```elixir
config :triplex, tenant_table: :"information_schema.schemata"
```

## Usage

Expand Down Expand Up @@ -145,3 +153,10 @@ For more information, check the `Triplex.Plug` documentation for an overview of
## Thanks

This lib is inspired by the gem [apartment](https://github.com/influitive/apartment), which does the same thing in Ruby on Rails world. We also give credit (and a lot of thanks) to @Dania02525 for the work on [apartmentex](https://github.com/Dania02525/apartmentex). A lot of the work here is based on what she has done there. And also to @jeffdeville, who forked ([tenantex](https://github.com/jeffdeville/tenantex)) taking a different approach, which gave us additional ideas.

## Copyright and License

Copyright (c) 2017 ateliware

This work is free. You can redistribute it and/or modify it under the
terms of the MIT License. See the [LICENSE.md](./LICENSE.md) file for more details.
55 changes: 29 additions & 26 deletions mix.exs
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
defmodule Triplex.Mixfile do
use Mix.Project

@source_url "https://github.com/ateliware/triplex"
@version "1.3.0"

def project do
[
app: :triplex,
version: "1.3.0",
version: @version,
elixir: "~> 1.7",
description: "Build multitenant applications on top of Ecto.",
package: package(),
elixirc_paths: elixirc_paths(Mix.env()),
build_embedded: Mix.env() == :prod,
Expand All @@ -15,15 +17,11 @@ defmodule Triplex.Mixfile do
test_coverage: [tool: ExCoveralls],
preferred_cli_env: preferred_cli_env(),
deps: deps(),
docs: [main: "readme", extras: ["README.md", "CHANGELOG.md"]],
docs: docs(),
name: "Triplex",
source_url: "https://github.com/ateliware/triplex"
]
end

# Configuration for the OTP application
#
# Type "mix help compile.app" for more information
def application do
[extra_applications: [:logger]]
end
Expand All @@ -32,30 +30,17 @@ defmodule Triplex.Mixfile do
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(_), do: ["lib"]

# Dependencies can be Hex packages:
#
# {:mydep, "~> 0.3.0"}
#
# Or git/path repositories:
#
# {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
#
# To depend on another app inside the umbrella:
#
# {:myapp, in_umbrella: true}
#
# Type "mix help deps" for more examples and options
defp deps do
[
{:credo, "~> 0.8.10", only: [:test, :dev], optional: true, runtime: false},
{:decimal, ">= 1.6.0"},
{:ecto_sql, "~> 3.4"},
{:ex_doc, "~> 0.18.0", only: :dev},
{:ex_doc, ">= 0.0.0", only: :docs, runtime: false},
{:excoveralls, "~> 0.10", only: :test},
{:inch_ex, ">= 0.0.0", only: :docs},
{:inch_ex, ">= 0.0.0", only: :docs, runtime: false},
{:myxql, ">= 0.3.0", optional: true},
{:plug, "~> 1.6", optional: true},
{:postgrex, ">= 0.15.0", optional: true},
{:myxql, ">= 0.3.0", optional: true},
{:decimal, ">= 1.6.0"}
]
end

Expand All @@ -76,18 +61,36 @@ defmodule Triplex.Mixfile do
end

defp package do
# These are the default files included in the package
[
name: :triplex,
description: "Build multitenant applications on top of Ecto.",
files: ["lib", "mix.exs", "README*", "LICENSE*"],
maintainers: ["Kelvin Stinghen"],
licenses: ["MIT"],
links: %{"GitHub" => "https://github.com/ateliware/triplex"}
links: %{"GitHub" => @source_url}
]
end

defp docs do
[
extras: [
"CHANGELOG.md": [title: "Changelog"],
"CONTRIBUTING.md": [title: "Contributing"],
"CODE_OF_CONDUCT.md": [title: "Code of Conduct"],
"LICENSE.md": [title: "License"],
"README.md": [title: "Overview"]
],
main: "readme",
source_url: @source_url,
source_ref: "v#{@version}",
formatters: ["html"]
]
end

defp preferred_cli_env do
[
docs: :docs,
"hex.publish": :docs,
coveralls: :test,
"coveralls.travis": :test,
"coveralls.detail": :test,
Expand Down
Loading