Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
120 commits
Select commit Hold shift + click to select a range
a994dc8
Fix shards build
zw963 Aug 8, 2022
220bb6f
Add sound support for linux/macOS when build success or failed.
zw963 Aug 8, 2022
1afb6b9
Refactor install.cr
zw963 Mar 7, 2023
199bb72
Fix success wav filename.
zw963 Mar 9, 2023
14acd60
Fixed: run use correct crystal bianry name
zw963 Feb 18, 2024
64c8e25
Add baked_file_system for baked sound files into binary and use it di…
zw963 Feb 18, 2024
8ae3c1e
Disable sound player for mac.
zw963 Apr 3, 2024
ec7db72
fix bug.
zw963 May 14, 2024
4e87d53
Fix warning
zw963 Dec 1, 2024
bb51a73
Refactor: add type.
zw963 Dec 1, 2024
aadaaa5
Refactor: @sound_player should nilable.
zw963 Dec 1, 2024
0ea9d8b
Refactor
zw963 Dec 2, 2024
de13bde
Move Sentry::config into separate file
zw963 Dec 2, 2024
8f6343d
Move process_runner into separate file
zw963 Dec 2, 2024
028770c
Add VERSION
zw963 Dec 2, 2024
9c6e32f
format setrny_cli.cr manually
zw963 Dec 2, 2024
4034dfc
Parse the build binary output name from shards
zw963 Dec 2, 2024
2f392c7
Refactor
zw963 Dec 2, 2024
4a71682
Cleanup the unnecessary initialize
zw963 Dec 2, 2024
1f6f39c
Fixed: 1. passing build args issue. 2. Fixed output binary file same …
zw963 Dec 2, 2024
1d3b027
Rename method name
zw963 Dec 2, 2024
4d2dac0
cleanup
zw963 Dec 2, 2024
8699346
Refactor
zw963 Dec 2, 2024
5e77409
Refactor use property? for info
zw963 Dec 2, 2024
d4a3699
Refactor
zw963 Dec 2, 2024
9c59b1f
Rename method name: run_args -> run_args_str
zw963 Dec 2, 2024
1e4e240
Set Config#str_path to nilable
zw963 Dec 2, 2024
9f25757
move private method into end of class
zw963 Dec 2, 2024
3a1ca84
Refactor process_runner.cr
zw963 Dec 2, 2024
8ec1fa3
Refactor: remove process_runner display_name property.
zw963 Dec 2, 2024
caab012
Refactor
zw963 Dec 2, 2024
286537f
Rename refactor
zw963 Dec 2, 2024
f039d46
Refactor
zw963 Dec 2, 2024
3102842
clean up
zw963 Dec 2, 2024
25e74f2
Fix print good bye message.
zw963 Dec 2, 2024
7b583e5
Refactor: 1. rename method name, 2. print arg default.
zw963 Dec 2, 2024
ac07a5c
Refctor sentry_cli.cr
zw963 Dec 3, 2024
2bbcd2b
Refactor
zw963 Dec 3, 2024
d454743
Refactor
zw963 Dec 3, 2024
030c5a5
Refactor use property block
zw963 Dec 3, 2024
1bb70e3
Add comment
zw963 Dec 3, 2024
6995319
Refactor
zw963 Dec 3, 2024
ab1a5dd
Fix --no-build option
zw963 Dec 3, 2024
c4bbf24
Refactor
zw963 Dec 3, 2024
8963d9e
Refactor
zw963 Dec 3, 2024
6da76f9
Refactor
zw963 Dec 3, 2024
4cbabff
Refactor
zw963 Dec 3, 2024
cbed9ec
Given run_command nilable, but have a default value.
zw963 Dec 3, 2024
c399dec
Fix sentry work if no shard.yml exists
zw963 Dec 3, 2024
6c3eab8
Fix build_args_str use method, because block form setter use cache va…
zw963 Dec 3, 2024
79deef0
cleanup
zw963 Dec 3, 2024
810c48f
Refactor
zw963 Dec 3, 2024
112bb3f
Rename build_args -> build_args_list
zw963 Dec 3, 2024
9f2de25
Rename build_arg_str -> build_arg, run_arg_str -> run_arg
zw963 Dec 3, 2024
6c86384
Fix build_args
zw963 Dec 3, 2024
b34f605
Refactor
zw963 Dec 3, 2024
0260038
Fix sentry -w to override default pattern.
zw963 Dec 4, 2024
df5ebdf
Added --no-sound option.
zw963 Dec 4, 2024
3751842
Use Process.find_executable instead of `which`
zw963 Dec 4, 2024
3f8d0d0
Rename --no-sound to --not-play-audio
zw963 Dec 4, 2024
825767e
add play_audio config.
zw963 Dec 4, 2024
0a69f14
Add should_build into config.
zw963 Dec 4, 2024
211866e
Add colorize into config.
zw963 Dec 4, 2024
5c88939
Fix --watch to override default.
zw963 Dec 4, 2024
41a430a
Update config example
zw963 Dec 4, 2024
bf860c9
Refactor
zw963 Dec 4, 2024
fd413a2
Add run_shards_install into config
zw963 Dec 4, 2024
9afa990
Add comment to new config.
zw963 Dec 4, 2024
7850fe0
Add github workflow
zw963 Dec 4, 2024
9099281
Refactor
zw963 Dec 4, 2024
2123be1
Rename file
zw963 Dec 4, 2024
8865037
Add --version to show sentry version.
zw963 Dec 4, 2024
ddbe6a5
Change --build to --buld-command for clarify.
zw963 Dec 4, 2024
187b85c
Update README.md
zw963 Dec 4, 2024
d3414ae
Delete build file before the first time build.
zw963 Dec 5, 2024
eaa736a
Add error message if run file not exists
zw963 Dec 5, 2024
b991eb3
Add -b for set full build command, for backwards compatibility
zw963 Dec 5, 2024
4575a85
Create bin folder if run_command inferred from shard.yml
zw963 Dec 5, 2024
bf5deb3
Check run_command is file before run it.
zw963 Dec 5, 2024
e6425f7
Refator: rename
zw963 Dec 5, 2024
5773336
Fix get correct run_command from --src when no shard.yml.
zw963 Dec 5, 2024
a24732d
Remove ./ in run_command
zw963 Dec 5, 2024
5b8b2e3
Update README.md
zw963 Dec 5, 2024
6e1f9c2
Refactor
zw963 Dec 5, 2024
0de5b34
Fix README.md
zw963 Dec 5, 2024
fa41fd7
Update README.md
zw963 Dec 5, 2024
0566a5d
Fix README.md
zw963 Dec 5, 2024
6ef1ade
Add workflow file
zw963 Dec 6, 2024
7ee0432
Add windows workflow
zw963 Dec 6, 2024
08a2136
Add git hash as rev version
zw963 Dec 6, 2024
cc37d4c
Bump version to 0.6.1
zw963 Dec 6, 2024
b950b8d
Initial windows support: https://github.com/samueleaton/sentry/pull/68
zw963 Dec 6, 2024
02d233e
Refactor on audio player for skip in windows
zw963 Dec 6, 2024
5649916
Use portable terminate api for catch Ctrl+C
zw963 Dec 6, 2024
be41169
Add .exe extension name when run command in windows
zw963 Dec 6, 2024
43c7be5
Merge pull request #1 from crystal-china/windows_support
zw963 Dec 10, 2024
e2afc6a
Bump version to 0.7.0
zw963 Dec 10, 2024
462e1eb
update workflow cache vertion to v4
zw963 Dec 10, 2024
0c679cd
Refactor
zw963 Dec 12, 2024
f764837
Refactor: wapper cli config logic into a class.
zw963 Dec 12, 2024
654551f
Add parse into cli_config method
zw963 Dec 12, 2024
9abaf39
Add specs for empty .sentry.yml
zw963 Dec 12, 2024
c2d65f8
Added more spec
zw963 Dec 12, 2024
2a1a10d
Set config.sets_run_command to be false
zw963 Dec 12, 2024
93a8f22
Refactor run_command regex
zw963 Dec 12, 2024
20a2d00
Add more spec, refactor code.
zw963 Dec 12, 2024
57b2ec3
Rename spec file name
zw963 Dec 12, 2024
0c13e38
Fix bugs, add more specs
zw963 Dec 12, 2024
c56d00d
Add more types
zw963 Dec 12, 2024
a118cc5
Merge branch 'add_spec'
zw963 Dec 12, 2024
16f4717
Bump version to 0.7.1
zw963 Dec 12, 2024
f8df6da
cleanup install.cr, install.rb
zw963 Dec 12, 2024
af364a0
Add Makefile
zw963 Dec 13, 2024
2a29171
Fix Makefile parse shards output file bug.
zw963 Dec 13, 2024
6bb2cea
Fix spec
zw963 Dec 19, 2024
d36d8ea
update git action
zw963 Mar 18, 2025
02dab34
Add date into VERSION
zw963 Mar 18, 2025
8a474d0
bump version to 0.7.2
zw963 Mar 18, 2025
06d616d
Fix formatter
zw963 Mar 22, 2025
4542cf7
Update README.md
zw963 Aug 27, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/alpine_x86_64_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
on:
push:
tags:
- "v*.*.*"

