jekyll-theme-zer0 0.7.2 โ†’ 0.10.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.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +272 -3
  3. data/README.md +83 -21
  4. data/_data/README.md +4 -5
  5. data/_includes/README.md +1 -1
  6. data/_includes/stats/README.md +14 -2
  7. data/_layouts/README.md +3 -3
  8. data/_plugins/preview_image_generator.rb +258 -0
  9. data/_plugins/theme_version.rb +88 -0
  10. data/_sass/core/_theme.scss +4 -1
  11. data/assets/images/previews/git-workflow-best-practices-for-modern-teams.png +0 -0
  12. data/scripts/README.md +443 -0
  13. data/scripts/analyze-commits.sh +313 -0
  14. data/scripts/bin/build +115 -0
  15. data/scripts/bin/release +240 -0
  16. data/scripts/bin/test +203 -0
  17. data/scripts/build +115 -0
  18. data/scripts/example-usage.sh +102 -0
  19. data/scripts/features/generate-preview-images +846 -0
  20. data/scripts/features/install-preview-generator +531 -0
  21. data/scripts/features/preview_generator.py +646 -0
  22. data/scripts/fix-markdown-format.sh +265 -0
  23. data/scripts/generate-preview-images.sh +791 -0
  24. data/scripts/install-preview-generator.sh +531 -0
  25. data/scripts/lib/README.md +291 -0
  26. data/scripts/lib/changelog.sh +313 -0
  27. data/scripts/lib/common.sh +154 -0
  28. data/scripts/lib/gem.sh +226 -0
  29. data/scripts/lib/git.sh +205 -0
  30. data/scripts/lib/preview_generator.py +646 -0
  31. data/scripts/lib/test/run_tests.sh +140 -0
  32. data/scripts/lib/test/test_changelog.sh +87 -0
  33. data/scripts/lib/test/test_gem.sh +68 -0
  34. data/scripts/lib/test/test_git.sh +82 -0
  35. data/scripts/lib/test/test_validation.sh +72 -0
  36. data/scripts/lib/test/test_version.sh +96 -0
  37. data/scripts/lib/validation.sh +139 -0
  38. data/scripts/lib/version.sh +178 -0
  39. data/scripts/release +240 -0
  40. data/scripts/setup.sh +155 -0
  41. data/scripts/test/integration/auto-version +243 -0
  42. data/scripts/test/integration/mermaid +252 -0
  43. data/scripts/test/lib/run_tests.sh +151 -0
  44. data/scripts/test/lib/test_changelog.sh +90 -0
  45. data/scripts/test/lib/test_gem.sh +71 -0
  46. data/scripts/test/lib/test_git.sh +85 -0
  47. data/scripts/test/lib/test_validation.sh +75 -0
  48. data/scripts/test/lib/test_version.sh +101 -0
  49. data/scripts/test/theme/validate +120 -0
  50. data/scripts/test-auto-version.sh +260 -0
  51. data/scripts/test-mermaid.sh +251 -0
  52. data/scripts/test.sh +156 -0
  53. data/scripts/utils/analyze-commits +300 -0
  54. data/scripts/utils/fix-markdown +251 -0
  55. data/scripts/utils/setup +137 -0
  56. data/scripts/version.sh +178 -0
  57. metadata +50 -2
