Skip to content

Commit

Permalink
Fix #49 split the library and the command-line tool
Browse files Browse the repository at this point in the history
This is a breaking change. The tool has been moved to the winrm-cli
project (https://github.com/masterzen/winrm-cli).
This commit removes the tool, and moves back all the library code
to the github.com/masterzen/winrm package.

Dependent libraries or tool might need to be modified to take the new
package path into account.
  • Loading branch information
Brice Figureau committed May 23, 2016
1 parent 4cfdf8d commit 420524e
Show file tree
Hide file tree
Showing 24 changed files with 11 additions and 517 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -7,7 +7,7 @@ DEPS = $(go list -f '{{range .TestImports}}{{.}} {{end}}' ./... | fgrep -v 'winr
all: deps
@mkdir -p bin/
@printf "$(OK_COLOR)==> Building$(NO_COLOR)\n"
@go build -o $(GOPATH)/bin/winrm github.com/masterzen/winrm
@go build github.com/masterzen/winrm

deps:
@printf "$(OK_COLOR)==> Installing dependencies$(NO_COLOR)\n"
Expand Down
26 changes: 8 additions & 18 deletions README.md
@@ -1,6 +1,8 @@
# WinRM for Go

This is a Go library (and command-line executable) to execute remote commands on Windows machines through
_Note_: if you're looking for the `winrm` command-line tool, this has been splitted from this project and is available at [winrm-cli](https://github.com/masterzen/winrm-cli)

This is a Go library to execute remote commands on Windows machines through
the use of WinRM/WinRS.

_Note_: this library doesn't support domain users (it doesn't support GSSAPI nor Kerberos). It's primary target is to execute remote commands on EC2 windows machines.
Expand Down Expand Up @@ -47,23 +49,17 @@ cd winrm
make
```

This will generate a binary in the base directory called `./winrm`.

_Note_: this winrm code doesn't depend anymore on [Gokogiri](https://github.com/moovweb/gokogiri) which means it is now in pure Go.

_Note_: you need go 1.1+. Please check your installation with
_Note_: you need go 1.5+. Please check your installation with

```
go version
```

## Command-line usage

Once built, you can run remote commands like this:

```sh
./winrm -hostname remote.domain.com -username "Administrator" -password "secret" "ipconfig /all"
```
For command-line usage check the [winrm-cli project](https://github.com/masterzen/winrm-cli)

## Library Usage

Expand Down Expand Up @@ -150,26 +146,20 @@ client, err := winrm.NewClientWithParameters(..., params)
## Developing on WinRM

If you wish to work on `winrm` itself, you'll first need [Go](http://golang.org)
installed (version 1.1+ is _required_). Make sure you have Go properly installed,
installed (version 1.5+ is _required_). Make sure you have Go properly installed,
including setting up your [GOPATH](http://golang.org/doc/code.html#GOPATH).

For some additional dependencies, Go needs [Mercurial](http://mercurial.selenic.com/)
and [Bazaar](http://bazaar.canonical.com/en/) to be installed.
Winrm itself doesn't require these, but a dependency of a dependency does.

Next, clone this repository into `$GOPATH/src/github.com/masterzen/winrm` and
then just type `make`. In a few moments, you'll have a working `winrm` executable:
then just type `make`.

```
$ make
...
$ bin/winrm
...
```
You can run tests by typing `make test`.

If you make any changes to the code, run `make format` in order to automatically
format the code according to Go standards.

When new dependencies are added to winrm you can use `make updatedeps` to
get the latest and subsequently use `make` to compile and generate the `winrm` binary.
get the latest and subsequently use `make` to compile.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion winrm/fixture_test.go → fixture_test.go
Expand Up @@ -2,9 +2,9 @@ package winrm

import (
"bytes"
"io/ioutil"
"encoding/base64"
"fmt"
"io/ioutil"
"net"
"net/http"
"net/http/httptest"
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion winrm/http_test.go → http_test.go
Expand Up @@ -43,7 +43,7 @@ func (s *WinRMSuite) TestHttpRequest(c *C) {
w.Header().Set("Content-Type", "application/soap+xml")
w.Write([]byte(response))
}))
c.Assert(err, IsNil)
c.Assert(err, IsNil)
defer ts.Close()
endpoint := NewEndpoint(host, port, false, false, nil)
client, err := NewClient(endpoint, "test", "test")
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
128 changes: 0 additions & 128 deletions winrm.go

This file was deleted.

0 comments on commit 420524e

Please sign in to comment.