jobs:
build:
runs-on: ubuntu-latest
container:
image: crystallang/crystal:latest-alpine
steps:
- name: Cache shards
uses: actions/cache@v4
with:
path: ~/.cache/shards
key: ${{ runner.os }}-shards-${{ hashFiles('shard.yml') }}
restore-keys: ${{ runner.os }}-shards-

- name: Download source
uses: actions/checkout@v4

- name: Check formatting
run: crystal tool format --check

- name: Install shards
run: shards check || shards install --without-development

- name: Disable git safe repository checks
run: git config --global --add safe.directory '*'

- name: Run tests
run: crystal spec --order=random --error-on-warnings

- name: Collect package information
run: |
echo "BINARY_NAME=bin/$(cat shard.yml |grep targets -A1|tail -n1 |sed 's#[ :]##g')" >> $GITHUB_ENV
echo "PKG_ARCH=x86_64" >> $GITHUB_ENV
echo "PLATFORM=unknown-linux-musl.tar.gz" >> $GITHUB_ENV
echo "BUILD_ARGS=--static --link-flags=\"-s -Wl,-z,relro,-z,now\"" >> $GITHUB_ENV

- name: Set asset name
run: |
echo "ASSERT_NAME=${{env.BINARY_NAME}}-${{github.ref_name}}-${{env.PKG_ARCH}}-${{env.PLATFORM}}" >> $GITHUB_ENV

