Skip to content

Commit

Permalink
Make it an umbrella project
Browse files Browse the repository at this point in the history
  • Loading branch information
Calamari committed Dec 26, 2015
1 parent 8109ae2 commit 4ef4918
Show file tree
Hide file tree
Showing 23 changed files with 133 additions and 43 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

If [available in Hex](https://hex.pm/docs/publish), the package can be installed as:

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

def deps do
[{:tetris, "~> 0.0.1"}]
[{:, "~> 0.0.1"}]
end

2. Ensure tetris is started before your application:
2. Ensure is started before your application:

def application do
[applications: [:tetris]]
[applications: [:]]
end
5 changes: 5 additions & 0 deletions apps/core/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/_build
/cover
/deps
erl_crash.dump
*.ez
19 changes: 19 additions & 0 deletions apps/core/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Core

**TODO: Add description**

## Installation

If [available in Hex](https://hex.pm/docs/publish), the package can be installed as:

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

def deps do
[{:core, "~> 0.0.1"}]
end

2. Ensure core is started before your application:

def application do
[applications: [:core]]
end
30 changes: 30 additions & 0 deletions apps/core/config/config.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# This file is responsible for configuring your application
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config

# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded nor affect the parent project. For this reason,
# if you want to provide default values for your application for
# 3rd-party users, it should be done in your "mix.exs" file.

# You can configure for your application as:
#
# config :core, key: :value
#
# And access this configuration in your application as:
#
# Application.get_env(:core, :key)
#
# Or configure a 3rd-party app:
#
# config :logger, level: :info
#

# It is also possible to import configuration files, relative to this
# directory. For example, you can emulate configuration per environment
# by uncommenting the line below and defining dev.exs, test.exs and such.
# Configuration from the imported file will override the ones defined
# here (which is why it is important to import them last).
#
# import_config "#{Mix.env}.exs"
19 changes: 19 additions & 0 deletions apps/core/lib/core.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
defmodule Core do
use Application

# See http://elixir-lang.org/docs/stable/elixir/Application.html
# for more information on OTP Applications
def start(_type, _args) do
import Supervisor.Spec, warn: false

children = [
# Define workers and child supervisors to be supervised
# worker(Core.Worker, [arg1, arg2, arg3]),
]

# See http://elixir-lang.org/docs/stable/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: Core.Supervisor]
Supervisor.start_link(children, opts)
end
end
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
39 changes: 39 additions & 0 deletions apps/core/mix.exs
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
defmodule Core.Mixfile do
use Mix.Project

def project do
[app: :core,
version: "0.0.1",
deps_path: "../../deps",
lockfile: "../../mix.lock",
elixir: "~> 1.1-rc",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
end

# Configuration for the OTP application
#
# Type "mix help compile.app" for more information
def application do
[applications: [:logger],
mod: {Core, []}]
end

# 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
[]
end
end
4 changes: 2 additions & 2 deletions test/tetris_test.exs → apps/core/test/core_test.exs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
defmodule TetrisTest do
defmodule CoreTest do
use ExUnit.Case
doctest Tetris
doctest Core

test "the truth" do
assert 1 + 1 == 2
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
34 changes: 10 additions & 24 deletions config/config.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,15 @@
# and its dependencies with the aid of the Mix.Config module.
use Mix.Config

# This configuration is loaded before any dependency and is restricted
# to this project. If another project depends on this project, this
# file won't be loaded nor affect the parent project. For this reason,
# if you want to provide default values for your application for
# 3rd-party users, it should be done in your "mix.exs" file.
# The configuration defined here will only affect the dependencies
# in the apps directory when commands are executed from the umbrella
# project. For this reason, it is preferred to configure each child
# application directly and import its configuration, as done below.
import_config "../apps/*/config/config.exs"

# You can configure for your application as:
# Sample configuration (overrides the imported configuration above):
#
# config :tetris, key: :value
#
# And access this configuration in your application as:
#
# Application.get_env(:tetris, :key)
#
# Or configure a 3rd-party app:
#
# config :logger, level: :info
#

# It is also possible to import configuration files, relative to this
# directory. For example, you can emulate configuration per environment
# by uncommenting the line below and defining dev.exs, test.exs and such.
# Configuration from the imported file will override the ones defined
# here (which is why it is important to import them last).
#
# import_config "#{Mix.env}.exs"
# config :logger, :console,
# level: :info,
# format: "$date $time [$level] $metadata$message\n",
# metadata: [:user_id]
2 changes: 0 additions & 2 deletions lib/tetris.ex

This file was deleted.

16 changes: 5 additions & 11 deletions mix.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,12 @@ defmodule Tetris.Mixfile do
use Mix.Project

def project do
[app: :tetris,
version: "0.0.1",
elixir: "~> 1.1-rc",
[apps_path: "apps",
build_embedded: Mix.env == :prod,
start_permanent: Mix.env == :prod,
deps: deps]
end

# Configuration for the OTP application
#
# Type "mix help compile.app" for more information
def application do
[applications: [:logger]]
end

# Dependencies can be Hex packages:
#
# {:mydep, "~> 0.3.0"}
Expand All @@ -25,7 +16,10 @@ defmodule Tetris.Mixfile do
#
# {:mydep, git: "https://github.com/elixir-lang/mydep.git", tag: "0.1.0"}
#
# Type "mix help deps" for more examples and options
# Type "mix help deps" for more examples and options.
#
# Dependencies listed here are available only for this project
# and cannot be accessed from applications inside the apps folder
defp deps do
[]
end
Expand Down

0 comments on commit 4ef4918

Please sign in to comment.