testsAndMisc/linux_configuration/scripts/single_use/utils/lib/plagiarism_optional.sh
Krzysztof kuhy Rudnicki 2a7b9d90ac install_plagiarism_tools.sh: split 534 -> 94 + 3 libs, with a real test harness
Wraps the four install stages into named functions, one per lib/plagiarism_*.sh
sibling (matching install_exercism.sh's convention), and extracts the two
embedded Python heredocs into real, lint-clean check_plagiarism.py/sherlock.py
files -- check_plagiarism.py needed a second split into plagiarism_similarity.py
to also clear the 250-line cap. Every function reaches 100% shell coverage via
a PATH-shim test harness (fake python3/pip/git/java/wine); the two Python CLIs
were separately verified against a real venv with actual nltk/scikit-learn.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011w2Pj4Ek3ZNMQVYcFHgXDY
2026-08-18 20:41:18 +02:00

49 lines
1.5 KiB
Bash
Executable File

#!/bin/bash
# Stages 3-4: optional plagiarism tools that need a manual download.
#
# Sourced by install_plagiarism_tools.sh; split out to keep it under the
# 250-line cap. Sourced rather than run, so it inherits the caller's strict
# mode and the color/log helpers and INSTALL_DIR global defined above the
# source line.
# Ferret (Java-based) - Optional
check_ferret() {
echo ""
echo "=== 3. Checking for Ferret (Java-based plagiarism tool) ==="
if ! command -v java &>/dev/null; then
warn "Java not installed, skipping Ferret"
return
fi
local ferret_dir="$INSTALL_DIR/ferret"
if [ -d "$ferret_dir" ]; then
return
fi
mkdir -p "$ferret_dir"
echo "Ferret is a Java-based tool from University of Hertfordshire."
echo "Download manually from: https://homepages.herts.ac.uk/~comqcln/Ferret/"
echo "Place JAR file in: $ferret_dir"
warn "Ferret requires manual download (academic license)"
}
# WCopyfind via Wine (Optional)
check_wcopyfind() {
echo ""
echo "=== 4. WCopyfind Information (Windows tool, needs Wine) ==="
if command -v wine &>/dev/null; then
echo "Wine is available. WCopyfind can be run via Wine."
echo "Download from: https://plagiarism.bloomfieldmedia.com/software/wcopyfind/"
echo "Run with: wine /path/to/WCopyfind.exe"
warn "WCopyfind requires manual download"
return
fi
echo "Wine not installed. To use WCopyfind:"
echo " 1. Install wine: sudo apt install wine (or equivalent)"
echo " 2. Download WCopyfind from: https://plagiarism.bloomfieldmedia.com/software/wcopyfind/"
warn "WCopyfind skipped (Wine not available)"
}