Skip to content

Commit

Permalink
Created project repository
Browse files Browse the repository at this point in the history
  • Loading branch information
artemis-beta committed Aug 26, 2024
0 parents commit 5d0f261
Show file tree
Hide file tree
Showing 7 changed files with 856 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# File created using '.gitignore Generator' for Visual Studio Code: https://bit.ly/vscode-gig
# Created by https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,chocolatey
# Edit at https://www.toptal.com/developers/gitignore?templates=windows,visualstudiocode,chocolatey

### Chocolatey ###
# Exclude packaged modules
*.nupkg

### VisualStudioCode ###
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets

# Local History for Visual Studio Code
.history/

# Built Visual Studio Code Extensions
*.vsix

### VisualStudioCode Patch ###
# Ignore all local history of files
.history
.ionide

### Windows ###
# Windows thumbnail cache files
Thumbs.db
Thumbs.db:encryptable
ehthumbs.db
ehthumbs_vista.db

# Dump file
*.stackdump

# Folder config file
[Dd]esktop.ini

# Recycle Bin used on file shares
$RECYCLE.BIN/

# Windows Installer files
*.cab
*.msi
*.msix
*.msm
*.msp
*.exe

# Windows shortcuts
*.lnk

# End of https://www.toptal.com/developers/gitignore/api/windows,visualstudiocode,chocolatey

# Custom rules (everything added below won't be overriden by 'Generate .gitignore File' if you use 'Update' option)

674 changes: 674 additions & 0 deletions LICENSE

Large diffs are not rendered by default.

17 changes: 17 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Open Rails Chocolatey Package
Allows the installation of [Open Rails](https://www.openrails.org/) by the Open Rails Team via the [Chocolatey Package Manager](https://community.chocolatey.org/) for Windows. The setup will install Open Rails on a Windows system.

## Install
```pwsh
choco install openrails
```

## Uninstall
```pwsh
choco uninstall openrails
```

## Upgrade
```pwsh
choco upgrade openrails
```
67 changes: 67 additions & 0 deletions openrails.nuspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Read this before creating packages: https://chocolatey.org/docs/create-packages -->
<!-- It is especially important to read the above link to understand additional requirements when publishing packages to the community feed aka dot org (https://chocolatey.org/packages). -->

<!-- Test your packages in a test environment: https://github.com/chocolatey/chocolatey-test-environment -->

<!--
This is a nuspec. It mostly adheres to https://docs.nuget.org/create/Nuspec-Reference. Chocolatey uses a special version of NuGet.Core that allows us to do more than was initially possible. As such there are certain things to be aware of:
* the package xmlns schema url may cause issues with nuget.exe
* Any of the following elements can ONLY be used by choco tools - projectSourceUrl, docsUrl, mailingListUrl, bugTrackerUrl, packageSourceUrl, provides, conflicts, replaces
* nuget.exe can still install packages with those elements but they are ignored. Any authoring tools or commands will error on those elements
-->

<!-- You can embed software files directly into packages, as long as you are not bound by distribution rights. -->
<!-- * If you are an organization making private packages, you probably have no issues here -->
<!-- * If you are releasing to the community feed, you need to consider distribution rights. -->
<!-- Do not remove this test for UTF-8: if “Ω” doesn’t appear as greek uppercase omega letter enclosed in quotation marks, you should use an editor that supports UTF-8, not this one. -->
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
<metadata>
<!-- == PACKAGE SPECIFIC SECTION == -->
<!-- This section is about this package, although id and version have ties back to the software -->
<!-- id is lowercase and if you want a good separator for words, use '-', not '.'. Dots are only acceptable as suffixes for certain types of packages, e.g. .install, .portable, .extension, .template -->
<!-- If the software is cross-platform, attempt to use the same id as the debian/rpm package(s) if possible. -->
<id>openrails</id>
<!-- version should MATCH as closely as possible with the underlying software -->
<!-- Is the version a prerelease of a version? https://docs.nuget.org/create/versioning#creating-prerelease-packages -->
<!-- Note that unstable versions like 0.0.1 can be considered a released version, but it's possible that one can release a 0.0.1-beta before you release a 0.0.1 version. If the version number is final, that is considered a released version and not a prerelease. -->
<version>1.5.1</version>
<!-- <packageSourceUrl>Where is this Chocolatey package located (think GitHub)? packageSourceUrl is highly recommended for the community feed</packageSourceUrl>-->
<!-- owners is a poor name for maintainers of the package. It sticks around by this name for compatibility reasons. It basically means you. -->
<!-- ============================== -->

<!-- == SOFTWARE SPECIFIC SECTION == -->
<!-- This section is about the software itself -->
<title>Open Rails</title>
<authors>Open Rails Team</authors>
<owners>artemisbeta</owners>
<!-- projectUrl is required for the community feed -->
<projectUrl>https://www.openrails.org/</projectUrl>
<packageSourceUrl>https://github.com/artemis-beta/chocolatey-openrails</packageSourceUrl>
<iconUrl>https://rawcdn.githack.com/openrails/openrails.org/835eb8585e286960f892c46701b2e8abdf1871dd/assets/logos/or_logo.png</iconUrl>
<!-- <copyright>Year Software Vendor</copyright> -->
<!-- If there is a license Url available, it is required for the community feed -->
<licenseUrl>https://github.com/openrails/openrails/blob/main/LICENSE</licenseUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<projectSourceUrl>https://github.com/openrails/openrails</projectSourceUrl>
<!--<docsUrl>At what url are the software docs located?</docsUrl>-->
<!--<mailingListUrl></mailingListUrl>-->
<bugTrackerUrl>https://github.com/openrails/openrails/issues</bugTrackerUrl>
<tags>openrails railway-simulation train-simulation</tags>
<copyright>© 2024 Open Rails</copyright>
<summary>Totally free train simulator that supports</summary>
<releaseNotes>
https://github.com/openrails/openrails/releases/tag/1.5.1
</releaseNotes>
<description><![CDATA[The world's largest range of digital content. Open Rails provides a train simulator for the largest collection of digital content in the world - routes, rolling stock and activities - initially developed for Microsoft's Train Simulator product.]]>
</description>
<!-- <releaseNotes>__REPLACE_OR_REMOVE__MarkDown_Okay</releaseNotes> -->
</metadata>
<files>
<!-- this section controls what actually gets packaged into the Chocolatey package -->
<file src="tools\**" target="tools" />
<!--Building from Linux? You may need this instead: <file src="tools/**" target="tools" />-->
</files>
</package>

1 change: 1 addition & 0 deletions tools/chocolateybeforemodify.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Stop-Process -ProcessName OpenRails.exe -ErrorAction SilentlyContinue
28 changes: 28 additions & 0 deletions tools/chocolateyinstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@

$ErrorActionPreference = 'Stop';
$checksum = "450702aac92dbfb68a2b1b4a4be5b24eea19e41c4496f7eccfc98ea19abc64b2f493d3e607c2ac5aab3754830f633ef3ab069325fe0a099cf78a012e9e6b0c65"
$repository = "openrails/openrails"
$software_name = "Open Rails"

Write-Host "Fetching version '$env:ChocolateyPackageVersion'"

$download_url = "https://github.com/$repository/releases/download/$env:ChocolateyPackageVersion/OpenRails-$env:ChocolateyPackageVersion.zip"
$toolsDir = "${env:ProgramFiles(x86)}\$software_name"

$packageArgs = @{
packageName = $env:ChocolateyPackageName
unzipLocation = $toolsDir
url = $download_url
softwareName = $software_name
checksum = $checksum
checksumType = 'sha512'
validExitCodes= @(0, 3010, 1605, 1614, 1641)
}

$exe_path = "$toolsDir\OpenRails.exe"
Install-ChocolateyZipPackage @packageArgs
Install-ChocolateyPath -PathToInstall $toolsDir -PathType "User"

Install-ChocolateyShortcut -ShortcutFilePath "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\$software_name.lnk" -TargetPath "$exe_path"

Update-SessionEnvironment
11 changes: 11 additions & 0 deletions tools/chocolateyuninstall.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
$ErrorActionPreference = 'Stop';
$software_name = "Open Rails"
$installPath = "${env:ProgramFiles(x86)}\$software_name"

Remove-Item -Recurse $installPath
Remove-Item "$env:APPDATA\Microsoft\Windows\Start Menu\Programs\$software_name.lnk"

#Remove from Path
$Environment = [System.Environment]::GetEnvironmentVariable("Path", "User")
$Environment = $Environment.Replace("$installPath", "")
[System.Environment]::SetEnvironmentVariable("Path", $Environment, "User")

0 comments on commit 5d0f261

Please sign in to comment.