al-quran.reflectslight.io/Rakefile.rb

60 lines
1.3 KiB
Ruby
Raw Normal View History

2022-11-02 04:49:43 +01:00
# frozen_string_literal: true
2022-11-08 11:45:40 +01:00
require "ryo"
require "listen"
2023-03-25 12:02:55 +01:00
load "tasks/deploy.rake"
2022-10-31 19:34:23 +01:00
namespace :nanoc do
desc "Compile the website"
2022-10-31 19:34:23 +01:00
task :compile do
2023-03-25 12:56:46 +01:00
ENV["SASS_PATH"] = "./src/css/"
2023-03-25 12:02:55 +01:00
sh "bundle exec nanoc co"
2022-10-31 19:34:23 +01:00
end
2022-11-08 11:45:40 +01:00
desc "Delete the build directory"
2022-11-08 11:45:40 +01:00
task :clean do
build_dir = Ryo.from(YAML.load_file("./nanoc.yaml")).output_dir
sh "rm -rf #{build_dir}"
end
2022-10-31 19:34:23 +01:00
end
2022-11-02 11:33:58 +01:00
task build: "nanoc:compile"
2022-10-31 19:34:23 +01:00
desc "Start a Ruby web server on localhost"
2022-11-03 23:09:51 +01:00
task server: ["nanoc:compile"] do
Dir.chdir(File.join(Dir.getwd, "build", "al-quran")) do
2023-03-25 12:02:55 +01:00
sh "bundle exec adsf"
2022-11-03 23:09:51 +01:00
end
end
namespace :watch do
desc "Watch for changes (server task)"
task :server do
Bundler.with_unbundled_env { Process.wait spawn("rake build") }
Listen.to(File.join(Dir.getwd, "src")) do
Bundler.with_unbundled_env { sh "rake build" }
end.start
Rake::Task["server"].invoke
end
end
2023-01-05 04:14:54 +01:00
namespace :lint do
desc "Run rubocop (Ruby)"
task :rubocop do
2023-03-12 20:50:19 +01:00
sh "bundle exec rubocop"
2022-11-02 04:38:46 +01:00
end
2023-01-05 04:14:54 +01:00
desc "Run eslint (TypeScript)"
task :eslint do
2022-11-02 04:38:46 +01:00
sh "npm run eslint"
end
2023-01-05 04:14:54 +01:00
namespace :eslint do
desc "Run eslint with the --fix option (TypeScript)"
task :fix do
sh "npm run eslint-autofix"
end
end
2022-11-02 04:38:46 +01:00
end
task lint: ["lint:rubocop", "lint:eslint"]
2022-10-31 19:34:23 +01:00
task default: "deploy:local"