Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Back port of documentation changes to main #1935

Merged
merged 4 commits into from
Mar 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 4 additions & 6 deletions gifs/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
FROM ubuntu:20.04

RUN curl -fsSL https://deb.nodesource.com/setup_12.x | bash -
RUN apt-get update &&\
DEBIAN_FRONTEND=noninteractive apt-get install -y pv curl clang rubygems nodejs python3-pip &&\
RUN apt-get update
RUN apt-get install openjdk-17-jdk openjdk-17-jre -y
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y pv curl clang rubygems nodejs python3-pip &&\
rm -rf /var/lib/apt/lists/* &&\
gem install rouge &&\
pip3 install asciinema==2.1.0

RUN mkdir /data
WORKDIR /data

COPY scala-cli-jvm /usr/bin/scala-cli
# Preload scala-cli
RUN cd /data
RUN echo 'def a = 123' > a.scala
RUN scala-cli compile a.scala || echo "Problems with bloop"

# Update path to point to newer version
RUN curl -fLo scala-cli.deb https://github.com/VirtusLab/scala-cli/releases/download/v0.1.15/scala-cli-x86_64-pc-linux.deb
RUN dpkg -i scala-cli.deb

COPY *.sh /data/
COPY scenarios /data/scenarios

Expand Down
3 changes: 2 additions & 1 deletion gifs/scenarios/complete-install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)

if [[ -z "${ASCIINEMA_REC}" ]]; then
# Warm up scala-cli
apt-get purge -y scala-cli || true
rm /usr/bin/scala-cli || true # remove scala-cliu from PATH
rm /usr/bin/java || true # remove java from PATH
# or do other preparation (e.g. create code)
else
. $SCRIPT_DIR/../demo-magic.sh
Expand Down
2 changes: 1 addition & 1 deletion gifs/scenarios/defaults.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ EOF
pe 'scala-cli fmt .'
p "cat Main.scala"
rougify --theme tulip Main.scala
pe 'scala-cli package .'
pe 'scala-cli --power package .'
doSleep 4
echo " " && echo "ok" > status.txt
fi
6 changes: 3 additions & 3 deletions gifs/scenarios/demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
if [[ -z "${ASCIINEMA_REC}" ]]; then
# Warm up scala-cli
echo "println(1)" | scala-cli -
cat <<EOF > demo.test.scala |
//> using lib "org.scalameta::munit:0.7.29"
cat <<EOF > demo.test.scala |
//> using dep "org.scalameta::munit:0.7.29"
EOF
scala-cli test demo.test.scala
# or do other preparation (e.g. create code)
Expand Down Expand Up @@ -56,7 +56,7 @@ EOF
clearConsole

cat <<EOF | updateFile demo.test.scala
//> using lib "org.scalameta::munit:0.7.29"
//> using dep "org.scalameta::munit:0.7.29"

class demoTest extends munit.FunSuite {
test("test nice args") {
Expand Down
8 changes: 4 additions & 4 deletions gifs/scenarios/powerful_scripts.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)

if [[ -z "${ASCIINEMA_REC}" ]]; then
# Warm up scala-cli
echo '//> using lib "com.lihaoyi::os-lib:0.7.8"' | scala-cli -
echo '//> using lib "com.lihaoyi::pprint:0.6.6"' | scala-cli -
echo '//> using dep "com.lihaoyi::os-lib:0.9.1"' | scala-cli -
echo '//> using dep "com.lihaoyi::pprint:0.8.1"' | scala-cli -
# or do other preparation (e.g. create code)
else
. $SCRIPT_DIR/../demo-magic.sh
Expand All @@ -20,8 +20,8 @@ else

# Put your stuff here
cat <<EOF | updateFile stat.sc
//> using lib "com.lihaoyi::os-lib:0.7.8"
//> using lib "com.lihaoyi::pprint:0.6.6"
//> using dep "com.lihaoyi::os-lib:0.9.1"
//> using dep "com.lihaoyi::pprint:0.8.1"
import pprint._
import os._

Expand Down
5 changes: 3 additions & 2 deletions gifs/scenarios/projects.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
if [[ -z "${ASCIINEMA_REC}" ]]; then
# Warm up scala-cli
echo "println(1)" | scala-cli -S 2.13.6 -
echo "//> using lib \"com.softwaremill.sttp.client3::core:3.3.18\" " | scala-cli -S 2.13.6 -
echo "//> using dep \"com.softwaremill.sttp.client3::core:3.8.13\" " | scala-cli -S 2.13.6 -
scala-cli config suppress-warning.outdated-dependencies-files true
# or do other preparation (e.g. create code)
else
. $SCRIPT_DIR/../demo-magic.sh
Expand All @@ -20,7 +21,7 @@ else

# Put your stuff here
cat <<EOF | updateFile Post.scala
//> using lib "com.softwaremill.sttp.client3::core:3.3.18"
//> using dep "com.softwaremill.sttp.client3::core:3.3.18"
import sttp.client3._

// https://sttp.softwaremill.com/en/latest/quickstart.html
Expand Down
4 changes: 2 additions & 2 deletions gifs/scenarios/scripting.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" &> /dev/null && pwd)
if [[ -z "${ASCIINEMA_REC}" ]]; then
# Warm up scala-cli
echo "println(1)" | scala-cli -
echo "//> using lib \"com.lihaoyi::os-lib::0.7.8\"" | scala-cli -
echo "//> using dep \"com.lihaoyi::os-lib::0.9.1\"" | scala-cli -
# or do other preparation (e.g. create code)
else
. $SCRIPT_DIR/../demo-magic.sh
Expand All @@ -24,7 +24,7 @@ Hello World from file
EOF

cat <<EOF | updateFile script.sc
//> using lib "com.lihaoyi::os-lib::0.7.8"
//> using dep "com.lihaoyi::os-lib::0.9.1"

val filePath = os.pwd / "file"
val fileContent = os.read(filePath)
Expand Down
2 changes: 1 addition & 1 deletion gifs/scenarios/todo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ else

# Put your stuff here

pe "scala-cli about"
pe "scala-cli version"
pe "echo 'println(\"TODO\")' | scala-cli -"

# Wait a bit to read output of last command
Expand Down
2 changes: 1 addition & 1 deletion modules/docs-tests/src/test/scala/sclicheck/DocTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DocTests extends munit.FunSuite {
DocTestEntry("reference", docsRootPath / "reference")
)

val options: Options = Options(scalaCliCommand = Seq(TestUtil.scalaCliPath))
val options: Options = Options(scalaCliCommand = Seq(TestUtil.scalaCliPath.toString))

private def lineContainsAnyChecks(l: String): Boolean =
l.startsWith("```md") || l.startsWith("```bash") ||
Expand Down
5 changes: 4 additions & 1 deletion modules/docs-tests/src/test/scala/sclicheck/GifTests.scala
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class GifTests extends munit.FunSuite {
lazy val ttyOpts = if (hasTty) Seq("-it") else Nil

def buildImages = true
def forceBuildImages = false
def forceBuildImages = true

def columns = 70
def rows = 20
Expand All @@ -44,8 +44,11 @@ class GifTests extends munit.FunSuite {
res.out.trim().nonEmpty
}
if (forceBuildImages || !hasImage("gif-renderer"))
val scalaCliJvmPath = gifRenderedDockerDir / "scala-cli-jvm"
os.copy.over(TestUtil.scalaCliPath, scalaCliJvmPath)
os.proc("docker", "build", gifRenderedDockerDir, "--tag", "gif-renderer")
.call(stdin = os.Inherit, stdout = os.Inherit)
os.remove(scalaCliJvmPath)
if (forceBuildImages || !hasImage("svg_rendrer"))
os.proc("docker", "build", svgRenderedDockerDir, "--tag", "svg_rendrer")
.call(stdin = os.Inherit, stdout = os.Inherit)
Expand Down
7 changes: 4 additions & 3 deletions modules/docs-tests/src/test/scala/sclicheck/TestUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,9 @@ object TestUtil {
System.err.println(s"Could not remove $f ($ex), ignoring it.")
}

lazy val scalaCliPath = Option(System.getenv("SCLICHECK_SCALA_CLI")).getOrElse {
sys.error("SCLICHECK_SCALA_CLI not set")
}
lazy val scalaCliPath =
Option(System.getenv("SCLICHECK_SCALA_CLI")).map(os.Path(_, os.pwd)).getOrElse {
sys.error("SCLICHECK_SCALA_CLI not set")
}

}
Binary file modified website/static/img/dark/gifs/defaults.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/img/dark/gifs/demo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/img/dark/gifs/powerful_scripts.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/img/dark/gifs/projects.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/img/dark/gifs/scripting.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/img/dark/gifs/todo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/img/gifs/defaults.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/img/gifs/demo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/img/gifs/powerful_scripts.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/img/gifs/projects.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/img/gifs/scripting.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified website/static/img/gifs/todo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.