Skip to content

Commit

Permalink
Update RStudio
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronparker committed Sep 30, 2023
1 parent ab29995 commit 5658b41
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 49 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"Rfor",
"rhel",
"Rizonesoft",
"rstudio",
"RTME",
"Safing",
"sarif",
Expand Down
53 changes: 18 additions & 35 deletions Evergreen/Apps/Get-RStudio.ps1
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Function Get-RStudio {
function Get-RStudio {
<#
.SYNOPSIS
Returns the available RStudio version and download URI.
Expand All @@ -9,48 +9,31 @@ Function Get-RStudio {
Based on Get-AtlassianBitbucket.ps1
#>
[OutputType([System.Management.Automation.PSObject])]
[CmdletBinding(SupportsShouldProcess = $False)]
[CmdletBinding(SupportsShouldProcess = $false)]
param (
[Parameter(Mandatory = $False, Position = 0)]
[Parameter(Mandatory = $false, Position = 0)]
[ValidateNotNull()]
[System.Management.Automation.PSObject]
$res = (Get-FunctionResource -AppName ("$($MyInvocation.MyCommand)".Split("-"))[1])
)

# Read the update URI
foreach ($branch in $res.Get.Update.Uri.GetEnumerator()) {
$params = @{
Uri = $res.Get.Update.Uri[$branch.Key]
}
$Content = Invoke-RestMethodWrapper @params

# Read the JSON and build an array of platform, channel, version
If ($Null -ne $Content) {
# Read the download URI
$Content = Invoke-RestMethodWrapper -Uri $res.Get.Download.Uri

# Step through each installer type
foreach ($product in $res.Get.Update.Products) {
foreach ($platform in $res.Get.Update.Platforms) {
foreach ($item in $Content.$product.platforms.$platform) {
# Step through each installer type
foreach ($Product in $res.Get.Download.Products) {

# Build the output object; Output object to the pipeline
$PSObject = [PSCustomObject] @{
Version = $item.version
Sha256 = $item.sha256
Size = $item.size
Branch = $branch.Name
Channel = $item.channel
ProductName = $Content.$product.name
InstallerName = $item.name
Type = Get-FileType -File $item.link
URI = $item.link
}
Write-Output -InputObject $PSObject
}
}
}
}
else {
Write-Error -Message "$($MyInvocation.MyCommand): Unable to return usable content from: $($res.Get.Update.Uri[$branch.Key])."
# Build the output object; Output object to the pipeline
$PSObject = [PSCustomObject] @{
Version = $Content.rstudio.$Product.stable.desktop.installer.windows.version
ProductName = $Content.rstudio.$Product.stable.desktop.installer.windows.label
Pro = $Content.rstudio.$Product.stable.desktop.installer.windows.pro
Date = $Content.rstudio.$Product.stable.desktop.installer.windows.last_modified
Size = $Content.rstudio.$Product.stable.desktop.installer.windows.size
Sha256 = $Content.rstudio.$Product.stable.desktop.installer.windows.sha256
Type = Get-FileType -File $Content.rstudio.$Product.stable.desktop.installer.windows.url
URI = $Content.rstudio.$Product.stable.desktop.installer.windows.url
}
Write-Output -InputObject $PSObject
}
}
19 changes: 5 additions & 14 deletions Evergreen/Manifests/RStudio.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
{
"Name": "RStudio Desktop",
"Source": "https://www.rstudio.com/",
"Source": "https://posit.co/products/open-source/rstudio/",
"Get": {
"Update": {
"Uri": {
"Spotted Wakerobin": "https://dailies.rstudio.com/rstudio/prairie-trillium/index.json",
"Prairie Trillium": "https://dailies.rstudio.com/rstudio/prairie-trillium/index.json",
"Ghost Orchid": "https://dailies.rstudio.com/rstudio/prairie-trillium/index.json",
"Juliet Rose": "https://dailies.rstudio.com/rstudio/juliet-rose/index.json"
},
"Download": {
"Uri": "https://www.rstudio.com/wp-content/downloads.json",
"Products": [
"desktop",
"desktop-pro"
],
"Platforms": [
"windows",
"windows-xcopy"
"open_source",
"pro"
]
}
},
Expand Down

0 comments on commit 5658b41

Please sign in to comment.