particle-cli-wrapper

command module
v1.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 14, 2021 License: Apache-2.0, MIT Imports: 26 Imported by: 0

README

Particle CLI Wrapper & Installer

This tools is a wrapper around the Particle CLI that manages the version of Node.js used and auto-updates the Javascript modules.

Install through the Particle website

If you already have the CLI installed, uninstall it with npm uninstall -g particle-cli

Overview

The Particle CLI Wrapper is a delicacy consisting of a light Go shell filled with a sweet creamy Node.js core.

The Go shell manages its own Node.js installation. It is able to update itself, Node and Node modules. It forwards commands to the main Node.js CLI module. Since it is compiled natively for each platform it is easy to install.

The Node.js core is today's production Particle CLI. It performs all interactions with the Particle cloud.

Architecture

The version of Node.js to be installed to run the CLI is selected in set-node-version. When this script is run, the installation files for Node.js and npm for Mac OSX, Windows and Linux are downloaded from <nodejs.org> then uploaded to <binaries.particle.io>

The CLI wrapper is compiled for Mac OSX, Windows and Linux with rake build and uploaded to <binaries.particle.io> with rake release

A manifest file is also uploaded at https://binaries.particle.io/cli/master/manifest.json with the latest version of the CLI wrapper for each platform and the Node.js version that should be installed.

When the CLI wrapper is run, it will download the manifest file. It will check if there's a new version of itself and download it. If the managed version of Node.js is missing or there is a new one, it will download and install Node.js. If the main Node.js module particle-cli is missing or there's a new version on npm, it will download and install it.

The managed version of Node.js, the modules and the CLI wrapper executable are stored in ~/.particle or C:\Users\name\AppData\Local\particle

Installer

See the installer directory for the source code of the Mac OSX, Windows and Linux installers that downloads the latest CLI wrapper and runs it once to make Node.js install.

See the Mac and Linux installer README and Windows installer README for more details.

Development

  • Install godep go get github.com/tools/godep
  • Clone repo into your Go workspace. For example, ~/go/src/github.com/particle/particle-cli-wrapper
  • cd to that folder
  • Install dependencies godep get
  • Build executable go build
  • Run ./particle-cli-wrapper

Releasing

See RELEASE.md

Validations

Before releasing a new version to particle-cli-wrapper, perform these validation steps:

  • Update the beta branch to the git commit to test
  • Run the steps in RELEASE.md to publish a beta release

On Windows, Linux and macOS, run the following tests:

  • Download the new particle-cli-wrapper
  • Take a backup of the Node runtime node-v* and node_modules in ~/.particle or C:\Users\<username>\AppData\Local\particle
  • On a machine that ran the previous version of particle-cli-wrapper more than 4 hours ago (this is determined by the modification time of the autoupdate file), run the new particle-cli-wrapper. Expect the update to run in the background (confirm with ps or Task Manager). After the update is finished, particle serial list should work.
  • Restore the copy of node-v* and node_modules. Run the old particle-cli-wrapper. Run the new particle-cli-wrapper. Expect a fast output since no update should happen immediately. particle serial list should work.
  • Delete node-v* and node_modules to simulate a fresh install. Run the new particle-cli-wrapper. Expect a long wait. After the install, particle serial list should work.
  • Restore the copy of node-v* and node_modules. Run the old particle-cli-wrapper. Run particle update-cli with the new particle-cli-wrapper. After the update, particle serial list should work.

Note: the behavior of particle serial list is to show the Particle devices connected to the USB port. Even when no device is connected, the message should be No devices available via serial.

Updating version of Node

  • Update the version of Node and npm in set-node-version
  • Run PARTICLE_CLI_RELEASE_ACCESS=<aws-token> PARTICLE_CLI_RELEASE_SECRET=<aws-secret> ./set-node-version (this will upload Node tarballs to binaries.particle.io for later retrieval by the CLI wrapper)
  • Test upgrade to new version with extra verbose logging go build && GODE_DEBUG=verbose PARTICLE_DEBUG=1 ./particle-cli-wrapper update-cli
  • Follow instructions in RELEASE.md to cut a beta release

License

Copyright 2016 © Particle Industries, Inc. Licensed under the Apache 2 license.

Based on the Heroku CLI

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
Godeps
_workspace/src/github.com/jtolds/gls
Package gls implements goroutine-local storage.
Package gls implements goroutine-local storage.
_workspace/src/github.com/kardianos/osext
Extensions to the standard "os" package.
Extensions to the standard "os" package.
_workspace/src/github.com/smartystreets/assertions
Package assertions contains the implementations for all assertions which are referenced in goconvey's `convey` package (github.com/smartystreets/goconvey/convey) for use with the So(...) method.
Package assertions contains the implementations for all assertions which are referenced in goconvey's `convey` package (github.com/smartystreets/goconvey/convey) for use with the So(...) method.
_workspace/src/github.com/smartystreets/assertions/internal/oglematchers
Package oglematchers provides a set of matchers useful in a testing or mocking framework.
Package oglematchers provides a set of matchers useful in a testing or mocking framework.
_workspace/src/github.com/smartystreets/assertions/internal/oglemock/createmock
createmock is used to generate source code for mock versions of interfaces from installed packages.
createmock is used to generate source code for mock versions of interfaces from installed packages.
_workspace/src/github.com/smartystreets/assertions/internal/oglemock/generate
Package generate implements code generation for mock classes.
Package generate implements code generation for mock classes.
_workspace/src/github.com/smartystreets/assertions/internal/oglemock/generate/test_cases/complicated_pkg
Package complicated_pkg contains an interface with lots of interesting cases, for use in integration testing.
Package complicated_pkg contains an interface with lots of interesting cases, for use in integration testing.
_workspace/src/github.com/smartystreets/assertions/internal/oglemock/generate/test_cases/renamed_pkg
A package that calls itself something different than its package path would have you believe.
A package that calls itself something different than its package path would have you believe.
_workspace/src/github.com/smartystreets/assertions/internal/ogletest
Package ogletest provides a framework for writing expressive unit tests.
Package ogletest provides a framework for writing expressive unit tests.
_workspace/src/github.com/smartystreets/assertions/should
package should is simply a rewording of the assertion functions in the assertions package.
package should is simply a rewording of the assertion functions in the assertions package.
_workspace/src/github.com/smartystreets/goconvey/convey
Package convey contains all of the public-facing entry points to this project.
Package convey contains all of the public-facing entry points to this project.
_workspace/src/github.com/smartystreets/goconvey/convey/gotest
Package gotest contains internal functionality.
Package gotest contains internal functionality.
_workspace/src/github.com/smartystreets/goconvey/convey/reporting
Package reporting contains internal functionality related to console reporting and output.
Package reporting contains internal functionality related to console reporting and output.
_workspace/src/github.com/toqueteos/webbrowser
Package webbrowser provides a simple API for opening web pages on your default browser.
Package webbrowser provides a simple API for opening web pages on your default browser.
_workspace/src/golang.org/x/crypto/ssh/terminal
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
Package terminal provides support functions for dealing with terminals, as commonly found on UNIX systems.
Package gode runs a sandboxed node installation to run node code and install npm packages.
Package gode runs a sandboxed node installation to run node code and install npm packages.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL