diff --git a/_data/builds/swiftly_release.yml b/_data/builds/swiftly_release.yml index 10df08a34..a1d084d11 100644 --- a/_data/builds/swiftly_release.yml +++ b/_data/builds/swiftly_release.yml @@ -1,8 +1,8 @@ -version: "0.4.0" +version: "1.0.0" platforms: - platform: Linux - x86_64: "https://download.swift.org/swiftly/linux/swiftly-0.4.0-x86_64.tar.gz" - arm64: "https://download.swift.org/swiftly/linux/swiftly-0.4.0-aarch64.tar.gz" + x86_64: "https://download.swift.org/swiftly/linux/swiftly-1.0.0-x86_64.tar.gz" + arm64: "https://download.swift.org/swiftly/linux/swiftly-1.0.0-aarch64.tar.gz" - platform: Darwin - x86_64: "https://download.swift.org/swiftly/darwin/swiftly-0.4.0.pkg" - arm64: "https://download.swift.org/swiftly/darwin/swiftly-0.4.0.pkg" + x86_64: "https://download.swift.org/swiftly/darwin/swiftly-1.0.0.pkg" + arm64: "https://download.swift.org/swiftly/darwin/swiftly-1.0.0.pkg" \ No newline at end of file diff --git a/_includes/install/_linux_platforms_tabs.md b/_includes/install/_linux_platforms_tabs.md index 81b17f179..fd8972220 100644 --- a/_includes/install/_linux_platforms_tabs.md +++ b/_includes/install/_linux_platforms_tabs.md @@ -1,3 +1,34 @@ +## Latest Release + + + +## Alternate installation options +

Select Linux platform:

diff --git a/_includes/install/_os_tabs.md b/_includes/install/_os_tabs.md index 103c8486d..0ed775013 100644 --- a/_includes/install/_os_tabs.md +++ b/_includes/install/_os_tabs.md @@ -3,7 +3,7 @@ Follow the instructions below to install the latest version of Swift on a [suppo
diff --git a/assets/javascripts/application.js b/assets/javascripts/application.js index 5a3841eca..f807674bf 100644 --- a/assets/javascripts/application.js +++ b/assets/javascripts/application.js @@ -87,5 +87,24 @@ layout: source } }) } + + if (navigator && navigator.clipboard) { + const copyCodeButtons = document.querySelectorAll('[class^="language-"] button'); + + copyCodeButtons.forEach(function(button) { + const codeElement = button.parentElement.querySelector('code'); + const originalText = button.innerText; + + button.addEventListener('mousedown', async function() { + await navigator.clipboard.writeText(codeElement.innerText); + + button.innerText = 'Copied!'; + + setTimeout(() => { + button.innerText = originalText; + }, 1000); + }); + }); + } }); })(); diff --git a/assets/stylesheets/elements/_grid.scss b/assets/stylesheets/elements/_grid.scss index fb2d1fd59..45506c9ee 100644 --- a/assets/stylesheets/elements/_grid.scss +++ b/assets/stylesheets/elements/_grid.scss @@ -9,7 +9,7 @@ background-color: var(--color-fill-secondary); border: 1px solid var(--color-fill-tertiary); border-radius: var(--border-radius); - + padding: 1rem; display: flex; flex-direction: column; @@ -77,7 +77,7 @@ } // Button typically embedded in a grid-level-1 -a.cta-secondary { +a.cta-secondary, [class^="language-"] button { background-color: var(--color-fill-tertiary); border: 1px solid var(--color-fill-quaternary); border-radius: var(--border-radius); @@ -99,7 +99,7 @@ a.cta-secondary { &:hover { color: var(--color-link); background-color: var(--color-fill-quaternary); - + text-decoration: none; @media (prefers-contrast: more) { @@ -112,3 +112,22 @@ a.cta-secondary { content: " ↗"; } } + +div.highlight { + position: relative; + + &:hover button { + display: block; + } +} + +[class^="language-"] button { + cursor: pointer; + padding: 0.1rem 0.4rem; + font-size: 0.8rem; + position: absolute; + right: 0.4rem; + top: 0.4rem; + margin: 0; + display: none; +} diff --git a/install/linux/index.md b/install/linux/index.md index f741e8b5f..9687fd51a 100644 --- a/install/linux/index.md +++ b/install/linux/index.md @@ -4,5 +4,4 @@ title: Install Swift --- {% include install/_os_tabs.md linux="true" %} - {% include install/_linux_platforms_tabs.md %} diff --git a/install/linux/swiftly/index.md b/install/linux/swiftly/index.md new file mode 100644 index 000000000..e45dbf3ae --- /dev/null +++ b/install/linux/swiftly/index.md @@ -0,0 +1,69 @@ +--- +layout: page +title: Getting Started with Swiftly on Linux +--- + +Download swiftly for [Linux (Intel)](https://download.swift.org/swiftly/linux/swiftly-{{ site.data.builds.swiftly_release.version }}-x86_64.tar.gz), or [Linux (ARM)](https://download.swift.org/swiftly/linux/swiftly-{{ site.data.builds.swiftly_release.version }}-aarch64.tar.gz). + +``` +curl -O https://download.swift.org/swiftly/linux/swiftly-{{ site.data.builds.swiftly_release.version }}-$(uname -m).tar.gz +``` + +You can verify the integrity of the archive using the PGP signature. This will download the signature, install the swift.org signatures into your keychain, and verify the signature. + +``` +curl https://www.swift.org/keys/all-keys.asc | gpg --import - +curl -O https://download.swift.org/swiftly/linux/swiftly-{{ site.data.builds.swiftly_release.version }}-$(uname -m).tar.gz.sig +gpg --verify swiftly-{{ site.data.builds.swiftly_release.version }}-$(uname -m).tar.gz.sig swiftly-{{ site.data.builds.swiftly_release.version }}-$(uname -m).tar.gz +``` + +Extract the archive. + +``` +tar -zxf swiftly-{{ site.data.builds.swiftly_release.version }}-$(uname -m).tar.gz +``` + +Run the following command in your terminal, to configure swiftly for your account, and automatically download the latest swift toolchain. + +``` +./swiftly init +``` + +Note: You can set the SWIFTLY_HOME_DIR and SWIFTLY_BIN_DIR environment variables to customize your install location. + +Your current shell may need some additional steps to update your session. Follow the guidance at the end of the installation for a smooth install experience, such as sourcing the environment file, and rehashing your shell's PATH. + +There can be certain packages that need to be installed on your system so that the Swift toolchain can function. The swiftly initialization routine will show you how to install any missing packages. + +Now that swiftly and swift are installed, you can access the `swift` command from the latest Swift release: + +``` +swift --version +-- +Swift version {{ site.data.builds.swift_releases.last.name }} (swift-{{ site.data.builds.swift_releases.last.name }}-RELEASE) +Target: x86_64-unknown-linux-gnu +``` + +Or, you can install (and use) another swift release: + +``` +swiftly install --use 5.10 +swift --version +-- +Swift version 5.10 (swift-5.10-RELEASE) +Target: x86_64-unknown-linux-gnu +``` + +There's also an option to install the latest snapshot release and get access to the latest features: + +``` +swiftly install --use main-snapshot +``` + +Check for updates to swiftly and install them by running the self-update command: + +``` +swiftly self-update +``` + +You can discover more about swiftly in the [documentation](https://www.swift.org/swiftly/documentation/swiftlydocs/) diff --git a/install/macos/index.md b/install/macos/index.md index 8370da5f2..393ff542d 100644 --- a/install/macos/index.md +++ b/install/macos/index.md @@ -5,27 +5,45 @@ title: Install Swift {% include install/_os_tabs.md macos="true" %} -## Latest Release (Swift {{ site.data.builds.swift_releases.last.name }}) - -