yavsc/Yavsc/Makefile

97 lines
2.4 KiB
Makefile

PRJNAME=Yavsc
7 years ago
DESTDIR=/srv/www/yavscpre
PRODDESTDIR=/srv/www/yavsc
7 years ago
ASPNET_ENV=Development
CONFIGURATION=Release
7 years ago
ASPNET_LOG_LEVEL=info #warn
7 years ago
HOSTING=localhost
HOSTADMIN=root
FRMWRK=dnx451
BINTARGET=Yavsc.dll
BINTARGETPATH=bin/$(CONFIGURATION)/$(FRMWRK)/$(BINTARGET)
7 years ago
PKGFILENAME=$(PRJNAME).$(VERSION).nupkg
DESTPATH=.
PACKAGE=$(DESTPATH)/$(PKGFILENAME)
NUGETSOURCE=$(HOME)/Nupkgs/
all: $(BINTARGETPATH)
dnu build
7 years ago
deploy: clean pushInPre pushInProd
git_status := $(shell git status -s --porcelain |wc -l)
status:
ifeq ($(git_status),0)
@echo Nothing to be done.
else
7 years ago
@echo There are pending changes:
@git status
endif
7 years ago
default: pushInPre
7 years ago
project.lock.json: project.json
dnu restore
watch: project.lock.json
ASPNET_ENV=$(ASPNET_ENV) ASPNET_LOG_LEVEL=$(ASPNET_LOG_LEVEL) dnx-watch web --configuration=$(CONFIGURATION)
7 years ago
6 years ago
run: project.lock.json
7 years ago
ASPNET_ENV=$(ASPNET_ENV) dnx web --configuration=$(CONFIGURATION)
7 years ago
clean:
7 years ago
rm -rf bin obj
cleanoutput:
7 years ago
rm -rf bin/$(CONFIGURATION)
rm -rf bin/output
7 years ago
7 years ago
bin/$(CONFIGURATION): project.lock.json
dnu build --configuration=$(CONFIGURATION)
7 years ago
7 years ago
bin/output: bin/$(CONFIGURATION)
7 years ago
@dnu publish
7 years ago
bin/output/wwwroot/version: bin/output
7 years ago
@git log -1 --pretty=format:%h > bin/output/wwwroot/version
7 years ago
7 years ago
pushInPre: cleanoutput bin/output/wwwroot/version
7 years ago
ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel-pre stop
ssh $(HOSTADMIN)@$(HOSTING) sudo rm -rf $(DESTDIR)/approot
7 years ago
(cd bin/output && rsync -ravu ./ $(HOSTADMIN)@$(HOSTING):$(DESTDIR) >/dev/null)
7 years ago
ssh $(HOSTADMIN)@$(HOSTING) sudo sync
ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel-pre start
7 years ago
7 years ago
pushInProd: cleanoutput bin/output/wwwroot/version
ifeq ($(git_status),0)
7 years ago
ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel stop
ssh $(HOSTADMIN)@$(HOSTING) sudo rm -rf $(PRODDESTDIR)/approot
7 years ago
(cd bin/output && rsync -ravu ./ $(HOSTADMIN)@$(HOSTING):$(PRODDESTDIR) >/dev/null)
7 years ago
ssh $(HOSTADMIN)@$(HOSTING) sudo sync
ssh $(HOSTADMIN)@$(HOSTING) sudo service kestrel start
7 years ago
else
7 years ago
@echo EPRODANDGITSTATUS! Refus de pousser en production: des changements doivent être validés auprès du contrôle de versions.
7 years ago
git status
7 years ago
endif
$(PACKAGE): $(BINTARGETPATH)
nuget pack $(PRJNAME).nuspec -Version $(VERSION) -Properties config=$(CONFIGURATION)
clean:
rm $(PACKAGE)
$(BINARY): project.lock.json
dnu build --configuration $(CONFIGURATION)
project.lock.json: project.json
dnu restore
deploy-pkg: $(PACKAGE)
cp $(PACKAGE) $(NUGETSOURCE)