Skip to content

Commit 599d4d7

Browse files
Merge pull request #689 from scala/download-pg-improvements
Improvements to the download page
2 parents e1a9a88 + 8d6fa1a commit 599d4d7

File tree

7 files changed

+263
-91
lines changed

7 files changed

+263
-91
lines changed

_layouts/downloadpage.html

Lines changed: 103 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -3,83 +3,111 @@
33
---
44

55
<section class="books">
6-
<div class="wrap">
7-
<div class="inner-box download">
8-
<div class="content-ribbon">
9-
<div class="ribbon-version">
10-
<span>{{page.release_version}}</span>
11-
</div>
12-
<ul>
13-
<li><a href="/download/changelog/">Release Notes</a></li>
14-
<li class="dot"></li>
15-
<li><a href="/download/changelog/">Changelog</a></li>
16-
</ul>
17-
</div>
18-
<div class="main-download">
19-
<h2>Compared to other programming languages, installing Scala is a bit unusual. It's possible to "install" Scala in numerous ways.</h2>
20-
<div class="install-steps">
21-
<div class="step">
22-
<img src="/resources/img/download/arrow-asset.png" alt="">
23-
<div class="number-step">1</div>
24-
<div class="text-step" id="download-step-one">
25-
<h3>First, make sure you have the Java 8 JDK installed.</h3>
26-
<p><code>java -version</code><span>(Make sure you have version 1.8.)</span></p>
27-
</div>
28-
</div>
29-
<div class="step">
30-
<div class="number-step">2</div>
31-
<div class="text-step">
32-
<h3>Then, install Scala using:</h3>
33-
</div>
34-
</div>
35-
<div class="download-options">
36-
<div class="download-intellij">
37-
<span class="or">or</span>
38-
<div class="description">
39-
<img src="/resources/img/download/arrow-left.png" alt="">
40-
<p>Best if you prefer a full-featured IDE (recommended for beginners)</p>
41-
</div>
42-
<a href="" class="btn-download" id="download-intellij-link">
43-
<i class="fa fa-download"></i>
44-
<span>Download intellij</span>
45-
</a>
46-
<ul>
47-
{% include tutorial-list.html column=1 %}
48-
</ul>
49-
</div>
50-
<div class="download-sbt">
51-
<div class="description">
52-
<img src="/resources/img/download/arrow-right.png" alt="">
53-
<p>Best if you are familiar with the command line</p>
54-
</div>
55-
<a href="" class="btn-download" id="download-sbt-link">
56-
<i class="fa fa-download"></i>
57-
<span>Download Sbt</span>
58-
</a>
59-
<ul>
60-
{% include tutorial-list.html column=0 %}
61-
</ul>
62-
</div>
63-
</div>
64-
<p class="bottom-lead">Scala is unusual because it is usually installed for each of your Scala projects rather than being installed system-wide. Both of the above options manage a specific Scala version per Scala project you create.</p>
6+
<div class="wrap">
7+
<div class="inner-box download">
8+
<div class="content-ribbon">
9+
<div class="ribbon-version">
10+
<span>{{page.release_version}}</span>
11+
</div>
12+
<ul>
13+
<li><a href="/download/changelog/">Release Notes</a></li>
14+
<li class="dot"></li>
15+
<li><a href="/download/changelog/">Changelog</a></li>
16+
</ul>
17+
</div>
18+
<div class="main-download">
19+
<h2>The most popular way to get Scala is either using Scala through sbt, the Scala build tool, or to use Scala through an IDE.</h2>
20+
<div class="install-steps">
21+
<div class="step">
22+
<img src="/resources/img/download/arrow-asset.png" alt="">
23+
<div class="number-step">1</div>
24+
<div class="text-step">
25+
<h3>First, make sure you have the Java 8 JDK installed.</h3>
26+
<p><code>java -version</code><span>(Make sure you have version 1.8.)</span></p>
27+
<p><i>(If you don't have it installed, <a href="http://www.oracle.com/technetwork/java/javase/downloads/index.html">download Java here</a>.)</i></p>
28+
</div>
29+
</div>
30+
<div class="step">
31+
<div class="number-step">2</div>
32+
<div class="text-step">
33+
<h3>Then, install Scala:</h3>
34+
<p>...either by installing an IDE such as IntelliJ, or sbt, Scala's build tool.</p>
35+
</div>
36+
</div>
37+
<div class="download-options">
38+
<div class="download-intellij">
39+
<span class="or">or</span>
40+
<div class="description">
41+
<img src="/resources/img/download/arrow-left.png" alt="">
42+
<p>Best if you prefer a full-featured IDE (recommended for beginners)</p>
43+
</div>
44+
<a href="" class="btn-download" id="download-intellij-link">
45+
<i class="fa fa-download"></i>
46+
<span>Download intellij</span>
47+
</a>
48+
<ul>
49+
{% include tutorial-list.html column=1 %}
50+
</ul>
51+
</div>
52+
<div class="download-sbt">
53+
<div class="description">
54+
<img src="/resources/img/download/arrow-right.png" alt="">
55+
<p>Best if you are familiar with the command line</p>
56+
</div>
57+
<a href="" class="btn-download" id="download-sbt-link">
58+
<i class="fa fa-download"></i>
59+
<span>Download Sbt</span>
60+
</a>
61+
<ul>
62+
{% include tutorial-list.html column=0 %}
63+
</ul>
64+
</div>
65+
</div>
6566

66-
<h3>Release Notes</h3> For a summary of important changes, see the <a href="https://github.com/scala/scala/releases">GitHub release notes</a>.
67-
<small>(Or consult our archive of <a href="{{ site.baseurl }}/news#announcements--changelog">older release notes</a>.)</small>
67+
<p class="bottom-lead">
68+
Compared to other programming languages, installing Scala is a bit unusual. Scala is unusual because it is usually installed for each of your Scala projects rather than being installed system-wide. Both of the above options manage (via sbt) a specific Scala version per Scala project you create.
69+
<br><br>
70+
But it's also possible to "install" Scala in numerous other ways; e.g., grab Scala binaries and use Scala from the command line or use Scala in your browser!
71+
<br><br>
72+
</p>
6873

69-
{% include download-resource-list.html %}
70-
<h3>License</h3>
71-
<p>The Scala distribution is released under the <a href="{{ site.baseurl }}/license/">3-clause BSD license</a>.</p>
72-
</div>
74+
<!-- <p class="bottom-lead"><h2>Other</h2></p> -->
7375

74-
</div>
75-
</div>
76-
</div>
76+
<div class="step other-ways-lead">
77+
<div class="number-step"><i class="fa fa-ellipsis-h" aria-hidden="true"></i></div>
78+
<div class="text-step">
79+
<h2>Other ways to install Scala</h2>
80+
<ul>
81+
<li>
82+
<a id="download-binaries">Download the Scala binaries for <span id="users-os"></span></a>
83+
<br/><span class="install"><a href="{{ site.baseurl }}/download/install.html">Need help running the binaries?</span>
84+
</li>
85+
<li>Use <a href="https://scastie.scala-lang.org">Scastie</a> to run single-file Scala programs in your browser.</li>
86+
<li><a href="http://ammonite.io/">Get Ammonite</a>, a popular Scala REPL</li>
87+
</ul>
88+
<p>Or are you looking for <a href="{{ site.baseurl }}/download/all.html">previous releases</a> of Scala?</p>
89+
</div>
90+
</div>
7791

78-
{% for step in site.data.downloads.stepOne %}
79-
<div style="display:none" id="stepOne-{{step.os}}">{{step.text}}</div>
80-
{% endfor %} {% for intellijUrl in site.data.downloads.intellijUrls %}
81-
<div style="display:none" id="intellij-{{intellijUrl.os}}">{{intellijUrl.url}}</div>
82-
{% endfor %} {% for sbtUrl in site.data.downloads.sbtUrls %}
83-
<div style="display:none" id="sbt-{{sbtUrl.os}}">{{sbtUrl.url}}</div>
84-
{% endfor %}
92+
93+
<h3>Release Notes</h3>
94+
For a summary of important changes, see the <a href="https://github.com/scala/scala/releases">GitHub release notes</a>.
95+
<br/><small>(Or consult our archive of <a href="{{ site.baseurl }}/news#announcements--changelog">older release notes</a>.)</small>
96+
97+
{% include download-resource-list.html %}
98+
<h3>License</h3>
99+
<p>The Scala distribution is released under the <a href="{{ site.baseurl }}/license/">3-clause BSD license</a>.</p>
100+
</div>
101+
102+
</div>
103+
</div>
104+
</div>
105+
106+
{% for step in site.data.downloads.stepOne %}
107+
<div style="display:none" id="stepOne-{{step.os}}">{{step.text}}</div>
108+
{% endfor %} {% for intellijUrl in site.data.downloads.intellijUrls %}
109+
<div style="display:none" id="intellij-{{intellijUrl.os}}">{{intellijUrl.url}}</div>
110+
{% endfor %} {% for sbtUrl in site.data.downloads.sbtUrls %}
111+
<div style="display:none" id="sbt-{{sbtUrl.os}}">{{sbtUrl.url}}</div>
112+
{% endfor %}
85113
</section>

_sass/layout/download.scss

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,25 @@
226226
}
227227

