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

Commit325b966

Browse files
committed
seechangkun#72: use travis-ci
1 parent407f6ed commit325b966

13 files changed

+101
-32
lines changed

‎.travis.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
services:
2+
-docker
3+
4+
before_install:
5+
-openssl aes-256-cbc -K $encrypted_9157553ce13c_key -iv $encrypted_9157553ce13c_iv -in .travis/travis.enc -out ~/.ssh/id_rsa -d
6+
-chmod 600 ~/.ssh/id_rsa
7+
-git config --global user.name "Changkun Ou"
8+
-git config --global user.email "hi@changkun.us"
9+
-make build-env
10+
11+
addons:
12+
ssh_known_hosts:
13+
-changkun.de
14+
15+
script:
16+
-make build
17+
18+
after_success:
19+
scp -r website/public/modern-cpp/* $encrypted_server_user@changkun.de:$encrypted_server_path

‎.travis/travis.enc

1.64 KB
Binary file not shown.

‎Makefile

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,34 @@
1-
all: pdf website
1+
DOCKER_ENV=changkun/modern-cpp-tutorial:build-env
2+
LANGS = zh-cn en-us
3+
ALL_BUILDS = pdf website
24

3-
pdf:
4-
cd pdf/zh-cn&& make
5-
cd pdf/en-us&& make
5+
# dep
6+
7+
all:$(ALL_BUILDS)
8+
9+
pdf:$(LANGS)
10+
$(LANGS):
11+
cd pdf/$@&& make&& make clean
612

713
website:
814
cd website&& make
915

16+
build:
17+
docker run --rm -v`pwd`:/modern-cpp-tutorial -it$(DOCKER_ENV) make
18+
19+
# dev
20+
21+
build-env:
22+
docker build -t$(DOCKER_ENV) -f ./docker/Dockerfile.
23+
1024
serve:
1125
cd website&& make s
1226

1327
clean:
1428
cd pdf/zh-cn&& make clean
1529
cd pdf/en-us&& make clean
1630
cd website&& make clean
31+
docker images -f"dangling=true" -q| xargs docker rmi -f
32+
docker image prune -f
1733

18-
.PHONY :pdf website clean
34+
.PHONY :$(LANGS)$(ALL_BUILDS) serve build-env build-all clean

‎README-zh-cn.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,14 @@
3737

3838
本书的[网站](https://changkun.de/modern-cpp)源码可以在[这里](./website)找到,由[hexo](https://hexo.io)[vuejs](https://vuejs.org) 协同构建而成。网站旨在提供一个除 GitHub 之外的阅读方式,除了在桌面端访问之外,你也可以在移动端上阅读本书。
3939

40+
##构建
41+
42+
如果你希望在本地编译整个仓库,我们建议使用[Docker](https://docs.docker.com/install/)。如果 Docker 在你的本地能正常使用,则可以简单的通过运行下面的指令完成构建:
43+
44+
```bash
45+
$ make build
46+
```
47+
4048
##致谢
4149

4250
笔者时间和水平有限,如果读者发现书中内容的错误,欢迎提[Issue](https://github.com/changkun/modern-cpp-tutorial/issues),或者直接提[Pull request](https://github.com/changkun/modern-cpp-tutorial/pulls)。详细贡献指南请参考[如何参与贡献](CONTRIBUTING.md),由衷感谢每一位指出本书中出现错误的读者,包括但不限于[Contributors](https://github.com/changkun/modern-cpp-tutorial/graphs/contributors)

‎README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,14 @@ There are few exercises At the end of each chapter of the book. It is for testin
4040

4141
The source code of the[website](https://changkun.de/modern-cpp) of this book can be found[here](./website), which is built by[hexo](https://hexo.io) and[vuejs](https://vuejs.org). The website provides you another way of reading the book, it is also adapts to mobile.
4242

43+
##Build
44+
45+
If you are interested in build everything locally, it is recommended using[Docker](https://docs.docker.com/install/). To build, simply run:
46+
47+
```bash
48+
$ make build
49+
```
50+
4351
##Acknowledgements
4452

4553
This book was originally written in Chinese by[Changkun Ou](https://changkun.de).

‎book/zh-cn/10-cpp20.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ void sort(Sortable& c); // c 是一个 Sortable 类型的对象
5555
5656
我们现在来看一个实际的例子。
5757
58-
TODO:
58+
TODO: https://godbolt.org/z/9liFPD
5959
6060
## 模块
6161

‎docker/Dockerfile

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
FROM node:latest
2+
3+
LABEL"maintainer"="Changkun Ou <hi@changkun.us>"
4+
LABEL"repository"="https://github.com/changkun/modern-cpp-tutorial"
5+
LABEL"homepage"="https://changkun.de/modern-cpp/"
6+
7+
# FUCKING UNICODE
8+
ENV LANG C.UTF-8
9+
ENV LC_ALL C.UTF-8
10+
11+
WORKDIR /modern-cpp-tutorial
12+
13+
# Node & Npm & Python3 are from node:latest
14+
# Install Texlive & Pandoc
15+
RUN apt update && \
16+
apt install wget texlive-full -y && \
17+
wget https://github.com/jgm/pandoc/releases/download/2.7.3/pandoc-2.7.3-1-amd64.deb && \
18+
dpkg -i pandoc-2.7.3-1-amd64.deb

‎pdf/en-us/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ revision:
1111

1212
pdf: markdown
1313
@echo"Compiling PDF file..."
14-
@pandoc -f markdown+smart -s$(filename).md -o$(filename).pdf\
14+
pandoc -f markdown+smart -s$(filename).md -o$(filename).pdf\
1515
--title-prefix$(title)\
1616
--listings -H meta/cpp-listings.tex\
1717
--template=meta/template.tex\
1818
--pdf-engine=`which xelatex`
1919
@echo"Done."
20-
@rm*.md revision.tex
20+
rm*.md revision.tex
2121

2222
markdown:
2323
@echo"Copy markdown files..."
24-
@cp -r ../../book/en-us/*.
24+
cp -r ../../book/en-us/*.
2525
@echo"Aggregating markdown files..."
26-
@python3 aggregator.py
26+
python3 aggregator.py
2727

2828
clean:
29-
rm -rf revision.tex*.md*.pdf
29+
rm -rf revision.tex*.md
3030

3131
.PHONY: markdown pdf clean

‎pdf/en-us/modern-cpp-tutorial.pdf

-5.2 KB
Binary file not shown.

‎pdf/zh-cn/Makefile

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ revision:
1111

1212
pdf: markdown
1313
@echo"Compiling PDF file..."
14-
@pandoc -f markdown+smart -s$(filename).md -o$(filename).pdf\
14+
pandoc -f markdown+smart -s$(filename).md -o$(filename).pdf\
1515
--title-prefix$(title)\
1616
--listings -H meta/cpp-listings.tex\
1717
--template=meta/template.tex\
1818
--pdf-engine=`which xelatex`
1919
@echo"Done."
20-
@rm*.md revision.tex
20+
rm*.md revision.tex
2121

2222
markdown:
2323
@echo"Copy markdown files..."
24-
@cp -r ../../book/zh-cn/*.
24+
cp -r ../../book/zh-cn/*.
2525
@echo"Aggregating markdown files..."
26-
@python3 aggregator.py
26+
python3 aggregator.py
2727

2828
clean:
29-
rm -rf revision.tex*.md*.pdf
29+
rm -rf revision.tex*.md
3030

3131
.PHONY: markdown pdf clean

‎pdf/zh-cn/aggregator.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,21 @@
11
# !/usr/bin/env python3
22
# author: changkun<hi@changkun.us>
33

4-
importos
4+
importos,io
55

66
chapters= ['00-preface.md','01-intro.md','02-usability.md','03-runtime.md','04-containers.md','05-pointers.md','06-regex.md','07-thread.md','08-filesystem.md','09-others.md','10-cpp20.md','appendix1.md','appendix2.md']
77

88
ignores= ['TOC','返回目录','许可','license']
99

10-
withopen('modern-cpp-tutorial.md','w')asoutfile:
11-
outfile.write("""---
10+
head="""---
1211
title: "高速上手 C++11/14/17/20"
1312
author: 欧长坤 <hi@changkun.us>
1413
copyright: cc-by-nc-nd 4.0
1514
---
16-
""")
15+
"""
16+
17+
withio.open('modern-cpp-tutorial.md','w',encoding='utf8')asoutfile:
18+
outfile.write(head)
1719
forchapterinchapters:
1820
ifos.path.isfile(chapter):
1921
withopen(chapter)asch:

‎pdf/zh-cn/modern-cpp-tutorial.pdf

250 KB
Binary file not shown.

‎website/Makefile

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,19 +11,17 @@ all: clean
1111
cp -r ../assets/figures ./src/modern-cpp/assets/figures
1212
cp -r ../exercises ./src/modern-cpp/
1313
cp -r ../code ./src/modern-cpp/
14-
hexo generate
14+
npxhexo generate
1515
mv public/index.html public/modern-cpp/index.html
1616
s: all
1717
node_modules/serve/bin/serve.js ./public
1818
clean:
19-
rm -rf ./src/modern-cpp/assets/cover-2nd.png
20-
rm -rf ./src/modern-cpp/assets/figures
21-
rm -rf public db.json src/modern-cpp/zh-cn
22-
rm -rf public db.json src/modern-cpp/en-us
23-
rm -rf ./src/modern-cpp/assets/alipay.jpg
24-
rm -rf ./src/modern-cpp/assets/wechat.jpg
25-
rm -rf ./src/modern-cpp/about/donate.md
26-
rm -rf ./src/modern-cpp/about/community.md
27-
rm -rf ./src/modern-cpp/code
28-
rm -rf ./src/modern-cpp/exercises
29-
19+
rm -rf ./src/modern-cpp/assets/cover-2nd.png\
20+
./src/modern-cpp/assets/figures\
21+
./src/modern-cpp/assets/alipay.jpg\
22+
./src/modern-cpp/assets/wechat.jpg\
23+
./src/modern-cpp/about/donate.md\
24+
./src/modern-cpp/about/community.md\
25+
./src/modern-cpp/code\
26+
./src/modern-cpp/exercises\
27+
public db.json src/modern-cpp/zh-cn src/modern-cpp/en-us

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp