mirror of
https://github.com/foo-dogsquared/website.git
synced 2025-01-30 16:58:00 +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/*
|
||||
- name: Build and deploy site
|
||||
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:
|
||||
nix_path: nixpkgs=channel:nixpkgs-unstable
|
||||
- name: Build webring
|
||||
run: nix develop -c make build-openring
|
||||
run: nix develop -c rake build_openring
|
||||
- name: Commit the changes
|
||||
run: |
|
||||
# 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/*
|
||||
- name: Build and deploy site
|
||||
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 'open-uri-cached'
|
||||
gem 'rouge'
|
||||
gem 'rubocop'
|
||||
gem 'rugged'
|
||||
gem 'slim'
|
||||
gem 'tilt'
|
||||
|
||||
group :development do
|
||||
gem 'rake'
|
||||
gem 'ruby-lsp', require: false
|
||||
end
|
||||
|
||||
group :lint do
|
||||
gem 'rubocop', require: false
|
||||
end
|
||||
|
@ -51,6 +51,7 @@ GEM
|
||||
ast (~> 2.4.1)
|
||||
prettier_print (1.2.0)
|
||||
rainbow (3.1.1)
|
||||
rake (13.0.6)
|
||||
regexp_parser (2.7.0)
|
||||
rexml (3.2.5)
|
||||
rouge (3.30.0)
|
||||
@ -95,6 +96,7 @@ DEPENDENCIES
|
||||
asciidoctor-tabs!
|
||||
concurrent-ruby
|
||||
open-uri-cached
|
||||
rake
|
||||
rouge
|
||||
rubocop
|
||||
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!
|
||||
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.
|
||||
|
||||
- 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 = [];
|
||||
source = {
|
||||
path = "gems";
|
||||
target = "ruby";
|
||||
type = "path";
|
||||
};
|
||||
targets = [];
|
||||
@ -77,7 +78,7 @@
|
||||
version = "1.0.0.beta.3";
|
||||
};
|
||||
ast = {
|
||||
groups = ["default"];
|
||||
groups = ["default" "lint"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
@ -166,7 +167,7 @@
|
||||
version = "1.0.1.11";
|
||||
};
|
||||
json = {
|
||||
groups = ["default"];
|
||||
groups = ["default" "lint"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
@ -226,7 +227,7 @@
|
||||
version = "1.0.0";
|
||||
};
|
||||
parallel = {
|
||||
groups = ["default"];
|
||||
groups = ["default" "lint"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
@ -239,7 +240,7 @@
|
||||
};
|
||||
parser = {
|
||||
dependencies = ["ast"];
|
||||
groups = ["default"];
|
||||
groups = ["default" "lint"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
@ -263,7 +264,7 @@
|
||||
version = "1.2.0";
|
||||
};
|
||||
rainbow = {
|
||||
groups = ["default"];
|
||||
groups = ["default" "lint"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
@ -274,8 +275,20 @@
|
||||
targets = [];
|
||||
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 = {
|
||||
groups = ["default"];
|
||||
groups = ["default" "lint"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
@ -287,7 +300,7 @@
|
||||
version = "2.7.0";
|
||||
};
|
||||
rexml = {
|
||||
groups = ["default"];
|
||||
groups = ["default" "lint"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
@ -312,7 +325,7 @@
|
||||
};
|
||||
rubocop = {
|
||||
dependencies = ["json" "parallel" "parser" "rainbow" "regexp_parser" "rexml" "rubocop-ast" "ruby-progressbar" "unicode-display_width"];
|
||||
groups = ["default"];
|
||||
groups = ["lint"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
@ -325,7 +338,7 @@
|
||||
};
|
||||
rubocop-ast = {
|
||||
dependencies = ["parser"];
|
||||
groups = ["default"];
|
||||
groups = ["default" "lint"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
@ -350,7 +363,7 @@
|
||||
version = "0.4.1";
|
||||
};
|
||||
ruby-progressbar = {
|
||||
groups = ["default"];
|
||||
groups = ["default" "lint"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
@ -448,7 +461,7 @@
|
||||
version = "2.1.0";
|
||||
};
|
||||
unicode-display_width = {
|
||||
groups = ["default"];
|
||||
groups = ["default" "lint"];
|
||||
platforms = [];
|
||||
source = {
|
||||
remotes = ["https://rubygems.org"];
|
||||
|
15
netlify.toml
15
netlify.toml
@ -1,18 +1,9 @@
|
||||
[build]
|
||||
publish = "public/"
|
||||
command = "make build -e"
|
||||
|
||||
[context.production.environment]
|
||||
HUGO_BASEURL = "$DEPLOY_URL"
|
||||
command = "rake build"
|
||||
|
||||
[context.branch-deploy]
|
||||
command = "make build-draft -e"
|
||||
|
||||
[context.branch-deploy.environment]
|
||||
HUGO_BASEURL = "$DEPLOY_PRIME_URL"
|
||||
command = "rake build[branch-deploy,$DEPLOY_PRIME_URL]"
|
||||
|
||||
[context.deploy-preview]
|
||||
command = "make build-draft -e"
|
||||
|
||||
[context.deploy-preview.environment]
|
||||
HUGO_BASEURL = "$DEPLOY_PRIME_URL"
|
||||
command = "rake build[deploy-preview,$DEPLOY_PRIME_URL]"
|
||||
|
Loading…
Reference in New Issue
Block a user