3411 Commits

Author SHA1 Message Date
Juan Cruz Viotti
3a42331875 fix(GUI): incorrect function call in FlashController (#1606)
This commit fixes a subtle issue where we are calling a non-existing
function of an error object, instead of using the exception reporter
module.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-18 11:47:26 -03:00
Juan Cruz Viotti
37b7ea3b0a refactor(image-stream): extract part of utils.js into mime.js (#1594)
This is a small refactoring commit that extracts the MIME related
function from utils.js into a new file called mime.js, and stores the
default image MIME type there as a constant, to avoid duplicating it in
multiple parts of the code.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-14 19:59:33 -04:00
Juan Cruz Viotti
a772877ae1 test(image-stream): move extraction timeout to a shared constant (#1599)
The image stream tests that extract images all have a 20s timeout, which
is manually set in all the suites related to extraction.

This commit extracts that number as a constant called DEFAULT_TIMEOUT.

See: https://github.com/resin-io/etcher/pull/1595
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-14 19:59:25 -04:00
Juan Cruz Viotti
76b6bdfd06 chore: cache ~/.pkg-cache in Travis CI and Appveyor CI (#1598)
Looks like pkg downloads node binaries from GitHub Releases, and GitHub
may impose a rate limiting if we download too many things from them in a
short period of time (likely to happen when there are many concurrent
PRs).

In order to mitigate this issue, this commit adds `$HOME/.pkg-cache`,
the directory where pkg stores node binaries, to the CI services cache.

See: https://github.com/resin-io/etcher/pull/1594
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-14 11:48:45 -04:00
Juan Cruz Viotti
2a8e91190c test(image-stream): increase DMG tests timeouts (#1595)
I caught an sporadic issue a couple of times, where the DMG tests would
exceed the default 2000ms mocha timeout. All the other image
decompression tests have a much higher timeout already, so this commit
adds the same timeout to the DMG tests file.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-13 17:41:44 -04:00
Juan Cruz Viotti
be8a638fce chore: pass --quiet to pip install (#1592)
This helps reduce a bit of output in the CI servers.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-13 16:15:03 -04:00
Juan Cruz Viotti
3e2da6a386 chore: cache electron-builder temporary files in macOS (#1591)
Our current Travis CI configuration caches temporary files created by
electron-builder, but only for GNU/Linux builds. In macOS, electron and
electron-builder store their cache at ~/Library/Caches, so we must cache
that as well.

This commit was motivated by the fact that most macOS builds are failing
for Electron package download timeouts.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-13 11:37:26 -04:00
Juan Cruz Viotti
ff547035be chore: only ignore top level directories in gitignore for some cases (#1588)
We accidentally added build/ to gitignore, causing any new files from
`scripts/build` to be ignored.

See: https://github.com/resin-io/etcher/pull/1547#discussion_r126790010
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-13 10:23:22 -04:00
Juan Cruz Viotti
ca9136d1cb chore: send analytics about package types (#1570)
This commit adds a `packageType` property to package.json, which is set
according to the package type of the Etcher target (e.g: dmg, nsis, deb,
etc).

This information is then sent to Mixpanel as the `packageType` property
of the "Application start" event.

Change-Type: patch
Changelog-Entry: Send anonymous analytics about package types.
Fixes: https://github.com/resin-io/etcher/issues/1328
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-13 10:13:56 -04:00
Juan Cruz Viotti
439be1c222 refactor(image-stream): rename file variable to imagePath (#1589)
This is a small initial step towards decoupling the image stream
handlers from the concept of a "file."

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-13 09:30:28 -04:00
Juan Cruz Viotti
77c60b91c6 upgrade: drivelist to v5.0.25 (#1574)
This version contains various improvements on the drive detection system
mainly on Windows. The improvements can be summarized as follows:

- Drivelist no longer spawns a .bat script to perform its job. This
  means that a lot of spawning related issues are now fixed

- Drivelist doesn't fetch drive sizes from WMI anymore, which was known
  to incorrectly report a very small size for certain drives, causing
  the famous "0.0 GB" Windows issues (see
  https://github.com/resin-io-modules/drivelist/issues/142)

- Cleanup temporary scripts after execution

This PR also sets the DRIVELIST_DEBUG environment variable to enable
debug information from Windows' drivelist implementation.

Change-Type: patch
Changelog-Entry: Implement Windows drive detection using C++
Changelog-Entry: Fix various Windows `.bat` spawning issues
Changelog-Entry: Fix 0.0 GB Windows drive detection issues
Changelog-Entry: Cleanup drive detection temporary scripts created for other operating systems
Fixes: https://github.com/resin-io/etcher/issues/1108
Fixes: https://github.com/resin-io/etcher/issues/1054
Fixes: https://github.com/resin-io/etcher/issues/995
Fixes: https://github.com/resin-io/etcher/issues/1483
Fixes: https://github.com/resin-io/etcher/issues/1142
Fixes: https://github.com/resin-io/etcher/issues/1571
See: https://github.com/resin-io-modules/drivelist/blob/master/CHANGELOG.md
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-12 15:18:05 -04:00
Juan Cruz Viotti
a5b1a92920 chore: add eslint-jsdoc-plugin to eslint (#1585)
This plugin helps us detect some things the built-in jsdoc rules can't,
like whether there is an example or not.

As expected, the addition of this plugin helped detect some minor JSDoc
issues.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-12 10:19:08 -04:00
Jonas Hermsmeier
58fa59e06d upgrade(package): Update udif 0.9.0 -> 0.10.0 (#1586)
This updates `udif` from 0.9.0 to 0.10.0, fixing two bugs;

* [57ddf788] fix(readstream): Avoid read-before-open situations
* [6333a183] fix(image): try/catch parsing the resource fork plist

[57ddf788]: 57ddf788b7
[6333a183]: 6333a183f6

Change-Type: patch
2017-07-12 10:21:38 +02:00
Benedict Aas
fc6c5bf585 refactor(GUI): deangular os-dialog and error module (#1546)
We remove the Angular dependency from `lib/gui/os/dialog` and
`lib/gui/modules/error` which is also now renamed to
`lib/gui/modules/exception`.

Changelog-Entry: Deangular the os-dialog and error modules
2017-07-11 17:21:48 -04:00
Juan Cruz Viotti
e52ef501bb chore: avoid brew taking a long time on macOS Travis builds (#1583)
- Homebrew now auto-updates before performing any installation, which
  can take quite some time. We can disable this by enabling
  HOMEBREW_NO_AUTO_UPDATE

- We can pass the --force-bottle option to `brew install` to force it to
  download pre-compiled binaries, and don't attempt any compilations

See: https://github.com/resin-io/etcher/pull/1582
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-11 17:12:44 -04:00
Juan Cruz Viotti
6ffba92dc8 chore: make use of pkg to package the Etcher CLI (#1547)
This commit replaces our home-grown CLI packaging mechanism based on
browserify + node-static-entry-point with pkg, an open source tool to
package Node.js applications for distribution.

Some highlights:

- Removing browserify got rid of a lot of dependencies from
  npm-shrinkwrap.json

- pkg currently has an issue where macOS binaries can't be code-signed
  (https://github.com/zeit/pkg/issues/128), therefore this commit
  comments-out the binary signing section for that operating system

- pkg currently has an issue where Windows binaries can't be branded
  (https://github.com/zeit/pkg/issues/149), therefore this commit
  comments-out the branding section for that operating system

See: https://github.com/zeit/pkg
Fixes: https://github.com/resin-io/etcher/issues/1531
Fixes: https://github.com/resin-io/etcher/issues/1450
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-11 14:37:14 -04:00
Juan Cruz Viotti
3ade1ea59b chore: don't install NSIS in Appveyor CI (#1584)
This dependency comes bundled with electron-builder, so there is no
reason to install it separately.

See: https://github.com/resin-io/etcher/pull/1582
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-11 14:14:15 -04:00
Juan Cruz Viotti
427a791de5 refactor(GUI): remove flash of white electron webContents workaround (#1575)
The lib/gui/etcher.js file contained a workaround to an Electron issue
that have since then been solved. In summary:

- Replace the `did-finish-load` event of `webContents` with
  `ready-to-show`, which is only emitted when the whole webview has
  finished loading

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-11 11:56:05 -04:00
Juan Cruz Viotti
dbe6ea68d5 chore: cache as most as possible from electron-builder (#1582)
These directories contain files downloaded by electron-builder (like
electron itself), that we can cache in Travis CI and Appveyor CI to
speed up builds.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-11 11:46:57 -04:00
Juan Cruz Viotti
b6c6eb4dfa chore(appveyor): make node_modules cache depend on npm-shrinkwrap.json (#1580)
We've been hitting some weird npm-shrinkwrap.json issues in our
shrinkwrap staged sanity checks, where Appveyor would complain that the
shrinkwrap is not up to date, while that wasn't the case either locally
or in Travis CI.

The issue is related to caching. If a commit changes a `from` entry of a
npm-shrinkwrap.json dependency, but the CI servers kept the cached
node_modules, then there will be a discrepancy between the `_from` field
from the `package.json` of a dependency in `node_modules` and what the
npm-shrinkwrap.json says. npm will obey `node_modules` over
`npm-shrinkwrap`, causing the invalid diff.

The fix is to make the Appveyor node_modules cached directory dependent
on any change to the npm-shrinkwrap.json file.

Change-Type: patch
See: https://github.com/resin-io/etcher/pull/1547
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-10 15:07:09 -04:00
Juan Cruz Viotti
fdceaadec5 refactor(GUI): move redux store to lib/shared (#1576)
After https://github.com/resin-io/etcher/pull/1569, the redux store can
run outside of a browser context. This commit moves it to `lib/shared`,
where we will likely move all the other models as well. As an extra, I
renamed `Store` to `store`, since there was no reason for that variable
to be capitalized.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-07 18:47:39 -04:00
Juan Cruz Viotti
4dc56f4678 refactor(GUI): decouple localStorage from the redux store (#1569)
We're currently persisting the user settings in localSettings by using a
redux plugin called redux-localstorage. As a way to decouple the redux
store from a technology that is browser specific, this commit makes the
following changes:

- Create local-settings.js, which is concerned with managing settings in
  a persisting location

- Decouple the redux store from the persisting storage method

- Extend the settings model to persist settings, cache reads, etc

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-06 17:49:13 -04:00
Jonas Hermsmeier
1b79d50288 fix(gui): Fix image checks in image selections (#1573)
I must have screwed something up during a rebase,
this mends the partition table an windows image checks.

Change-Type: patch
2017-07-06 16:00:07 -04:00
Juan Cruz Viotti
1b695a49e9 upgrade: electron-builder to v19.9.1 (#1548)
- Exclude *.dll/*.exe files from the asar in non-Windows operating
  systems (from 19.8.0)

- Correctly parse boolean flags in `--extraMetadata` (in v19.9.0)

See: https://github.com/electron-userland/electron-builder/releases/tag/v19.9.1
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-06 13:51:55 -04:00
Juan Cruz Viotti
fd109b5770 fix(elevator): make use of wide characters everywhere (#1559)
Switching the Windows language to a language encoded using UTF-16 (like
Japanese) revealed that our native elevator module garbles language
specific strings, making the child writer process unable to find an
image inside a language specific directory, and thus resulting in a
"File is not accessible" error.

As a solution, we make use of `std::wstring` and wide character Windows
API functions in the elevator module.

Change-Type: patch
Changelog-Entry: Fix "file is not accessible" error when flashing an image that lives inside a directory whose name is UTF-16 encoded on Windows.
Fixes: https://github.com/resin-io/etcher/issues/1459
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-05 14:13:36 -04:00
Jonas Hermsmeier
80b588683e feat(image-stream): Read MBR & GPT in .getImageMetadata() (#1248)
* feat(image-stream): Read MBR & GPT in .getImageMetadata()
* feat(gui): Display warning when image has no MBR
* test(image-stream): Update .isSupportedImage() tests
* feat(image-stream): Normalize MBR & GPT partitions
* test(image-stream): Add partition info
* feat(image-selection): Send missing part table event
* test(image-stream): Add GPT test image

Change-Type: minor
2017-07-05 16:18:02 +02:00
Benedict Aas
b18fa1f13f feat(GUI): add webview api version parameter (#1558)
We add the API version sent to the banner via a GET search parameter,
allowing for more intricate control over what data needs or can be sent.
2017-07-04 13:11:44 -04:00
Jonas Hermsmeier
f1ddf07a45 test(image-stream): Test more compression methods (#1565)
* test(image-stream): Add more zip compression methods
* test(image-stream): Add more dmg compression methods
* test(image-stream): Add bz2 level 9 test

Change-Type: patch
2017-07-03 23:35:06 +02:00
Jonas Hermsmeier
5f5a4b61b0 chore(scripts): Silence stdout for npm install (#1567)
Change-Type: patch
2017-07-03 17:08:53 -04:00
Andrew Scheller
20ca03496f chore: fix typo in Makefile (#1562)
This is a change that should have been made in #1543
2017-07-03 16:26:10 -04:00
Juan Cruz Viotti
7af66c4911 chore:(windows): make use of NSIS one-click installers (#1560)
One-click installers are a "modern" version of usual wizard installers,
and somewhat resemble the Squirrel.Windows installers you can see in
apps like Atom.

As the name implies, the user needs to agree the license, and that's
all, the remaining installer is non-interactive, leading to a very
smooth user experience.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-03 16:25:48 -04:00
Juan Cruz Viotti
2e3a2f045e chore: pipe stdout from npm ls to /dev/null (#1566)
As part of our CI sanity checks, we run `npm ls`, to ensure we don't
have any extraneous dependencies (the command fails if so), however by
its own definition, `npm ls` prints the whole dependency tree, which
spams the builds.

This commit redirects stdout to /dev/null, which contains the dependency
tree, but still prints and extraneous dependency warning, which is
printed to stderr instead.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-03 13:14:22 -04:00
Juan Cruz Viotti
c2563c2f87 chore(npm): move retry options to INSTALL_OPTS (#1564)
See: https://github.com/resin-io/etcher/pull/1550/files#r125015773
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-03 11:48:07 -04:00
Juan Cruz Viotti
53d8118b8f chore: don't remove optional dependencies in clean-shrinkwrap.js (#1551)
If we include a platform specific optional dependency in the shrinkwrap
file, then npm will insist in installing it even if the platform doesn't
match. As a solution, we figured out we can avoid putting this platform
specific optional dependencies in the npm-shrinkwrap.json file.

In order to do this, we currently have a script called
`clean-shrinkwrap.js` that runs *before* any `npm shrinkwrap` file (its
a `preshrinkwrap` npm script) that deletes all the platform specific
modules we know about using `npm rm`.

The problem with this approach is that `npm rm` will remove the module's
code from `node_modules`, which means that if we run `npm shrinkwrap`,
we will lose certain optional dependencies, that may be needed at a
later stage.

The solution is to modify the `clean-shrinkwrap.js` script to parse
`npm-shrinkwrap.json`, and manually delete the entries that we want to
omit. Also, the script needs to be run *after* `npm shrinkwrap`, so we
change the npm script name to `postshrinkwrap`.

Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-07-03 10:30:04 -04:00
Jonas Hermsmeier
9bd987f7f3 chore(package): Disable node_modules caching on Travis CI (#1561)
This disabled caching of the `node_modules` directory again,
as this is causing failures on Travis CI while building the installers.

Change-Type: patch
2017-06-30 09:54:25 -04:00
Jonas Hermsmeier
a370e9d4cb feat(gui): Show friendlier error dialog when opening images (#1557)
* feat(gui): Friendly error dialog when opening image fails

This displays a friendlier error dialog if opening an image fails
due any reason (like i.e. an unsupported compression method)

Change-Type: patch

* test(image-stream): Add test for unsupported compression method
* test(image-stream): Only check `error.description` when given
* test(image-stream): Add zip-deflate64.zip
2017-06-28 16:44:21 +02:00
Jonas Hermsmeier
65210e4cbc chore(ci): Enable node_modules & ccache caching (#1553)
This enables caching of `node_modules`, and `ccache` directories,
as well as installation of ccache on Mac OS.

Change-Type: patch
2017-06-27 23:27:43 +02:00
Jonas Hermsmeier
2008c50ebf chore(scripts): Make npm output less verbose (#1554)
This adds the `--silent` flag to several npm commands,
ideally making the output less verbose, for better overview in CI logs.

Change-Type: patch
2017-06-27 22:27:34 +02:00
Juan Cruz Viotti
3ab989cf3c chore: increase npm retries and max timeout (#1550)
CI servers fail with timeouts, or network issues quite frequently,
requiring maintainers to manually restart failed builds.

Hopefully these npm settings will help mitigating these issues.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-27 13:11:54 -04:00
Juan Cruz Viotti
d8e9cb93b7 chore: move all electron-builder configuration to electron-builder.yml (#1544)
The electron-builder configuration we're putting in package.json is
growing. To make it easier to read and edit, we'll move the whole
`build` property into a configuration file called
`electron-builder.yml`.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-27 10:15:38 -04:00
Juan Cruz Viotti
cd4cff7e43 chore: remove npm ranges from package.json (#1549)
We don't make use of npm ranges at all (every dependency and its
subdependencies are shrinkwrapped). Removing npm ranges allows us to
simplify our clean-shrinkwrap.js script to get rid of platform specific
optional dependencies, and their subdependencies.

See: https://github.com/resin-io/etcher/pull/1514
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-26 18:49:51 -04:00
Juan Cruz Viotti
9b735778c2 chore: use various electron-builder defaults (#1543)
Now that all GUI builds are done through electron-builder, we'll
simplify our Makefile by adopting certain electron-builder defaults:

- Output final packages in `dist/`
- Adopt electron-builder code-signing environment variables

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-24 15:54:55 -04:00
Juan Cruz Viotti
a7ac28b717 chore: make use of electron-builder to build GNU/Linux packages (#1520)
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-23 20:10:51 -04:00
Juan Cruz Viotti
4f87079f12 chore: make use of electron-builder for the package-electron target (#1540)
This target builds a package for the current operating system, but
doesn't create an installer out of it, which is useful for debugging
purposes.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-23 18:59:15 -04:00
Juan Cruz Viotti
840388e8c5 chore: don't extract native dependencies out of the asar (#1542)
Turns out add-ons are loaded just fine from the asar now.

See: https://github.com/electron-userland/electron-builder/issues/1723
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-23 18:57:57 -04:00
Benedict Aas
5297ddf68c feat(GUI): swap progress bar speed and time (#1537)
We swap the placement of the progress speed and time residing below the
progress bar.

Changelog-Entry: Swap speed and time below the flashing progress bar.
Closes: https://github.com/resin-io/etcher/issues/1312
2017-06-22 17:35:51 -04:00
Jonas Hermsmeier
4f4c606949 test(image-stream): Fix test image data (#1535)
This updates the base test image to be a complete, but small
disk image, as thre previous image was quite large for running tests (32MB),
and was chopped off at an arbitrary position, causing other tools to fail
on it as an input.

Change-Type: patch
2017-06-21 16:31:21 +02:00
Juan Cruz Viotti
dbc8aa159d chore(travis): remove unused afsctool macOS dependency (#1521)
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-16 17:36:00 -04:00
Juan Cruz Viotti
103a048e4d refactor(GUI): replace SET_SETTING with an atomic SET_SETTINGS action (#1515)
This commit is the first on a series of commit to incrementally
implement support for configuration files (so we avoid a huge PR like we
have at the moment).

Once of the first things we can do is replace the `SET_SETTING` redux
action with an atomic `SET_SETTINGS` action that sets all the settings
for the application at once.

The purpose of this change is that later the `SET_SETTINGS` action can
be modified to stringify all the settings and store them in a
configuration file, without having to deal with merges, conflicts, etc
(since the client application if forced to resolve those problems before
calling the `SET_SETTINGS` action.)

The behaviour of the code remains almost the same, with the exception
that the user can now set settings that we don't know about, so the user
can switch between Etcher versions without getting weird errors if one
of the configuration keys he has doesn't exist in the other version.

See: https://github.com/resin-io/etcher/pull/1382
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-15 12:57:15 -04:00
Juan Cruz Viotti
a8f6275763 chore: generate single-binary portable installers on Windows (#1518)
We currently support portable builds that are basically ZIPs containing
the main Etcher executable and all its related libraries.

Turns out `electron-builder` supports NSIS-based portable builds that
can create a single executable that has everything it needs to run,
including any external assets.

This commit makes use of this new portable Windows installer
functionality, replacing the old ZIP approach.

Change-Type: patch
Changelog-Entry: Generate single-binary portable installers on Windows.
Signed-off-by: Juan Cruz Viotti <jv@jviotti.com>
2017-06-15 12:10:22 -04:00