Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Nov 8, 2022. It is now read-only.

Commitd13f8e5

Browse files
committed
make system refactor
1 parente6b436b commitd13f8e5

18 files changed

+186
-73
lines changed

‎.travis.yml‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ before_script:
1010
-MIX_ENV=test mix deps.get
1111
-nvm install 8.10 && nvm use 8.10
1212
-npm install -g apollo
13+
script:
14+
-MIX_ENV=test mix compile --warnings-as-errors, coveralls.json
15+
-mix test && MIX_ENV=test mix coveralls.travis
1316
after_script:
1417
-MIX_ENV=test mix inch.report
1518
-apollo schema:publish --endpoint="http://devapiraw.coderplanets.com/graphiql"
16-
script:
17-
-MIX_ENV=test mix compile --warnings-as-errors
18-
-mix test && MIX_ENV=test mix coveralls.travis
19+
after_success:
20+
-bash <(curl -s https://codecov.io/bash)
1921
cache:
2022
directories:
2123
-"$HOME/.cargo"

‎Makefile‎

Lines changed: 74 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,91 @@
1+
include Makefile.mk
12

2-
BELONG = "coderplanets"
3-
REPO = "coderplanets_server"
3+
help:
4+
$(call publish.help)
5+
$(call console.help)
6+
$(call dashboard.help)
7+
$(call ci.help)
8+
$(call github.help)
49

5-
CI_BUILD_LINK = "https://travis-ci.org/$(BELONG)/$(REPO)"
6-
CI_COVER_LINK = "https://coveralls.io/github/$(BELONG)/$(REPO)"
7-
CI_DOC_LINK = "https://inch-ci.org/github/$(BELONG)/$(REPO)"
10+
init:
11+
mix ecto.setup
812

9-
GITHUB_CODE_LINK = "https://github.com/$(BELONG)/$(REPO)"
10-
GITHUB_DOC_LINK = "https://github.com/$(BELONG)/$(REPO)/tree/dev/docs"
11-
GITHUB_PR_LINK = "https://github.com/$(BELONG)/$(REPO)/pulls"
12-
GITHUB_ISSUE_LINK = "https://github.com/$(BELONG)/$(REPO)/issues"
13+
dep:
14+
mix deps.get
1315

14-
ci:
15-
@echo"\n"
16-
@echo" [valid ci commands]"
17-
@echo" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
18-
@echo" ci.build : browse travis status"
19-
@echo" |$(CI_BUILD_LINK)"
20-
@echo" ........................................"
21-
@echo" ci.cover : browse test coveralls status"
22-
@echo" |$(CI_COVER_LINK)"
23-
@echo" ........................................"
24-
@echo" ci.doc : browse doc coverage status"
25-
@echo" |$(CI_DOC_LINK)"
26-
@echo"\n"
16+
build:
17+
mix compile
2718

28-
github:
29-
@echo"\n"
30-
@echo" [valid github commands]"
31-
@echo" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
32-
@echo" github.code : browse source code in github"
33-
@echo" |$(GITHUB_CODE_LINK)"
34-
@echo" ........................................"
35-
@echo" github.doc : browse repo docs in github"
36-
@echo" |$(GITHUB_DOC_LINK)"
37-
@echo" ........................................"
38-
@echo" github.pr : browse PRs in github"
39-
@echo" |$(GITHUB_PR_LINK)"
40-
@echo" ........................................"
41-
@echo" github.issue : browse issues in github"
42-
@echo" |$(GITHUB_ISSUE_LINK)"
43-
@echo" ........................................"
44-
@echo" github.issue.new : create issue in github"
45-
@echo" |$(GITHUB_ISSUE_LINK)/new"
46-
@echo"\n"
19+
publish:
20+
$(call publish.help)
21+
publish.help:
22+
$(call publish.help)
23+
publish.dev:
24+
./publish/dev/packer.sh
25+
publish.prod:
26+
./publish/production/packer.sh
27+
28+
# test
29+
test:
30+
mixtest
31+
test.watch:
32+
mix test.watch
33+
test.report:
34+
MIX_ENV=mix test.coverage
35+
$(call browse,"./cover/excoveralls.html")
36+
test.report.text:
37+
MIX_ENV=mix test.coverage.short
38+
39+
# lint code
40+
lint:
41+
mix lint# credo --strict
42+
lint.static:
43+
mix lint.static# use dialyzer
44+
45+
# open iex with history support
46+
console.help:
47+
$(call console.help)
48+
console:
49+
iex --erl"-kernel shell_history enabled" -S mix
50+
console.dev:
51+
MIX_ENV=dev iex --erl"-kernel shell_history enabled" -S mix
52+
console.mock:
53+
MIX_ENV=mock iex --erl"-kernel shell_history enabled" -S mix
54+
55+
# todo: monitor.apollo monitor.alicloud
56+
dashboard:
57+
$(call dashboard.help)
58+
dashboard.help:
59+
$(call dashboard.help)
60+
dashboard.apollo:
61+
$(call browse,"$(DASHBOARD_APOLLO_LINK)")
62+
dashboard.aliyun:
63+
$(call browse,"$(DASHBOARD_ALIYUN_LINK)")
4764

4865
# ci helpers
66+
ci:
67+
$(call ci.help)
68+
ci.help:
69+
$(call ci.help)
4970
ci.build:
50-
open"$(CI_BUILD_LINK)"
71+
$(call browse,"$(CI_BUILD_LINK)")
5172
ci.cover:
52-
open"$(CI_COVER_LINK)"
73+
$(call browse,"$(CI_COVER_LINK)")
5374
ci.doc:
54-
open"$(CI_DOC_LINK)"
75+
$(call browse,"$(CI_DOC_LINK)")
5576

5677
# github helpers
78+
github:
79+
$(call github.help)
80+
github.help:
81+
$(call github.help)
5782
github.code:
58-
open"$(GITHUB_CODE_LINK)"
83+
$(call browse,"$(GITHUB_CODE_LINK)")
5984
github.doc:
60-
open"$(GITHUB_DOC_LINK)"
85+
$(call browse,"$(GITHUB_DOC_LINK)")
6186
github.pr:
62-
open"$(GITHUB_PR_LINK)"
87+
$(call browse,"$(GITHUB_PR_LINK)")
6388
github.issue:
64-
open"$(GITHUB_ISSUE_LINK)"
89+
$(call browse,"$(GITHUB_ISSUE_LINK)")
6590
github.issue.new:
66-
open"$(GITHUB_ISSUE_LINK)/new"
91+
$(call browse,"$(GITHUB_ISSUE_LINK)/new")

‎Makefile.mk‎

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
OS := ${shell uname}
2+
3+
.PHONY: test publish
4+
5+
BELONG = "coderplanets"
6+
REPO = "coderplanets_server"
7+
8+
DASHBOARD_APOLLO_LINK = "https://engine.apollographql.com/account/gh.mydearxym/services"
9+
DASHBOARD_ALIYUN_LINK = "https://home.console.aliyun.com/new"
10+
11+
CI_BUILD_LINK = "https://travis-ci.org/$(BELONG)/$(REPO)"
12+
CI_COVER_LINK = "https://coveralls.io/github/$(BELONG)/$(REPO)"
13+
CI_DOC_LINK = "https://inch-ci.org/github/$(BELONG)/$(REPO)"
14+
15+
GITHUB_CODE_LINK = "https://github.com/$(BELONG)/$(REPO)"
16+
GITHUB_DOC_LINK = "https://github.com/$(BELONG)/$(REPO)/tree/dev/docs"
17+
GITHUB_PR_LINK = "https://github.com/$(BELONG)/$(REPO)/pulls"
18+
GITHUB_ISSUE_LINK = "https://github.com/$(BELONG)/$(REPO)/issues"
19+
20+
ifeq ($(OS),Darwin)# Mac OS X
21+
BROWSER_TOOL = open
22+
endif
23+
ifeq ($(OS),Linux)
24+
BROWSER_TOOL = google-chrome
25+
endif
26+
ifeq ($(OS),Windows)
27+
BROWSER_TOOL = explorer
28+
endif
29+
30+
definebrowse
31+
$(BROWSER_TOOL) "$(1)"
32+
endef
33+
34+
definepublish.help
35+
@echo "\n"
36+
@echo " [valid publish commands]"
37+
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
38+
@echo " publish.dev : pack & push code to aliyun for dev"
39+
@echo " | need manually restart docker container on aliyun"
40+
@echo " ..............................................................."
41+
@echo " publish.prod : pack & push code to for produnction"
42+
@echo " | need manually restart docker container on aliyun"
43+
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
44+
endef
45+
46+
defineconsole.help
47+
@echo "\n"
48+
@echo " [valid console commands]"
49+
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
50+
@echo " console : run iex"
51+
@echo " ..................................."
52+
@echo " console.dev : run iex in dev env"
53+
@echo " ..................................."
54+
@echo " console.mock : run iex in mock env"
55+
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
56+
endef
57+
58+
definedashboard.help
59+
@echo "\n"
60+
@echo " [valid dashboard commands]"
61+
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
62+
@echo " dashboard.apollo : graphql api status provide by apollo engine"
63+
@echo " |$(DASHBOARD_APOLLO_LINK)"
64+
@echo " ................................................................................."
65+
@echo " dashboard.aliyun : aliyun console"
66+
@echo " |$(DASHBOARD_ALIYUN_LINK)"
67+
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
68+
endef
69+
70+
defineci.help
71+
@echo "\n"
72+
@echo " [valid ci commands]"
73+
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
74+
@echo " ci.build : browse travis status"
75+
@echo " |$(CI_BUILD_LINK)"
76+
@echo " ......................................................................."
77+
@echo " ci.cover : browse test coveralls status"
78+
@echo " |$(CI_COVER_LINK)"
79+
@echo " ......................................................................."
80+
@echo " ci.doc : browse doc coverage status"
81+
@echo " |$(CI_DOC_LINK)"
82+
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
83+
endef
84+
85+
definegithub.help
86+
@echo "\n"
87+
@echo " [valid github commands]"
88+
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
89+
@echo " github.code : browse source code in github"
90+
@echo " |$(GITHUB_CODE_LINK)"
91+
@echo " ...................................................................................."
92+
@echo " github.doc : browse repo docs in github"
93+
@echo " |$(GITHUB_DOC_LINK)"
94+
@echo " ...................................................................................."
95+
@echo " github.pr : browse PRs in github"
96+
@echo " |$(GITHUB_PR_LINK)"
97+
@echo " ...................................................................................."
98+
@echo " github.issue : browse issues in github"
99+
@echo " |$(GITHUB_ISSUE_LINK)"
100+
@echo " ...................................................................................."
101+
@echo " github.issue.new : create issue in github"
102+
@echo " |$(GITHUB_ISSUE_LINK)/new"
103+
@echo " ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
104+
endef

‎console.sh‎

Lines changed: 0 additions & 3 deletions
This file was deleted.

‎publish.sh‎

Lines changed: 0 additions & 15 deletions
This file was deleted.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

‎docker/dev/packer.sh‎renamed to ‎publish/dev/packer.sh‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ PRJ_DIR="./"
66
PACKER_TMP_DIR="./packer_tmp"
77
BRANCH_NAME="dev"
88
ARCHIVE_NAME="./docker/${ENV}/api_server.tar.gz"
9-
TOTAL_STEPS=5
9+
TOTAL_STEPS=4
1010

1111
cd"${PRJ_DIR}"
1212

@@ -26,7 +26,7 @@ mkdir -p "${PACKER_TMP_DIR}/config"
2626
mkdir -p"${PACKER_TMP_DIR}/lib"
2727
mkdir -p"${PACKER_TMP_DIR}/priv"
2828

29-
echo"[Step3/${TOTAL_STEPS}] creating${ARCHIVE_NAME} ..."
29+
echo"[Step2/${TOTAL_STEPS}] creating${ARCHIVE_NAME} ..."
3030

3131
cp mix.exs"${PACKER_TMP_DIR}/"
3232
cp config/dev.exs"${PACKER_TMP_DIR}/config"
@@ -40,6 +40,6 @@ cd ..
4040
mv"${PACKER_TMP_DIR}/api_server.tar.gz""${ARCHIVE_NAME}"
4141
rm -rf packer_tmp
4242

43-
echo"[Step4/${TOTAL_STEPS}]${ARCHIVE_NAME} created!"
43+
echo"[Step3/${TOTAL_STEPS}]${ARCHIVE_NAME} created!"
4444
echo"------------------------------------------------"
4545
echo"[Step 4/${TOTAL_STEPS}] run git push to push the code to ali-cloud to finish!"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp