Idea has been to give better chance to make it explicit. But you're
right, it's not needed, so removed it.
https://codereview.appspot.com/11103043/diff/6001/cmd/juju/synctools.go#newcode206
cmd/juju/synctools.go:206: return nil, fmt.Errorf("specified source path
is no directory: %s", p)
On 2013/07/11 20:40:40, dimitern wrote:
> s/no/not a/, also if you're saying "specified", please pass `path`
instead of
> `p`, since that what was passed before Clean (less confusing for the
user)
It's not the same. storagePath may be /foo, the tool name
tools/bar-1.2.3.tar.gz. So the dir will be /foo/tools. But using Dir()
is good, simply used Split() too often. ;)
Please take a look.
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools. go synctools. go (right):
File cmd/juju/
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools. go#newcode50 synctools. go:50: to avoid having to access data outside of the
cmd/juju/
local cloud.
On 2013/07/11 20:40:40, dimitern wrote:
> please add an example of the two kinds of --source options: file path
and url.
Done, but only added a hint to the option to specify a source directory.
The idea of alternatively pass a HTTP location has been postponed.
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools. go#newcode61 synctools. go:61: f.StringVar( &c.source, "source", "default",
cmd/juju/
"chose a location on the file system or via http as source")
On 2013/07/11 20:40:40, dimitern wrote:
> s/"default"/""/ (see below)
Done, also changed wrong help text.
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools. go#newcode186 synctools. go:186: if sourceFlagValue == "" || sourceFlagValue
cmd/juju/
== "default" {
On 2013/07/11 20:40:40, dimitern wrote:
> "default" seems icky - how's this different from "" ? why do we need
it?
Idea has been to give better chance to make it explicit. But you're
right, it's not needed, so removed it.
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools. go#newcode206 synctools. go:206: return nil, fmt.Errorf( "specified source path
cmd/juju/
is no directory: %s", p)
On 2013/07/11 20:40:40, dimitern wrote:
> s/no/not a/, also if you're saying "specified", please pass `path`
instead of
> `p`, since that what was passed before Clean (less confusing for the
user)
Done.
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools. go#newcode226 synctools. go:226: pathlen := len(f.path) + 1
cmd/juju/
On 2013/07/11 20:40:40, dimitern wrote:
> maybe len(f.path) + len("/") is less ambiguous.
Simply added a comment. ;)
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools. go#newcode243 synctools. go:243: sort.Strings(list)
cmd/juju/
On 2013/07/11 20:40:40, dimitern wrote:
> why are you sorting it?
See interface specification: "... in alphabetical order ...".
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools. go#newcode249 synctools. go:249: return path.Join(f.path, name), nil
cmd/juju/
On 2013/07/11 20:40:40, dimitern wrote:
> in this case it should be filepath.Join, I think
Had it before, but see discussion with John.
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools_ test.go synctools_ test.go (right):
File cmd/juju/
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools_ test.go# newcode53 synctools_ test.go: 53: // Create a local tool directory.
cmd/juju/
On 2013/07/11 20:40:40, dimitern wrote:
> s/tool/tools/
Done.
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools_ test.go# newcode106 synctools_ test.go: 106: c.Assert(ctx, NotNil)
cmd/juju/
On 2013/07/11 20:40:40, dimitern wrote:
> shouldn't you be testing for specific contents of ctx instead?
See tests below, simply done it the same way. Don't know the original
intention, but this way nobody should ask why the test differs from
those below.
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools_ test.go# newcode213 synctools_ test.go: 213: dir, _ := filepath. Split(path)
cmd/juju/
On 2013/07/11 20:40:40, dimitern wrote:
> isn't dir the same as storagePath after this, use that instead? why
the split?
> why not Base or Dir?
It's not the same. storagePath may be /foo, the tool name 1.2.3.tar. gz. So the dir will be /foo/tools. But using Dir()
tools/bar-
is good, simply used Split() too often. ;)
https:/ /codereview. appspot. com/11103043/ diff/6001/ cmd/juju/ synctools_ test.go# newcode216 synctools_ test.go: 216: file, err := os.Create(path)
cmd/juju/
On 2013/07/11 20:40:40, dimitern wrote:
> why not ioutil.WriteFile instead of most of the block below?
Aaargh, good catch. I had in mind that there's a simple helper, but
somehow I missed to use it. Thanks.
https:/ /codereview. appspot. com/11103043/