Add tasks/config/install.rake
This commit is contained in:
parent
12b798a6bc
commit
ad48f02b11
4 changed files with 18 additions and 3 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,6 +1,7 @@
|
|||
build/
|
||||
tmp/
|
||||
node_modules/
|
||||
.bundle/
|
||||
*.log
|
||||
.env
|
||||
.idea
|
||||
|
|
|
@ -1,10 +1,11 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require "bundler/setup"
|
||||
require "ryo"
|
||||
require "listen"
|
||||
require_relative "lib/tasks"
|
||||
load "tasks/config.rake"
|
||||
|
||||
load "tasks/config/build.rake"
|
||||
load "tasks/config/install.rake"
|
||||
|
||||
namespace :nanoc do
|
||||
desc "Compile the website"
|
||||
|
|
|
@ -5,7 +5,7 @@ require "bundler/setup"
|
|||
require "erb"
|
||||
require "ryo"
|
||||
require "yaml"
|
||||
require_relative "../tasks.lib/erb_context"
|
||||
require_relative "../../tasks.lib/erb_context"
|
||||
|
||||
read_options = ->(env:) do
|
||||
path = File.join(Dir.getwd, "config", "#{env}.yml")
|
||||
|
@ -34,6 +34,7 @@ build_files = -> (env:, base:, glob:) do
|
|||
end
|
||||
end
|
||||
|
||||
desc "Build configuration files"
|
||||
task "config:build", :env do |task, args|
|
||||
env = args[:env]
|
||||
case env
|
||||
|
@ -46,6 +47,7 @@ task "config:build", :env do |task, args|
|
|||
Rake::Task["config:build:nginx"].invoke(env)
|
||||
end
|
||||
|
||||
desc "Build /etc configuration files"
|
||||
task "config:build:etc", :env do |task, args|
|
||||
env = args[:env]
|
||||
build_files.call(
|
||||
|
@ -55,6 +57,7 @@ task "config:build:etc", :env do |task, args|
|
|||
)
|
||||
end
|
||||
|
||||
desc "Build nginx configuration files"
|
||||
task "config:build:nginx", :env do |task, args|
|
||||
env = args[:env]
|
||||
build_files.call(
|
10
tasks/config/install.rake
Normal file
10
tasks/config/install.rake
Normal file
|
@ -0,0 +1,10 @@
|
|||
desc "Install configuration files"
|
||||
task "config:install", :env do |tasks, args|
|
||||
env = args[:env]
|
||||
if Process.euid != 0
|
||||
sh "doas -u root bundle exec rake config:install[#{env}]"
|
||||
exit $?.exitstatus
|
||||
end
|
||||
copy_entry File.join(Dir.getwd, "build", env, "usr.local.etc"),
|
||||
"/usr/local/etc"
|
||||
end
|
Loading…
Reference in a new issue