- name: Build release binary
id: release
run: |
echo "ASSERT_NAME=${{env.ASSERT_NAME}}" >> $GITHUB_OUTPUT
shards build --production --progress --no-debug -Dstrict_multi_assign -Dno_number_autocast ${{env.BUILD_ARGS}}
tar zcvf ${{env.ASSERT_NAME}} ${{env.BINARY_NAME}} LICENSE

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{steps.release.outputs.ASSERT_NAME}}
55 changes: 55 additions & 0 deletions .github/workflows/gnu_x86_64_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on:
push:
tags:
- "v*.*.*"

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Cache shards
uses: actions/cache@v4
with:
path: ~/.cache/shards
key: ${{ runner.os }}-shards-${{ hashFiles('shard.yml') }}
restore-keys: ${{ runner.os }}-shards-

- name: Download source
uses: actions/checkout@v4

- name: Install Crystal
uses: crystal-lang/install-crystal@v1

- name: Check formatting
run: crystal tool format --check

- name: Install shards
run: shards check || shards install --without-development

- name: Run tests
run: KEMAL_ENV=test crystal spec --order=random --error-on-warnings

- name: Collect package information
run: |
echo "BINARY_NAME=bin/$(cat shard.yml |grep targets -A1|tail -n1 |sed 's#[ :]##g')" >> $GITHUB_ENV
echo "PKG_ARCH=x86_64" >> $GITHUB_ENV
echo "PLATFORM=unknown-linux-gnu.tar.gz" >> $GITHUB_ENV
echo "BUILD_ARGS=--link-flags=\"-s -Wl,-z,relro,-z,now\"" >> $GITHUB_ENV

- name: Set asset name
run: |
echo "ASSERT_NAME=${{env.BINARY_NAME}}-${{github.ref_name}}-${{env.PKG_ARCH}}-${{env.PLATFORM}}" >> $GITHUB_ENV

- name: Build release binary
id: release
run: |
echo "ASSERT_NAME=${{env.ASSERT_NAME}}" >> $GITHUB_OUTPUT
shards build --production --progress --no-debug -Dstrict_multi_assign -Dno_number_autocast ${{env.BUILD_ARGS}}
tar zcvf ${{env.ASSERT_NAME}} ${{env.BINARY_NAME}} LICENSE

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{steps.release.outputs.ASSERT_NAME}}
55 changes: 55 additions & 0 deletions .github/workflows/macos_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
on:
push:
tags:
- "v*.*.*"

jobs:
build:
runs-on: macos-latest
steps:
- name: Cache shards
uses: actions/cache@v4
with:
path: ~/.cache/shards
key: ${{ runner.os }}-shards-${{ hashFiles('shard.yml') }}
restore-keys: ${{ runner.os }}-shards-

