Skip to content
This repository has been archived by the owner on Jul 13, 2018. It is now read-only.

Misc suggestions #1

Merged
merged 1 commit into from May 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -13,4 +13,4 @@ erl_crash.dump
logs
_build
.idea
rebar3*
rebar3
3 changes: 2 additions & 1 deletion cowboy_erlydtl.template
Expand Up @@ -8,8 +8,9 @@
%% base

{template, "template/dot.gitignore", "{{name}}/.gitignore"}.
{template, "template/dtl.gitignore", "{{name}}/priv/templates-compiled/.gitignore"}.
{template, "template/dot.gitkeep", "{{name}}/priv/templates-compiled/.gitkeep"}.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The top-level .gitignore takes care of the compiled template files, however, the directory must be present so the zero-byte .gitkeep file is created. There's nothing special about the name, it's just a widely-used convention to preserve an empty directory in a git repo.

{template, "template/Makefile", "{{name}}/Makefile"}.
{template, "template/rebar3.mk", "{{name}}/rebar3.mk"}.
{template, "template/rebar.config", "{{name}}/rebar.config"}.

%% code templates
Expand Down
25 changes: 2 additions & 23 deletions template/Makefile
@@ -1,24 +1,3 @@
REBAR3_URL=https://s3.amazonaws.com/rebar3/rebar3
all: clean compile

# If there is a rebar in the current directory, use it
ifeq ($(wildcard rebar3),rebar3)
REBAR3 = $(CURDIR)/rebar3
endif

# Fallback to rebar on PATH
REBAR3 ?= $(shell test -e `which rebar3` 2>/dev/null && which rebar3 || echo "./rebar3")

# And finally, prep to download rebar if all else fails
ifeq ($(REBAR3),)
REBAR3 = $(CURDIR)/rebar3
endif

all: $(REBAR3)
@$(REBAR3) do clean, compile

rel: all
@$(REBAR3) release

$(REBAR3):
curl -Lo rebar3 $(REBAR3_URL) || wget $(REBAR3_URL)
chmod a+x rebar3
include rebar3.mk
25 changes: 13 additions & 12 deletions template/dot.gitignore
@@ -1,17 +1,18 @@
.rebar3
_build/
ebin/
.idea/
log*/
.rebar/
.rebar3/

_*
.eunit
*.o
*.beam
*.plt
*.swp
*.swo
.erlang.cookie
ebin
log
erl_crash.dump
.rebar
logs
_build
.idea
.eunit
*.o
*.plt
rebar3
rebar3.crashdump
*.swo
*.swp
Empty file added template/dot.gitkeep
Empty file.
2 changes: 0 additions & 2 deletions template/dtl.gitignore

This file was deleted.

50 changes: 50 additions & 0 deletions template/rebar3.mk
@@ -0,0 +1,50 @@
.PHONY: clean compile dialyzer rel run test

REBAR3_URL := https://s3.amazonaws.com/rebar3/rebar3

# If there is a rebar in the current directory, use it
ifeq ($(wildcard rebar3),rebar3)
REBAR3 := $(CURDIR)/rebar3
endif

# Fallback to rebar on PATH
REBAR3 ?= $(shell which rebar3 2>/dev/null || echo "$(CURDIR)/rebar3")

# And finally, prep to download rebar if all else fails
ifeq ($(REBAR3),)
REBAR3 := $(CURDIR)/rebar3
endif

clean: rebar3
@$(REBAR3) clean

compile: rebar3
@$(REBAR3) compile

dialyzer: compile
@$(REBAR3) dialyzer

rel: rebar3
@$(REBAR3) release

run: rebar3
@$(REBAR3) shell

test: compile
@$(REBAR3) ct

rebar3: $(REBAR3)

$(REBAR3):
@echo "Retrieving $(REBAR3) from $(REBAR3_URL)"
@curl -sLo $(REBAR3) $(REBAR3_URL) || wget $(REBAR3_URL)
@chmod a+x $(REBAR3)
@echo
@echo '************************************************************************'
@echo 'NOTE - please follow these instructions:'
@echo
$(CURDIR)/rebar3 local install
@echo
@echo '************************************************************************'
@echo
@rm -f $(CURDIR)/rebar3