-
Notifications
You must be signed in to change notification settings - Fork 473
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #241 from mochi/rebar3
Start on rebar3 support
- Loading branch information
Showing
26 changed files
with
162 additions
and
164 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,34 +5,24 @@ on: | |
pull_request: | ||
jobs: | ||
test: | ||
name: test | ||
name: test ${{matrix.otp}} on ${{matrix.os}} | ||
runs-on: ${{matrix.os}} | ||
container: | ||
image: erlang:${{matrix.otp}} | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: | ||
- ubuntu-latest | ||
otp: | ||
- "24.3.3" | ||
- "23.3.4.5" | ||
- "22.3.4.9" | ||
- "21.3.8.17" | ||
- "24.3.4.0" | ||
- "23.3.4.14" | ||
- "22.3.4.26" | ||
- "21.3.8.24" | ||
- "20.3.8.26" | ||
include: | ||
- os: ubuntu-18.04 | ||
otp: "19.3.6.13" | ||
- os: ubuntu-18.04 | ||
otp: "18.3.4.11" | ||
- "19.3.6.13" | ||
- "18.3.4.11" | ||
steps: | ||
- uses: actions/[email protected] | ||
- run: | | ||
VERSION=${{matrix.otp}} | ||
RELEASE=$(lsb_release -cs) | ||
DIR=$(mktemp -d) | ||
pushd $DIR | ||
FILE=esl-erlang_$VERSION-1~ubuntu~$RELEASE\_amd64.deb | ||
wget https://packages.erlang-solutions.com/erlang/debian/pool/$FILE | ||
sudo dpkg -i $FILE | ||
popd | ||
rm -r $DIR | ||
- run: make test | ||
- run: REBAR=rebar make test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,3 +11,5 @@ | |
*.beam | ||
*.dump | ||
rebar.lock | ||
/_build | ||
/rebar3.crashdump |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,18 @@ | ||
PREFIX:=../ | ||
DEST:=$(PREFIX)$(PROJECT) | ||
REBAR?=rebar3 | ||
|
||
REBAR=./rebar | ||
.PHONY: all edoc test clean build | ||
|
||
.PHONY: all edoc test clean build_plt dialyzer app | ||
all: build | ||
|
||
all: | ||
@$(REBAR) prepare-deps | ||
build: | ||
@$(REBAR) get-deps # rebar2 compatibility, it's no-op on rebar3 | ||
@$(REBAR) compile | ||
|
||
edoc: all | ||
@$(REBAR) doc | ||
|
||
test: | ||
@rm -rf .eunit | ||
@mkdir -p .eunit | ||
test: build | ||
@$(REBAR) eunit | ||
|
||
edoc: build | ||
@$(REBAR) edoc | ||
|
||
clean: | ||
@$(REBAR) clean | ||
|
||
app: | ||
@[ -z "$(PROJECT)" ] && echo "ERROR: required variable PROJECT missing" 1>&2 && exit 1 || true | ||
@$(REBAR) -r create template=mochiwebapp dest=$(DEST) appid=$(PROJECT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/ebin | ||
/doc | ||
/_test | ||
/.eunit | ||
/docs | ||
.DS_Store | ||
/TEST-*.xml | ||
/deps | ||
/.rebar | ||
*.swp | ||
*.beam | ||
*.dump | ||
_build/ | ||
rebar.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
REBAR?=rebar3 | ||
|
||
.PHONY: all edoc test clean app | ||
|
||
build: | ||
@$(REBAR) get-deps # rebar2 compatibility, it's no-op on rebar3 | ||
@$(REBAR) compile | ||
|
||
test: | ||
@$(REBAR) eunit | ||
|
||
edoc: | ||
@$(REBAR) edoc | ||
|
||
clean: | ||
@$(REBAR) clean |
2 changes: 1 addition & 1 deletion
2
support/templates/mochiwebapp_skel/bench.sh → examples/example_project/bench.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,6 @@ | |
<title>It Worked</title> | ||
</head> | ||
<body> | ||
{{appid}} running. | ||
example_project running. | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
%% -*- erlang -*- | ||
{application, example_project, | ||
[{description, "example_project"}, | ||
{vsn, "0.1"}, | ||
{modules, []}, | ||
{registered, []}, | ||
{mod, {'example_project_app', []}}, | ||
{env, []}, | ||
{applications, [kernel, stdlib, crypto]}]}. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
%% @author Mochi Media <[email protected]> | ||
%% @copyright 2010 Mochi Media <[email protected]> | ||
|
||
%% @doc example_project. | ||
|
||
-module(example_project). | ||
-author("Mochi Media <[email protected]>"). | ||
-export([start/0, stop/0]). | ||
|
||
ensure_started(App) -> | ||
case application:start(App) of | ||
ok -> | ||
ok; | ||
{error, {already_started, App}} -> | ||
ok | ||
end. | ||
|
||
|
||
%% @spec start() -> ok | ||
%% @doc Start the example_project server. | ||
start() -> | ||
example_project_deps:ensure(), | ||
ensure_started(crypto), | ||
application:start(example_project). | ||
|
||
|
||
%% @spec stop() -> ok | ||
%% @doc Stop the example_project server. | ||
stop() -> | ||
application:stop(example_project). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
%% @author Mochi Media <[email protected]> | ||
%% @copyright example_project Mochi Media <[email protected]> | ||
|
||
%% @doc Callbacks for the example_project application. | ||
|
||
-module(example_project_app). | ||
-author("Mochi Media <[email protected]>"). | ||
|
||
-behaviour(application). | ||
-export([start/2,stop/1]). | ||
|
||
|
||
%% @spec start(_Type, _StartArgs) -> ServerRet | ||
%% @doc application start callback for example_project. | ||
start(_Type, _StartArgs) -> | ||
example_project_deps:ensure(), | ||
example_project_sup:start_link(). | ||
|
||
%% @spec stop(_State) -> ServerRet | ||
%% @doc application stop callback for example_project. | ||
stop(_State) -> | ||
ok. |
8 changes: 4 additions & 4 deletions
8
...es/mochiwebapp_skel/src/mochiapp_deps.erl → ...mple_project/src/example_project_deps.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
%% @author {{author}} | ||
%% @copyright {{year}} {{author}} | ||
%% @author Mochi Media <[email protected]> | ||
%% @copyright 2010 Mochi Media <[email protected]> | ||
|
||
%% @doc Ensure that the relatively-installed dependencies are on the code | ||
%% loading path, and locate resources relative | ||
%% to this application's path. | ||
|
||
-module({{appid}}_deps). | ||
-author("{{author}}"). | ||
-module(example_project_deps). | ||
-author("Mochi Media <[email protected]>"). | ||
|
||
-export([ensure/0, ensure/1]). | ||
-export([get_base_dir/0, get_base_dir/1]). | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,10 @@ | ||
%% @author {{author}} | ||
%% @copyright {{year}} {{author}} | ||
%% @author Mochi Media <[email protected]> | ||
%% @copyright 2010 Mochi Media <[email protected]> | ||
|
||
%% @doc Supervisor for the {{appid}} application. | ||
%% @doc Supervisor for the example_project application. | ||
|
||
-module({{appid}}_sup). | ||
-author("{{author}}"). | ||
-module(example_project_sup). | ||
-author("Mochi Media <[email protected]>"). | ||
|
||
-behaviour(supervisor). | ||
|
||
|
@@ -41,7 +41,7 @@ upgrade() -> | |
%% @spec init([]) -> SupervisorTree | ||
%% @doc supervisor callback. | ||
init([]) -> | ||
Web = web_specs({{appid}}_web, {{port}}), | ||
Web = web_specs(example_project_web, 8080), | ||
Processes = [Web], | ||
Strategy = {one_for_one, 10, 10}, | ||
{ok, | ||
|
@@ -50,7 +50,7 @@ init([]) -> | |
web_specs(Mod, Port) -> | ||
WebConfig = [{ip, {0,0,0,0}}, | ||
{port, Port}, | ||
{docroot, {{appid}}_deps:local_path(["priv", "www"])}], | ||
{docroot, example_project_deps:local_path(["priv", "www"])}], | ||
{Mod, | ||
{Mod, start, [WebConfig]}, | ||
permanent, 5000, worker, dynamic}. |
10 changes: 5 additions & 5 deletions
10
...tes/mochiwebapp_skel/src/mochiapp_web.erl → ...ample_project/src/example_project_web.erl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
%% @author {{author}} | ||
%% @copyright {{year}} {{author}} | ||
%% @author Mochi Media <[email protected]> | ||
%% @copyright 2010 Mochi Media <[email protected]> | ||
|
||
%% @doc Web server for {{appid}}. | ||
%% @doc Web server for example_project. | ||
|
||
-module('{{appid}}_web'). | ||
-module('example_project_web'). | ||
|
||
-author("{{author}}"). | ||
-author("Mochi Media <[email protected]>"). | ||
|
||
-export([loop/2, start/1, stop/0]). | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/sh | ||
exec erl \ | ||
-pa _build/default/lib/example_project/ebin \ | ||
-pa _build/default/lib/mochiweb/ebin \ | ||
-pa ebin deps/*/ebin \ | ||
-boot start_sasl \ | ||
-sname example_project_dev \ | ||
-s example_project \ | ||
-s reloader |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.