-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added rake tasks for generating new blog posts.
- Loading branch information
1 parent
fb06b8b
commit 9f01131
Showing
1 changed file
with
70 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
namespace :blog do | ||
desc 'Create a new blog post' | ||
task :new_post, [:title] do |t,args| | ||
date = Date.today | ||
title = args.title | ||
author = ENV['USER'] | ||
|
||
slug = title.sub(/[[:punct:]]$/,'').gsub(/[^a-zA-Z0-9]+/,'-') | ||
path = File.join('blog','_posts',"#{date}-#{slug}.md") | ||
|
||
contents = <<~BLOG_POST | ||
--- | ||
layout: post | ||
title: #{title} | ||
author: #{author} | ||
tags: | ||
- FIXME | ||
--- | ||
BLOG_POST | ||
|
||
File.write(path,contents) | ||
puts "Created #{path}" | ||
end | ||
|
||
desc "Create a new 'release' blog post" | ||
task :new_release, [:title] do |t,args| | ||
date = Date.today | ||
title = args.title | ||
author = ENV['USER'] | ||
|
||
slug = title.chomp('!').gsub(/[^a-zA-Z0-9]+/,'-') | ||
path = File.join('blog','_posts',"#{date}-#{slug}.md") | ||
|
||
contents = <<~BLOG_POST | ||
--- | ||
layout: post | ||
title: #{title} | ||
author: #{author} | ||
tags: | ||
- release | ||
--- | ||
[ronin-FIXME][ronin-FIXME] [X.Y.Z][ronin-FIXME-X.Y.Z] has been released. | ||
## How To Update | ||
### Gems | ||
To only update [ronin-FIXME] to [X.Y.Z][ronin-FIXME-X.Y.Z], simply run: | ||
```shell | ||
gem update ronin-FIXME | ||
``` | ||
### Docker | ||
{% include docker_update.md %} | ||
### Snap | ||
{% include snap_update.md %} | ||
[ronin-FIXME]: https://github.com/ronin-rb/ronin-FIXME#readme | ||
[ronin-FIXME-X.Y.Z]: https://github.com/ronin-rb/ronin-FIXME/releases/tag/vX.Y.Z | ||
BLOG_POST | ||
|
||
File.write(path,contents) | ||
puts "Created #{path}" | ||
end | ||
end |