- name: Download source
uses: actions/checkout@v4

- name: Install Crystal
uses: crystal-lang/install-crystal@v1

- name: Check formatting
run: crystal tool format --check

- name: Install shards
run: shards check || shards install --without-development

- name: Run tests
run: KEMAL_ENV=test crystal spec --order=random --error-on-warnings

- name: Collect package information
run: |
echo "BINARY_NAME=bin/$(cat shard.yml |grep targets -A1|tail -n1 |sed 's#[ :]##g')" >> $GITHUB_ENV
echo "PKG_ARCH=x86_64" >> $GITHUB_ENV
echo "PLATFORM=apple-darwin.tar.gz" >> $GITHUB_ENV
echo "BUILD_ARGS=" >> $GITHUB_ENV

- name: Set asset name
run: |
echo "ASSERT_NAME=${{env.BINARY_NAME}}-${{github.ref_name}}-${{env.PKG_ARCH}}-${{env.PLATFORM}}" >> $GITHUB_ENV

- name: Build release binary
id: release
run: |
echo "ASSERT_NAME=${{env.ASSERT_NAME}}" >> $GITHUB_OUTPUT
shards build --production --progress --no-debug -Dstrict_multi_assign -Dno_number_autocast ${{env.BUILD_ARGS}}
tar zcvf ${{env.ASSERT_NAME}} ${{env.BINARY_NAME}} LICENSE

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{steps.release.outputs.ASSERT_NAME}}
49 changes: 49 additions & 0 deletions .github/workflows/windows-msvc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
on:
push:
tags:
- "v*.*.*"

jobs:
build:
runs-on: windows-2022
steps:
- name: Cache shards
uses: actions/cache@v4
with:
path: ~/.cache/shards
key: ${{ runner.os }}-shards-${{ hashFiles('shard.yml') }}
restore-keys: ${{ runner.os }}-shards-

- name: Download source
uses: actions/checkout@v4

- name: Install Crystal
uses: crystal-lang/install-crystal@v1

- name: Install shards
run: shards check || shards install --without-development

- name: Collect package information
run: |
echo "BINARY_NAME=bin/$(cat shard.yml |Select-String -Pattern 'targets:' -Context 1 |%{$_ -replace '> targets:',''}|%{$_ -replace '[\s:]*',''})" >> $Env:GITHUB_ENV
echo "PKG_ARCH=x86_64" >> $Env:GITHUB_ENV
echo "PLATFORM=pc-windows-msvc.zip" >> $Env:GITHUB_ENV
echo "BUILD_ARGS=" >> $Env:GITHUB_ENV

- name: Set asset name
run: |
echo "ASSERT_NAME=${{env.BINARY_NAME}}-${{github.ref_name}}-${{env.PKG_ARCH}}-${{env.PLATFORM}}" >> $Env:GITHUB_ENV

- name: Build release binary
id: release
run: |
echo "ASSERT_NAME=${{env.ASSERT_NAME}}" >> $Env:GITHUB_OUTPUT
shards build --production --progress --no-debug -Dstrict_multi_assign -Dno_number_autocast ${{env.BUILD_ARGS}}
7z a ${{env.ASSERT_NAME}} ${{env.BINARY_NAME}}.exe LICENSE

- name: Release
uses: softprops/action-gh-release@v2
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{steps.release.outputs.ASSERT_NAME}}
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
# Libraries don't need dependency lock
# Dependencies will be locked in application that uses them
/shard.lock

/bin
33 changes: 22 additions & 11 deletions .sentry.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,27 +8,38 @@

# The name of your application when displayed in log output. By default, this
# is the app name specified in `shard.yml`.
display_name: my-program-name
display_name: sentry

# Set this to `true` to show configuration information when starting Sentry.
info: true

# The command used to compile the application. Setting this option to `nil` or
# an empty string will act like specifying `--no-build` on the command line.
build: crystal build ./src/sentry_cli.cr -o ./my-program-name
# Set this to `false` to removes colorization from output.
colorize: false

# Any additional arguments to pass to the build command. Build args may only
# be given if the build command is a single argument.
build_args:
# Set this to `false` to skips the attempt to play audio file with `aplay'
# from `alsa-utils' package when building on Linux succeeds or fails.
play_audio: false

# Set this to `false` to skips the build step.
should_build: false

# Set this to `true` to run `shards install` once before Sentry build and run commands.
run_shards_install: true

# The command used to compile the application.
build_command: crystal