228228
.bottom-lead {
229-
margin-top: 165px;
229+
margin-top: 80px;
230230
@include bp(large) {
231231
margin-top: 20px;
232232
}
233+
}
234+
235+
.other-ways-lead {
236+
margin-top: 30px;
237+
@include bp(large) {
238+
margin-top: 20px;
239+
}
240+
margin-bottom: 50px;
241+
@include bp(large) {
242+
margin-bottom: 10px;
243+
}
244+
}
233245

246+
.install {
247+
font-size: 11px;
248+
font-style: italic;
234249
}
235250
}

documentation/getting-started.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
---
22
layout: inner-page-no-masthead
33
title: Getting Started
4-
permalink: /documentation/getting-started/
4+
# permalink: /documentation/getting-started/
55
includeTOC: true
6-
redirect_to:
7-
- http://docs.scala-lang.org/getting-started
6+
# redirect_to:
7+
# - http://docs.scala-lang.org/getting-started
88
---
99

1010
These tutorials will get you writing Scala code as quickly as possible. Choose one set of tutorials depending on whether you prefer to work in the command line or in an IDE.
Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
---
2+
title: Your First Lines of Scala
3+
layout: inner-page-no-masthead
4+
includeTOC: true
5+
---
6+
7+
## Your first lines of code
8+
9+
### The "Hello, world!" Program
10+
11+
As a first example, we use the standard "Hello, world!" program to demonstrate the use of the Scala tools without knowing too much about the language.
12+
13+
object HelloWorld {
14+
def main(args: Array[String]): Unit = {
15+
println("Hello, world!")
16+
}
17+
}
18+
19+
The structure of this program should be familiar to Java programmers: it consists of the method `main` which prints out a friendly greeting to the standard output.
20+
21+
We assume that both the [Scala software]({{ site.baseurl }}/download) and the user environment are set up correctly. For example:
22+
23+
| Environment | Variable | Value (example)
24+
|:------------|:-----------------|:---------------
25+
| Unix | `$SCALA_HOME` | `/usr/local/share/scala`
26+
| | `$PATH` | `$PATH:$SCALA_HOME/bin`
27+
| Windows | `%SCALA_HOME%` | `c:\Progra~1\Scala`
28+
| | `%PATH%` | `%PATH%;%SCALA_HOME%\bin`
29+
30+
31+
### Run it interactively!
32+
33+
The `scala` command starts an interactive shell where Scala expressions are interpreted interactively.
34+
35+
> scala
36+
This is a Scala shell.
37+
Type in expressions to have them evaluated.
38+
Type :help for more information.
39+
40+
scala> object HelloWorld {
41+
| def main(args: Array[String]): Unit = {
42+
| println("Hello, world!")
43+
| }
44+
| }
45+
defined module HelloWorld
46+
47+
scala> HelloWorld.main(Array())
48+
Hello, world!
49+
50+
scala>:q
51+
>
52+
53+
The shortcut `:q` stands for the internal shell command `:quit` used to exit the interpreter.
54+
55+
### Compile it!
56+
57+
The `scalac` command compiles one (or more) Scala source file(s) and generates Java bytecode which can be executed on any [standard JVM](http://java.sun.com/docs/books/jvms/). The Scala compiler works similarly to `javac`, the Java compiler of the [Java SDK](http://java.sun.com/javase/).
58+
59+
> scalac HelloWorld.scala
60+
61+
By default `scalac` generates the class files into the current working directory. You may specify a different output directory using the `-d` option.
62+
63+
> scalac -d classes HelloWorld.scala
64+
65+
66+
### Execute it!
67+
68+
The `scala` command executes the generated bytecode with the appropriate options:
69+
70+
> scala HelloWorld
71+
72+
`scala` allows us to specify command options, such as the `-classpath` (alias `-cp`) option:
73+
74+
> scala -cp classes HelloWorld
75+
76+
The argument of the `scala` command has to be a top-level object. If that object extends trait scala.App, then all statements contained in that object will be executed; otherwise you have to add a method `main` which will act as the entry point of your program.
77+
78+
Here is how the "Hello, world!" example looks like using the `App` trait:
79+
80+
object HelloWorld extends App {
81+
println("Hello, world!")
82+
}
83+
84+
### Script it!
85+
86+
We may also run our example as a shell script or batch command (see the examples in the man pages of the `scala` command).
87+
88+
The [bash](http://www.gnu.org/software/bash/) shell script `script.sh` containing the following Scala code (and shell preamble):
89+
90+
#!/usr/bin/env scala
91+
92+
object HelloWorld extends App {
93+
println("Hello, world!")
94+
}
95+
HelloWorld.main(args)
96+
97+
can be run directly from the command shell:
98+
99+
> ./script.sh
100+
101+
**Note**: We assume here that the file `script.sh` has execute permission and the search path for the `scala` command is specified in the `PATH` environment variable.

download/all.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
22
title: All Available Versions
33
layout: inner-page-no-masthead
4-
permalink: /download/all/
4+
# permalink: /download/all/
55
---
66

77
This page contains a comprehensive archive of previous Scala releases.
88

9-
{% include downloads-list.html %}
9+
{% include downloads-list.html %}

download/install.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
title: Install
2+
title: Running Scala Binaries
33
layout: inner-page-no-masthead
4-
permalink: /download/install/
4+
# permalink: /download/install/
55
includeTOC: true
66
---
77

8-
**To run Scala from the command-line, simply [download]({{ site.baseurl }}/download)
8+
**To run Scala from the command-line, simply [download]({{ site.baseurl }}/download)
99
the binaries and unpack the archive.**
1010

1111
Start the Scala interpreter (aka the "REPL") by launching `scala` from where
@@ -25,6 +25,5 @@ For quick access, add `scala` and `scalac` to your path. For example:
2525

2626
## Get Started with Scala
2727

28-
Check out the
29-
["first lines of code" section of our getting started guide]({{ site.baseurl }}/documentation/getting-started.html#your-first-lines-of-code)
30-
to take your first steps in Scala.
28+
Check out
29+
[our guide to taking your first steps in Scala]({{ site.baseurl }}/documentation/your-first-lines-of-scala.html).

0 commit comments

Comments
 (0)