Skip to content

Commit

Permalink
Merge branch 'master' into aws
Browse files Browse the repository at this point in the history
  • Loading branch information
straight-shoota committed Apr 6, 2022
2 parents 12dd02b + 7aff793 commit 09589e8
Show file tree
Hide file tree
Showing 69 changed files with 902 additions and 685 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/deploy-book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,18 @@ jobs:
steps:
- name: Download source
uses: actions/checkout@v2
- name: Extract branch name to deploy
id: branch
shell: bash -x {0}
run: |
if [[ ${GITHUB_BASE_REF:-$GITHUB_REF} =~ ^(refs/heads/)?(master|release/[0-9][0-9.]+)$ ]]; then
echo "::set-output name=branch::${BASH_REMATCH[2]#release/}"
fi
- name: Install Crystal
id: crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ steps.branch.outputs.branch }}
- name: Install Python
uses: actions/setup-python@v2
- name: Cache dependencies
Expand All @@ -24,17 +34,16 @@ jobs:
restore-keys: pip-
- name: Install dependencies
run: make deps
- name: Build book
run: LINT=true make build
- name: Disallow unchecked intra-site links
run: make check_internal_links
- name: Extract branch name to deploy
id: branch
- name: Determine a version for API doc links
shell: bash -x {0}
run: |
if [[ $GITHUB_REF =~ ^refs/heads/(master|[0-9][0-9.]+)$ ]]; then
echo "::set-output name=branch::${BASH_REMATCH[1]}"
if [[ '${{ steps.branch.outputs.branch }}' =~ ^[0-9] ]]; then
echo "CRYSTAL_VERSION=${{ steps.crystal.outputs.crystal }}" >> ${GITHUB_ENV}
fi
- name: Populate sample version of Crystal
run: crystal --version | tee crystal-version.txt
- name: Build book
run: LINT=true make build
- name: Configure AWS Credentials
if: github.event_name == 'push' && steps.branch.outputs.branch != null && github.repository == 'crystal-lang/crystal-book'
uses: aws-actions/configure-aws-credentials@v1
Expand Down
11 changes: 1 addition & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,7 @@ clean_all: clean clean_deps clean_vendor

.PHONY: format_api_docs_links
format_api_docs_links:
echo $(DOCS_FILES) | xargs sed -i -E -e 's|https?://(www\.)?crystal-lang.org/api/([A-Z])|https://crystal-lang.org/api/latest/\2|g'

.PHONY: check_internal_links
check_internal_links: $(DOCS_FILES)
if grep -P '\[\w.*?\]\((?!http)[^ )]*?(\.html|/)(#[^ )]*?)?\)' docs/**/*.md; then \
echo "Links within the site must end with .md"; exit 1; \
fi
if grep -P '\]\(/|//crystal-lang.org/reference/' docs/**/*.md; then \
echo "Absolute links within the site are disallowed, use relative links instead"; exit 1; \
fi
echo $(DOCS_FILES) | xargs sed -i -E -e 's@\bhttps?://(www\.)?crystal-lang\.org/api/([0-9]+(\.[0-9]+)+|latest|master)/([^ )]+\.html)\b@https://crystal-lang.org/api/\4@g'

.PHONY: help
help: ## Show this help
Expand Down
2 changes: 1 addition & 1 deletion crystal-version.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Crystal 1.2.2 [6529d725a] (2021-11-10)
Crystal 1.3.0 [a3ee70ca0] (2022-01-06)

LLVM: 10.0.0
Default target: x86_64-unknown-linux-gnu
1 change: 1 addition & 0 deletions docs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@
* [as](syntax_and_semantics/as.md)
* [as?](syntax_and_semantics/as_question.md)
* [typeof](syntax_and_semantics/typeof.md)
* [Type autocasting](syntax_and_semantics/autocasting.md)
* [Macros](syntax_and_semantics/macros/README.md)
* [Macro methods](syntax_and_semantics/macros/macro_methods.md)
* [Hooks](syntax_and_semantics/macros/hooks.md)
Expand Down
14 changes: 0 additions & 14 deletions docs/assets/script.js

This file was deleted.

2 changes: 1 addition & 1 deletion docs/assets/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
margin: 0;
}
.card > ul {
display: flex;
display: flex !important;
flex-wrap: wrap;
list-style: none;
padding: 0;
Expand Down
21 changes: 10 additions & 11 deletions docs/database/connection_pool.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,16 @@ If a connection is lost or can't be established retry at most `retry_attempts` t

The following program will print the current time from MySQL but if the connection is lost or the whole server is down for a few seconds the program will still run without raising exceptions.

!!! example "sample.cr"
```crystal
require "mysql"

DB.open "mysql://root@localhost?retry_attempts=8&retry_delay=3" do |db|
loop do
pp db.scalar("SELECT NOW()")
sleep 0.5
end
end
```
```crystal title="sample.cr"
require "mysql"
DB.open "mysql://root@localhost?retry_attempts=8&retry_delay=3" do |db|
loop do
pp db.scalar("SELECT NOW()")
sleep 0.5
end
end
```

```console
$ crystal sample.cr
Expand Down
7 changes: 3 additions & 4 deletions docs/getting_started/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,9 @@ More details about using the compiler can be found on the manpage `man crystal`

The following example is the classic Hello World. In Crystal it looks like this:

!!! example "hello_world.cr"
```crystal
puts "Hello World!"
```
```crystal title="hello_world.cr"
puts "Hello World!"
```

We may run our example like this:

Expand Down
Loading

0 comments on commit 09589e8

Please sign in to comment.