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,342 @@
1
+ #!/bin/bash
2
+
3
+ # Release deployment script for Jekyll Theme Zer0
4
+ # Usage: ./scripts/release.sh [options]
5
+
6
+ set -e
7
+
8
+ # Colors for output
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
12
+ BLUE='\033[0;34m'
13
+ NC='\033[0m' # No Color
14
+
15
+ # Default values
16
+ DRY_RUN=false
17
+ SKIP_TESTS=false
18
+ SKIP_BUILD=false
19
+ SKIP_PUBLISH=false
20
+ CREATE_GITHUB_RELEASE=true
21
+ DRAFT_RELEASE=false
22
+ PRERELEASE=false
23
+
24
+ # Function to show usage
25
+ show_usage() {
26
+ cat << EOF
27
+ 🚀 Jekyll Theme Zer0 Release Deployment Script
28
+
29
+ USAGE:
30
+ ./scripts/release.sh [OPTIONS]
31
+
32
+ OPTIONS:
33
+ --dry-run Show what would be done without making changes
34
+ --skip-tests Skip running tests before release
35
+ --skip-build Skip building the gem
36
+ --skip-publish Skip publishing to RubyGems
37
+ --no-github-release Skip creating GitHub release
38
+ --draft Create GitHub release as draft
39
+ --prerelease Mark GitHub release as prerelease
40
+ --help Show this help message
41
+
42
+ EXAMPLES:
43
+ ./scripts/release.sh # Full release deployment
44
+ ./scripts/release.sh --dry-run # Preview what would happen
45
+ ./scripts/release.sh --draft # Create draft GitHub release
46
+ ./scripts/release.sh --skip-publish # Build and test but don't publish
47
+
48
+ WORKFLOW:
49
+ 1. Validate current state (git clean, version consistency)
50
+ 2. Run tests (unless --skip-tests)
51
+ 3. Build gem (unless --skip-build)
52
+ 4. Publish to RubyGems (unless --skip-publish)
53
+ 5. Create GitHub Release (unless --no-github-release)
54
+
55
+ EOF
56
+ }
57
+
58
+ # Parse arguments
59
+ while [[ $# -gt 0 ]]; do
60
+ case $1 in
61
+ --dry-run)
62
+ DRY_RUN=true
63
+ shift
64
+ ;;
65
+ --skip-tests)
66
+ SKIP_TESTS=true
67
+ shift
68
+ ;;
69
+ --skip-build)
70
+ SKIP_BUILD=true
71
+ shift
72
+ ;;
73
+ --skip-publish)
74
+ SKIP_PUBLISH=true
75
+ shift
76
+ ;;
77
+ --no-github-release)
78
+ CREATE_GITHUB_RELEASE=false
79
+ shift
80
+ ;;
81
+ --draft)
82
+ DRAFT_RELEASE=true
83
+ shift
84
+ ;;
85
+ --prerelease)
86
+ PRERELEASE=true
87
+ shift
88
+ ;;
89
+ --help)
90
+ show_usage
91
+ exit 0
92
+ ;;
93
+ *)
94
+ echo -e "${RED}Unknown option: $1${NC}"
95
+ show_usage
96
+ exit 1
97
+ ;;
98
+ esac
99
+ done
100
+
101
+ # Function to log messages
102
+ log() {
103
+ echo -e "${GREEN}[RELEASE]${NC} $1"
104
+ }
105
+
106
+ info() {
107
+ echo -e "${BLUE}[INFO]${NC} $1"
108
+ }
109
+
110
+ warn() {
111
+ echo -e "${YELLOW}[WARNING]${NC} $1"
112
+ }
113
+
114
+ error() {
115
+ echo -e "${RED}[ERROR]${NC} $1"
116
+ exit 1
117
+ }
118
+
119
+ dry_run() {
120
+ if [[ "$DRY_RUN" == true ]]; then
121
+ echo -e "${YELLOW}[DRY RUN]${NC} Would execute: $1"
122
+ return 0
123
+ else
124
+ return 1
125
+ fi
126
+ }
127
+
128
+ # Header
129
+ echo -e "${BLUE}================================${NC}"
130
+ echo -e "${BLUE}🚀 Jekyll Theme Zer0 Release${NC}"
131
+ echo -e "${BLUE}================================${NC}"
132
+ echo ""
133
+
134
+ if [[ "$DRY_RUN" == true ]]; then
135
+ warn "DRY RUN MODE - No changes will be made"
136
+ echo ""
137
+ fi
138
+
139
+ # Check if we're in the right directory
140
+ if [[ ! -f "jekyll-theme-zer0.gemspec" ]]; then
141
+ error "Must be run from the repository root directory"
142
+ fi
143
+
144
+ # Check if we're in a git repository
145
+ if ! git rev-parse --git-dir > /dev/null 2>&1; then
146
+ error "Not in a git repository"
147
+ fi
148
+
149
+ # Get current version
150
+ if [[ ! -f "lib/jekyll-theme-zer0/version.rb" ]]; then
151
+ error "Version file not found: lib/jekyll-theme-zer0/version.rb"
152
+ fi
153
+
154
+ CURRENT_VERSION=$(grep -o 'VERSION = "[^"]*"' lib/jekyll-theme-zer0/version.rb | sed 's/VERSION = "\(.*\)"/\1/')
155
+ if [[ -z "$CURRENT_VERSION" ]]; then
156
+ error "Could not read version from lib/jekyll-theme-zer0/version.rb"
157
+ fi
158
+
159
+ TAG="v$CURRENT_VERSION"
160
+ GEM_FILE="jekyll-theme-zer0-$CURRENT_VERSION.gem"
161
+
162
+ log "Current version: $CURRENT_VERSION"
163
+ log "Release tag: $TAG"
164
+ log "Gem file: $GEM_FILE"
165
+ echo ""
166
+
167
+ # Check if working directory is clean
168
+ if [[ -n $(git status --porcelain) ]]; then
169
+ error "Working directory is not clean. Please commit or stash changes first."
170
+ fi
171
+
172
+ # Check if tag already exists
173
+ if git tag -l | grep -q "^$TAG$"; then
174
+ warn "Tag $TAG already exists"
175
+ if [[ "$DRY_RUN" == false ]]; then
176
+ read -p "Continue anyway? (y/N): " -n 1 -r
177
+ echo
178
+ if [[ ! $REPLY =~ ^[Yy]$ ]]; then
179
+ log "Release cancelled"
180
+ exit 0
181
+ fi
182
+ fi
183
+ fi
184
+
185
+ # Step 1: Run tests
186
+ if [[ "$SKIP_TESTS" == false ]]; then
187
+ log "Step 1: Running tests..."
188
+ if dry_run "./test/test_runner.sh --verbose"; then
189
+ info "Would run tests"
190
+ else
191
+ if [[ -x "./test/test_runner.sh" ]]; then
192
+ ./test/test_runner.sh --verbose
193
+ else
194
+ warn "Test runner not found or not executable, skipping tests"
195
+ fi
196
+ fi
197
+ echo ""
198
+ else
199
+ warn "Skipping tests (--skip-tests specified)"
200
+ echo ""
201
+ fi
202
+
203
+ # Step 2: Build gem
204
+ if [[ "$SKIP_BUILD" == false ]]; then
205
+ log "Step 2: Building gem..."
206
+ if dry_run "./scripts/build.sh"; then
207
+ info "Would build gem: $GEM_FILE"
208
+ else
209
+ ./scripts/build.sh
210
+ if [[ ! -f "$GEM_FILE" ]]; then
211
+ error "Gem build failed - $GEM_FILE not found"
212
+ fi
213
+ info "✅ Gem built successfully: $GEM_FILE"
214
+ fi
215
+ echo ""
216
+ else
217
+ warn "Skipping gem build (--skip-build specified)"
218
+ echo ""
219
+ fi
220
+
221
+ # Step 3: Publish to RubyGems
222
+ if [[ "$SKIP_PUBLISH" == false ]]; then
223
+ log "Step 3: Publishing to RubyGems..."
224
+ if dry_run "gem push $GEM_FILE"; then
225
+ info "Would publish gem to RubyGems"
226
+ else
227
+ if [[ ! -f "$GEM_FILE" ]]; then
228
+ error "Gem file not found: $GEM_FILE. Run with --skip-build=false first."
229
+ fi
230
+
231
+ # Check if we have RubyGems credentials
232
+ if [[ ! -f ~/.gem/credentials ]]; then
233
+ error "RubyGems credentials not found. Run 'gem signin' first."
234
+ fi
235
+
236
+ gem push "$GEM_FILE"
237
+ info "✅ Gem published to RubyGems successfully"
238
+ fi
239
+ echo ""
240
+ else
241
+ warn "Skipping RubyGems publication (--skip-publish specified)"
242
+ echo ""
243
+ fi
244
+
245
+ # Step 4: Create GitHub Release
246
+ if [[ "$CREATE_GITHUB_RELEASE" == true ]]; then
247
+ log "Step 4: Creating GitHub Release..."
248
+
249
+ # Check if gh CLI is available
250
+ if command -v gh >/dev/null 2>&1; then
251
+ # Extract release notes from CHANGELOG.md
252
+ RELEASE_NOTES=""
253
+ if [[ -f "CHANGELOG.md" ]]; then
254
+ RELEASE_NOTES=$(awk -v version="$CURRENT_VERSION" '
255
+ /^## \[/ {
256
+ if (found) exit
257
+ if ($0 ~ "\\[" version "\\]") found=1
258
+ next
259
+ }
260
+ found && /^## \[/ { exit }
261
+ found && !/^## \[/ { print }
262
+ ' CHANGELOG.md | sed '/^$/d')
263
+ fi
264
+
265
+ if [[ -z "$RELEASE_NOTES" ]]; then
266
+ RELEASE_NOTES="### Changed
267
+ - Released version $CURRENT_VERSION"
268
+ fi
269
+
270
+ # Create release notes file
271
+ echo "$RELEASE_NOTES" > release_notes.md
272
+
273
+ DRAFT_FLAG=""
274
+ PRERELEASE_FLAG=""
275
+
276
+ if [[ "$DRAFT_RELEASE" == true ]]; then
277
+ DRAFT_FLAG="--draft"
278
+ fi
279
+
280
+ if [[ "$PRERELEASE" == true ]] || [[ "$CURRENT_VERSION" =~ (rc|beta|alpha) ]]; then
281
+ PRERELEASE_FLAG="--prerelease"
282
+ fi
283
+
284
+ if dry_run "gh release create $TAG"; then
285
+ info "Would create GitHub release: $TAG"
286
+ info "Draft: $DRAFT_RELEASE, Prerelease: $PRERELEASE"
287
+ else
288
+ # Create or check if tag exists
289
+ if ! git tag -l | grep -q "^$TAG$"; then
290
+ git tag -a "$TAG" -m "Release version $CURRENT_VERSION"
291
+ git push origin "$TAG"
292
+ fi
293
+
294
+ gh release create "$TAG" \
295
+ --title "🚀 Jekyll Theme Zer0 v$CURRENT_VERSION" \
296
+ --notes-file release_notes.md \
297
+ $DRAFT_FLAG \
298
+ $PRERELEASE_FLAG \
299
+ "$GEM_FILE" \
300
+ "release_notes.md"
301
+
302
+ rm -f release_notes.md
303
+ info "✅ GitHub Release created successfully"
304
+ fi
305
+ else
306
+ warn "GitHub CLI (gh) not found. Please install it to create releases automatically."
307
+ info "Manual steps:"
308
+ info "1. Go to https://github.com/bamr87/zer0-mistakes/releases/new"
309
+ info "2. Choose tag: $TAG"
310
+ info "3. Upload: $GEM_FILE"
311
+ fi
312
+ echo ""
313
+ else
314
+ warn "Skipping GitHub Release creation (--no-github-release specified)"
315
+ echo ""
316
+ fi
317
+
318
+ # Cleanup
319
+ if [[ "$DRY_RUN" == false ]] && [[ -f "$GEM_FILE" ]]; then
320
+ log "Cleaning up local gem file..."
321
+ rm -f "$GEM_FILE"
322
+ fi
323
+
324
+ # Summary
325
+ echo -e "${GREEN}================================${NC}"
326
+ echo -e "${GREEN}🎉 Release Deployment Complete!${NC}"
327
+ echo -e "${GREEN}================================${NC}"
328
+ echo ""
329
+ echo -e "📋 Summary:"
330
+ echo -e " Version: ${BLUE}$CURRENT_VERSION${NC}"
331
+ echo -e " Tag: ${BLUE}$TAG${NC}"
332
+ echo ""
333
+ echo -e "🔗 Links:"
334
+ echo -e " RubyGems: ${BLUE}https://rubygems.org/gems/jekyll-theme-zer0/versions/$CURRENT_VERSION${NC}"
335
+ echo -e " GitHub Release: ${BLUE}https://github.com/bamr87/zer0-mistakes/releases/tag/$TAG${NC}"
336
+ echo -e " Documentation: ${BLUE}https://github.com/bamr87/zer0-mistakes#readme${NC}"
337
+ echo ""
338
+
339
+ if [[ "$DRY_RUN" == true ]]; then
340
+ warn "This was a dry run. No changes were made."
341
+ echo "Run without --dry-run to perform the actual release."
342
+ fi
data/scripts/setup.sh ADDED
@@ -0,0 +1,155 @@
1
+ #!/bin/bash
2
+
3
+ # Development setup script for zer0-mistakes Jekyll theme
4
+ # Usage: ./scripts/setup.sh
5
+
6
+ set -e
7
+
8
+ # Colors for output
9
+ RED='\033[0;31m'
10
+ GREEN='\033[0;32m'
11
+ YELLOW='\033[1;33m'
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"