Skip to content

Commit 368cdf3

Browse files
authored
Merge pull request #41 from funbox/develop
Improvements
2 parents 6f8fd76 + 6cfb04c commit 368cdf3

File tree

4 files changed

+42
-38
lines changed

4 files changed

+42
-38
lines changed

.travis.yml

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ matrix:
2323

2424
before_install:
2525
- make deps
26+
- make deps-test
2627

2728
script:
2829
- make test

Makefile

+31-28
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,49 @@
1-
########################################################################################
1+
################################################################################
22

3-
DESTDIR?=
4-
PREFIX?=/usr
3+
# This Makefile generated by GoMakeGen 0.7.1 using next command:
4+
# gomakegen .
55

6-
########################################################################################
6+
################################################################################
77

8-
.PHONY = all clean install uninstall deps test upstart-playground systemd-playground
8+
.DEFAULT_GOAL := help
9+
.PHONY = fmt all clean deps deps-test test help
910

10-
########################################################################################
11+
################################################################################
1112

12-
all: init-exporter
13+
all: init-exporter ## Build all binaries
1314

14-
init-exporter:
15+
init-exporter: ## Build init-exporter binary
1516
go build init-exporter.go
1617

17-
deps:
18+
install: ## Install binaries
19+
cp init-exporter /usr/bin/init-exporter
20+
21+
uninstall: ## Uninstall binaries
22+
rm -f /usr/bin/init-exporter
23+
24+
deps: ## Download dependencies
1825
git config --global http.https://pkg.re.followRedirects true
19-
go get -d -v pkg.re/check.v1
2026
go get -d -v pkg.re/essentialkaos/ek.v9
2127
go get -d -v pkg.re/essentialkaos/go-simpleyaml.v1
22-
go get -d -v pkg.re/yaml.v2
23-
24-
fmt:
25-
find . -name "*.go" -exec gofmt -s -w {} \;
2628

27-
test:
28-
go test ./procfile ./export -covermode=count
29+
deps-test: ## Download dependencies for tests
30+
git config --global http.https://pkg.re.followRedirects true
31+
go get -d -v pkg.re/check.v1
32+
go get -d -v pkg.re/essentialkaos/ek.v9
2933

30-
install:
31-
mkdir -p $(DESTDIR)$(PREFIX)/bin
32-
cp init-exporter $(DESTDIR)$(PREFIX)/bin/
33-
cp common/init-exporter.conf $(DESTDIR)/etc/
34+
test: ## Run tests
35+
go test -covermode=count ./...
3436

35-
uninstall:
36-
rm -f $(DESTDIR)$(PREFIX)/bin/init-exporter
37-
rm -rf $(DESTDIR)/etc/init-exporter.conf
37+
fmt: ## Format source code with gofmt
38+
find . -name "*.go" -exec gofmt -s -w {} \;
3839

39-
clean:
40+
clean: ## Remove generated files
4041
rm -f init-exporter
4142

42-
upstart-playground:
43-
docker build -f ./Dockerfile.upstart -t upstart-playground . && docker run -ti --rm=true upstart-playground /bin/bash
43+
help: ## Show this info
44+
@echo -e '\nSupported targets:\n'
45+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) \
46+
| awk 'BEGIN {FS = ":.*?## "}; {printf " \033[33m%-12s\033[0m %s\n", $$1, $$2}'
47+
@echo -e ''
4448

45-
systemd-playground:
46-
docker build -f ./Dockerfile.systemd -t systemd-playground . && docker run -ti --rm=true systemd-playground /bin/bash
49+
################################################################################

common/init-exporter.spec

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
###############################################################################
1+
################################################################################
22

33
# rpmbuilder:relative-pack true
44

5-
###############################################################################
5+
################################################################################
66

77
%define _posixroot /
88
%define _root /root
@@ -34,11 +34,11 @@
3434
%define _rpmstatedir %{_sharedstatedir}/rpm-state
3535
%define _pkgconfigdir %{_libdir}/pkgconfig
3636

37-
###############################################################################
37+
################################################################################
3838

3939
%define debug_package %{nil}
4040

41-
###############################################################################
41+
################################################################################
4242

4343
Summary: Utility for exporting services described by Procfile to init system
4444
Name: init-exporter
@@ -59,12 +59,12 @@ Provides: systemd-exporter = %{version}-%{release}
5959

6060
Provides: %{name} = %{version}-%{release}
6161

62-
###############################################################################
62+
################################################################################
6363

6464
%description
6565
Utility for exporting services described by Procfile to init system.
6666

67-
###############################################################################
67+
################################################################################
6868

6969
%prep
7070
%setup -q
@@ -73,7 +73,7 @@ Utility for exporting services described by Procfile to init system.
7373
export GOPATH=$(pwd)
7474

7575
pushd src/github.com/funbox/%{name}
76-
%{__make} %{?_smp_mflags}
76+
%{__make} %{?_smp_mflags} all
7777
popd
7878

7979
%install
@@ -97,7 +97,7 @@ install -pm 755 src/github.com/funbox/%{name}/common/%{name}.conf \
9797
%clean
9898
rm -rf %{buildroot}
9999

100-
###############################################################################
100+
################################################################################
101101

102102
%files
103103
%defattr(-,root,root,-)
@@ -108,7 +108,7 @@ rm -rf %{buildroot}
108108
%{_bindir}/upstart-export
109109
%{_bindir}/systemd-export
110110

111-
###############################################################################
111+
################################################################################
112112

113113
%changelog
114114
* Wed Nov 08 2017 Anton Novojilov <[email protected]> - 0.17.0-0

readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -331,4 +331,4 @@ Examples
331331
332332
init-exporter is released under the MIT license (see [LICENSE](LICENSE))
333333
334-
<a href="https://funbox.ru"><img src="https://funbox.ru/badges/sponsored_by_funbox.svg" alt="Sponsored by FunBox" width=250 /></a>
334+
[![Sponsored by FunBox](https://funbox.ru/badges/sponsored_by_funbox_grayscale.svg)](https://funbox.ru)

0 commit comments

Comments
 (0)