2024-08-28 01:18:42 +02:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2024-08-28 00:35:31 +02:00
|
|
|
namespace :source do
|
2024-08-28 01:18:42 +02:00
|
|
|
desc "Clone the website"
|
2024-08-28 00:35:31 +02:00
|
|
|
task :clone do
|
2024-08-28 01:54:57 +02:00
|
|
|
sh "git clone https://github.com/ReflectsLight/al-quran.reflectslight.io source/"
|
2024-08-28 00:35:31 +02:00
|
|
|
end
|
|
|
|
|
2024-08-28 01:18:42 +02:00
|
|
|
desc "Pull website updates"
|
2024-08-28 00:35:31 +02:00
|
|
|
task :pull do
|
|
|
|
Dir.chdir File.join(__dir__, "source") do
|
2024-08-28 01:54:57 +02:00
|
|
|
sh "git pull origin main"
|
2024-08-28 00:35:31 +02:00
|
|
|
end
|
|
|
|
end
|
2024-08-28 01:18:42 +02:00
|
|
|
end
|
2024-08-28 00:35:31 +02:00
|
|
|
|
2024-08-28 01:18:42 +02:00
|
|
|
namespace :website do
|
2024-08-28 00:41:25 +02:00
|
|
|
desc "Build the website"
|
2024-08-28 01:18:42 +02:00
|
|
|
task build: %i[website:clean] do
|
2024-08-28 00:35:31 +02:00
|
|
|
Dir.chdir File.join(__dir__, "source") do
|
|
|
|
Bundler.with_unbundled_env do
|
2024-08-28 00:40:27 +02:00
|
|
|
sh "bundle exec rake nanoc:clean"
|
|
|
|
sh "bundle exec rake nanoc:build[production]"
|
|
|
|
sh "mv build/ ../"
|
2024-08-28 00:35:31 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2024-08-28 00:39:17 +02:00
|
|
|
|
2024-08-28 00:41:25 +02:00
|
|
|
desc "Deploy the website"
|
2024-08-28 01:18:42 +02:00
|
|
|
task deploy: %i[source:pull website:build] do
|
2024-08-28 01:19:17 +02:00
|
|
|
sh "git commit -am 'Deploy the website' || true"
|
2024-08-28 00:41:25 +02:00
|
|
|
sh "git push github production"
|
2024-08-28 00:39:17 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
desc "Clean the build/ directory"
|
|
|
|
task :clean do
|
|
|
|
sh "rm -rf build/"
|
|
|
|
end
|
2024-08-28 00:35:31 +02:00
|
|
|
end
|