jekyll-theme-zer0 0.10.6 โ 0.15.2
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 +428 -0
- data/README.md +79 -31
- data/_data/README.md +419 -17
- data/_data/generate_statistics.rb +216 -9
- data/_data/generate_statistics.sh +106 -0
- data/_data/github-actions-example.yml +210 -0
- 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 +19 -6
- data/_data/posts_organization.yml +153 -0
- data/_data/prerequisites.yml +112 -0
- data/_data/statistics_config.yml +203 -0
- data/_data/ui-text.yml +321 -0
- data/_data/update_statistics.sh +126 -0
- 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 +9 -10
- 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 +54 -17
- 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 +131 -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/changelog.sh +89 -57
- data/scripts/lib/gem.sh +19 -7
- data/scripts/release +7 -236
- data/scripts/setup.sh +9 -153
- data/scripts/test/lib/run_tests.sh +1 -2
- data/scripts/test-auto-version.sh +7 -256
- data/scripts/test-mermaid.sh +7 -287
- data/scripts/test.sh +9 -154
- metadata +16 -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
|
@@ -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" "$@"
|
data/scripts/test-mermaid.sh
CHANGED
|
@@ -1,291 +1,11 @@
|
|
|
1
1
|
#!/bin/bash
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
#
|
|
3
|
+
# ============================================================================
|
|
4
|
+
# WRAPPER: This script forwards to scripts/test/integration/mermaid
|
|
5
5
|
#
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
# --verbose Show detailed output
|
|
10
|
-
# --headless Run in headless mode (for CI/CD)
|
|
11
|
-
# --quick Run quick validation only
|
|
12
|
-
# --local Test local Jekyll server
|
|
13
|
-
# --docker Test Docker container
|
|
14
|
-
###############################################################################
|
|
6
|
+
# The canonical location is scripts/test/integration/mermaid. This wrapper
|
|
7
|
+
# exists for backward compatibility with existing workflows.
|
|
8
|
+
# ============================================================================
|
|
15
9
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
# Colors for output
|
|
20
|
-
RED='\033[0;31m'
|
|
21
|
-
GREEN='\033[0;32m'
|
|
22
|
-
YELLOW='\033[1;33m'
|
|
23
|
-
BLUE='\033[0;34m'
|
|
24
|
-
NC='\033[0m' # No Color
|
|
25
|
-
|
|
26
|
-
# Test counters
|
|
27
|
-
TESTS_PASSED=0
|
|
28
|
-
TESTS_FAILED=0
|
|
29
|
-
TOTAL_TESTS=0
|
|
30
|
-
|
|
31
|
-
# Configuration
|
|
32
|
-
VERBOSE=false
|
|
33
|
-
HEADLESS=false
|
|
34
|
-
QUICK=false
|
|
35
|
-
TEST_MODE="both" # local, docker, both
|
|
36
|
-
|
|
37
|
-
# Parse arguments
|
|
38
|
-
for arg in "$@"; do
|
|
39
|
-
case $arg in
|
|
40
|
-
--verbose)
|
|
41
|
-
VERBOSE=true
|
|
42
|
-
shift
|
|
43
|
-
;;
|
|
44
|
-
--headless)
|
|
45
|
-
HEADLESS=true
|
|
46
|
-
shift
|
|
47
|
-
;;
|
|
48
|
-
--quick)
|
|
49
|
-
QUICK=true
|
|
50
|
-
shift
|
|
51
|
-
;;
|
|
52
|
-
--local)
|
|
53
|
-
TEST_MODE="local"
|
|
54
|
-
shift
|
|
55
|
-
;;
|
|
56
|
-
--docker)
|
|
57
|
-
TEST_MODE="docker"
|
|
58
|
-
shift
|
|
59
|
-
;;
|
|
60
|
-
--help)
|
|
61
|
-
echo "Usage: $0 [options]"
|
|
62
|
-
echo "Options:"
|
|
63
|
-
echo " --verbose Show detailed output"
|
|
64
|
-
echo " --headless Run in headless mode (for CI/CD)"
|
|
65
|
-
echo " --quick Run quick validation only"
|
|
66
|
-
echo " --local Test local Jekyll server only"
|
|
67
|
-
echo " --docker Test Docker container only"
|
|
68
|
-
echo " --help Show this help message"
|
|
69
|
-
exit 0
|
|
70
|
-
;;
|
|
71
|
-
*)
|
|
72
|
-
echo "Unknown option: $arg"
|
|
73
|
-
echo "Use --help for usage information"
|
|
74
|
-
exit 1
|
|
75
|
-
;;
|
|
76
|
-
esac
|
|
77
|
-
done
|
|
78
|
-
|
|
79
|
-
# Logging functions
|
|
80
|
-
log_info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
81
|
-
log_success() { echo -e "${GREEN}[โ]${NC} $1"; }
|
|
82
|
-
log_warning() { echo -e "${YELLOW}[!]${NC} $1"; }
|
|
83
|
-
log_error() { echo -e "${RED}[โ]${NC} $1"; }
|
|
84
|
-
|
|
85
|
-
# Test function
|
|
86
|
-
run_test() {
|
|
87
|
-
local test_name="$1"
|
|
88
|
-
local test_command="$2"
|
|
89
|
-
|
|
90
|
-
TOTAL_TESTS=$((TOTAL_TESTS + 1))
|
|
91
|
-
|
|
92
|
-
if [ "$VERBOSE" = true ]; then
|
|
93
|
-
log_info "Running: $test_name"
|
|
94
|
-
fi
|
|
95
|
-
|
|
96
|
-
if eval "$test_command" >/dev/null 2>&1; then
|
|
97
|
-
TESTS_PASSED=$((TESTS_PASSED + 1))
|
|
98
|
-
log_success "$test_name"
|
|
99
|
-
return 0
|
|
100
|
-
else
|
|
101
|
-
TESTS_FAILED=$((TESTS_FAILED + 1))
|
|
102
|
-
log_error "$test_name"
|
|
103
|
-
return 1
|
|
104
|
-
fi
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
# Test file existence
|
|
108
|
-
test_file_exists() {
|
|
109
|
-
local file_path="$1"
|
|
110
|
-
local description="$2"
|
|
111
|
-
|
|
112
|
-
run_test "$description" "[ -f '$file_path' ]"
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
# Test file content
|
|
116
|
-
test_file_content() {
|
|
117
|
-
local file_path="$1"
|
|
118
|
-
local pattern="$2"
|
|
119
|
-
local description="$3"
|
|
120
|
-
|
|
121
|
-
run_test "$description" "grep -q '$pattern' '$file_path'"
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
# Test URL accessibility
|
|
125
|
-
test_url() {
|
|
126
|
-
local url="$1"
|
|
127
|
-
local description="$2"
|
|
128
|
-
|
|
129
|
-
run_test "$description" "curl -s -f '$url' >/dev/null"
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
# Test Mermaid script loading
|
|
133
|
-
test_mermaid_script() {
|
|
134
|
-
local url="$1"
|
|
135
|
-
local description="$2"
|
|
136
|
-
local response
|
|
137
|
-
local count
|
|
138
|
-
|
|
139
|
-
TOTAL_TESTS=$((TOTAL_TESTS + 1))
|
|
140
|
-
response=$(curl -s "$url" 2>/dev/null) || true
|
|
141
|
-
count=$(echo "$response" | grep -c 'mermaid.min.js' || true)
|
|
142
|
-
if [ "$count" -gt 0 ]; then
|
|
143
|
-
TESTS_PASSED=$((TESTS_PASSED + 1))
|
|
144
|
-
log_success "$description"
|
|
145
|
-
return 0
|
|
146
|
-
else
|
|
147
|
-
TESTS_FAILED=$((TESTS_FAILED + 1))
|
|
148
|
-
log_error "$description"
|
|
149
|
-
return 1
|
|
150
|
-
fi
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
# Test Mermaid initialization
|
|
154
|
-
test_mermaid_init() {
|
|
155
|
-
local url="$1"
|
|
156
|
-
local description="$2"
|
|
157
|
-
local response
|
|
158
|
-
local count
|
|
159
|
-
|
|
160
|
-
TOTAL_TESTS=$((TOTAL_TESTS + 1))
|
|
161
|
-
response=$(curl -s "$url" 2>/dev/null) || true
|
|
162
|
-
count=$(echo "$response" | grep -c 'mermaid.initialize' || true)
|
|
163
|
-
if [ "$count" -gt 0 ]; then
|
|
164
|
-
TESTS_PASSED=$((TESTS_PASSED + 1))
|
|
165
|
-
log_success "$description"
|
|
166
|
-
return 0
|
|
167
|
-
else
|
|
168
|
-
TESTS_FAILED=$((TESTS_FAILED + 1))
|
|
169
|
-
log_error "$description"
|
|
170
|
-
return 1
|
|
171
|
-
fi
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
# Test diagram rendering
|
|
175
|
-
test_diagram_rendering() {
|
|
176
|
-
local url="$1"
|
|
177
|
-
local description="$2"
|
|
178
|
-
local response
|
|
179
|
-
local count
|
|
180
|
-
|
|
181
|
-
TOTAL_TESTS=$((TOTAL_TESTS + 1))
|
|
182
|
-
response=$(curl -s "$url" 2>/dev/null) || true
|
|
183
|
-
count=$(echo "$response" | grep -c 'class="mermaid"' || true)
|
|
184
|
-
if [ "$count" -gt 0 ]; then
|
|
185
|
-
TESTS_PASSED=$((TESTS_PASSED + 1))
|
|
186
|
-
log_success "$description"
|
|
187
|
-
return 0
|
|
188
|
-
else
|
|
189
|
-
TESTS_FAILED=$((TESTS_FAILED + 1))
|
|
190
|
-
log_error "$description"
|
|
191
|
-
return 1
|
|
192
|
-
fi
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
# Main test execution
|
|
196
|
-
main() {
|
|
197
|
-
echo "๐งช Mermaid Integration Test Suite"
|
|
198
|
-
echo "=================================="
|
|
199
|
-
echo "Mode: $TEST_MODE"
|
|
200
|
-
echo "Verbose: $VERBOSE"
|
|
201
|
-
echo "Quick: $QUICK"
|
|
202
|
-
echo ""
|
|
203
|
-
|
|
204
|
-
# Core file tests
|
|
205
|
-
log_info "Testing core files..."
|
|
206
|
-
|
|
207
|
-
test_file_exists "_includes/components/mermaid.html" "Mermaid include file exists"
|
|
208
|
-
test_file_exists "docs/jekyll/mermaid.md" "Main documentation exists"
|
|
209
|
-
test_file_exists "docs/jekyll/mermaid-test-suite.md" "Test suite exists"
|
|
210
|
-
test_file_exists "docs/jekyll/jekyll-diagram-with-mermaid.md" "Tutorial exists"
|
|
211
|
-
|
|
212
|
-
# Configuration tests
|
|
213
|
-
log_info "Testing configuration..."
|
|
214
|
-
|
|
215
|
-
test_file_content "_config.yml" "jekyll-mermaid" "Jekyll-mermaid plugin configured"
|
|
216
|
-
test_file_content "_config.yml" "mermaid:" "Mermaid configuration present"
|
|
217
|
-
test_file_content "_includes/core/head.html" "page.mermaid" "Conditional loading configured"
|
|
218
|
-
test_file_content "_includes/core/head.html" "mermaid.html" "Mermaid include referenced"
|
|
219
|
-
|
|
220
|
-
# Mermaid include file tests
|
|
221
|
-
log_info "Testing Mermaid include file..."
|
|
222
|
-
|
|
223
|
-
test_file_content "_includes/components/mermaid.html" "mermaid@10" "Mermaid v10 CDN link"
|
|
224
|
-
test_file_content "_includes/components/mermaid.html" "mermaid.initialize" "Mermaid initialization script"
|
|
225
|
-
test_file_content "_includes/components/mermaid.html" "forest" "Forest theme configured"
|
|
226
|
-
test_file_content "_includes/components/mermaid.html" "FontAwesome" "FontAwesome support included"
|
|
227
|
-
|
|
228
|
-
# Documentation tests
|
|
229
|
-
log_info "Testing documentation..."
|
|
230
|
-
|
|
231
|
-
test_file_content "docs/jekyll/mermaid.md" "mermaid: true" "Main docs have front matter"
|
|
232
|
-
test_file_content "docs/jekyll/mermaid-test-suite.md" "mermaid: true" "Test suite has front matter"
|
|
233
|
-
test_file_content "docs/jekyll/mermaid.md" "graph TD" "Main docs have examples"
|
|
234
|
-
test_file_content "docs/jekyll/mermaid-test-suite.md" "graph TD" "Test suite has examples"
|
|
235
|
-
|
|
236
|
-
# Server tests (if not quick mode)
|
|
237
|
-
if [ "$QUICK" = false ]; then
|
|
238
|
-
log_info "Testing server functionality..."
|
|
239
|
-
|
|
240
|
-
# Test local server if enabled
|
|
241
|
-
if [ "$TEST_MODE" = "local" ] || [ "$TEST_MODE" = "both" ]; then
|
|
242
|
-
log_info "Testing local Jekyll server..."
|
|
243
|
-
|
|
244
|
-
# Check if local server is running
|
|
245
|
-
if curl -s -f "http://localhost:4000" >/dev/null 2>&1; then
|
|
246
|
-
test_url "http://localhost:4000/docs/jekyll/mermaid/" "Main documentation accessible"
|
|
247
|
-
test_url "http://localhost:4000/docs/jekyll/mermaid-test-suite/" "Test suite accessible"
|
|
248
|
-
test_mermaid_script "http://localhost:4000/docs/jekyll/mermaid-test-suite/" "Mermaid script loads on test page"
|
|
249
|
-
test_mermaid_init "http://localhost:4000/docs/jekyll/mermaid-test-suite/" "Mermaid initializes on test page"
|
|
250
|
-
test_diagram_rendering "http://localhost:4000/docs/jekyll/mermaid-test-suite/" "Diagrams render on test page"
|
|
251
|
-
else
|
|
252
|
-
log_warning "Local Jekyll server not running. Start with: bundle exec jekyll serve"
|
|
253
|
-
fi
|
|
254
|
-
fi
|
|
255
|
-
|
|
256
|
-
# Test Docker server if enabled
|
|
257
|
-
if [ "$TEST_MODE" = "docker" ] || [ "$TEST_MODE" = "both" ]; then
|
|
258
|
-
log_info "Testing Docker container..."
|
|
259
|
-
|
|
260
|
-
# Check if Docker container is running
|
|
261
|
-
if docker ps | grep -q "zer0-mistakes-jekyll"; then
|
|
262
|
-
test_url "http://localhost:4000/docs/jekyll/mermaid/" "Docker: Main documentation accessible"
|
|
263
|
-
test_url "http://localhost:4000/docs/jekyll/mermaid-test-suite/" "Docker: Test suite accessible"
|
|
264
|
-
test_mermaid_script "http://localhost:4000/docs/jekyll/mermaid-test-suite/" "Docker: Mermaid script loads"
|
|
265
|
-
test_mermaid_init "http://localhost:4000/docs/jekyll/mermaid-test-suite/" "Docker: Mermaid initializes"
|
|
266
|
-
test_diagram_rendering "http://localhost:4000/docs/jekyll/mermaid-test-suite/" "Docker: Diagrams render"
|
|
267
|
-
else
|
|
268
|
-
log_warning "Docker container not running. Start with: docker-compose up -d"
|
|
269
|
-
fi
|
|
270
|
-
fi
|
|
271
|
-
fi
|
|
272
|
-
|
|
273
|
-
# Summary
|
|
274
|
-
echo ""
|
|
275
|
-
echo "๐ Test Results Summary"
|
|
276
|
-
echo "======================"
|
|
277
|
-
echo "Total Tests: $TOTAL_TESTS"
|
|
278
|
-
echo "Passed: $TESTS_PASSED"
|
|
279
|
-
echo "Failed: $TESTS_FAILED"
|
|
280
|
-
|
|
281
|
-
if [ $TESTS_FAILED -eq 0 ]; then
|
|
282
|
-
log_success "All tests passed! โ
"
|
|
283
|
-
exit 0
|
|
284
|
-
else
|
|
285
|
-
log_error "Some tests failed! โ"
|
|
286
|
-
exit 1
|
|
287
|
-
fi
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
# Run main function
|
|
291
|
-
main "$@"
|
|
10
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
+
exec "$SCRIPT_DIR/test/integration/mermaid" "$@"
|