3471 Commits

Author SHA1 Message Date
Juan Cruz Viotti
f87a690df1 fix(GUI): correctly reference the eta property in lib/gui/app.js (#1273)
See: https://github.com/resin-io/etcher/pull/1264/files#r110662965
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-10 16:57:20 -04:00
Ștefan Daniel Mihăilă
91a1c3d107 feat(GUI): use resin-corvus in AnalyticsService (#1208)
Change-Type: patch
Changelog-Entry: Start reporting errors to Sentry instead of to TrackJS.
Fixes: https://github.com/resin-io/etcher/issues/1027
2017-04-10 15:06:32 -04:00
Mico Piira
1d14f8ad08 docs(README): fix waffle.io badge (#1271) 2017-04-10 14:39:46 -04:00
Juan Cruz Viotti
1b68e9394b style(shared): fix given that is -> given that it typo (#1272)
See: https://github.com/resin-io/etcher/pull/1262#discussion_r110541438
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-10 14:36:01 -04:00
Benedict Aas
b28c345ba0 refactor(GUI): remove Angular from FlashStateModel and rename (#1264)
We remove the usage of Angular from 'FlashStateModel' and its usage
throughout the project comes under the new 'flashState' moniker.


Depends: https://github.com/resin-io/etcher/pull/1261
2017-04-10 14:30:21 -04:00
Andrew Scheller
07dad2a0ef chore: fix a CI script to 'properly fail' on Windows (#1270) 2017-04-10 10:06:32 -04:00
Benedict Aas
19dd2834fb fix(GUI): replace Math object usage in progressButton directive (#1263)
We were using `Math.min` in a progressButton's template expression,
however such object is not exposed to the Angular expression context.
2017-04-10 09:59:13 -04:00
Jonas Hermsmeier
f15587807a test: Use mocha with promises instead of callbacks (#1268)
This changes the test cases to just return the Promises,
to avoid timing out on failures and to provide better
error messages and stack traces.

Change-Type: patch
2017-04-09 21:30:58 +02:00
Juan Cruz Viotti
3cdd925c41 refactor: get rid of is-elevated (#1262)
This commit implements our own version of the `is-elevated` module. The
reason behind this is that `is-elevated` relies on lots of unnecessary
modules, that eventually require `spawn-sync` and `try-thread-sleep`,
which conditionally require dependencies that are not even declared in
their `package.json`, causing issues when concatenating the Etcher CLI.

See: https://github.com/resin-io/etcher/pull/1235
See: https://github.com/resin-io/etcher/pull/1228
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-08 20:15:17 -04:00
Jonas Hermsmeier
02da446914 chore(ci): limit git clone depth (#1269)
This may speed up cloning on CI services by reducing the clone depth.

Change-Type: patch
2017-04-08 20:14:46 -04:00
Andrew Scheller
810ced3907 chore: fix CI script to work when 'require'ing nested modules (#1267) 2017-04-08 20:00:43 -04:00
Jonas Hermsmeier
b3b928ae4f feat(image-stream): Support Apple Disk Images (#1257)
This adds support for flashing Apple Disk Images (.dmg)

Change-Type: minor
2017-04-07 21:34:18 +02:00
Juan Cruz Viotti
2411a7677d upgrade: mountutils to v1.0.3 (#1266)
This version contains a fix to make the module work fine on a
concatenated JavaScript file.

See: https://github.com/resin-io-modules/mountutils/pull/23
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-07 12:55:22 -04:00
Benedict Aas
ff495a45a8 refactor(GUI): remove angular from SettingsModel and rename (#1261)
We remove the usage of Angular in SettingsModel in our efforts to make
Etcher as agnostic as possible as we make our move to React.
2017-04-07 10:45:43 -04:00
Jonas Hermsmeier
07b6dd247d feat(robot): Support logging arbitrary data to the console (#1212)
This adds a new command recognition for message type "log",
to enable `console.log()`ing arbitrary data to the parent process console.

Not sure if we'd really want this in, but it's very handy for debugging,
and would keep us from writing these 3 lines every time
we want to inspect something in between those processes.

Change-Type: minor
2017-04-06 14:40:38 -04:00
Juan Cruz Viotti
4cd8776d06 chore: make the CI servers fail-fast if one of their builds fails (#1241)
This means that if any architecture build fails, then we stop the other
ones right away, for performance reasons.

See: ce51074e6f
See: https://blog.travis-ci.com/2013-11-27-fast-finishing-builds/
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-06 14:40:27 -04:00
Ștefan Daniel Mihăilă
7fe503c89a feat(GUI): add analytics image / drive info on flash done / error events (#1255)
Change-Type: patch
2017-04-06 14:39:49 -04:00
Andrew Scheller
76aa05f320 chore: Stop OSX builds on Travis frequently timing out (#1260)
See https://docs.travis-ci.com/user/common-build-problems/#Build-times-out-because-no-output-was-received
2017-04-06 17:39:47 +01:00
Juan Cruz Viotti
802d9abb1d refactor: unify image objects across GUI and image-stream (#1229)
`image-stream` returns image objects that look like this:

```js
{
  stream: <readable stream>,
  transform: <transform stream>,
  size: {
    original: <number>,
    final: {
      value: <number>,
      estimation: <boolean>
    }
  },
  ...
}
```

While the GUI handles image objects that look like this:

```sh
{
  path: <string>,
  size: <number>,
  ...
}
```

It looks like we should share a common structure between both, so we can
use `image-stream` images in `drive-constraints`, for example.

Turns out that we actually transform `image-stream` image objects to GUI
image objects when the user selects an image using the image selector
dialog, which is another indicator that we should normalise this
situation.

As a solution, this commit does the following:

- Add `path` to `image-stream` image object
- Reuse `image-stream` image objects in the GUI, given they are a
  superset of GUI image objects

See: https://github.com/resin-io/etcher/pull/1223#discussion_r108165110
Fixes: https://github.com/resin-io/etcher/issues/1232
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-06 09:41:08 -04:00
Benedict Aas
63901ccf77 fix(GUI): limit button progress and width to 100 (#1256)
We limit the progress button width by limiting the progress to a maximum
value of 100.

Change-Type: patch
Changelog-Entry: Prevent progress button percentage to exceed 100%.
2017-04-05 12:00:59 -04:00
Juan Cruz Viotti
e16234e3e8 refactor(GUI): get rid of drive-constraints Angular factory wrapper (#1250)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-04 13:44:03 -04:00
Juan Cruz Viotti
71d5fad2b0 refactor(image-stream): get rid of rindle (#1246)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-04 09:49:00 -04:00
Juan Cruz Viotti
c5a711af0f refactor(CLI): make use of mountutils to unmount drives (#1209)
`mountutils` is a native C++ NodeJS addon the Etcher team has been
working on to solve several issues we've been having with third party
unmount programs.

We'll see how this little module behaves after some real world usage.
I'm confident that it will fix the issues linked in this commit.

This commit also upgrades `npm` to 4.4.4 in Appveyor, given there is a
known building issue on Windows that is solved in a recent version.

Change-Type: minor
Changelog-Entry: Fix several unmount related issues in all platforms.
See: https://github.com/resin-io-modules/mountutils
Fixes: https://github.com/resin-io/etcher/issues/1177
Fixes: https://github.com/resin-io/etcher/issues/985
Fixes: https://github.com/resin-io/etcher/issues/750
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-02 21:34:05 -04:00
Juan Cruz Viotti
997133c979 refactor(GUI): get rid of basename Angular filter (#1252)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-01 14:52:06 -04:00
Juan Cruz Viotti
4a3a123f42 refactor(image-stream): get rid of read-chunk (#1243)
We also took the opportunity to make `utils.getArchiveMimeType()`
asynchronous.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-01 14:47:14 -04:00
Jonas Hermsmeier
d5ec71c5da chore(package): Make clean-shrinkwrap remove optional dependencies (#1236)
Previously dependencies weren't actually removed from `node_modules`,
this runs `npm rm` on the optional dependencies, effectively excluding
them, and their dependencies from the shrinkwrap file.

Also the script has been hooked to the `preshrinkwrap` hook,
to remove the need of having to run it manually.

Change-Type: patch
2017-03-31 14:35:50 -04:00
Juan Cruz Viotti
8fff29224d refactor(image-stream): get rid of gzip-uncompressed-size (#1247)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-31 13:38:32 -04:00
Andrew Scheller
63c7eed2a9 chore: add a require() checking script (#1237)
* chore: Add a require() checking script

This adds another sanity-check bash script to scan the Etcher source files
and check all required node modules are available.

* Workaround for jq crash on Windows
2017-03-31 11:00:59 -04:00
Juan Cruz Viotti
4f790afe49 chore: remove unused tail related modules (#1242)
We used to rely on these modules before we started passing progress
information from the writer to the GUI using IPC.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-31 10:53:31 -04:00
Juan Cruz Viotti
8a12e9cf94 refactor(image-stream): get rid of isstream (#1244)
The dependency is not yet removed from `npm-shrinkwrap.json` given that
there another one that keeps requiring it.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-31 10:53:23 -04:00
Juan Cruz Viotti
bc2512ac5e refactor(GUI): get rid of the username module (#1245)
This module contains various fallbacks in case `os.userInfo()` doesn't
exist, which does exist in Electron.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-31 10:52:21 -04:00
Juan Cruz Viotti
4f66d6713f style(CLI): improve drive not large enough message wording (#1239)
See: https://github.com/resin-io/etcher/pull/1223#discussion_r108707741
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-30 01:42:34 +01:00
Andrew Scheller
06be2e9dfb style: fix require() typo in lib/cli/writer.js 2017-03-29 18:13:31 -04:00
Juan Cruz Viotti
55dc17d9a7
Revert "chore(package.json): add dynamic dependencies as optional dependencies (#1228)"
This reverts commit 396145d62586fa5c887f87303ecfc295b9668ea4.
2017-03-29 15:09:30 -04:00
Juan Cruz Viotti
4616f4bfd9
Revert "chore: make thread-sleep and spawn-sync production dependencies (#1235)"
This reverts commit 85cac531c96c422912431b4f00870a2afe56119a.
2017-03-29 15:08:59 -04:00
Juan Cruz Viotti
85cac531c9 chore: make thread-sleep and spawn-sync production dependencies (#1235)
These are dynamic dependencies we've recently added to the list of top
level optional dependencies in order to be able to resolve them when
using browserify to package the Etcher CLI.

The issue is that `thread-sleep` is using a very old `node-pre-gyp`
version (0.6.9) that doesn't support Electron at all, thus resulting in
the following error when setting `npm_config_runtime=electron`:

```
node-pre-gyp ERR! UNCAUGHT EXCEPTION
node-pre-gyp ERR! stack Error: Unknown Runtime: 'electron'
```

This commit makes these dependencies production dependencies, so we can
tweak the `node-pre-gyp` version to make it work.

See: https://github.com/resin-io/etcher/pull/1228
See: https://github.com/mapbox/node-pre-gyp/issues/281
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-29 13:32:08 -04:00
Juan Cruz Viotti
af921a0cb3 docs(README): uninstall instructions for debian/brew (#1231)
We have inline instructions to install Etcher from package managers.
This commit extends them to quickly mention how to uninstall as well.

Fixes: https://github.com/resin-io/etcher/issues/1225
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-29 12:43:32 -04:00
Jonas Hermsmeier
4f7d160513 chore(package): remove extraneous dependencies from shrinkwrap (#1234)
Change-Type: patch
2017-03-29 11:50:06 -04:00
Juan Cruz Viotti
0e8dee0506 fix(GUI): provide a friendly message when no polkit agent is available (#1221)
`sudo-prompt`, the module we use to provide elevation for GNU/Linux,
relies on polkit to show the elevation dialog. Polkit implements a
"backend" to control privileges, but relies on different packages to
provide a GUI frontend.

If no GUI frontend can be found on the system, then `sudo-prompt` will
fail with a `No polkit authentication agent found.` In this case, we
shouldn't present a scary stack trace to the user, and we should also
not send this error to TrackJS.

As a solution, we intercept such error in
`lib/child-writer/writer-proxy.js`, and convert it into a human readable
user error using `errors.createUserError()`, which is passed to the
Etcher GUI using the "robot" mechanism.

Fixes: https://github.com/resin-io/etcher/issues/1179
Change-Type: patch
Changelog-Entry: Provide a user friendly error message when no polkit authentication agent is available on the system.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-29 11:26:34 -04:00
Benedict Aas
e7f0613d82 feat(GUI): display drive name and description in tooltip (#1233)
In the main page we show the drive description, and on hover a tooltip
shows the drive name. The tooltip behaviour is changed to show both,
un-truncated.

Closes: https://github.com/resin-io/etcher/issues/1170
Changelog-Entry: Add the un-truncated drive description to the selected drive step tooltip.
2017-03-29 09:12:45 -04:00
Juan Cruz Viotti
3c1882d2b4 chore(travis): move deploy command to a separate script (#1224)
We're passing a shell conditional to `deploy.script`, however Travis CI
seems to get confused about this in the deploy section, causing
GNU/Linux to run `make publish-aws-s3` directly on the Travis CI build
instead of in the Docker container, which causes the deployment to
eventually fail because of missing dependencies.

According to Travis CI:

> `deploy.script` must be a scalar pointing to an executable file or
> command.

See https://travis-ci.org/resin-io/etcher/jobs/214723725 for a failure
example.

We also move the Appveyor deploy script to a separate file for symmetry
purposes.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-28 14:15:52 -04:00
Juan Cruz Viotti
78a3206295 fix(CLI): prevent flashing an image that is larger than the drive (#1223)
The CLI still happily let you flash an image that doesn't fit on the
drive. This commit prevents such scenario right before flashing, but we
should still implement a smarter CLI drive detection widget for when the
user runs the CLI interactively.

Change-Type: patch
Changelog-Entry: Prevent flashing an image that is larger than the drive with the CLI.
Fixes: https://github.com/resin-io/etcher/issues/858
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-28 13:55:58 -04:00
Juan Cruz Viotti
57952f6f55 fix(CLI): don't print stack traces by default (#1206)
Currently, the Etcher CLI will print scary stack traces for every single
error (e.g: if you forgot to pass an image to the tool), given that
`errors.getDescription()` will return a stack trace if no other
description could be found.

This commit introduces an `ETCHER_CLI_DEBUG` environment variable, which
when set, it will cause the Etcher CLI to output stack traces, plus a
boolean `userFriendlyDescriptionsOnly` option to
`errors.getDescription()`, so we can control whether
`errors.getDescription()` returns things like stack traces, or
stringified error objects.

Change-Type: minor
Changelog-Entry: Don't print stack traces by default in the CLI.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-28 09:43:15 -04:00
Juan Cruz Viotti
396145d625 chore(package.json): add dynamic dependencies as optional dependencies (#1228)
In order to package the Etcher CLI, we concatenate all the code from the
`lib/cli/etcher.js` entry point using browserify.

There are some dependencies down the hierarchy that dynamically require
other dependencies, by enclosing `require()` calls in `try`/`catch`
blocks. The dynamic dependencies these modules require are not even
present in the `package.json`, and thus rightfully confuse browserify.

See https://github.com/ForbesLindesay/spawn-sync/blob/master/lib/spawn-sync.js#L10
See https://github.com/IndigoUnited/node-cross-spawn/blob/master/index.js#L32

There are two solutions to this problem:

- Make browserify stub these problematic dependencies with a blank file
  by using `--ignore`

This approach initially looks like the way to go, however it means that
every module that requires this particular dependency will receive just
a blank stub. It might be that some other dependencies rely on them, so
this approach could cause very obscure bugs later on.

- Add them to `package.json`

This is the approach taken by this commit. We add them to
`optionalDependencies` instead of `dependencies`, so we can still make
use of tools that analyse the code base for unused dependencies.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-28 09:41:53 -04:00
Juan Cruz Viotti
da85aa31aa style(CLI): improve error message when drive doesn't exist anymore (#1222)
The current message is short and unfriendly.

Fixes: https://github.com/resin-io/etcher/issues/1125
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-28 09:41:38 -04:00
Juan Cruz Viotti
63dda89035 fix(GUI): prevent blank application when sending SIGINT (#1220)
This issue only affects GNU/Linux and macOS. If the user sends SIGINT to
the application, the main process dies, but we get an orphaned blank
browser window. The problem only seems to occur when there is a
`beforeunload` window event handlers, which we use to warn the user when
quitting while flashing.

Change-Type: patch
Changelog-Entry: Prevent blank application when sending SIGINT on GNU/Linux and macOS.
Fixes: https://github.com/resin-io/etcher/issues/1028
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-28 09:39:23 -04:00
Juan Cruz Viotti
724d47fb6a doc(image-stream): document that .getFromFilePath also resolves metadata (#1217)
See: https://github.com/resin-io/etcher/pull/1211#issuecomment-288896853
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-27 09:58:55 -04:00
Juan Cruz Viotti
180802b985 fix(GUI): disallow reloading the app in macOS using Cmd+R (#1219)
Users can currently force the browser window to reload by using Cmd+R in
macOS. The `will-navigate` event handler in this same file is supposed
to protect us from this case, however it's not fired at all just in
macOS for some reason.

As a solution, we attach dummy keyboard shortcut handlers for Cmd+R,
Ctrl+R, and F5, to override the normal browser window behaviour.

The reason behind disallowing reloads is that a reload during a critical
operation such as writing, validation, elevating, unmounting, drive
scanning, etc will cause undefined behaviour, resulting in nonsense
errors that we can't solve coming to TrackJS.

See: https://github.com/electron/electron/issues/8841
Fixes: https://github.com/resin-io/etcher/issues/1210
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-26 19:29:11 -04:00
Andrew Scheller
68d50ba2f5 chore: don't bother sending any build context to Docker (#1226)
We don't actually use any build context, as we just mount the local
directory as a volume anyway. Omitting it speeds up the container
start-up time. This is an enhanced version of #1173
2017-03-26 18:19:40 -04:00
Jonas Hermsmeier
cbc9dfecf6 chore(scripts): rebuild instead of removing node_modules (#1215)
As removing the `node_modules` completely and then re-installing
is quite time consuming and SSD-thrashing, resort to pruning
and rebuilding native add-ons when switching targets.

Change-Type: patch
2017-03-24 12:56:26 -04:00