Giter Club home page Giter Club logo

posh-sdkman's Introduction

posh-sdk - the POwerSHell The Software Development Kit Manager

posh-sdk is a clone of the SDK CLI. In most aspects its an 1:1 copy of the BASH based version.

For further information about the features of SDKMAN! please the documentation on the SDKMAN! Project Page.

posh-sdk consumes the REST-API of the offical SDKMAN! CLI and may therefore break if the API will be changed in future.

Please report any bugs and feature request on the GitHub Issue Tracker.

ATTENTION - Always offline and selfupdate Issue

Recently the used url for the API endpoint got drop so that the posh-sdk thinks there is always a connection issue. The newest available version uses the new API endpoint but due to the expected connection issue the update has to be done manually.

Please update the posh-sdk client using your favorite method. PsGet users also could use Update-Module posh-sdk.

Differences to the BASH version

  • different directory used as default ~.posh-sdk instead of ~.sdk -> posh-sdk is not directly able to manage the .sdk-dir of SDKMAN!
  • command extension are not supported
  • different way to configurate data-dir and auto-anwser
  • not all installable candidates are useful currently in Powershell (eg the groovyserv 0.13 package is not usable because there is no client app/script in the package)

Installation

You have multiple choices for installation of posh-sdk:

Requirements:

  • Powershell 3.0+ (included in Windows 8+/Windows Server 2012+, for Windows 7 install Windows Management Framework 3.0)

With PsGet

  1. Execute Install-Module -Name Posh-SDKMan
  2. Execute Import-Module Posh-SDKMan(best add it to your profile.ps1)
  3. Execute sdk help to get started!

Via short script (currently not working)

  1. Execute (new-object Net.WebClient).DownloadString('https://raw.githubusercontent.com/ronnypolley/posh-sdkman/main/PSSDKMan/GetPoshSDK.ps1') | iex
  2. Execute Import-Module posh-sdk(best add it to your profile.ps1)
  3. Execute sdk help to get started!

Classic way

  1. Checkout this repository to your Powershell module-directory.
  2. Execute Import-Module posh-sdk(best add it to your profile.ps1)
  3. Execute sdk help to get started!

Update

Newer versions of posh-sdk will notify you about new versions which can be installed by sdk selfupdate. If sdk version does not show a version of posh-sdk you have to update manually.

How to get a update of posh-sdk manually ?

How to update depends on how you installed posh-sdk:

With PsGet

Update-Module posh-sdk

Via short Script

(new-object Net.WebClient).DownloadString('https://raw.githubusercontent.com/ronnypolley/posh-sdkman/main/PSSDKMan/GetPoshSDK.ps1') | iex

Classic way

Go to the checkout location and pull the repository.

Usage

For a general overview of the feature please the SDKMAN! Project Page because posh-sdk is designed to work like the original BASH client.

Add Import-Module posh-sdk to your powershell profile to be able to use it after each start of Powershell. If you do not know where your profile is located, execute $Global:profile.

Configuration

By default posh-sdk put all the data (inclusive the to be installed executables) into ~/.posh_sdk. You can change the location by setting:

$Global:PSDK_DIR = <path>

n your profile BEFORE the Import-Module posh-sdk line.

Similar to the BASH client you can configure posh-sdk to automatically set new installed versions as default version. You do this by adding:

$Global:PSDK_AUTO_ANSWER = $true

in your profile.

Uninstall

If you want to remove posh-sdk you need to perform 3 steps:

  1. Remove the Import-Module posh-sdk statement from your powershell profile (The path can be found with PS> $PROFILE).
  2. Remove the posh-sdk folder from you powershell modules (Most likely posh-sdk is in the first path of PS> $env:PSModulePath).
  3. Remove the ~\posh_sdk folder in your home folder.

If you now restart your powershell instance, posh-sdk is gone.

Troubleshooting

Q: Error "File xxx cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details."

A: By default, PowerShell restricts execution of all scripts. This is all about security. To "fix" this run PowerShell as Administrator and call

Set-ExecutionPolicy RemoteSigned

Running the Pester Tests

All posh-sdk test are written for Pester. Please see its documentation: Pester

To run the tests in Powershell, load the Pester module and run in posh-sdk dir:

Invoke-Pester

posh-sdkman's People

Contributors

ronnypolley avatar dependabot[bot] avatar obourgeoispro avatar

Stargazers

Ligun avatar Gautier Levert avatar Chris Kaminski avatar  avatar FanX avatar Ralf D. Müller avatar  avatar

Watchers

James Cloos avatar  avatar

posh-sdkman's Issues

"This command is not available in offline mode" trying to install a tool without specifing a version

