backend/bin/update-book
#!/usr/bin/env ruby
require 'pry'
require_relative '../config/environment'
permalink = ARGV[0]
branch = ARGV[1]
repo = Twist::Repositories::BookRepo.new
book = repo.find_by_permalink(permalink)
worker = case book.format
when "markdown"
Twist::Processors::Markdown::BookWorker
when "asciidoc"
Twist::Processors::Asciidoc::BookWorker
end
worker.perform_async(
permalink: permalink,
branch: branch,
username: book.github_user,
repo: book.github_repo,
)
puts "Update enqueued for #{book.title}"