Code Monkey home page Code Monkey logo

sdkman-cli's Introduction

SDKMAN! Golang CLI

Build Status

This project has been downgraded to a mere spike, the learnings of which will lead to the next phase of exploration of the CLI. We are also looking at Rust as an alternative implementation solution.

The current bash implementation is still completely fit for purpose and remains in full production use.

Living Documentation

SDKMAN's development is always driven by tests. More than that, we use Cucumber to describe the behaviour of the CLI in plain English. We do so using Cucumber features, all of which can be found under the features/ folder of this repo. These Features form a body of Living Documentation that evolves with the software implementation.

The Cucumber Features are backed by Step Definitions, snippets of matched code that are invoked in order as the Cucumber Feature are

Development

Prerequisites

Ensure that Go is installed on your system.

Optionally, install Godog for running the Cucumber specifications directly:

$ go get github.com/DATA-DOG/godog/cmd/godog

Running the tests

To run all tests using Go's builtin test support (unit and cukes):

$ cd path/to/the/repo/sdk
$ go test --godog.format=pretty

If Godog was installed earlier, run the Cucumber specs directly in isolation with the following command:

$ godog

Run

To kick the tyres before building:

$ go run sdk.go version

Build

To build and run the binary executable:

$ go build
$ ./sdk

sdkman-cli's People

Contributors

aalmiray avatar akiernan avatar beckje01 avatar bes avatar busches avatar danthegoodman avatar dependabot[bot] avatar dsyer avatar dvdkruk avatar fdelporte avatar felipecrs avatar felipefzdz avatar gayanper avatar grimreaper avatar helpermethod avatar hgeraldino avatar idegtiarenko avatar marc0der avatar masatonagai avatar mikybars avatar parttimenerd avatar pbassiner avatar pledbrook avatar qudongfang avatar rgoldberg avatar rlovtangen avatar samirtalwar avatar ssiwek-dxc avatar yerinle avatar yujiorama avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdkman-cli's Issues

Handle corrupt archives due to download failure

This occurs if the network connection is interrupted or if curl fails downloading for any other reason.

Need to add a check for the zip integrity after downloading.

ZIP_OK=$(zip -T "$HOME/.gvm/archives/grails-2.0.4.zip" | grep 'OK')

If ZIP_OK is empty then, handle the condition.

Requires new dependency on zip command, so install.sh also needs to be updated.

If version is not installed when "use" is run, prompt user to install

In the following scenario after a fresh gvm install:

gvm use grails 2.1.1

...should just work, for maximum "wow" factor. i.e. without an explicit install. IMO install should not usually be needed.

I would expect "use" to prompt the user instead of complaining that 2.1.1 is not installed yet:

gvm use grails 2.1.1
Grails version 2.1.1 is not currently installed, would you like to install it now? (y, n)

That would rock

Cygwin - list command does not work after installing grails

There seems to be a path issue on Windows with Cygwin. When I call the list command,

gvm list grails

See the following errors at the end of the output:

ls: cannot access /home/IE: No such file or directory
ls: cannot access User/.gvm/grails: No such file or directory

Then, neither the installed or usable grails versions have the proper highlight next to them.

The output is as follows:

$ gvm list grails
Groovy Version Manager 0.1
GVM server 0.1 on vertx 1.2.3.final

=== BROADCAST ==========================================
This application is currently in beta. If you experience
any problems then please raise an issue on GitHub at:
https://github.com/freshgroovy/gvm/issues

Only Grails is available in this beta release. Groovy,
Griffon and Gradle coming soon!
========================================================
ls: cannot access /home/IE: No such file or directory
ls: cannot access User/.gvm/grails: No such file or directory

--------------------------------------------------------
Available Grails Versions
--------------------------------------------------------

   1.3.7
   1.3.8
   1.3.9
   2.0.0
   2.0.1
   2.0.2
   2.0.3
   2.0.4
   2.1.0
   2.1.1
--------------------------------------------------------
* - installed
> - currently in use
--------------------------------------------------------

Selfupdate dumps garbage on console.

The selfupdate command causes the script to overwrite itself with a new version. This causes bash to dump out the following to standard out.

