Add rake/
This commit is contained in:
parent
043523e48a
commit
a25a80661a
4 changed files with 10 additions and 11 deletions
|
@ -6,9 +6,9 @@ require "yaml"
|
||||||
|
|
||||||
##
|
##
|
||||||
# Rake tasks
|
# Rake tasks
|
||||||
load "tasks/deploy.rake"
|
load "rake/tasks/deploy.rake"
|
||||||
load "tasks/linter.rake"
|
load "rake/tasks/linter.rake"
|
||||||
load "tasks/nanoc.rake"
|
load "rake/tasks/nanoc.rake"
|
||||||
|
|
||||||
desc "Serve the website on localhost"
|
desc "Serve the website on localhost"
|
||||||
task :server, [:host, :port] do |_t, args|
|
task :server, [:host, :port] do |_t, args|
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
namespace :nanoc do
|
namespace :nanoc do
|
||||||
require "bundler/setup"
|
require "bundler/setup"
|
||||||
cwd = File.realpath File.join(__dir__, "..")
|
root = File.realpath File.join(__dir__, "..", "..")
|
||||||
|
|
||||||
desc "Clean the build/ directory"
|
desc "Clean the build/ directory"
|
||||||
task :clean do
|
task :clean do
|
||||||
Dir.chdir(cwd) do
|
Dir.chdir(root) do
|
||||||
sh "rm -rf node_modules/.cache/"
|
sh "rm -rf node_modules/.cache/"
|
||||||
sh "rm -rf tmp/"
|
sh "rm -rf tmp/"
|
||||||
sh "rm -rf build"
|
sh "rm -rf build"
|
||||||
|
@ -13,10 +13,9 @@ namespace :nanoc do
|
||||||
|
|
||||||
desc "Produce the build/ directory"
|
desc "Produce the build/ directory"
|
||||||
task :build, [:buildenv] do |t, args|
|
task :build, [:buildenv] do |t, args|
|
||||||
|
Dir.chdir(root) do
|
||||||
Dir.chdir(cwd) do
|
|
||||||
buildenv = args.buildenv || ENV["buildenv"] || "development"
|
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/"
|
sh "rm -rf build/al-quran/css/"
|
||||||
Bundler.with_unbundled_env {
|
Bundler.with_unbundled_env {
|
||||||
sh "SASS_PATH=#{sass_path} buildenv=#{buildenv} bundle exec nanoc co"
|
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"
|
desc "Produce the build/ directory on-demand"
|
||||||
task watch: ['nanoc:build'] do
|
task watch: ['nanoc:build'] do
|
||||||
Dir.chdir(cwd) do
|
Dir.chdir(root) do
|
||||||
require "listen"
|
require "listen"
|
||||||
path = File.join(Dir.getwd, "src")
|
srcdir = File.join(root, "src")
|
||||||
Listen.to(path) do
|
Listen.to(srcdir) do
|
||||||
Bundler.with_unbundled_env { sh "rake nanoc:build" }
|
Bundler.with_unbundled_env { sh "rake nanoc:build" }
|
||||||
end.start
|
end.start
|
||||||
sleep
|
sleep
|
Loading…
Reference in a new issue