jackdaw 1.0.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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: f5b17899530465a6c70afaf54e32479a44f82c97eb3a590ad765273824765997
4
+ data.tar.gz: '08c704ec34e10236e64b73f789fed9c3ffb1c084f7216a918b6914296a9e60df'
5
+ SHA512:
6
+ metadata.gz: ba74079fefe98d864b769f62fe32ee8d3ea5bb9765c2c0823ffc9ec00d1af0e132ad2e0032f0be5de3c7c509b7307d89e8f752597cf8508e5d96cfe8a3b27a0d
7
+ data.tar.gz: e3f055613bbf027a8758e5dcb7d0e0fd992c35962275111c94b9844b577161c8c7708b8c27050643c6c4b88de076ae47195fb7c949406bb8fee1fdcfeb79bcac
data/.rubocop.yml ADDED
@@ -0,0 +1,32 @@
1
+ AllCops:
2
+ TargetRubyVersion: 4.0
3
+ NewCops: enable
4
+ SuggestExtensions: false
5
+
6
+ Style/StringLiterals:
7
+ EnforcedStyle: single_quotes
8
+
9
+ Style/StringLiteralsInInterpolation:
10
+ EnforcedStyle: single_quotes
11
+
12
+ # CLI classes naturally have many public methods
13
+ Metrics/ClassLength:
14
+ Max: 200
15
+
16
+ # CLI methods often have longer implementations for user output
17
+ Metrics/MethodLength:
18
+ Max: 50
19
+
20
+ # CLI build methods have inherent complexity
21
+ Metrics/AbcSize:
22
+ Max: 60
23
+
24
+ Metrics/CyclomaticComplexity:
25
+ Max: 10
26
+
27
+ Metrics/PerceivedComplexity:
28
+ Max: 12
29
+
30
+ # CLI classes don't need top-level documentation
31
+ Style/Documentation:
32
+ Enabled: false
data/CHANGELOG.md ADDED
@@ -0,0 +1,82 @@
1
+ # Changelog
2
+
3
+ All notable changes to Jackdaw will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [1.0.0] - 2026-01-06
9
+
10
+ ### Added
11
+ - **Core Features**
12
+ - Lightning-fast static site generation with parallel processing
13
+ - Incremental builds (6-18x faster than clean builds)
14
+ - Convention-over-configuration approach (zero config files needed)
15
+ - Beautiful CLI with colorful output and emojis
16
+ - Live reload development server with auto-refresh
17
+ - GitHub Flavored Markdown with syntax highlighting (Rouge)
18
+ - ERB template system with layouts and partials
19
+
20
+ - **CLI Commands**
21
+ - `jackdaw new <name>` - Create new site project with starter templates
22
+ - `jackdaw build` - Build static site with incremental and clean options
23
+ - `jackdaw serve` - Development server with live reload
24
+ - `jackdaw create <type> <name>` - Create new content from templates
25
+ - `jackdaw template list` - List available content templates
26
+ - `jackdaw version` - Show version information
27
+
28
+ - **Project Structure**
29
+ - Convention-based directory layout (site/src, site/templates, site/assets, public/)
30
+ - Double-extension content files (name.type.md)
31
+ - Automatic date extraction from filenames (YYYY-MM-DD-name.type.md)
32
+ - Template discovery and validation
33
+
34
+ - **Content Processing**
35
+ - Automatic metadata extraction (title, date, excerpt, reading time)
36
+ - Smart content type detection
37
+ - Nested directory structure preservation
38
+ - Asset copying with directory structure maintenance
39
+
40
+ - **Template System**
41
+ - ERB template rendering with full context
42
+ - Layout wrapping (layout.html.erb)
43
+ - Partial includes with render helper
44
+ - Template caching for performance
45
+ - Access to all_posts and all_pages collections
46
+ - Site name inference from directory
47
+
48
+ - **Performance**
49
+ - Multi-threaded parallel processing (uses all CPU cores)
50
+ - Smart incremental builds with mtime-based change detection
51
+ - Template compilation caching
52
+ - Benchmark results:
53
+ - Small sites (30 files): 5,821 files/sec incremental
54
+ - Medium sites (150 files): 12,343 files/sec incremental
55
+ - Large sites (600 files): 16,280 files/sec incremental
56
+
57
+ - **Development Experience**
58
+ - Live reload with file watching (Listen gem)
59
+ - Beautiful CLI output with ANSI colors
60
+ - Detailed build statistics
61
+ - Verbose mode for debugging
62
+ - Comprehensive error messages
63
+
64
+ - **Testing**
65
+ - 99 comprehensive tests covering all components
66
+ - Unit tests for core classes
67
+ - Integration tests for build pipeline
68
+ - End-to-end workflow tests
69
+ - Test fixtures and helpers
70
+
71
+ ### Technical Details
72
+ - Ruby 4.0+ compatible
73
+ - Dependencies: Thor, Kramdown, Rouge, Parallel, Listen, Puma, Rack
74
+ - RuboCop compliant
75
+ - Comprehensive documentation
76
+
77
+ ### Performance Benchmarks
78
+ - Clean build: 164-693 files/sec
79
+ - Incremental build: 5,821-16,280 files/sec
80
+ - Build 600 files in under 1 second
81
+
82
+ [1.0.0]: https://github.com/yourusername/jackdaw/releases/tag/v1.0.0
data/README.md ADDED
@@ -0,0 +1,467 @@
1
+ # Jackdaw ⚡️
2
+
3
+ **Lightning-fast Ruby static site generator with convention over configuration**
4
+
5
+ Jackdaw is a minimal, fast static site generator that emphasizes:
6
+ - **Speed**: Parallel processing and incremental builds
7
+ - **Simplicity**: Convention over configuration - zero config files needed
8
+ - **Developer Experience**: Live reload, beautiful CLI output, intuitive structure
9
+
10
+ ## Features
11
+
12
+ - ⚡️ **Blazing Fast**: Build 600 files in under 1 second
13
+ - 🔄 **Incremental Builds**: Only rebuilds changed files (6-18x faster)
14
+ - 🎨 **Beautiful CLI**: Colorful, informative command output
15
+ - 🔥 **Live Reload**: Auto-refresh browser on file changes
16
+ - 📝 **Markdown + ERB**: GitHub Flavored Markdown with ERB templates
17
+ - 🎯 **Convention-Based**: No configuration files required
18
+ - 🌈 **Syntax Highlighting**: Built-in code highlighting with Rouge
19
+ - 🚀 **Development Server**: Built-in server with live reload
20
+
21
+ ## Performance
22
+
23
+ | Site Size | Files | Clean Build | Incremental | Files/sec |
24
+ |-----------|-------|-------------|-------------|-----------|
25
+ | Small | 30 | 0.18s | 0.005s | 5,821 |
26
+ | Medium | 150 | 0.35s | 0.012s | 12,343 |
27
+ | Large | 600 | 0.87s | 0.037s | 16,280 |
28
+
29
+ ## Installation
30
+
31
+ Add this line to your application's Gemfile:
32
+
33
+ ```ruby
34
+ gem 'jackdaw'
35
+ ```
36
+
37
+ And then execute:
38
+
39
+ ```bash
40
+ $ bundle install
41
+ ```
42
+
43
+ Or install it yourself as:
44
+
45
+ ```bash
46
+ $ gem install jackdaw
47
+ ```
48
+
49
+ ## Quick Start
50
+
51
+ ### Create a new site
52
+
53
+ ```bash
54
+ $ jackdaw new my-blog
55
+ $ cd my-blog.site
56
+ ```
57
+
58
+ This creates a project structure:
59
+
60
+ ```
61
+ my-blog.site/
62
+ ├── site/
63
+ │ ├── src/ # Your content (Markdown files)
64
+ │ ├── templates/ # ERB templates
65
+ │ └── assets/ # Static assets (CSS, images, etc.)
66
+ └── public/ # Generated output (git-ignored)
67
+ ```
68
+
69
+ ### Build your site
70
+
71
+ ```bash
72
+ $ jackdaw build # Build the site
73
+ $ jackdaw build --clean # Clean build (remove old files)
74
+ $ jackdaw build --verbose # Show detailed output
75
+ ```
76
+
77
+ ### Development server
78
+
79
+ ```bash
80
+ $ jackdaw serve # Start server with live reload on port 4000
81
+ $ jackdaw serve --port 3000 # Use custom port
82
+ $ jackdaw serve --no-livereload # Disable live reload
83
+ ```
84
+
85
+ Visit `http://localhost:4000` to see your site with auto-reload enabled!
86
+
87
+ ### Create content
88
+
89
+ ```bash
90
+ $ jackdaw create blog "My First Post" # Creates: 2026-01-06-my-first-post.blog.md
91
+ $ jackdaw create page "About" # Creates: about.page.md
92
+ $ jackdaw create page "company/history" # Creates: company/history.page.md
93
+ ```
94
+
95
+ ### List available templates
96
+
97
+ ```bash
98
+ $ jackdaw template list
99
+ ```
100
+
101
+ ## Project Structure
102
+
103
+ Jackdaw follows a simple, convention-based structure:
104
+
105
+ ```
106
+ my-site.site/
107
+ ├── site/
108
+ │ ├── src/ # Content directory
109
+ │ │ ├── index.page.md # Homepage
110
+ │ │ ├── about.page.md # About page
111
+ │ │ └── blog/ # Blog posts
112
+ │ │ └── 2026-01-06-hello.blog.md
113
+ │ │
114
+ │ ├── templates/ # ERB templates
115
+ │ │ ├── layout.html.erb # Main layout
116
+ │ │ ├── page.html.erb # Page template
117
+ │ │ ├── blog.html.erb # Blog post template
118
+ │ │ └── _nav.html.erb # Partial (starts with _)
119
+ │ │
120
+ │ └── assets/ # Static files
121
+ │ ├── styles.css
122
+ │ └── images/
123
+
124
+ └── public/ # Generated output
125
+ ├── index.html
126
+ ├── about.html
127
+ ├── blog/
128
+ │ └── 2026-01-06-hello.html
129
+ └── assets/
130
+ ```
131
+
132
+ ## Content Files
133
+
134
+ Content files use a naming convention: `<name>.<type>.md`
135
+
136
+ ### Pages
137
+
138
+ ```markdown
139
+ # About Us
140
+
141
+ Regular pages using the page template.
142
+ ```
143
+
144
+ **File**: `about.page.md` → **Output**: `about.html`
145
+
146
+ ### Blog Posts (with date prefixes)
147
+
148
+ ```markdown
149
+ # My First Post
150
+
151
+ Blog posts automatically get date metadata from filename.
152
+ ```
153
+
154
+ **File**: `2026-01-06-first-post.blog.md` → **Output**: `blog/2026-01-06-first-post.html`
155
+
156
+ ### Metadata Extraction
157
+
158
+ Jackdaw automatically extracts metadata:
159
+
160
+ - **Title**: From first H1 heading (`# Title`)
161
+ - **Date**: From filename (`YYYY-MM-DD-`) or file modification time
162
+ - **Excerpt**: First 150 words
163
+ - **Reading Time**: Calculated from word count
164
+
165
+ ## Templates
166
+
167
+ ### Layout Template (`layout.html.erb`)
168
+
169
+ ```erb
170
+ <!DOCTYPE html>
171
+ <html>
172
+ <head>
173
+ <title><%= title %> - <%= site_name %></title>
174
+ </head>
175
+ <body>
176
+ <%= render 'nav' %>
177
+ <%= content %>
178
+ </body>
179
+ </html>
180
+ ```
181
+
182
+ ### Page Template (`page.html.erb`)
183
+
184
+ ```erb
185
+ <main>
186
+ <%= content %>
187
+ </main>
188
+ ```
189
+
190
+ ### Blog Template (`blog.html.erb`)
191
+
192
+ ```erb
193
+ <article>
194
+ <h1><%= title %></h1>
195
+ <time><%= date.strftime('%B %d, %Y') %></time>
196
+ <%= content %>
197
+ </article>
198
+ ```
199
+
200
+ ### Partials
201
+
202
+ Partials start with `_` and can be included with `<%= render 'name' %>`
203
+
204
+ **File**: `_nav.html.erb`
205
+
206
+ ```erb
207
+ <nav>
208
+ <a href="/">Home</a>
209
+ <a href="/blog">Blog</a>
210
+ </nav>
211
+ ```
212
+
213
+ **Usage**: `<%= render 'nav' %>`
214
+
215
+ ## Template Variables
216
+
217
+ Available in all templates:
218
+
219
+ | Variable | Description |
220
+ |----------|-------------|
221
+ | `<%= content %>` | Rendered markdown content |
222
+ | `<%= title %>` | Page title (from H1) |
223
+ | `<%= date %>` | Post date (Date object) |
224
+ | `<%= excerpt %>` | First 150 words |
225
+ | `<%= reading_time %>` | Estimated minutes to read |
226
+ | `<%= site_name %>` | Site name (from directory) |
227
+ | `<%= all_posts %>` | Array of all blog posts |
228
+ | `<%= all_pages %>` | Array of all pages |
229
+
230
+ ## Syntax Highlighting
231
+
232
+ Code blocks are automatically highlighted:
233
+
234
+ ````markdown
235
+ ```ruby
236
+ def hello
237
+ puts "Hello, World!"
238
+ end
239
+ ```
240
+ ````
241
+
242
+ ## Creating Custom Templates
243
+
244
+ 1. Create a new template file: `templates/project.html.erb`
245
+ 2. Add your template code
246
+ 3. Create content with: `jackdaw create project "My Project"`
247
+
248
+ Dated templates (auto-prefix with date):
249
+ - `blog`, `post`, `article`, `news`
250
+
251
+ Override with flags:
252
+ ```bash
253
+ $ jackdaw create page "Timeline" --dated # Add date to page
254
+ $ jackdaw create blog "Timeless" --no-date # Remove date from blog
255
+ ```
256
+
257
+ ## CLI Commands
258
+
259
+ ### `jackdaw new <name>`
260
+
261
+ Create a new site project with starter templates and example content.
262
+
263
+ ```bash
264
+ $ jackdaw new my-blog
265
+ $ cd my-blog.site
266
+ ```
267
+
268
+ ### `jackdaw build [options]`
269
+
270
+ Build the static site.
271
+
272
+ **Options:**
273
+ - `--clean, -c` Clean output directory before building
274
+ - `--verbose, -v` Show detailed output
275
+
276
+ ```bash
277
+ $ jackdaw build # Incremental build
278
+ $ jackdaw build --clean # Full rebuild
279
+ ```
280
+
281
+ ### `jackdaw serve [options]`
282
+
283
+ Start development server with live reload.
284
+
285
+ **Options:**
286
+ - `--port, -p PORT` Server port (default: 4000)
287
+ - `--host, -h HOST` Server host (default: localhost)
288
+ - `--no-livereload` Disable live reload
289
+
290
+ ```bash
291
+ $ jackdaw serve # Start on port 4000
292
+ $ jackdaw serve --port 3000 # Use port 3000
293
+ $ jackdaw serve --no-livereload # No auto-refresh
294
+ ```
295
+
296
+ ### `jackdaw create <template> <name> [options]`
297
+
298
+ Create a new content file from template.
299
+
300
+ **Options:**
301
+ - `--dated` Add date prefix to filename
302
+ - `--no-date` Skip date prefix
303
+
304
+ ```bash
305
+ $ jackdaw create blog "First Post" # → 2026-01-06-first-post.blog.md
306
+ $ jackdaw create page "About" # → about.page.md
307
+ $ jackdaw create page "company/team" # → company/team.page.md
308
+ $ jackdaw create page "Timeline" --dated # → 2026-01-06-timeline.page.md
309
+ ```
310
+
311
+ ### `jackdaw template list`
312
+
313
+ List all available templates.
314
+
315
+ ```bash
316
+ $ jackdaw template list
317
+ ```
318
+
319
+ ### `jackdaw version`
320
+
321
+ Show Jackdaw version.
322
+
323
+ ```bash
324
+ $ jackdaw version
325
+ ```
326
+
327
+ ## How It Works
328
+
329
+ ### Build Process
330
+
331
+ 1. **Scan**: Discover all content, template, and asset files
332
+ 2. **Check**: Determine which files need rebuilding (mtime-based)
333
+ 3. **Process**: Render content in parallel using all CPU cores
334
+ 4. **Write**: Output HTML files to public/ directory
335
+ 5. **Copy**: Copy assets to public/assets/
336
+
337
+ ### Incremental Builds
338
+
339
+ Jackdaw uses modification time (mtime) checking to only rebuild files when:
340
+ - Content file changed
341
+ - Template file changed
342
+ - Layout file changed
343
+
344
+ This makes rebuilds **6-18x faster** than clean builds.
345
+
346
+ ### Live Reload
347
+
348
+ The development server watches for file changes and:
349
+ 1. Detects changes using the Listen gem
350
+ 2. Triggers incremental rebuild
351
+ 3. Injects JavaScript that polls for changes
352
+ 4. Refreshes browser automatically
353
+
354
+ ## Best Practices
355
+
356
+ ### Content Organization
357
+
358
+ ```
359
+ src/
360
+ ├── index.page.md # Homepage
361
+ ├── about.page.md # Top-level pages
362
+ ├── blog/ # Blog posts by category
363
+ │ └── 2026-01-06-post.blog.md
364
+ └── projects/ # Nested content
365
+ └── project-name.page.md
366
+ ```
367
+
368
+ ### Template Naming
369
+
370
+ - Main layout: `layout.html.erb` (required)
371
+ - Content templates: `<type>.html.erb` (e.g., `blog.html.erb`)
372
+ - Partials: `_<name>.html.erb` (e.g., `_header.html.erb`)
373
+
374
+ ### Dated Content
375
+
376
+ Use dated types for time-based content:
377
+ - `blog` - Blog posts
378
+ - `post` - General posts
379
+ - `article` - Articles
380
+ - `news` - News items
381
+
382
+ Use non-dated types for static content:
383
+ - `page` - Pages
384
+ - `project` - Projects
385
+ - Any custom type
386
+
387
+ ## Deployment
388
+
389
+ Jackdaw generates static HTML files in the `public/` directory. Deploy to any static host:
390
+
391
+ ### Netlify / Vercel
392
+
393
+ ```bash
394
+ $ jackdaw build
395
+ # Deploy public/ directory
396
+ ```
397
+
398
+ ### GitHub Pages
399
+
400
+ ```bash
401
+ $ jackdaw build
402
+ $ cd public
403
+ $ git init
404
+ $ git add .
405
+ $ git commit -m "Deploy"
406
+ $ git push origin gh-pages
407
+ ```
408
+
409
+ ### Nginx / Apache
410
+
411
+ Copy `public/` contents to your web server's document root.
412
+
413
+ ## Troubleshooting
414
+
415
+ ### Server won't start
416
+
417
+ Make sure you're in a `.site` directory:
418
+
419
+ ```bash
420
+ $ jackdaw serve
421
+ ✗ No site directory found. Run this command from a .site directory.
422
+ ```
423
+
424
+ ### Template not found
425
+
426
+ List available templates:
427
+
428
+ ```bash
429
+ $ jackdaw template list
430
+ ```
431
+
432
+ ### Build errors
433
+
434
+ Run with verbose flag to see details:
435
+
436
+ ```bash
437
+ $ jackdaw build --verbose
438
+ ```
439
+
440
+ ## Development
441
+
442
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
443
+
444
+ ## Contributing
445
+
446
+ Bug reports and pull requests are welcome on GitHub.
447
+
448
+ ## License
449
+
450
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
451
+
452
+ ## Credits
453
+
454
+ Built with:
455
+ - [Thor](https://github.com/rails/thor) - CLI framework
456
+ - [Kramdown](https://kramdown.gettalong.org/) - Markdown parser
457
+ - [Rouge](https://github.com/rouge-ruby/rouge) - Syntax highlighting
458
+ - [Parallel](https://github.com/grosser/parallel) - Multi-threading
459
+ - [Listen](https://github.com/guard/listen) - File watching
460
+ - [Puma](https://puma.io/) - Web server
461
+ - [Rack](https://github.com/rack/rack) - Web server interface
462
+
463
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
464
+
465
+ ## Contributing
466
+
467
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/jackdaw.
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec