jekyll-theme-zer0 0.7.2 → 0.8.1

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 (40) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +72 -0
  3. data/README.md +33 -4
  4. data/_plugins/preview_image_generator.rb +258 -0
  5. data/_plugins/theme_version.rb +88 -0
  6. data/assets/images/previews/git-workflow-best-practices-for-modern-teams.png +0 -0
  7. data/scripts/README.md +443 -0
  8. data/scripts/analyze-commits.sh +313 -0
  9. data/scripts/build +115 -0
  10. data/scripts/build.sh +33 -0
  11. data/scripts/build.sh.legacy +174 -0
  12. data/scripts/example-usage.sh +102 -0
  13. data/scripts/fix-markdown-format.sh +265 -0
  14. data/scripts/gem-publish.sh +42 -0
  15. data/scripts/gem-publish.sh.legacy +700 -0
  16. data/scripts/generate-preview-images.sh +846 -0
  17. data/scripts/install-preview-generator.sh +531 -0
  18. data/scripts/lib/README.md +263 -0
  19. data/scripts/lib/changelog.sh +313 -0
  20. data/scripts/lib/common.sh +154 -0
  21. data/scripts/lib/gem.sh +226 -0
  22. data/scripts/lib/git.sh +205 -0
  23. data/scripts/lib/preview_generator.py +646 -0
  24. data/scripts/lib/test/run_tests.sh +140 -0
  25. data/scripts/lib/test/test_changelog.sh +87 -0
  26. data/scripts/lib/test/test_gem.sh +68 -0
  27. data/scripts/lib/test/test_git.sh +82 -0
  28. data/scripts/lib/test/test_validation.sh +72 -0
  29. data/scripts/lib/test/test_version.sh +96 -0
  30. data/scripts/lib/validation.sh +139 -0
  31. data/scripts/lib/version.sh +178 -0
  32. data/scripts/release +240 -0
  33. data/scripts/release.sh +33 -0
  34. data/scripts/release.sh.legacy +342 -0
  35. data/scripts/setup.sh +155 -0
  36. data/scripts/test-auto-version.sh +260 -0
  37. data/scripts/test-mermaid.sh +251 -0
  38. data/scripts/test.sh +156 -0
  39. data/scripts/version.sh +152 -0
  40. metadata +37 -1
