41 lines
1.1 KiB
Ruby
41 lines
1.1 KiB
Ruby
# typed: false
|
|
# frozen_string_literal: true
|
|
T.bind(self, T.all(Rake::DSL, Object))
|
|
|
|
namespace :ib do
|
|
desc "run a single e621 posts index job"
|
|
task latest_posts_job: :environment do
|
|
Domain::Inkbunny::Job::LatestPostsJob.set(priority: -10).perform_later({})
|
|
end
|
|
|
|
desc "Enqueue missing posts"
|
|
task enqueue_missing_posts: :environment do
|
|
Tasks::Inkbunny::EnqueueMissingPostsTask.new(start_at: ENV["start_at"]).run
|
|
end
|
|
|
|
desc "set auth credentials"
|
|
task set_auth: :environment do
|
|
username = nil
|
|
password = nil
|
|
|
|
while username.blank?
|
|
print "enter username: "
|
|
username = $stdin.gets.chomp
|
|
end
|
|
|
|
while password.blank?
|
|
print "enter password: "
|
|
password = $stdin.gets.chomp
|
|
end
|
|
|
|
GlobalState
|
|
.find_or_create_by(key: "inkbunny-username")
|
|
.update!(value: username) { |gs| gs.value_type = :string }
|
|
GlobalState
|
|
.find_or_create_by(key: "inkbunny-password")
|
|
.update!(value: password) { |gs| gs.value_type = :password }
|
|
|
|
puts "auth credentials set to #{username} / #{password}"
|
|
end
|
|
end
|