mirror of
https://github.com/foo-dogsquared/website.git
synced 2025-01-30 22:57:59 +00:00
Replace Makefile with Rakefile
This commit is contained in:
parent
6c48ab1dac
commit
0ac7f03b1b
2
.github/workflows/build-drafts.yml
vendored
2
.github/workflows/build-drafts.yml
vendored
@ -27,4 +27,4 @@ jobs:
|
|||||||
git fetch origin +refs/heads/content/*:refs/heads/content/*
|
git fetch origin +refs/heads/content/*:refs/heads/content/*
|
||||||
- name: Build and deploy site
|
- name: Build and deploy site
|
||||||
run: |
|
run: |
|
||||||
nix develop --command bash -c "make build-draft && netlify deploy --context branch-deploy"
|
nix develop --command bash -c "netlify deploy --build --context branch-deploy"
|
||||||
|
2
.github/workflows/build-webring.yml
vendored
2
.github/workflows/build-webring.yml
vendored
@ -12,7 +12,7 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
nix_path: nixpkgs=channel:nixpkgs-unstable
|
nix_path: nixpkgs=channel:nixpkgs-unstable
|
||||||
- name: Build webring
|
- name: Build webring
|
||||||
run: nix develop -c make build-openring
|
run: nix develop -c rake build_openring
|
||||||
- name: Commit the changes
|
- name: Commit the changes
|
||||||
run: |
|
run: |
|
||||||
# Show the commit as set by the Actions bot.
|
# Show the commit as set by the Actions bot.
|
||||||
|
2
.github/workflows/build.yml
vendored
2
.github/workflows/build.yml
vendored
@ -27,4 +27,4 @@ jobs:
|
|||||||
git fetch origin +refs/heads/content/*:refs/heads/content/*
|
git fetch origin +refs/heads/content/*:refs/heads/content/*
|
||||||
- name: Build and deploy site
|
- name: Build and deploy site
|
||||||
run: |
|
run: |
|
||||||
nix develop --command bash -c "make build && netlify deploy"
|
nix develop --command bash -c "netlify deploy --build --prod"
|
||||||
|
6
Gemfile
6
Gemfile
@ -10,11 +10,15 @@ gem 'asciidoctor-tabs', github: 'asciidoctor/asciidoctor-tabs'
|
|||||||
gem 'concurrent-ruby'
|
gem 'concurrent-ruby'
|
||||||
gem 'open-uri-cached'
|
gem 'open-uri-cached'
|
||||||
gem 'rouge'
|
gem 'rouge'
|
||||||
gem 'rubocop'
|
|
||||||
gem 'rugged'
|
gem 'rugged'
|
||||||
gem 'slim'
|
gem 'slim'
|
||||||
gem 'tilt'
|
gem 'tilt'
|
||||||
|
|
||||||
group :development do
|
group :development do
|
||||||
|
gem 'rake'
|
||||||
gem 'ruby-lsp', require: false
|
gem 'ruby-lsp', require: false
|
||||||
end
|
end
|
||||||
|
|
||||||
|
group :lint do
|
||||||
|
gem 'rubocop', require: false
|
||||||
|
end
|
||||||
|
@ -51,6 +51,7 @@ GEM
|
|||||||
ast (~> 2.4.1)
|
ast (~> 2.4.1)
|
||||||
prettier_print (1.2.0)
|
prettier_print (1.2.0)
|
||||||
rainbow (3.1.1)
|
rainbow (3.1.1)
|
||||||
|
rake (13.0.6)
|
||||||
regexp_parser (2.7.0)
|
regexp_parser (2.7.0)
|
||||||
rexml (3.2.5)
|
rexml (3.2.5)
|
||||||
rouge (3.30.0)
|
rouge (3.30.0)
|
||||||
@ -95,6 +96,7 @@ DEPENDENCIES
|
|||||||
asciidoctor-tabs!
|
asciidoctor-tabs!
|
||||||
concurrent-ruby
|
concurrent-ruby
|
||||||
open-uri-cached
|
open-uri-cached
|
||||||
|
rake
|
||||||
rouge
|
rouge
|
||||||
rubocop
|
rubocop
|
||||||
ruby-lsp
|
ruby-lsp
|
||||||
|
20
Makefile
20
Makefile
@ -1,20 +0,0 @@
|
|||||||
.PHONY: build
|
|
||||||
build:
|
|
||||||
hugo --destination public
|
|
||||||
|
|
||||||
.PHONY: build-draft
|
|
||||||
build-draft:
|
|
||||||
hugo --environment development --buildDrafts --buildFuture --buildExpired --destination public
|
|
||||||
|
|
||||||
.PHONY: build-openring
|
|
||||||
build-openring:
|
|
||||||
./bin/openring-create --input assets/templates/openring-input.html --output layouts/partials/openring.html
|
|
||||||
|
|
||||||
.PHONY: serve
|
|
||||||
serve:
|
|
||||||
hugo serve --buildFuture --verboseLog --destination public
|
|
||||||
|
|
||||||
.PHONY: update
|
|
||||||
update:
|
|
||||||
curl --silent --location https://api.github.com/repos/foo-dogsquared/hugo-theme-more-contentful/commits | jq '.[0].sha' --raw-output | xargs --replace='{}' hugo mod get -u "github.com/foo-dogsquared/hugo-theme-more-contentful@{}" && hugo mod tidy
|
|
||||||
curl --silent --location https://api.github.com/repos/foo-dogsquared/hugo-mod-web-feeds/commits | jq '.[0].sha' --raw-output | xargs --replace='{}' hugo mod get -u "github.com/foo-dogsquared/hugo-mod-web-feeds@{}" && hugo mod tidy
|
|
@ -21,7 +21,7 @@ Otherwise, you might have to manually install the following components:
|
|||||||
With the things installed, you can just clone the Git repo of this project, run `make serve`, and voila!
|
With the things installed, you can just clone the Git repo of this project, run `make serve`, and voila!
|
||||||
You're now a content creator!
|
You're now a content creator!
|
||||||
|
|
||||||
Most of the usual tasks done with this project should be handled by this project already which is listed in its link:Makefile[Makefile].
|
Most of the usual tasks done with this project should be handled by this project already which is listed in its link:./Rakefile[Rakefile].
|
||||||
You can view the file for more details but for the sake of completion, here are the following tasks.
|
You can view the file for more details but for the sake of completion, here are the following tasks.
|
||||||
|
|
||||||
- Building the website with `make serve`.
|
- Building the website with `make serve`.
|
||||||
|
53
Rakefile
Normal file
53
Rakefile
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
require 'json'
|
||||||
|
require 'open3'
|
||||||
|
require 'shellwords'
|
||||||
|
|
||||||
|
github_api_headers = {
|
||||||
|
'Header' => 'application/vnd.github+json',
|
||||||
|
'X-GitHub-Api-Version' => '2022-11-28'
|
||||||
|
}
|
||||||
|
github_api_headers['Authorization'] = "Token #{ENV['GITHUB_API_BEARER_TOKEN']}" if ENV['GITHUB_API_BEARER_TOKEN']
|
||||||
|
|
||||||
|
desc 'Build the site in Netlify with the given context'
|
||||||
|
task :build, [:context, :base_url] do |_, args|
|
||||||
|
args.with_defaults(context: 'production')
|
||||||
|
draft_args = '--environment development --buildDrafts --buildFuture --buildExpired' unless args.context == 'production'
|
||||||
|
base_uri_args = "-b #{args.base_url}" if args.base_url
|
||||||
|
|
||||||
|
# Unfortunately, we have to pass it inside of another Nix shell since
|
||||||
|
# Asciidoctor doesn't want to be found when executed in here for whatever
|
||||||
|
# reason.
|
||||||
|
sh "nix develop -c hugo #{draft_args} #{base_uri_args} --destination public"
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Build the webring to be embedded with the site'
|
||||||
|
task :build_webring, [:limit, :input, :output, :file] do |_, args|
|
||||||
|
args.with_defaults(
|
||||||
|
limit: 5,
|
||||||
|
file: './data/blogs.json',
|
||||||
|
input: './assets/templates/openring-input.html',
|
||||||
|
output: './layouts/partials/openring.html'
|
||||||
|
)
|
||||||
|
|
||||||
|
File.open args.file do |f|
|
||||||
|
feeds = JSON.parse(f.read).sample(args.limit)
|
||||||
|
feeds.map! { |feed| "-s #{Shellwords.escape(feed)}" }
|
||||||
|
|
||||||
|
command = ['openring', '-n', args.limit.to_s]
|
||||||
|
command.append(*feeds)
|
||||||
|
|
||||||
|
Open3.pipeline command.join(' '), in: args.input, out: args.output
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Create a web server'
|
||||||
|
task :serve do
|
||||||
|
sh 'nix develop -c hugo serve --buildFuture --verboseLog --destination public'
|
||||||
|
end
|
||||||
|
|
||||||
|
desc 'Update the Hugo modules for this project'
|
||||||
|
task :update do
|
||||||
|
sh 'hugo mod get ./... && hugo mod tidy'
|
||||||
|
end
|
35
gemset.nix
35
gemset.nix
@ -30,6 +30,7 @@
|
|||||||
platforms = [];
|
platforms = [];
|
||||||
source = {
|
source = {
|
||||||
path = "gems";
|
path = "gems";
|
||||||
|
target = "ruby";
|
||||||
type = "path";
|
type = "path";
|
||||||
};
|
};
|
||||||
targets = [];
|
targets = [];
|
||||||
@ -77,7 +78,7 @@
|
|||||||
version = "1.0.0.beta.3";
|
version = "1.0.0.beta.3";
|
||||||
};
|
};
|
||||||
ast = {
|
ast = {
|
||||||
groups = ["default"];
|
groups = ["default" "lint"];
|
||||||
platforms = [];
|
platforms = [];
|
||||||
source = {
|
source = {
|
||||||
remotes = ["https://rubygems.org"];
|
remotes = ["https://rubygems.org"];
|
||||||
@ -166,7 +167,7 @@
|
|||||||
version = "1.0.1.11";
|
version = "1.0.1.11";
|
||||||
};
|
};
|
||||||
json = {
|
json = {
|
||||||
groups = ["default"];
|
groups = ["default" "lint"];
|
||||||
platforms = [];
|
platforms = [];
|
||||||
source = {
|
source = {
|
||||||
remotes = ["https://rubygems.org"];
|
remotes = ["https://rubygems.org"];
|
||||||
@ -226,7 +227,7 @@
|
|||||||
version = "1.0.0";
|
version = "1.0.0";
|
||||||
};
|
};
|
||||||
parallel = {
|
parallel = {
|
||||||
groups = ["default"];
|
groups = ["default" "lint"];
|
||||||
platforms = [];
|
platforms = [];
|
||||||
source = {
|
source = {
|
||||||
remotes = ["https://rubygems.org"];
|
remotes = ["https://rubygems.org"];
|
||||||
@ -239,7 +240,7 @@
|
|||||||
};
|
};
|
||||||
parser = {
|
parser = {
|
||||||
dependencies = ["ast"];
|
dependencies = ["ast"];
|
||||||
groups = ["default"];
|
groups = ["default" "lint"];
|
||||||
platforms = [];
|
platforms = [];
|
||||||
source = {
|
source = {
|
||||||
remotes = ["https://rubygems.org"];
|
remotes = ["https://rubygems.org"];
|
||||||
@ -263,7 +264,7 @@
|
|||||||
version = "1.2.0";
|
version = "1.2.0";
|
||||||
};
|
};
|
||||||
rainbow = {
|
rainbow = {
|
||||||
groups = ["default"];
|
groups = ["default" "lint"];
|
||||||
platforms = [];
|
platforms = [];
|
||||||
source = {
|
source = {
|
||||||
remotes = ["https://rubygems.org"];
|
remotes = ["https://rubygems.org"];
|
||||||
@ -274,8 +275,20 @@
|
|||||||
targets = [];
|
targets = [];
|
||||||
version = "3.1.1";
|
version = "3.1.1";
|
||||||
};
|
};
|
||||||
|
rake = {
|
||||||
|
groups = ["development"];
|
||||||
|
platforms = [];
|
||||||
|
source = {
|
||||||
|
remotes = ["https://rubygems.org"];
|
||||||
|
sha256 = "15whn7p9nrkxangbs9hh75q585yfn66lv0v2mhj6q6dl6x8bzr2w";
|
||||||
|
target = "ruby";
|
||||||
|
type = "gem";
|
||||||
|
};
|
||||||
|
targets = [];
|
||||||
|
version = "13.0.6";
|
||||||
|
};
|
||||||
regexp_parser = {
|
regexp_parser = {
|
||||||
groups = ["default"];
|
groups = ["default" "lint"];
|
||||||
platforms = [];
|
platforms = [];
|
||||||
source = {
|
source = {
|
||||||
remotes = ["https://rubygems.org"];
|
remotes = ["https://rubygems.org"];
|
||||||
@ -287,7 +300,7 @@
|
|||||||
version = "2.7.0";
|
version = "2.7.0";
|
||||||
};
|
};
|
||||||
rexml = {
|
rexml = {
|
||||||
groups = ["default"];
|
groups = ["default" "lint"];
|
||||||
platforms = [];
|
platforms = [];
|
||||||
source = {
|
source = {
|
||||||
remotes = ["https://rubygems.org"];
|
remotes = ["https://rubygems.org"];
|
||||||
@ -312,7 +325,7 @@
|
|||||||
};
|
};
|
||||||
rubocop = {
|
rubocop = {
|
||||||
dependencies = ["json" "parallel" "parser" "rainbow" "regexp_parser" "rexml" "rubocop-ast" "ruby-progressbar" "unicode-display_width"];
|
dependencies = ["json" "parallel" "parser" "rainbow" "regexp_parser" "rexml" "rubocop-ast" "ruby-progressbar" "unicode-display_width"];
|
||||||
groups = ["default"];
|
groups = ["lint"];
|
||||||
platforms = [];
|
platforms = [];
|
||||||
source = {
|
source = {
|
||||||
remotes = ["https://rubygems.org"];
|
remotes = ["https://rubygems.org"];
|
||||||
@ -325,7 +338,7 @@
|
|||||||
};
|
};
|
||||||
rubocop-ast = {
|
rubocop-ast = {
|
||||||
dependencies = ["parser"];
|
dependencies = ["parser"];
|
||||||
groups = ["default"];
|
groups = ["default" "lint"];
|
||||||
platforms = [];
|
platforms = [];
|
||||||
source = {
|
source = {
|
||||||
remotes = ["https://rubygems.org"];
|
remotes = ["https://rubygems.org"];
|
||||||
@ -350,7 +363,7 @@
|
|||||||
version = "0.4.1";
|
version = "0.4.1";
|
||||||
};
|
};
|
||||||
ruby-progressbar = {
|
ruby-progressbar = {
|
||||||
groups = ["default"];
|
groups = ["default" "lint"];
|
||||||
platforms = [];
|
platforms = [];
|
||||||
source = {
|
source = {
|
||||||
remotes = ["https://rubygems.org"];
|
remotes = ["https://rubygems.org"];
|
||||||
@ -448,7 +461,7 @@
|
|||||||
version = "2.1.0";
|
version = "2.1.0";
|
||||||
};
|
};
|
||||||
unicode-display_width = {
|
unicode-display_width = {
|
||||||
groups = ["default"];
|
groups = ["default" "lint"];
|
||||||
platforms = [];
|
platforms = [];
|
||||||
source = {
|
source = {
|
||||||
remotes = ["https://rubygems.org"];
|
remotes = ["https://rubygems.org"];
|
||||||
|
15
netlify.toml
15
netlify.toml
@ -1,18 +1,9 @@
|
|||||||
[build]
|
[build]
|
||||||
publish = "public/"
|
publish = "public/"
|
||||||
command = "make build -e"
|
command = "rake build"
|
||||||
|
|
||||||
[context.production.environment]
|
|
||||||
HUGO_BASEURL = "$DEPLOY_URL"
|
|
||||||
|
|
||||||
[context.branch-deploy]
|
[context.branch-deploy]
|
||||||
command = "make build-draft -e"
|
command = "rake build[branch-deploy,$DEPLOY_PRIME_URL]"
|
||||||
|
|
||||||
[context.branch-deploy.environment]
|
|
||||||
HUGO_BASEURL = "$DEPLOY_PRIME_URL"
|
|
||||||
|
|
||||||
[context.deploy-preview]
|
[context.deploy-preview]
|
||||||
command = "make build-draft -e"
|
command = "rake build[deploy-preview,$DEPLOY_PRIME_URL]"
|
||||||
|
|
||||||
[context.deploy-preview.environment]
|
|
||||||
HUGO_BASEURL = "$DEPLOY_PRIME_URL"
|
|
||||||
|
Loading…
Reference in New Issue
Block a user