From a25a80661a9dea6d6dc7614f8b5477de512c9cc4 Mon Sep 17 00:00:00 2001 From: 0x1eef <0x1eef@protonmail.com> Date: Fri, 15 Mar 2024 12:52:39 -0300 Subject: [PATCH] Add rake/ --- Rakefile.rb | 6 +++--- {tasks => rake/tasks}/deploy.rake | 0 {tasks => rake/tasks}/linter.rake | 0 {tasks => rake/tasks}/nanoc.rake | 15 +++++++-------- 4 files changed, 10 insertions(+), 11 deletions(-) rename {tasks => rake/tasks}/deploy.rake (100%) rename {tasks => rake/tasks}/linter.rake (100%) rename {tasks => rake/tasks}/nanoc.rake (76%) diff --git a/Rakefile.rb b/Rakefile.rb index 06c3aae..be34dfb 100644 --- a/Rakefile.rb +++ b/Rakefile.rb @@ -6,9 +6,9 @@ require "yaml" ## # Rake tasks -load "tasks/deploy.rake" -load "tasks/linter.rake" -load "tasks/nanoc.rake" +load "rake/tasks/deploy.rake" +load "rake/tasks/linter.rake" +load "rake/tasks/nanoc.rake" desc "Serve the website on localhost" task :server, [:host, :port] do |_t, args| diff --git a/tasks/deploy.rake b/rake/tasks/deploy.rake similarity index 100% rename from tasks/deploy.rake rename to rake/tasks/deploy.rake diff --git a/tasks/linter.rake b/rake/tasks/linter.rake similarity index 100% rename from tasks/linter.rake rename to rake/tasks/linter.rake diff --git a/tasks/nanoc.rake b/rake/tasks/nanoc.rake similarity index 76% rename from tasks/nanoc.rake rename to rake/tasks/nanoc.rake index 3f08222..9270afa 100644 --- a/tasks/nanoc.rake +++ b/rake/tasks/nanoc.rake @@ -1,10 +1,10 @@ namespace :nanoc do require "bundler/setup" - cwd = File.realpath File.join(__dir__, "..") + root = File.realpath File.join(__dir__, "..", "..") desc "Clean the build/ directory" task :clean do - Dir.chdir(cwd) do + Dir.chdir(root) do sh "rm -rf node_modules/.cache/" sh "rm -rf tmp/" sh "rm -rf build" @@ -13,10 +13,9 @@ namespace :nanoc do desc "Produce the build/ directory" task :build, [:buildenv] do |t, args| - - Dir.chdir(cwd) do + Dir.chdir(root) do buildenv = args.buildenv || ENV["buildenv"] || "development" - sass_path = File.join(cwd, "src", "css") + sass_path = File.join(root, "src", "css") sh "rm -rf build/al-quran/css/" Bundler.with_unbundled_env { sh "SASS_PATH=#{sass_path} buildenv=#{buildenv} bundle exec nanoc co" @@ -26,10 +25,10 @@ namespace :nanoc do desc "Produce the build/ directory on-demand" task watch: ['nanoc:build'] do - Dir.chdir(cwd) do + Dir.chdir(root) do require "listen" - path = File.join(Dir.getwd, "src") - Listen.to(path) do + srcdir = File.join(root, "src") + Listen.to(srcdir) do Bundler.with_unbundled_env { sh "rake nanoc:build" } end.start sleep