jekyll-theme-zer0 0.10.4 โ 0.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +459 -0
- data/README.md +24 -8
- data/_data/navigation/about.yml +39 -11
- data/_data/navigation/docs.yml +53 -23
- data/_data/navigation/home.yml +27 -9
- data/_data/navigation/main.yml +27 -8
- data/_data/navigation/posts.yml +22 -6
- data/_data/navigation/quickstart.yml +8 -3
- data/_includes/README.md +2 -0
- data/_includes/components/js-cdn.html +4 -1
- data/_includes/components/post-card.html +2 -11
- data/_includes/components/preview-image.html +32 -0
- data/_includes/content/intro.html +5 -6
- data/_includes/core/footer.html +5 -3
- data/_includes/core/header.html +14 -0
- data/_includes/navigation/sidebar-categories.html +20 -9
- data/_includes/navigation/sidebar-folders.html +8 -7
- data/_includes/navigation/sidebar-right.html +16 -10
- data/_layouts/blog.html +15 -45
- data/_layouts/category.html +4 -24
- data/_layouts/collection.html +2 -12
- data/_layouts/default.html +1 -1
- data/_layouts/journals.html +2 -12
- data/_layouts/notebook.html +296 -0
- data/_sass/core/_docs.scss +1 -1
- data/_sass/custom.scss +55 -18
- data/_sass/notebooks.scss +458 -0
- data/assets/images/notebooks/test-notebook_files/test-notebook_4_0.png +0 -0
- data/assets/js/sidebar.js +511 -0
- data/scripts/README.md +128 -105
- data/scripts/analyze-commits.sh +9 -311
- data/scripts/bin/build +22 -22
- data/scripts/build +7 -111
- data/scripts/convert-notebooks.sh +415 -0
- data/scripts/features/validate_preview_urls.py +500 -0
- data/scripts/fix-markdown-format.sh +8 -262
- data/scripts/generate-preview-images.sh +7 -787
- data/scripts/install-preview-generator.sh +8 -528
- data/scripts/lib/README.md +5 -5
- data/scripts/lib/gem.sh +19 -7
- data/scripts/release +7 -236
- data/scripts/setup.sh +9 -153
- data/scripts/test-auto-version.sh +7 -256
- data/scripts/test-mermaid.sh +7 -287
- data/scripts/test.sh +9 -154
- metadata +9 -10
- data/scripts/features/preview_generator.py +0 -646
- data/scripts/lib/test/run_tests.sh +0 -140
- data/scripts/lib/test/test_changelog.sh +0 -87
- data/scripts/lib/test/test_gem.sh +0 -68
- data/scripts/lib/test/test_git.sh +0 -82
- data/scripts/lib/test/test_validation.sh +0 -72
- data/scripts/lib/test/test_version.sh +0 -96
- data/scripts/version.sh +0 -178
data/scripts/release
CHANGED
|
@@ -1,240 +1,11 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
#
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# WRAPPER: This script forwards to scripts/bin/release
|
|
5
|
+
#
|
|
6
|
+
# The canonical location is scripts/bin/release. This wrapper exists for
|
|
7
|
+
# backward compatibility with existing workflows and VS Code tasks.
|
|
8
|
+
# ============================================================================
|
|
7
9
|
|
|
8
|
-
set -euo pipefail
|
|
9
|
-
|
|
10
|
-
# Get script and library directories
|
|
11
10
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
# Source all required libraries
|
|
15
|
-
source "$LIB_DIR/common.sh"
|
|
16
|
-
source "$LIB_DIR/validation.sh"
|
|
17
|
-
source "$LIB_DIR/version.sh"
|
|
18
|
-
source "$LIB_DIR/git.sh"
|
|
19
|
-
source "$LIB_DIR/changelog.sh"
|
|
20
|
-
source "$LIB_DIR/gem.sh"
|
|
21
|
-
|
|
22
|
-
# Show usage function
|
|
23
|
-
show_usage() {
|
|
24
|
-
cat << EOF
|
|
25
|
-
๐ Simplified Release Command for zer0-mistakes
|
|
26
|
-
|
|
27
|
-
USAGE:
|
|
28
|
-
./scripts/release [VERSION_TYPE] [OPTIONS]
|
|
29
|
-
|
|
30
|
-
VERSION TYPES:
|
|
31
|
-
patch Bump patch version (0.0.X) - Bug fixes (default)
|
|
32
|
-
minor Bump minor version (0.X.0) - New features
|
|
33
|
-
major Bump major version (X.0.0) - Breaking changes
|
|
34
|
-
|
|
35
|
-
OPTIONS:
|
|
36
|
-
--dry-run Preview changes without executing
|
|
37
|
-
--skip-tests Skip running test suite
|
|
38
|
-
--skip-publish Build but don't publish to RubyGems
|
|
39
|
-
--no-github-release Skip creating GitHub release
|
|
40
|
-
--non-interactive Run without confirmation prompts
|
|
41
|
-
--verbose Show detailed debug output
|
|
42
|
-
--help, -h Show this help message
|
|
43
|
-
|
|
44
|
-
EXAMPLES:
|
|
45
|
-
./scripts/release # Patch release (0.6.0 โ 0.6.1)
|
|
46
|
-
./scripts/release minor # Minor release (0.6.0 โ 0.7.0)
|
|
47
|
-
./scripts/release major --dry-run # Preview major release
|
|
48
|
-
./scripts/release patch --skip-tests # Quick release without tests
|
|
49
|
-
|
|
50
|
-
ENVIRONMENT VARIABLES:
|
|
51
|
-
DRY_RUN=true Enable dry run mode
|
|
52
|
-
INTERACTIVE=false Disable confirmation prompts
|
|
53
|
-
VERBOSE=true Enable debug output
|
|
54
|
-
|
|
55
|
-
WORKFLOW:
|
|
56
|
-
1. Validate environment
|
|
57
|
-
2. Calculate new version
|
|
58
|
-
3. Generate changelog from commits
|
|
59
|
-
4. Update version files
|
|
60
|
-
5. Run tests (unless --skip-tests)
|
|
61
|
-
6. Build gem
|
|
62
|
-
7. Commit and tag
|
|
63
|
-
8. Publish to RubyGems (unless --skip-publish)
|
|
64
|
-
9. Create GitHub release (unless --no-github-release)
|
|
65
|
-
10. Push changes to repository
|
|
66
|
-
|
|
67
|
-
For more information, see: scripts/lib/README.md
|
|
68
|
-
EOF
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
# Default configuration
|
|
72
|
-
VERSION_TYPE="patch"
|
|
73
|
-
SKIP_TESTS=false
|
|
74
|
-
SKIP_PUBLISH=false
|
|
75
|
-
SKIP_GITHUB_RELEASE=false
|
|
76
|
-
SHOW_HELP=false
|
|
77
|
-
|
|
78
|
-
# Parse arguments
|
|
79
|
-
for arg in "$@"; do
|
|
80
|
-
case $arg in
|
|
81
|
-
--help|-h)
|
|
82
|
-
SHOW_HELP=true
|
|
83
|
-
;;
|
|
84
|
-
patch|minor|major)
|
|
85
|
-
VERSION_TYPE="$arg"
|
|
86
|
-
;;
|
|
87
|
-
esac
|
|
88
|
-
done
|
|
89
|
-
|
|
90
|
-
# Show help if requested
|
|
91
|
-
if [[ "$SHOW_HELP" == "true" ]]; then
|
|
92
|
-
show_usage
|
|
93
|
-
exit 0
|
|
94
|
-
fi
|
|
95
|
-
|
|
96
|
-
# Parse remaining arguments
|
|
97
|
-
while [[ $# -gt 0 ]]; do
|
|
98
|
-
case $1 in
|
|
99
|
-
patch|minor|major)
|
|
100
|
-
# Already handled above
|
|
101
|
-
shift
|
|
102
|
-
;;
|
|
103
|
-
--help|-h)
|
|
104
|
-
# Already handled above
|
|
105
|
-
shift
|
|
106
|
-
;;
|
|
107
|
-
--dry-run)
|
|
108
|
-
export DRY_RUN=true
|
|
109
|
-
shift
|
|
110
|
-
;;
|
|
111
|
-
--skip-tests)
|
|
112
|
-
SKIP_TESTS=true
|
|
113
|
-
shift
|
|
114
|
-
;;
|
|
115
|
-
--skip-publish)
|
|
116
|
-
SKIP_PUBLISH=true
|
|
117
|
-
shift
|
|
118
|
-
;;
|
|
119
|
-
--no-github-release)
|
|
120
|
-
SKIP_GITHUB_RELEASE=true
|
|
121
|
-
shift
|
|
122
|
-
;;
|
|
123
|
-
--non-interactive)
|
|
124
|
-
export INTERACTIVE=false
|
|
125
|
-
shift
|
|
126
|
-
;;
|
|
127
|
-
--verbose)
|
|
128
|
-
export VERBOSE=true
|
|
129
|
-
shift
|
|
130
|
-
;;
|
|
131
|
-
*)
|
|
132
|
-
error "Unknown option: $1 (use --help for usage)"
|
|
133
|
-
;;
|
|
134
|
-
esac
|
|
135
|
-
done
|
|
136
|
-
|
|
137
|
-
# Main release workflow
|
|
138
|
-
main() {
|
|
139
|
-
print_header "๐ Release Automation"
|
|
140
|
-
|
|
141
|
-
# Show configuration
|
|
142
|
-
info "Version type: $VERSION_TYPE"
|
|
143
|
-
info "Dry run: ${DRY_RUN:-false}"
|
|
144
|
-
info "Interactive: ${INTERACTIVE:-true}"
|
|
145
|
-
echo ""
|
|
146
|
-
|
|
147
|
-
# Step 1: Validate environment
|
|
148
|
-
validate_environment "$SKIP_PUBLISH" "$SKIP_GITHUB_RELEASE"
|
|
149
|
-
|
|
150
|
-
# Step 2: Version calculation
|
|
151
|
-
step "Calculating new version..."
|
|
152
|
-
local current_version
|
|
153
|
-
current_version=$(get_current_version)
|
|
154
|
-
info "Current version: $current_version"
|
|
155
|
-
|
|
156
|
-
local new_version
|
|
157
|
-
new_version=$(calculate_new_version "$current_version" "$VERSION_TYPE")
|
|
158
|
-
info "New version: $new_version"
|
|
159
|
-
|
|
160
|
-
# Confirm before proceeding
|
|
161
|
-
if [[ "$INTERACTIVE" == "true" ]] && [[ "$DRY_RUN" != "true" ]]; then
|
|
162
|
-
echo ""
|
|
163
|
-
if ! confirm "Proceed with release $current_version โ $new_version?"; then
|
|
164
|
-
warn "Release cancelled by user"
|
|
165
|
-
exit 0
|
|
166
|
-
fi
|
|
167
|
-
fi
|
|
168
|
-
echo ""
|
|
169
|
-
|
|
170
|
-
# Step 3: Generate changelog
|
|
171
|
-
step "Generating changelog..."
|
|
172
|
-
local last_tag
|
|
173
|
-
last_tag=$(get_last_version_tag)
|
|
174
|
-
generate_changelog "$new_version" "$last_tag" "HEAD"
|
|
175
|
-
echo ""
|
|
176
|
-
|
|
177
|
-
# Step 4: Update version files
|
|
178
|
-
update_version_files "$new_version"
|
|
179
|
-
echo ""
|
|
180
|
-
|
|
181
|
-
# Step 5: Run tests
|
|
182
|
-
if [[ "$SKIP_TESTS" != "true" ]]; then
|
|
183
|
-
run_tests
|
|
184
|
-
echo ""
|
|
185
|
-
else
|
|
186
|
-
warn "Skipping tests (--skip-tests specified)"
|
|
187
|
-
echo ""
|
|
188
|
-
fi
|
|
189
|
-
|
|
190
|
-
# Step 6: Build gem
|
|
191
|
-
build_gem "$new_version"
|
|
192
|
-
echo ""
|
|
193
|
-
|
|
194
|
-
# Step 7: Commit and tag
|
|
195
|
-
commit_and_tag "$new_version"
|
|
196
|
-
echo ""
|
|
197
|
-
|
|
198
|
-
# Step 8: Publish gem
|
|
199
|
-
if [[ "$SKIP_PUBLISH" != "true" ]]; then
|
|
200
|
-
publish_gem "$new_version"
|
|
201
|
-
echo ""
|
|
202
|
-
else
|
|
203
|
-
warn "Skipping RubyGems publication (--skip-publish specified)"
|
|
204
|
-
echo ""
|
|
205
|
-
fi
|
|
206
|
-
|
|
207
|
-
# Step 9: Create GitHub release
|
|
208
|
-
if [[ "$SKIP_GITHUB_RELEASE" != "true" ]]; then
|
|
209
|
-
create_github_release "$new_version"
|
|
210
|
-
echo ""
|
|
211
|
-
else
|
|
212
|
-
warn "Skipping GitHub release (--no-github-release specified)"
|
|
213
|
-
echo ""
|
|
214
|
-
fi
|
|
215
|
-
|
|
216
|
-
# Step 10: Push changes
|
|
217
|
-
push_changes
|
|
218
|
-
echo ""
|
|
219
|
-
|
|
220
|
-
# Step 11: Cleanup
|
|
221
|
-
cleanup_gem_files "$new_version"
|
|
222
|
-
echo ""
|
|
223
|
-
|
|
224
|
-
# Success summary
|
|
225
|
-
print_header "โ
Release Complete!"
|
|
226
|
-
|
|
227
|
-
print_summary "Release $new_version" \
|
|
228
|
-
"Version: $current_version โ $new_version" \
|
|
229
|
-
"Type: $VERSION_TYPE bump" \
|
|
230
|
-
"Tag: v$new_version" \
|
|
231
|
-
"" \
|
|
232
|
-
"๐ฆ RubyGems: https://rubygems.org/gems/jekyll-theme-zer0/versions/$new_version" \
|
|
233
|
-
"๐ท๏ธ GitHub: https://github.com/bamr87/zer0-mistakes/releases/tag/v$new_version" \
|
|
234
|
-
"๐ Repository: https://github.com/bamr87/zer0-mistakes"
|
|
235
|
-
|
|
236
|
-
success "Release workflow completed successfully!"
|
|
237
|
-
}
|
|
238
|
-
|
|
239
|
-
# Run main function
|
|
240
|
-
main "$@"
|
|
11
|
+
exec "$SCRIPT_DIR/bin/release" "$@"
|
data/scripts/setup.sh
CHANGED
|
@@ -1,155 +1,11 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
#
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
BLUE='\033[0;34m'
|
|
13
|
-
NC='\033[0m' # No Color
|
|
14
|
-
|
|
15
|
-
# Function to log messages
|
|
16
|
-
log() {
|
|
17
|
-
echo -e "${GREEN}[SETUP]${NC} $1"
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
warn() {
|
|
21
|
-
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
error() {
|
|
25
|
-
echo -e "${RED}[ERROR]${NC} $1"
|
|
26
|
-
exit 1
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
info() {
|
|
30
|
-
echo -e "${BLUE}[INFO]${NC} $1"
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
log "Setting up zer0-mistakes Jekyll theme development environment..."
|
|
34
|
-
|
|
35
|
-
# Check system requirements
|
|
36
|
-
log "Checking system requirements..."
|
|
37
|
-
|
|
38
|
-
# Check Ruby
|
|
39
|
-
if ! command -v ruby &> /dev/null; then
|
|
40
|
-
error "Ruby is not installed. Please install Ruby >= 2.7.0"
|
|
41
|
-
fi
|
|
42
|
-
|
|
43
|
-
RUBY_VERSION=$(ruby --version | awk '{print $2}')
|
|
44
|
-
log "Ruby version: $RUBY_VERSION"
|
|
45
|
-
|
|
46
|
-
# Check Bundler
|
|
47
|
-
if ! command -v bundle &> /dev/null; then
|
|
48
|
-
log "Installing Bundler..."
|
|
49
|
-
gem install bundler
|
|
50
|
-
fi
|
|
51
|
-
|
|
52
|
-
# Check jq
|
|
53
|
-
if ! command -v jq &> /dev/null; then
|
|
54
|
-
warn "jq is not installed. Installing via Homebrew (macOS)..."
|
|
55
|
-
if command -v brew &> /dev/null; then
|
|
56
|
-
brew install jq
|
|
57
|
-
else
|
|
58
|
-
error "jq is required but not installed. Please install jq manually."
|
|
59
|
-
fi
|
|
60
|
-
fi
|
|
61
|
-
|
|
62
|
-
# Check Git
|
|
63
|
-
if ! command -v git &> /dev/null; then
|
|
64
|
-
error "Git is not installed"
|
|
65
|
-
fi
|
|
66
|
-
|
|
67
|
-
# Install dependencies
|
|
68
|
-
log "Installing Ruby dependencies..."
|
|
69
|
-
bundle install
|
|
70
|
-
|
|
71
|
-
# Make scripts executable
|
|
72
|
-
log "Making scripts executable..."
|
|
73
|
-
chmod +x scripts/*.sh
|
|
74
|
-
|
|
75
|
-
# Validate gemspec
|
|
76
|
-
log "Validating gemspec..."
|
|
77
|
-
if gem specification jekyll-theme-zer0.gemspec > /dev/null 2>&1; then
|
|
78
|
-
info "โ Gemspec is valid"
|
|
79
|
-
else
|
|
80
|
-
error "Gemspec validation failed"
|
|
81
|
-
fi
|
|
82
|
-
|
|
83
|
-
# Create CHANGELOG if it doesn't exist
|
|
84
|
-
if [[ ! -f "CHANGELOG.md" ]]; then
|
|
85
|
-
log "Creating CHANGELOG.md..."
|
|
86
|
-
cat > CHANGELOG.md << 'EOF'
|
|
87
|
-
# Changelog
|
|
88
|
-
|
|
89
|
-
All notable changes to this project will be documented in this file.
|
|
90
|
-
|
|
91
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
92
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
93
|
-
|
|
94
|
-
## [Unreleased]
|
|
95
|
-
|
|
96
|
-
### Added
|
|
97
|
-
- Initial development setup
|
|
98
|
-
|
|
99
|
-
EOF
|
|
100
|
-
fi
|
|
101
|
-
|
|
102
|
-
# Create .gitignore additions for gem development
|
|
103
|
-
if ! grep -q "*.gem" .gitignore 2>/dev/null; then
|
|
104
|
-
log "Adding gem development entries to .gitignore..."
|
|
105
|
-
cat >> .gitignore << 'EOF'
|
|
106
|
-
|
|
107
|
-
# Gem development
|
|
108
|
-
*.gem
|
|
109
|
-
.bundle/
|
|
110
|
-
vendor/
|
|
111
|
-
pkg/
|
|
112
|
-
EOF
|
|
113
|
-
fi
|
|
114
|
-
|
|
115
|
-
# Setup Git hooks (optional)
|
|
116
|
-
if [[ -d ".git" ]]; then
|
|
117
|
-
log "Setting up Git hooks..."
|
|
118
|
-
mkdir -p .git/hooks
|
|
119
|
-
|
|
120
|
-
# Pre-commit hook to run basic validations
|
|
121
|
-
cat > .git/hooks/pre-commit << 'EOF'
|
|
122
|
-
#!/bin/bash
|
|
123
|
-
# Pre-commit hook for zer0-mistakes Jekyll theme
|
|
124
|
-
|
|
125
|
-
echo "Running pre-commit validations..."
|
|
126
|
-
|
|
127
|
-
# Validate gemspec
|
|
128
|
-
if ! gem specification jekyll-theme-zer0.gemspec > /dev/null 2>&1; then
|
|
129
|
-
echo "โ Gemspec validation failed"
|
|
130
|
-
exit 1
|
|
131
|
-
fi
|
|
132
|
-
|
|
133
|
-
# Check if package.json version is valid
|
|
134
|
-
if ! jq -e '.version' package.json > /dev/null 2>&1; then
|
|
135
|
-
echo "โ Invalid version in package.json"
|
|
136
|
-
exit 1
|
|
137
|
-
fi
|
|
138
|
-
|
|
139
|
-
echo "โ
Pre-commit validations passed"
|
|
140
|
-
EOF
|
|
141
|
-
chmod +x .git/hooks/pre-commit
|
|
142
|
-
fi
|
|
143
|
-
|
|
144
|
-
log "Setup complete!"
|
|
145
|
-
log ""
|
|
146
|
-
log "Available commands:"
|
|
147
|
-
log " ./scripts/version.sh [patch|minor|major] - Bump version"
|
|
148
|
-
log " ./scripts/build.sh [--publish] - Build (and optionally publish) gem"
|
|
149
|
-
log " ./scripts/test.sh - Run tests"
|
|
150
|
-
log ""
|
|
151
|
-
log "Development workflow:"
|
|
152
|
-
log "1. Make your changes"
|
|
153
|
-
log "2. Run ./scripts/test.sh to validate"
|
|
154
|
-
log "3. Run ./scripts/version.sh to bump version"
|
|
155
|
-
log "4. Run ./scripts/build.sh --publish to release"
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# WRAPPER: This script forwards to scripts/utils/setup
|
|
5
|
+
#
|
|
6
|
+
# The canonical location is scripts/utils/setup. This wrapper exists for
|
|
7
|
+
# backward compatibility with existing workflows.
|
|
8
|
+
# ============================================================================
|
|
9
|
+
|
|
10
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
+
exec "$SCRIPT_DIR/utils/setup" "$@"
|
|
@@ -1,260 +1,11 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
# Colors for output
|
|
10
|
-
RED='\033[0;31m'
|
|
11
|
-
GREEN='\033[0;32m'
|
|
12
|
-
YELLOW='\033[1;33m'
|
|
13
|
-
BLUE='\033[0;34m'
|
|
14
|
-
CYAN='\033[0;36m'
|
|
15
|
-
NC='\033[0m' # No Color
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# WRAPPER: This script forwards to scripts/test/integration/auto-version
|
|
5
|
+
#
|
|
6
|
+
# The canonical location is scripts/test/integration/auto-version. This wrapper
|
|
7
|
+
# exists for backward compatibility with existing workflows.
|
|
8
|
+
# ============================================================================
|
|
16
9
|
|
|
17
10
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
# Logging functions
|
|
21
|
-
log_info() {
|
|
22
|
-
echo -e "${BLUE}[INFO]${NC} $1"
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
log_success() {
|
|
26
|
-
echo -e "${GREEN}[SUCCESS]${NC} $1"
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
log_warning() {
|
|
30
|
-
echo -e "${YELLOW}[WARNING]${NC} $1"
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
log_error() {
|
|
34
|
-
echo -e "${RED}[ERROR]${NC} $1"
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
log_test() {
|
|
38
|
-
echo -e "${CYAN}[TEST]${NC} $1"
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
# Test counter
|
|
42
|
-
TESTS_RUN=0
|
|
43
|
-
TESTS_PASSED=0
|
|
44
|
-
|
|
45
|
-
run_test() {
|
|
46
|
-
local test_name="$1"
|
|
47
|
-
local test_command="$2"
|
|
48
|
-
local expected_result="${3:-}"
|
|
49
|
-
|
|
50
|
-
((TESTS_RUN++))
|
|
51
|
-
log_test "Running: $test_name"
|
|
52
|
-
|
|
53
|
-
local actual_result
|
|
54
|
-
if actual_result=$(eval "$test_command" 2>&1); then
|
|
55
|
-
if [[ -n "$expected_result" ]]; then
|
|
56
|
-
if [[ "$actual_result" == "$expected_result" ]]; then
|
|
57
|
-
log_success "โ
$test_name"
|
|
58
|
-
((TESTS_PASSED++))
|
|
59
|
-
else
|
|
60
|
-
log_error "โ $test_name - Expected: '$expected_result', Got: '$actual_result'"
|
|
61
|
-
fi
|
|
62
|
-
else
|
|
63
|
-
log_success "โ
$test_name"
|
|
64
|
-
((TESTS_PASSED++))
|
|
65
|
-
fi
|
|
66
|
-
else
|
|
67
|
-
log_error "โ $test_name - Command failed: $actual_result"
|
|
68
|
-
fi
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
# Test the commit analysis script
|
|
72
|
-
test_commit_analysis() {
|
|
73
|
-
log_info "Testing commit analysis functionality..."
|
|
74
|
-
|
|
75
|
-
# Test script exists and is executable
|
|
76
|
-
run_test "Commit analysis script exists" "test -x '$SCRIPT_DIR/analyze-commits.sh'"
|
|
77
|
-
|
|
78
|
-
# Test help output
|
|
79
|
-
run_test "Help output works" "$SCRIPT_DIR/analyze-commits.sh --help | grep -q 'Commit Analysis Script'"
|
|
80
|
-
|
|
81
|
-
# Test with sample commit ranges (if we have git history)
|
|
82
|
-
if git rev-list --count HEAD >/dev/null 2>&1; then
|
|
83
|
-
local commit_count=$(git rev-list --count HEAD)
|
|
84
|
-
|
|
85
|
-
if [[ $commit_count -gt 1 ]]; then
|
|
86
|
-
# Test analyzing last commit
|
|
87
|
-
run_test "Analyze last commit" "$SCRIPT_DIR/analyze-commits.sh HEAD~1..HEAD | grep -E '^(patch|minor|major|none)$'"
|
|
88
|
-
|
|
89
|
-
# Test analyzing multiple commits if available
|
|
90
|
-
if [[ $commit_count -gt 3 ]]; then
|
|
91
|
-
run_test "Analyze multiple commits" "$SCRIPT_DIR/analyze-commits.sh HEAD~3..HEAD | grep -E '^(patch|minor|major|none)$'"
|
|
92
|
-
fi
|
|
93
|
-
fi
|
|
94
|
-
else
|
|
95
|
-
log_warning "No git history available for commit analysis tests"
|
|
96
|
-
fi
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
# Test gem publication script compatibility
|
|
100
|
-
test_gem_publish_script() {
|
|
101
|
-
log_info "Testing gem publication script compatibility..."
|
|
102
|
-
|
|
103
|
-
# Test script exists and is executable
|
|
104
|
-
run_test "Gem publish script exists" "test -x '$SCRIPT_DIR/gem-publish.sh'"
|
|
105
|
-
|
|
106
|
-
# Test new automated options
|
|
107
|
-
run_test "Automated release option works" "$SCRIPT_DIR/gem-publish.sh --help | grep -q 'automated-release'"
|
|
108
|
-
run_test "Auto commit range option works" "$SCRIPT_DIR/gem-publish.sh --help | grep -q 'auto-commit-range'"
|
|
109
|
-
|
|
110
|
-
# Test dry run with automated options
|
|
111
|
-
if [[ -f "$PROJECT_ROOT/lib/jekyll-theme-zer0/version.rb" ]]; then
|
|
112
|
-
run_test "Dry run with automated options" "$SCRIPT_DIR/gem-publish.sh patch --dry-run --automated-release --skip-tests --skip-publish --no-github-release | grep -q 'Automated Release Mode'"
|
|
113
|
-
fi
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
# Test workflow files syntax
|
|
117
|
-
test_workflow_syntax() {
|
|
118
|
-
log_info "Testing GitHub Actions workflow syntax..."
|
|
119
|
-
|
|
120
|
-
# Check if yamllint is available
|
|
121
|
-
if command -v yamllint >/dev/null 2>&1; then
|
|
122
|
-
run_test "Auto-version-bump workflow syntax" "yamllint '$PROJECT_ROOT/.github/workflows/auto-version-bump.yml'"
|
|
123
|
-
else
|
|
124
|
-
# Basic YAML syntax check with Python
|
|
125
|
-
if command -v python3 >/dev/null 2>&1; then
|
|
126
|
-
run_test "Auto-version-bump workflow syntax" "python3 -c 'import yaml; yaml.safe_load(open(\"$PROJECT_ROOT/.github/workflows/auto-version-bump.yml\"))'"
|
|
127
|
-
else
|
|
128
|
-
log_warning "Neither yamllint nor python3 available for YAML validation"
|
|
129
|
-
fi
|
|
130
|
-
fi
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
# Test file permissions and executability
|
|
134
|
-
test_file_permissions() {
|
|
135
|
-
log_info "Testing file permissions..."
|
|
136
|
-
|
|
137
|
-
local scripts=(
|
|
138
|
-
"$SCRIPT_DIR/analyze-commits.sh"
|
|
139
|
-
"$SCRIPT_DIR/gem-publish.sh"
|
|
140
|
-
)
|
|
141
|
-
|
|
142
|
-
for script in "${scripts[@]}"; do
|
|
143
|
-
local script_name=$(basename "$script")
|
|
144
|
-
run_test "$script_name is executable" "test -x '$script'"
|
|
145
|
-
done
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
# Test integration between components
|
|
149
|
-
test_integration() {
|
|
150
|
-
log_info "Testing integration between components..."
|
|
151
|
-
|
|
152
|
-
# Test that analyze-commits.sh can be called by the workflow
|
|
153
|
-
if [[ -x "$SCRIPT_DIR/analyze-commits.sh" ]]; then
|
|
154
|
-
# Test with a simple commit range
|
|
155
|
-
if git rev-list --count HEAD >/dev/null 2>&1; then
|
|
156
|
-
local commit_count=$(git rev-list --count HEAD)
|
|
157
|
-
if [[ $commit_count -gt 0 ]]; then
|
|
158
|
-
run_test "Integration: commit analysis returns valid output" "$SCRIPT_DIR/analyze-commits.sh HEAD~1..HEAD | grep -E '^(patch|minor|major|none)$'"
|
|
159
|
-
fi
|
|
160
|
-
fi
|
|
161
|
-
fi
|
|
162
|
-
|
|
163
|
-
# Test that gem-publish.sh accepts the new parameters
|
|
164
|
-
if [[ -x "$SCRIPT_DIR/gem-publish.sh" ]]; then
|
|
165
|
-
run_test "Integration: gem-publish accepts automated params" "$SCRIPT_DIR/gem-publish.sh patch --dry-run --automated-release --auto-commit-range=HEAD~1..HEAD --skip-tests --skip-publish --no-github-release | grep -q 'DRY RUN MODE'"
|
|
166
|
-
fi
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
# Test conventional commit detection
|
|
170
|
-
test_conventional_commits() {
|
|
171
|
-
log_info "Testing conventional commit detection..."
|
|
172
|
-
|
|
173
|
-
# Create test commits in memory (don't actually commit)
|
|
174
|
-
local test_commits=(
|
|
175
|
-
"feat: add new feature"
|
|
176
|
-
"fix: resolve bug in component"
|
|
177
|
-
"BREAKING CHANGE: remove deprecated API"
|
|
178
|
-
"chore: update dependencies"
|
|
179
|
-
"docs: improve documentation"
|
|
180
|
-
)
|
|
181
|
-
|
|
182
|
-
local expected_results=(
|
|
183
|
-
"minor"
|
|
184
|
-
"patch"
|
|
185
|
-
"major"
|
|
186
|
-
"patch"
|
|
187
|
-
"patch"
|
|
188
|
-
)
|
|
189
|
-
|
|
190
|
-
# Note: This would require a more sophisticated test setup
|
|
191
|
-
# For now, just test that the patterns exist in the script
|
|
192
|
-
run_test "Conventional commit patterns exist" "grep -q 'feat.*minor' '$SCRIPT_DIR/analyze-commits.sh'"
|
|
193
|
-
run_test "Fix patterns exist" "grep -q 'fix.*patch' '$SCRIPT_DIR/analyze-commits.sh'"
|
|
194
|
-
run_test "Breaking change patterns exist" "grep -q 'BREAKING.*major' '$SCRIPT_DIR/analyze-commits.sh'"
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
# Main test execution
|
|
198
|
-
main() {
|
|
199
|
-
log_info "๐งช Starting Automated Version Bump System Tests"
|
|
200
|
-
echo "=================================================="
|
|
201
|
-
echo ""
|
|
202
|
-
|
|
203
|
-
# Change to project root
|
|
204
|
-
cd "$PROJECT_ROOT"
|
|
205
|
-
|
|
206
|
-
# Run all test suites
|
|
207
|
-
test_file_permissions
|
|
208
|
-
test_commit_analysis
|
|
209
|
-
test_gem_publish_script
|
|
210
|
-
test_workflow_syntax
|
|
211
|
-
test_integration
|
|
212
|
-
test_conventional_commits
|
|
213
|
-
|
|
214
|
-
# Test summary
|
|
215
|
-
echo ""
|
|
216
|
-
echo "=================================================="
|
|
217
|
-
log_info "๐ฏ Test Results Summary"
|
|
218
|
-
echo "Tests Run: $TESTS_RUN"
|
|
219
|
-
echo "Tests Passed: $TESTS_PASSED"
|
|
220
|
-
echo "Tests Failed: $((TESTS_RUN - TESTS_PASSED))"
|
|
221
|
-
|
|
222
|
-
if [[ $TESTS_PASSED -eq $TESTS_RUN ]]; then
|
|
223
|
-
log_success "๐ All tests passed! Automated version bump system is ready."
|
|
224
|
-
exit 0
|
|
225
|
-
else
|
|
226
|
-
log_error "โ Some tests failed. Please review the issues above."
|
|
227
|
-
exit 1
|
|
228
|
-
fi
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
# Show usage if requested
|
|
232
|
-
if [[ "${1:-}" == "--help" ]] || [[ "${1:-}" == "-h" ]]; then
|
|
233
|
-
cat << EOF
|
|
234
|
-
Test Script for Automated Version Bump System
|
|
235
|
-
|
|
236
|
-
USAGE:
|
|
237
|
-
$0
|
|
238
|
-
|
|
239
|
-
DESCRIPTION:
|
|
240
|
-
This script tests the automated version bump system including:
|
|
241
|
-
- Commit analysis functionality
|
|
242
|
-
- Gem publication script compatibility
|
|
243
|
-
- Workflow file syntax validation
|
|
244
|
-
- Integration between components
|
|
245
|
-
- Conventional commit detection
|
|
246
|
-
|
|
247
|
-
REQUIREMENTS:
|
|
248
|
-
- Git repository with commit history
|
|
249
|
-
- Executable scripts in scripts/ directory
|
|
250
|
-
- Valid GitHub Actions workflow files
|
|
251
|
-
|
|
252
|
-
OUTPUT:
|
|
253
|
-
Detailed test results and summary
|
|
254
|
-
Exit code 0 on success, 1 on failure
|
|
255
|
-
EOF
|
|
256
|
-
exit 0
|
|
257
|
-
fi
|
|
258
|
-
|
|
259
|
-
# Execute main function
|
|
260
|
-
main "$@"
|
|
11
|
+
exec "$SCRIPT_DIR/test/integration/auto-version" "$@"
|