/Users/omid/.gvm/bin/gvm: line 258: unexpected EOF while looking for matching `"'
/Users/omid/.gvm/bin/gvm: line 259: syntax error: unexpected end of file

Clean this up by writing standard out to /dev/null

Version switch affects all open terminals

This may be a question of personal preference, but it's difficult to use gvm in scenarios where you want different versions active in different terminal windows/tabs. For example, I may be working with a Grails app that's 2.1.1 and a plugin that's 2.0.4. Switching version every time I switch between terminal windows between the app and the plugin is way too awkward.

I guess this is fundamental to the way gvm works, but it's almost a blocker for my workflow. I'll try to think of some solutions.

Show broadcast message once

I'm finding it really annoying that the broadcast message is displayed every time I run a command. It's a huge amount of noise and particularly distracts from the commands that only have a line or two of output.

Can we show each broadcast message just once for a particular GVM installation?

Global install

It would be nice to have the option to share installations between all users of a machine (maybe with a user-specific symlink to the active version).

GVM_VERSION and GVM_SERVICE must be DRY

These two values are found throughout the scripts and need to be DRY. Possible solution is to serve the gvm, gvm-install.sh and install.sh as templates and replacing the values from one of the two:

  • fetch them out of the datastore
  • set them in a properties file

source .profile/.bashrc after installation

To install gvm on Ubuntu, I ran the following command:

curl -s beta.freshgroovy.org | bash 

to install gvm. This added

[[ -s "$HOME/.gvm/bin/gvm-init.sh" ]] && . "$HOME/.gvm/bin/gvm-init.sh"

to .profile. However, when I executed

gvm help

I got a "command not found" error. Once I read the updated .profile using

. .profile

everything worked fine, but ideally this should happen automatically (or at least the installation instructions should advise that this is necessary

Point at a local installation for dev purpose

As a Groovy developer, I often install development versions of Groovy locally.
It's usually the master branch of upcoming Groovy releases, etc.

It'd be nice if I could tell GVM to use my local installation as well, in addition to all the known release versions. For example:

gvm install local groovy 2.1.0-SNAPSHOT /dev/groovy/master/target/install

Or something like that. I'm sure you'll find a better command-line to use.

grails --version fails under v.1.3.9

I installed grails 2.1.1and grails 1.3.9. When I use grails 2.1.1 and execute

grails --version

It works fine, but when I switch to 1.3.9 this same command fails:

gvm@Office100:~$ grails --version
Welcome to Grails 1.3.9 - http://grails.org/
Licensed under Apache Standard License 2.0
Grails home is set to: /home/gvm/.gvm/grails/1.3.9

Base Directory: /home/gvm
Resolving dependencies...
Dependencies resolved in 1011ms.
Running pre-compiled script
Script 'Version' not found, did you mean:
   1) SetVersion
   2) GenerateController
   3) Interactive
   4) CreateFilters
   5) CreateController
Please make a selection or enter Q to quit: 

it's possible that

grails --version

also fails under "vanilla" grails 1.3.9, but I don't think so.

Tests fail if GVM_DIR not set

There are several issues here. First, running the tests produces a NullPointerException if GVM_DIR is not set. I had to look at test report to see the stack trace to identify which file was throwing the error in order to determine the ultimate cause of the error.

Second, it seems that nothing mentions that GVM_DIR needs to be set. And finally, I can't tell what it should be set to.

I'd like to contribute a simple current command to gvm with test, but I need to be able to run the tests to do that.

Add 'install' task to build

I would like to be able to make changes to my gvm source tree and then install those into the ~/.gvm directory via an install task. Useful for testing.

One thing I'm not sure about is whether to support something like revert or whether to rely on the developer switching to a working branch and doing the install again.

MacOS - Downloading from: is blank

The current output says:

Downloading: grails 1.3.7 from:

but does not show where it is being downloaded from. Should just remove the from: or actually specify a location

Support for Grails release candiates

I'm getting a failure attempting to install Grails 2.2.0.RC1. Here's the output:

  % gvm install grails 2.2.0.RC1                                                                                                         !991
zsh: correct 'grails' to '.grails' [nyae]? n
Groovy enVironment Manager 0.5
GVM server 0.5 on vertx 1.2.3.final

=== BROADCAST ==========================================
This application is currently in beta.
Report issues: https://github.com/freshgroovy/gvm/issues
--------------------------------------------------------
Latest update:
Lots of bug fixes.
Issue list, latest fixes on top: http://bit.ly/SPcnrl
========================================================

Stop! 2.2.0.RC1 is not a valid grails version.

Use real Vertx server for Cucumber tests

The Cucumber tests should verify that both the client and server are working as expected. At the moment, they're using a stub server implementation. Since I want to add a test for checking the behaviour of out-of-date versions of gvm and the implementation of that feature requires code changes on the server, we really need to be running against the server code.

I guess the issue here is the dependency on MongoDB, but I wonder whether it's possible to run the server app with a dummy mongo-persister busmod that we can initialise with duff data. Or we can have the Cuke tests require a running MongoDB instance, but that's probably a non-starter.

Switch to version used by local Grails application

gswitch has a nice feature where it selects the version to switch to based on your local Grails application. This is really nice when you have many Grails projects, as it saves you from inspecting application.properties just to type in the same version. With this feature you simply type gswitch and your done:

$ gswitch 
Local Grails Application is using version 2.0.3
Setting to version 2.0.3... done.

Would be nice to have a similar feature in gvm, like gvm use grails.
Or automatically switching to correct version when changing directory to a Grails application, like rvm has with its .rvmrc:

$ cd octopress/
Using /Users/ronny/.rvm/gems/ruby-1.9.3-p125

Other candidates could have this feature as well, if it makes sense for that particular candidate.

Initial install script complains about existing gvm grails

When I have a grails version installed from gvm, the initial install script ( curl -s beta.gvmtool.net | bash ) will complain that grails is already installed and fail to continue.

Should probably ignore grails versions within .gvm directories or detect that gvm is already installed.

Checking for previous versions of Grails...
Grails found.

======================================================================================================
 You already have Grails installed. This will cause problems with GVM.
 Grails was found at:

 /Users/tomaslin/.gvm/grails/current/bin/grails

 Please remove it from your PATH and restart.
======================================================================================================

Version warning is displayed even when doing `selfupdate`

If my gvm version is out of date I get the following message even if the command I issued was gvm selfupdate:

===============================================
Your version of GVM is out of date!
-----------------------------------------------

Current version installed : 0.7
Latest available version  : 0.8

This upgrade can be performed by:

    gvm selfupdate

===============================================

Cygwin : Can't convert empty path before each grails execution

When I use gvm to install grails, always see

$ grails help
cygpath: can't convert empty path

| Loading Grails 2.1.1
| Configuring classpath
| Downloading: C:\cygwin\home\IE User\.gvm\grails\2.1.1\lib\org.springframework.                                                                           uaa\org.springframework.uaa.client\ivy-1.0.1.RELEASE.xml
| Downloading: C:\cygwin\home\IE User\.gvm\grails\2.1.1\lib\com.google.protobuf\ 

seems that somehow it inserts and incorrect path during installation somewhere

Should probably defer the check for grails installed until user tries to install grails candidate

Currently, the bash install script checks for a grails version and fails if grails has already been installed.

However, this makes it impossible to use gvm to manage only groovy versions, for example.

The check for a grails version being installed should probably be moved to the installation of the candidate, so that an error occurs only when the user tries to use gvm to manage grails.

MacOS - getting an empty line from curl

Seeing this output:

% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
85 46.2M 85 39.6M 0 0 539k 0 0:01:27 0:01:15 0:00:12 601k

See an empty line in curl that seems to fetch nothing.

Rework 'help' text

Make the help text on gvm help a bit more verbose:
Have each command on it 's own line with a short description (also with possible command parameters)

Cygwin - does not check that you can unzip

Unzip is not installed by default in cygwin.

When trying to install a new grails version, you get

Downloading: grails 1.3.8 from:


  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 46.2M  100 46.2M    0     0   510k      0  0:01:32  0:01:32 --:--:-- 1370k

Installing: grails 1.3.8
/home/IE User/.gvm/bin/gvm: line 162: unzip: command not found
mv: cannot stat `/tmp/grails-1.3.8': No such file or directory
Done installing!

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.