# Any additional arguments to pass to the build command.
build_args: build ./src/sentry_cli.cr -o ./bin/sentry

# The command used to run the compiled application.
run: ./my-program-name
run_command: ./bin/sentry

# Any additional arguments to pass to the run command. Run args may only be
# given if the run command is a single argument.
run_args:
# Any additional arguments to pass to the run command.
run_args: -p 3288

# The list of patterns of files for sentry to watch.
watch:
- ./src/**/*.cr
- ./src/**/*.ecr
- ./spec/**/*.cr
93 changes: 93 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
-include Makefile.local # for optional local options

NAME = sentry

COMPILER ?= crystal
SHARDS ?= shards

SOURCES != find src -name '*.cr'
LIB_SOURCES != find lib -name '*.cr' 2>/dev/null
SPEC_SOURCES != find spec -name '*.cr' 2>/dev/null

CRYSTAL_ENTRY_FILE != cat shard.yml |grep main: |cut -d: -f2|cut -d" " -f2
OUTPUT_FILE != cat shard.yml |grep main: -B1 |head -n1 |awk '{print $$1}'|awk -F: '{print $$1}'
CRYSTAL_ENTRY_PATH := $(shell pwd)/$(CRYSTAL_ENTRY_FILE)

CACHE_DIR != $(COMPILER) env CRYSTAL_CACHE_DIR
CACHE_DIR := $(CACHE_DIR)/$(subst /,-,${shell echo $(CRYSTAL_ENTRY_PATH) |cut -c2-})

FLAGS ?= --progress -Dstrict_multi_assign -Dno_number_autocast -Dpreview_overload_order
RELEASE_FLAGS ?= --no-debug --link-flags=-s --release --progress -Dstrict_multi_assign -Dno_number_autocast -Dpreview_overload_order

# INSTALL:
DESTDIR ?= /usr/local
BINDIR ?= $(DESTDIR)/bin
INSTALL ?= /usr/bin/install

O := bin/$(OUTPUT_FILE)

.PHONY: all
all: build ## build [default]

.PHONY: build
build: $(O) ## Build the application binary

$(O): $(SOURCES) $(LIB_SOURCES) lib bin
$(COMPILER) build $(FLAGS) $(CRYSTAL_ENTRY_FILE) -o $(O)

# 注意, 这些不带 .PHONY 通常都是真实文件名或目录名
lib: ## Run shards install to install dependencies
$(SHARDS) install

.PHONY: spec
spec: $(SPEC_SOURCES) $(SOURCES) $(LIB_SOURCES) lib bin ## Run spec
$(COMPILER) spec $(FLAGS) --order=random --error-on-warnings

.PHONY: format
format: ## Apply source code formatting
$(COMPILER) tool format src spec

.PHONY: install
install: release ## Install the compiler at DESTDIR
$(INSTALL) -d -m 0755 "$(BINDIR)/"
$(INSTALL) -m 0755 "$(O)" "$(BINDIR)/$(NAME)"

.PHONY: uninstall
uninstall: ## Uninstall the compiler from DESTDIR
rm -f "$(BINDIR)/$(NAME)"

.PHONY: check
check: ## Check dependencies, run shards install if necessary
$(SHARDS) check || $(SHARDS) install

.PHONY: clean
clean: ## Delete built binary
rm -f $(O)

.PHONY: cleanall
cleanall: clean # Delete built binary with cache
rm -rf ${CACHE_DIR}

.PHONY: release
release: $(SOURCES) $(LIB_SOURCES) lib bin ## Build release binary
$(COMPILER) build $(RELEASE_FLAGS) $(CRYSTAL_ENTRY_FILE) -o $(O)

bin:
@mkdir -p bin

.PHONY: help
help: ## Show this help
@echo
@printf '\033[34mtargets:\033[0m\n'
@grep -hE '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) |\
sort |\
awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
@echo
@printf '\033[34moptional variables:\033[0m\n'
@grep -hE '^[a-zA-Z_-]+ \?=.*?## .*$$' $(MAKEFILE_LIST) |\
sort |\
awk 'BEGIN {FS = " \\?=.*?## "}; {printf " \033[36m%-15s\033[0m %s\n", $$1, $$2}'
@echo
@printf '\033[34mrecipes:\033[0m\n'
@grep -hE '^##.*$$' $(MAKEFILE_LIST) |\
awk 'BEGIN {FS = "## "}; /^## [a-zA-Z_-]/ {printf " \033[36m%s\033[0m\n", $$2}; /^## / {printf " %s\n", $$2}'
Loading