-
-
Notifications
You must be signed in to change notification settings - Fork 150
[WIP] Download tools refactoring #95
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Changes from all commits
Commits
Show all changes
24 commits
Select commit
Hold shift + click to select a range
54b274f
Move utilities to a package to keep things clean
matteosuppo b6c0cbc
Move initialization of tools in package tools
matteosuppo 3785777
Move the function to download tools in a package
matteosuppo 92da217
Make the indexurl configurable
matteosuppo 57fdc3e
Fix a typo for darwin
matteosuppo a3991cf
Fix stupid typo again
matteosuppo d083191
Foxed conflicts in main
matteosuppo 22c5028
[WIP] Working download toold from json
facchinm d603c93
Add "github.com/blang/semver" to govendor
facchinm 62fa42b
adding github.com/blang/semver sources
facchinm 700a888
move TellCommandNotToSpawnShell to tools package
facchinm cbe8007
address filepath issue
facchinm 33c4356
execute post_install.bat if contained in downloaded tool
facchinm fcb34fd
modify reference package_json and call post_install
facchinm 95a9232
rework "latest" behaviour
facchinm 1acfc46
remove useless log on windows
facchinm 1d2a4b7
[WIN] solve some path-replated bugs
facchinm 2ea2c2a
handle Verbose parameters
facchinm e2b5a2a
add exclude list for extended header "files"
facchinm 2a8dfff
[STUB] add GPG check on package_index
facchinm 453530a
add time handling in tools
facchinm bfd2fb4
GPG check and avoid redownloading the json every time
facchinm 30a2a69
use https to download package_index.json
facchinm b663ce9
add golang.org/x/crypto/openpgp/armor to govendor
facchinm File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# tools | ||
-- | ||
import "github.com/arduino/arduino-create-agent/tools" | ||
|
||
|
||
## Usage | ||
|
||
#### type Tools | ||
|
||
```go | ||
type Tools struct { | ||
Directory string | ||
IndexURL string | ||
Logger log.StdLogger | ||
} | ||
``` | ||
|
||
Tools handle the tools necessary for an upload on a board. It provides a means | ||
to download a tool from the arduino servers. | ||
|
||
- *Directory* contains the location where the tools are downloaded. | ||
- *IndexURL* contains the url where the tools description is contained. | ||
- *Logger* is a StdLogger used for reporting debug and info messages | ||
- *installed* contains a map of the tools and their exact location | ||
|
||
Usage: You have to instantiate the struct by passing it the required parameters: | ||
|
||
_tools := tools.Tools{ | ||
Directory: "/home/user/.arduino-create", | ||
IndexURL: "http://downloads.arduino.cc/packages/package_index.json" | ||
Logger: log.Logger | ||
} | ||
|
||
#### func (*Tools) Download | ||
|
||
```go | ||
func (t *Tools) Download(name, version, behaviour string) error | ||
``` | ||
Download will parse the index at the indexURL for the tool to download. It will | ||
extract it in a folder in .arduino-create, and it will update the Installed map. | ||
|
||
name contains the name of the tool. version contains the version of the tool. | ||
behaviour contains the strategy to use when there is already a tool installed | ||
|
||
If version is "latest" it will always download the latest version (regardless of | ||
the value of behaviour) | ||
|
||
If version is not "latest" and behaviour is "replace", it will download the | ||
version again. If instead behaviour is "keep" it will not download the version | ||
if it already exists. | ||
|
||
#### func (*Tools) GetLocation | ||
|
||
```go | ||
func (t *Tools) GetLocation(command string) (string, error) | ||
``` | ||
GetLocation extracts the toolname from a command like | ||
|
||
#### func (*Tools) Init | ||
|
||
```go | ||
func (t *Tools) Init() | ||
``` | ||
Init creates the Installed map and populates it from a file in .arduino-create |
This file was deleted.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here