@@ -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
@@ -0,0 +1,265 @@
1
+ #!/usr/bin/env bash
2
+
3
+ #
4
+ # Markdown Formatting Fix Script
5
+ # Addresses common markdown linting violations across the repository
6
+ #
7
+
8
+ set -euo pipefail
9
+
10
+ # Configuration
11
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
12
+ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
13
+
14
+ # Colors for output
15
+ RED='\033[0;31m'
16
+ GREEN='\033[0;32m'
17
+ YELLOW='\033[1;33m'
18
+ BLUE='\033[0;34m'
19
+ NC='\033[0m' # No Color
20
+
21
+ # Logging functions
22
+ log_info() {
23
+ echo -e "${BLUE}[INFO]${NC} $1"
24
+ }
25
+
26
+ log_success() {
27
+ echo -e "${GREEN}[SUCCESS]${NC} $1"
28
+ }
29
+
30
+ log_warning() {
31
+ echo -e "${YELLOW}[WARNING]${NC} $1"
32
+ }
33
+
34
+ log_error() {
35
+ echo -e "${RED}[ERROR]${NC} $1"
36
+ }
37
+
38
+ # Function to fix common markdown issues
39
+ fix_markdown_file() {
40
+ local file="$1"
41
+ local temp_file="${file}.tmp"
42
+
43
+ log_info "Fixing markdown formatting in: $file"
44
+
45
+ # Create backup
46
+ cp "$file" "${file}.backup"
47
+
48
+ # Apply fixes using sed (macOS compatible)
49
+ sed -e 's/[[:space:]]*$//' \
50
+ -e '/^#/a\
51
+ ' \
52
+ -e '/^##/a\
53
+ ' \
54
+ -e '/^###/a\
55
+ ' \
56
+ -e '/^####/a\
57
+ ' \
58
+ -e '/^#####/a\
59
+ ' \
60
+ -e '/^######/a\
61
+ ' \
62
+ -e '/^- /i\
63
+ ' \
64
+ -e '/^* /i\
65
+ ' \
66
+ -e '/^+ /i\
67
+ ' \
68
+ -e '/^[0-9]/i\
69
+ ' \
70
+ -e 's/```$/```bash/' \
71
+ -e 's/^```[[:space:]]*$/```bash/' \
72
+ "$file" > "$temp_file"
73
+
74
+ # Additional fixes with awk for more complex patterns
75
+ awk '
76
+ BEGIN { prev_was_heading = 0; prev_was_list = 0 }
77
+
78
+ # Handle headings - ensure blank line before and after
79
+ /^#/ {
80
+ if (NR > 1 && prev_line != "" && !prev_was_heading) print ""
81
+ print $0
82
+ prev_was_heading = 1
83
+ prev_was_list = 0
84
+ prev_line = $0
85
+ next
86
+ }
87
+
88
+ # Handle list items - ensure blank line before first item
89
+ /^[[:space:]]*[-*+]/ || /^[[:space:]]*[0-9]+\./ {
90
+ if (!prev_was_list && prev_line != "" && !prev_was_heading) print ""
91
+ print $0
92
+ prev_was_list = 1
93
+ prev_was_heading = 0
94
+ prev_line = $0
95
+ next
96
+ }
97
+
98
+ # Handle code blocks - ensure they have language specification
99
+ /^```[[:space:]]*$/ {
100
+ print "```bash"
101
+ prev_was_heading = 0
102
+ prev_was_list = 0
103
+ prev_line = $0
104
+ next
105
+ }
106
+
107
+ # Regular lines
108
+ {
109
+ print $0
110
+ prev_was_heading = 0
111
+ prev_was_list = 0
112
+ prev_line = $0
113
+ }
114
+ ' "$temp_file" > "$file"
115
+
116
+ # Clean up
117
+ rm "$temp_file"
118
+
119
+ log_success "Fixed formatting in: $file"
120
+ }
121
+
122
+ # Function to remove trailing whitespace
123
+ remove_trailing_whitespace() {
124
+ local file="$1"
125
+ log_info "Removing trailing whitespace from: $file"
126
+
127
+ # Remove trailing whitespace
128
+ sed -i '' 's/[[:space:]]*$//' "$file"
129
+
130
+ log_success "Removed trailing whitespace from: $file"
131
+ }
132
+
133
+ # Function to fix heading punctuation
134
+ fix_heading_punctuation() {
135
+ local file="$1"
136
+ log_info "Fixing heading punctuation in: $file"
137
+
138
+ # Remove trailing punctuation from headings
139
+ sed -i '' 's/^\(#\+[[:space:]]*.*\)[.!?:;,]*[[:space:]]*$/\1/' "$file"
140
+
141
+ log_success "Fixed heading punctuation in: $file"
142
+ }
143
+
144
+ # Function to fix emphasis formatting
145
+ fix_emphasis_formatting() {
146
+ local file="$1"
147
+ log_info "Fixing emphasis formatting in: $file"
148
+
149
+ # Fix common emphasis issues
150
+ sed -i '' \
151
+ -e 's/\*\*\([^*]*\) \*\*/\*\*\1\*\*/g' \
152
+ -e 's/\*\([^*]*\) \*/\*\1\*/g' \
153
+ "$file"
154
+
155
+ log_success "Fixed emphasis formatting in: $file"
156
+ }
157
+
158
+ # Main execution function
159
+ main() {
160
+ log_info "Starting markdown formatting fixes..."
161
+
162
+ # Find all markdown files
163
+ local md_files
164
+ mapfile -t md_files < <(find "$PROJECT_ROOT" -name "*.md" \
165
+ -not -path "*/node_modules/*" \
166
+ -not -path "*/.git/*" \
167
+ -not -path "*/vendor/*" \
168
+ -not -path "*/_site/*")
169
+
170
+ if [ ${#md_files[@]} -eq 0 ]; then
171
+ log_warning "No markdown files found"
172
+ return 0
173
+ fi
174
+
175
+ log_info "Found ${#md_files[@]} markdown files to process"
176
+
177
+ # Process each file
178
+ for file in "${md_files[@]}"; do
179
+ if [ -f "$file" ]; then
180
+ remove_trailing_whitespace "$file"
181
+ fix_heading_punctuation "$file"
182
+ fix_emphasis_formatting "$file"
183
+ fix_markdown_file "$file"
184
+ fi
185
+ done
186
+
187
+ log_success "Completed markdown formatting fixes for ${#md_files[@]} files"
188
+
189
+ # Provide summary
190
+ echo
191
+ log_info "Summary of fixes applied:"
192
+ echo " ✓ Removed trailing whitespace"
193
+ echo " ✓ Added blank lines around headings"
194
+ echo " ✓ Added blank lines before list items"
195
+ echo " ✓ Fixed code block language specifications"
196
+ echo " ✓ Fixed heading punctuation"
197
+ echo " ✓ Fixed emphasis formatting"
198
+ echo
199
+ log_info "Backup files created with .backup extension"
200
+ log_info "Run 'git diff' to review changes before committing"
201
+ }
202
+
203
+ # Help function
204
+ show_help() {
205
+ cat << EOF
206
+ Markdown Formatting Fix Script
207
+
208
+ USAGE:
209
+ $0 [OPTIONS]
210
+
211
+ OPTIONS:
212
+ -h, --help Show this help message
213
+ --dry-run Show what would be fixed without making changes
214
+ --file FILE Fix only the specified file
215
+
216
+ EXAMPLES:
217
+ $0 # Fix all markdown files
218
+ $0 --file README.md # Fix only README.md
219
+ $0 --dry-run # Preview changes without applying
220
+
221
+ This script fixes common markdown linting violations:
222
+ - Trailing whitespace
223
+ - Missing blank lines around headings
224
+ - Missing blank lines before lists
225
+ - Code blocks without language specification
226
+ - Heading punctuation issues
227
+ - Emphasis formatting problems
228
+
229
+ EOF
230
+ }
231
+
232
+ # Parse command line arguments
233
+ case "${1:-}" in
234
+ -h|--help)
235
+ show_help
236
+ exit 0
237
+ ;;
238
+ --dry-run)
239
+ log_info "DRY RUN MODE - No changes will be made"
240
+ # Implementation for dry run would go here
241
+ exit 0
242
+ ;;
243
+ --file)
244
+ if [ -n "${2:-}" ] && [ -f "$2" ]; then
245
+ log_info "Fixing single file: $2"
246
+ remove_trailing_whitespace "$2"
247
+ fix_heading_punctuation "$2"
248
+ fix_emphasis_formatting "$2"
249
+ fix_markdown_file "$2"
250
+ log_success "Completed fixing: $2"
251
+ else
252
+ log_error "File not found: ${2:-}"
253
+ exit 1
254
+ fi
255
+ exit 0
256
+ ;;
257
+ "")
258
+ main
259
+ ;;
260
+ *)
261
+ log_error "Unknown option: $1"
262
+ show_help
263
+ exit 1
264
+ ;;
265
+ esac
@@ -0,0 +1,42 @@
1
+ #!/bin/bash
2
+
3
+ # DEPRECATED: This script is deprecated and will be removed in v0.8.0
4
+ # Please use the new simplified release command instead.
5
+
6
+ set -e
7
+
8
+ # Colors
9
+ YELLOW='\033[1;33m'
10
+ CYAN='\033[0;36m'
11
+ NC='\033[0m'
12
+
13
+ echo -e "${YELLOW}╔════════════════════════════════════════════════════════════╗${NC}"
14
+ echo -e "${YELLOW}║ ⚠️ DEPRECATION WARNING ║${NC}"
15
+ echo -e "${YELLOW}╚════════════════════════════════════════════════════════════╝${NC}"
16
+ echo ""
17
+ echo -e "${YELLOW}This script (gem-publish.sh) is deprecated and will be removed in v0.8.0${NC}"
18
+ echo ""
19
+ echo -e "Please use the new simplified command instead:"
20
+ echo -e " ${CYAN}./scripts/release${NC} [patch|minor|major] [options]"
21
+ echo ""
22
+ echo -e "Benefits of the new command:"
23
+ echo -e " ✅ Cleaner, more maintainable code"
24
+ echo -e " ✅ Modular library-based architecture"
25
+ echo -e " ✅ Comprehensive test coverage"
26
+ echo -e " ✅ Better error handling"
27
+ echo -e " ✅ Easier to understand and modify"
28
+ echo ""
29
+ echo -e "Example migration:"
30
+ echo -e " ${YELLOW}OLD:${NC} ./scripts/gem-publish.sh patch --dry-run"
31
+ echo -e " ${CYAN}NEW:${NC} ./scripts/release patch --dry-run"
32
+ echo ""
33
+ echo -e "For more information, see:"
34
+ echo -e " • scripts/lib/README.md"
35
+ echo -e " • docs/RELEASE_WORKFLOW_IMPROVEMENTS.md"
36
+ echo ""
37
+ echo -e "${YELLOW}Redirecting to new command in 3 seconds...${NC}"
38
+ sleep 3
39
+ echo ""
40
+
41
+ # Redirect to new command
42
+ exec "$(dirname "$0")/release" "$@"