data/scripts/bin/test ADDED
@@ -0,0 +1,203 @@
1
+ #!/bin/bash
2
+
3
+ # Unified test runner for zer0-mistakes Jekyll theme
4
+ # Usage: ./scripts/bin/test [options]
5
+ #
6
+ # Runs all test suites: library tests, theme tests, and integration tests.
7
+
8
+ set -euo pipefail
9
+
10
+ # Get script and library directories
11
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
+ SCRIPTS_ROOT="$SCRIPT_DIR/.."
13
+ LIB_DIR="$SCRIPTS_ROOT/lib"
14
+ TEST_DIR="$SCRIPTS_ROOT/test"
15
+
16
+ # Source common library for logging
17
+ source "$LIB_DIR/common.sh"
18
+
19
+ # Aliases for consistent function naming
20
+ log_info() { info "$@"; }
21
+ log_success() { success "$@"; }
22
+ log_warning() { warn "$@"; }
23
+ log_error() { echo -e "${RED}[ERROR]${NC} $@" >&2; }
24
+
25
+ # Show usage
26
+ show_usage() {
27
+ cat << EOF
28
+ ๐Ÿงช Unified Test Runner for zer0-mistakes
29
+
30
+ USAGE:
31
+ ./scripts/bin/test [OPTIONS] [TEST_SUITE]
32
+
33
+ TEST SUITES:
34
+ all Run all tests (default)
35
+ lib Run library unit tests only
36
+ theme Run theme validation tests only
37
+ integration Run integration tests only
38
+
39
+ OPTIONS:
40
+ --verbose, -v Show detailed test output
41
+ --dry-run Preview what tests would run
42
+ --help, -h Show this help message
43
+
44
+ EXAMPLES:
45
+ ./scripts/bin/test # Run all tests
46
+ ./scripts/bin/test lib # Run library tests only
47
+ ./scripts/bin/test --verbose # Run all tests with verbose output
48
+
49
+ TEST LOCATIONS:
50
+ Library tests: scripts/test/lib/
51
+ Theme tests: scripts/test/theme/
52
+ Integration tests: scripts/test/integration/
53
+ EOF
54
+ }
55
+
56
+ # Parse arguments
57
+ TEST_SUITE="all"
58
+ for arg in "$@"; do
59
+ case $arg in
60
+ --help|-h)
61
+ show_usage
62
+ exit 0
63
+ ;;
64
+ --verbose|-v)
65
+ export VERBOSE=true
66
+ ;;
67
+ --dry-run)
68
+ export DRY_RUN=true
69
+ ;;
70
+ all|lib|theme|integration)
71
+ TEST_SUITE="$arg"
72
+ ;;
73
+ *)
74
+ error "Unknown option: $arg (use --help for usage)"
75
+ ;;
76
+ esac
77
+ done
78
+
79
+ # Track test results
80
+ TOTAL_TESTS=0
81
+ TOTAL_PASSED=0
82
+ TOTAL_FAILED=0
83
+
84
+ # Run library tests
85
+ run_lib_tests() {
86
+ log_info "Running library unit tests..."
87
+
88
+ if [[ -f "$TEST_DIR/lib/run_tests.sh" ]]; then
89
+ # Use current bash interpreter to ensure bash 4+ features work
90
+ if "$BASH" "$TEST_DIR/lib/run_tests.sh"; then
91
+ log_success "Library tests passed"
92
+ ((TOTAL_PASSED++)) || true
93
+ else
94
+ log_error "Library tests failed"
95
+ ((TOTAL_FAILED++)) || true
96
+ fi
97
+ ((TOTAL_TESTS++)) || true
98
+ else
99
+ log_warning "Library test runner not found at $TEST_DIR/lib/run_tests.sh"
100
+ fi
101
+ }
102
+
103
+ # Run theme validation tests
104
+ run_theme_tests() {
105
+ log_info "Running theme validation tests..."
106
+
107
+ # Check for theme test script (will be migrated here)
108
+ if [[ -f "$TEST_DIR/theme/validate" ]]; then
109
+ if "$TEST_DIR/theme/validate"; then
110
+ log_success "Theme tests passed"
111
+ ((TOTAL_PASSED++)) || true
112
+ else
113
+ log_error "Theme tests failed"
114
+ ((TOTAL_FAILED++)) || true
115
+ fi
116
+ ((TOTAL_TESTS++)) || true
117
+ else
118
+ # Fall back to legacy test.sh in scripts root
119
+ if [[ -f "$SCRIPTS_ROOT/test.sh" ]]; then
120
+ log_warning "Using legacy test.sh (will be migrated to test/theme/)"
121
+ if "$SCRIPTS_ROOT/test.sh"; then
122
+ log_success "Theme tests passed"
123
+ ((TOTAL_PASSED++)) || true
124
+ else
125
+ log_error "Theme tests failed"
126
+ ((TOTAL_FAILED++)) || true
127
+ fi
128
+ ((TOTAL_TESTS++)) || true
129
+ else
130
+ log_warning "Theme tests not found"
131
+ fi
132
+ fi
133
+ }
134
+
135
+ # Run integration tests
136
+ run_integration_tests() {
137
+ log_info "Running integration tests..."
138
+
139
+ local found_tests=false
140
+
141
+ for test_file in "$TEST_DIR/integration"/*; do
142
+ if [[ -f "$test_file" && -x "$test_file" ]]; then
143
+ found_tests=true
144
+ local test_name
145
+ test_name=$(basename "$test_file")
146
+ log_info "Running integration test: $test_name"
147
+
148
+ if "$test_file"; then
149
+ log_success "$test_name passed"
150
+ ((TOTAL_PASSED++)) || true
151
+ else
152
+ log_error "$test_name failed"
153
+ ((TOTAL_FAILED++)) || true
154
+ fi
155
+ ((TOTAL_TESTS++)) || true
156
+ fi
157
+ done
158
+
159
+ if [[ "$found_tests" == "false" ]]; then
160
+ log_warning "No integration tests found in $TEST_DIR/integration/"
161
+ fi
162
+ }
163
+
164
+ # Main execution
165
+ log_info "๐Ÿงช Starting test suite: $TEST_SUITE"
166
+ echo ""
167
+
168
+ case $TEST_SUITE in
169
+ all)
170
+ run_lib_tests
171
+ echo ""
172
+ run_theme_tests
173
+ echo ""
174
+ run_integration_tests
175
+ ;;
176
+ lib)
177
+ run_lib_tests
178
+ ;;
179
+ theme)
180
+ run_theme_tests
181
+ ;;
182
+ integration)
183
+ run_integration_tests
184
+ ;;
185
+ esac
186
+
187
+ # Summary
188
+ echo ""
189
+ echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
190
+ log_info "Test Summary"
191
+ echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
192
+ echo " Total test suites: $TOTAL_TESTS"
193
+ echo " Passed: $TOTAL_PASSED"
194
+ echo " Failed: $TOTAL_FAILED"
195
+ echo "โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”"
196
+
197
+ if [[ $TOTAL_FAILED -gt 0 ]]; then
198
+ log_error "Some tests failed!"
199
+ exit 1
200
+ else
201
+ log_success "All tests passed!"
202
+ exit 0
203
+ fi
data/scripts/build ADDED
@@ -0,0 +1,115 @@
1
+ #!/bin/bash
2
+
3
+ # Simplified build command for zer0-mistakes Jekyll theme
4
+ # Usage: ./scripts/build [options]
5
+ #
6
+ # Quick gem building without the full release workflow.
7
+
8
+ set -euo pipefail
9
+
10
+ # Get script and library directories
11
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
+ LIB_DIR="$SCRIPT_DIR/lib"
13
+
14
+ # Source required libraries
15
+ source "$LIB_DIR/common.sh"
16
+ source "$LIB_DIR/validation.sh"
17
+ source "$LIB_DIR/version.sh"
18
+ source "$LIB_DIR/gem.sh"
19
+
20
+ # Parse arguments
21
+ while [[ $# -gt 0 ]]; do
22
+ case $1 in
23
+ --dry-run)
24
+ export DRY_RUN=true
25
+ shift
26
+ ;;
27
+ --verbose)
28
+ export VERBOSE=true
29
+ shift
30
+ ;;
31
+ --help|-h)
32
+ show_usage
33
+ exit 0
34
+ ;;
35
+ *)
36
+ error "Unknown option: $1 (use --help for usage)"
37
+ ;;
38
+ esac
39
+ done
40
+
41
+ # Show usage
42
+ show_usage() {
43
+ cat << EOF
44
+ ๐Ÿ”จ Simplified Build Command for zer0-mistakes
45
+
46
+ USAGE:
47
+ ./scripts/build [OPTIONS]
48
+
49
+ DESCRIPTION:
50
+ Builds the Jekyll theme gem without running the full release workflow.
51
+ Useful for testing gem packaging or preparing for manual publication.
52
+
53
+ OPTIONS:
54
+ --dry-run Preview build without creating files
55
+ --verbose Show detailed debug output
56
+ --help, -h Show this help message
57
+
58
+ EXAMPLES:
59
+ ./scripts/build # Build gem with current version
60
+ ./scripts/build --dry-run # Preview what would be built
61
+ ./scripts/build --verbose # Build with debug output
62
+
63
+ ENVIRONMENT VARIABLES:
64
+ DRY_RUN=true Enable dry run mode
65
+ VERBOSE=true Enable debug output
66
+
67
+ OUTPUT:
68
+ Creates: jekyll-theme-zer0-VERSION.gem in current directory
69
+
70
+ For full release workflow, use: ./scripts/release
71
+ EOF
72
+ }
73
+
74
+ # Main build workflow
75
+ main() {
76
+ print_header "๐Ÿ”จ Gem Build"
77
+
78
+ # Step 1: Basic validation (no RubyGems auth needed for build)
79
+ step "Validating environment..."
80
+ validate_git_repo
81
+ validate_required_files
82
+ validate_gemspec
83
+ success "Environment validated"
84
+ echo ""
85
+
86
+ # Step 2: Get current version
87
+ step "Reading version..."
88
+ local version
89
+ version=$(get_current_version)
90
+ info "Current version: $version"
91
+ info "Gem file: jekyll-theme-zer0-${version}.gem"
92
+ echo ""
93
+
94
+ # Step 3: Build gem
95
+ build_gem "$version"
96
+ echo ""
97
+
98
+ # Success summary
99
+ if [[ "$DRY_RUN" != "true" ]]; then
100
+ print_summary "Build Complete" \
101
+ "โœ… Built: jekyll-theme-zer0-${version}.gem" \
102
+ "" \
103
+ "Next steps:" \
104
+ " โ€ข Test: gem install jekyll-theme-zer0-${version}.gem" \
105
+ " โ€ข Publish: gem push jekyll-theme-zer0-${version}.gem" \
106
+ " โ€ข Or use: ./scripts/release for full workflow"
107
+ else
108
+ info "Dry run complete - no files created"
109
+ fi
110
+
111
+ success "Build completed successfully!"
112
+ }
113
+
114
+ # Run main function
115
+ main "$@"
@@ -0,0 +1,102 @@
1
+ #!/bin/bash
2
+
3
+ # Example script demonstrating library usage
4
+ # This shows how simple release workflows become with the new libraries
5
+
6
+ set -euo pipefail
7
+
8
+ # Get library directory
9
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
10
+ LIB_DIR="$SCRIPT_DIR/lib"
11
+
12
+ # Source all libraries
13
+ source "$LIB_DIR/common.sh"
14
+ source "$LIB_DIR/validation.sh"
15
+ source "$LIB_DIR/version.sh"
16
+ source "$LIB_DIR/git.sh"
17
+ source "$LIB_DIR/changelog.sh"
18
+ source "$LIB_DIR/gem.sh"
19
+
20
+ # Configuration
21
+ export DRY_RUN=true
22
+ export INTERACTIVE=false
23
+
24
+ # Main demonstration
25
+ main() {
26
+ print_header "Library Usage Example"
27
+
28
+ echo -e "${CYAN}This example shows how the new libraries work together.${NC}"
29
+ echo -e "${CYAN}Running in DRY_RUN mode (no actual changes made).${NC}"
30
+ echo ""
31
+
32
+ # Step 1: Validation
33
+ step "Step 1: Environment Validation"
34
+ validate_git_repo
35
+ validate_required_files
36
+ validate_dependencies
37
+ echo ""
38
+
39
+ # Step 2: Version Management
40
+ step "Step 2: Version Management"
41
+ current_version=$(get_current_version)
42
+ info "Current version: $current_version"
43
+
44
+ new_version=$(calculate_new_version "$current_version" "minor")
45
+ info "Next version would be: $new_version"
46
+ echo ""
47
+
48
+ # Step 3: Git Operations
49
+ step "Step 3: Git Information"
50
+ last_tag=$(get_last_version_tag)
51
+ info "Last version tag: $last_tag"
52
+
53
+ commit_count=$(count_commits_since "$last_tag")
54
+ info "Commits since last tag: $commit_count"
55
+
56
+ current_branch=$(get_current_branch)
57
+ info "Current branch: $current_branch"
58
+ echo ""
59
+
60
+ # Step 4: Changelog Preview
61
+ step "Step 4: Changelog Generation"
62
+ info "Analyzing commits for changelog..."
63
+
64
+ commits=$(get_commits_between "$last_tag" "HEAD" | head -5)
65
+ if [[ -n "$commits" ]]; then
66
+ echo -e "${PURPLE}Recent commits:${NC}"
67
+ while IFS='|' read -r hash subject author date; do
68
+ [[ -z "$hash" ]] && continue
69
+ echo " - $subject"
70
+ done <<< "$commits"
71
+ fi
72
+ echo ""
73
+
74
+ # Step 5: Gem Operations (dry run)
75
+ step "Step 5: Gem Operations Preview"
76
+ info "Would build: jekyll-theme-zer0-${new_version}.gem"
77
+ info "Would run: bundle exec rspec"
78
+ info "Would publish to: https://rubygems.org/gems/jekyll-theme-zer0"
79
+ echo ""
80
+
81
+ # Summary
82
+ print_summary "Example Complete" \
83
+ "โœ… Environment validated" \
84
+ "โœ… Version calculated: $current_version โ†’ $new_version" \
85
+ "โœ… Git information retrieved" \
86
+ "โœ… Changelog preview generated" \
87
+ "โœ… Gem operations previewed"
88
+
89
+ success "All library functions working correctly!"
90
+
91
+ echo ""
92
+ echo -e "${CYAN}To actually perform a release, use:${NC}"
93
+ echo -e " ${YELLOW}./scripts/release minor${NC}"
94
+ echo ""
95
+ echo -e "${CYAN}To learn more about the libraries:${NC}"
96
+ echo -e " ${YELLOW}cat scripts/lib/README.md${NC}"
97
+ }
98
+
99
+ # Run if executed directly
100
+ if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
101
+ main "$@"
102
+ fi