-
-
Notifications
You must be signed in to change notification settings - Fork 298
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for TeX Live package manager (
tlmgr
) packages
Allow tlmgr packages to be installed, dumped, checked, updated and cleaned up.
- Loading branch information
Showing
21 changed files
with
415 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# frozen_string_literal: true | ||
|
||
module Bundle | ||
module Checker | ||
class TlmgrPackageChecker < Bundle::Checker::Base | ||
PACKAGE_TYPE = :tlmgr | ||
PACKAGE_TYPE_NAME = "TeX Live Package" | ||
|
||
def failure_reason(package, no_upgrade:) | ||
"#{PACKAGE_TYPE_NAME} #{package} needs to be installed." | ||
end | ||
|
||
def installed_and_up_to_date?(package, no_upgrade: false) | ||
Bundle::TlmgrPackageInstaller.package_installed?(package) | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# frozen_string_literal: true | ||
|
||
module Bundle | ||
module TlmgrPackageDumper | ||
module_function | ||
|
||
def reset! | ||
@packages = nil | ||
@outdated_packages = nil | ||
end | ||
|
||
def packages | ||
@packages ||= if Bundle.tlmgr_installed? | ||
`tlmgr info --only-installed 2>/dev/null`.split("\n").map { |l| l.match(/i ([^:]+).*/)[1] }.map(&:downcase) | ||
else | ||
[] | ||
end | ||
end | ||
|
||
# TODO: See how we can get around the sudo requirement because of the way e.g. basictex installs itself | ||
# See also https://tug.org/texlive/doc/tlmgr.html#USER-MODE | ||
def outdated_packages | ||
@outdated_packages ||= if Bundle.tlmgr_installed? | ||
`sudo tlmgr update --all --dry-run 2>/dev/null`.split("\n") | ||
.map { |l| l.match(/^update:\s+([^ ]+).*/)[1] } | ||
.reject(&:empty?).map(&:downcase) | ||
else | ||
[] | ||
end | ||
end | ||
|
||
def dump | ||
packages.map { |name| "tlmgr \"#{name}\"" }.join("\n") | ||
end | ||
end | ||
end |
Oops, something went wrong.