`sdk i sbt -Verbose

AUSFÜHRLICH: Broadcast API call to: https://api.sdkman.io/2/broadcast/latest
AUSFÜHRLICH: GET https://api.sdkman.io/2/broadcast/latest with 0-byte payload
AUSFÜHRLICH: received -1-byte response of content type text/plain
AUSFÜHRLICH: Online-Mode: True
AUSFÜHRLICH: Old broadcast message loaded
AUSFÜHRLICH: Available candidates: activemq ant asciidoctorj ballerina bpipe btrace
concurnas connor cuba cxf doctoolchain flink gaiden gradle gradleprofiler grails groovy
groovyserv hadoop http4k infrastructor java jbake jbang jmc jmeter jreleaser karaf kotlin
kscript layrry leiningen maven micronaut mulefd mvnd pomchecker quarkus sbt scala spark
springboot sshoogr test tomcat vertx visualvm webtau znai
AUSFÜHRLICH: Command: i
AUSFÜHRLICH: Perform Install-Candidate-Version
AUSFÜHRLICH: No version provided. Fallback to default version!
AUSFÜHRLICH: Try to get default version from remote
AUSFÜHRLICH: GET https://api.sdkman.io/2/candidates/sbt/default with 0-byte payload
WARNUNG: This command is not available in offline mode.`

gvm install grails results in an exception (flofreud/posh-gvm/issues/27)

flofreud#27

Hi,
your posh-gvm module to install grails is not working, tried now on 2 machines both Windows 10
Power shell version 5

same command to install groovy works fine
gvm install groovy works fine
Exception

PS C:\Users\Daniel\Documents\WindowsPowerShell\Modules> gvm install grails

Downloading: grails 3.3.3

Exception calling "GetResponse" with "0" argument(s): "The request was aborted: Could not create SSL/TLS secure
channel."
At C:\Users\Daniel\Documents\WindowsPowerShell\Modules\posh-gvm\Utils.ps1:468 char:5

    $response = $request.GetResponse()

    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

        CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
        FullyQualifiedErrorId : WebException
PS C:\Users\Daniel\Documents\WindowsPowerShell\Modules> $PSVersionTable.PSVersion

Major Minor Build Revision

5 1 16299 251

Command `gvm flush candidate` totally breaks application (flofreud/posh-gvm/issues/22)

Copy of flofreud#22

gvm flush candidate removes file candidates.txt from .meta folder.

After that any other command returns error:

    in Utils.ps1:341 char:9

            throw 'Can not retrieve list of candidates'

            ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

            CategoryInfo : OperationStopped: (Can not retrieve list of candidates:String) [], RuntimeException
            FullyQualifiedErrorId : Can not retrieve list of candidates

Problem with unzip

I had some problems installing tools. I always got

WARNING: Could not unzip the archive of doctoolchain 2.0.1. Please delete archive from C:\Users\ralfd.posh_sdk.meta\archives (or delete all with 'sdk flush archives'

I debugged it a bit and noticed that it wasn't a problem with the archives folder but with the temp folder.
I already contained an item and this the number of items in this folder after unzipping was !=1

https://github.com/ronnypolley/posh-sdkman/blob/develop/PSSDKMan/Utils.ps1#L432

I wonder if it would make sense to clean up the temp folder before we execute the install command?

Add a GUID to module description

For the deployment to https://www.powershellgallery.com we need to a GUID to the module description.

Publish-PSArtifactUtility : Failed to publish module 'PSSDKMan': 'nuget.exe failed to push Der Antwortstatuscode gibt
keinen Erfolg an: 500 (There were errors extracting PowerShell metadata: The module manifest file (.psd1) is missing
required fields: GUID. Update your manifest with the required fields and try publishing again.).
'.
In C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\2.2.5\PSModule.psm1:10990 Zeichen:17
+ ...             Publish-PSArtifactUtility @PublishPSArtifactUtility_Param ...
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (:) [Write-Error], WriteErrorException
    + FullyQualifiedErrorId : FailedToPublishTheModule,Publish-PSArtifactUtility

Update gh-pages

They currently consist only of the given template and should include the usage and some images of the project

rename it to sdk

The functions can only be called from within powershell so a special name is not needed.

psdk -> sdk

Variables will still have the prefix P or POSH to distinguish them from variables used for SDKMAN (urls, version, ...)

posh-gvm install error (flofreud/posh-gvm/issues/29)

flofreud#29

When i installed posh-gvm, i got following info:

(new-object Net.WebClient).DownloadString('https://raw.githubusercontent.com/flofreud/posh-gvm/master/GetPoshGvm.ps1') | iex
Downloading posh-gvm from https://github.com/flofreud/posh-gvm/archive/master.zip
posh-gvm installed!
Please see https://github.com/flofreud/posh-gvm#usage for details to get started.
WARN: Execute 'Import-Module posh-gvm -Force' so changes take effect!

Then i execute 'Import-Module posh-gvm -Force',

Test-Path : Illegal character in the path
+         if ( !( Test-Path "$Global:PGVM_DIR\$candidate" ) ) {
+                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidArgument: (C:\Users\John\.p...ransitional\ EN":String) [Test-Path],ArgumentException
+ FullyQualifiedErrorId : ItemExistsArgumentError,Microsoft.PowerShell.Com 
   mands.TestPathCommand

I did a lot search, but got nothing useful.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.