3246 Commits

Author SHA1 Message Date
Juan Cruz Viotti
735478bf52 fix(GUI): don't split robot input by new lines inside properties (#1008)
We've recently PRed a commit that handles multiple IPC messages being
triggered at the same time, confusing `JSON.parse()`. As a solution to
such problem, we are splitting the CLI output on new lines, based on the
assumption that each line represents a different object, however we
didn't consider that in the case of errors, we include an `stacktrace`
property which usually includes new line characters, causing such
information to be completely garbled and cause `JSON.parse()` once again
to get confused.

As a solution, we only split by new lines that are not surrounded by
quotes (since they represent a JSON property).

See: https://github.com/resin-io/etcher/pull/997
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-10 12:25:16 -04:00
Juan Cruz Viotti
404eeffbeb chore: compile CSS into lib/gui/css (#1002)
We currently compile CSS into `build/css`, however we plan to use
node-gyp in this project, which can't be configured to build to a
directory other than `build`, therefore, the compiled CSS must move
somewhere else.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-06 15:55:07 -04:00
Ștefan Daniel Mihăilă
050d187e6f refactor: extract SelectionStateModel stateless functions (#982)
`SelectionStateModel`'s methods `isSystemDrive` and `isDriveLocked`
don't depend on application state. They have been extracted in a different
AngularJS service: `DriveConstraintsModel`. The new service's actual
implementation is in `lib/src`, in order to be reused by the CLI.

Miscellaneous changes:

- Rename `lib/src` to `lib/shared`
- Refactor `drive-constraints` to throw when image is undefined

The default behaviour was to pretend that we're all good if the if
the image is not specified. We're not using this "feature", and
it can be dangerous if we forget to pass in the image.

- Make `isSystemDrive` return `false` if `system` property is undefined
- Use `drive-constraints` in `store.js`

Change-Type: patch
2017-01-06 12:42:11 -04:00
Juan Cruz Viotti
dc32699b65 upgrade: drivelist to v5.0.5 (#1001)
- https://github.com/resin-io-modules/drivelist/pull/129

Change-Type: patch
Changelog-Entry: Fix system drives detected as removable drives on Mac Mini.
See: https://github.com/resin-io/etcher/issues/983
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-06 12:22:08 -04:00
Juan Cruz Viotti
2dac3ac079 chore: build x64 and x86 jobs for GNU/Linux (#964)
This change makes Travis CI spawn 3 jobs:

- GNU/Linux with TARGET_ARCH=x64
- GNU/Linux with TARGET_ARCH=x86
- macOS with TARGET_ARCH=x64

We add `make info` before starting the build for convenience.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-06 11:32:53 -04:00
Juan Cruz Viotti
e641265f4d upgrade: etcher-image-write to v9.0.0 (#1000)
This version includes support for retrying up to ten times when EIO
errors are encountered during reading.

See: https://github.com/resin-io-modules/etcher-image-write/pull/70
Fixes: https://github.com/resin-io/etcher/issues/981
Change-Type: patch
Changelog-Entry: Fix sporadic "EIO: i/o error, read" errors during validation.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-06 11:31:16 -04:00
Juan Cruz Viotti
405b98d5ef fix(GUI): multiple JSON objects coming up at once from the IPC client (#997)
The GUI executes the CLI and pipes every line of output coming from
either `stdout` or `stderr` to the IPC server as "messages."

In some scenarios, the child process data handler might receive multiple
lines of output at the same time. Since the CLI outputs stringified JSON
objects each in a different line, trying to parse two JSON objects
separated by a new line causes the parser to crash.

As a solution, we split the data coming in by new lines (`\r\n` in
Windows), and emit a message for only the last one.

Fixes: https://github.com/resin-io/etcher/issues/898
Changelog-Entry: Fix "Invalid message" error caused by the IPC client emitting multiple JSON objects as a single message.
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-05 13:59:56 -04:00
Juan Cruz Viotti
e82e6bdc5c chore: don't upgrade npm to latest on Appveyor (#999)
Running `npm install -g npm` causes npm to be upgraded to v4, which
seems to have the following bug when running `npm install`:

```
npm ERR! Callback called more than once.
```

Not upgrading npm on our Appveyor builds causes npm to stay at v3, and
the problem dissapears.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-05 12:21:22 -04:00
Juan Cruz Viotti
e210a2ba0e upgrade: etcher-image-write to v8.1.5 (#998)
- https://github.com/resin-io-modules/etcher-image-write/pull/73

Fixes: https://github.com/resin-io/etcher/issues/834
Changelog-Entry: Fix "EIO: i/o error, write" error.
Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-05 11:20:19 -04:00
Benedict Aas
ec3c74d7e5 feat(gui): sort file picker extensions alphabetically (#991)
We sort the supported file extensions listed in the file picker
in alphabetical order.

See: https://github.com/resin-io/etcher/issues/984
Changelog-Entry: Sort supported extensions alphabetically in the image file-picker.
Change-Type: patch
2016-12-30 00:44:13 -04:00
Benedict Aas
de6ad80038 feat(gui): add referers to etcher.io links (#990)
We add referers to the two etcher.io links in the interface—one for the
update link, and one for the footer logo link.

Closes: https://github.com/resin-io/etcher/issues/987
2016-12-30 00:43:31 -04:00
Juan Cruz Viotti
5fb7b30584 Set theme jekyll-theme-minimal 2016-12-21 17:53:10 -04:00
Benedict Aas
d7e1fe09fc feat(gui): label system drives in drive-list widget (#978)
System drives in the drive-list widget now have a red warning label
beneath. Also new is the `isSystemDrive()` method under
`SelectionStateModel` and its unit-tests.

See: https://github.com/resin-io/etcher/issues/888
Changelog-Entry: Label system drives in the drive-list widget
2016-12-16 10:41:04 -04:00
Andrew Scheller
e8544cf315 doc: Move the asar requirement from "Windows" to "Common" (#977)
Asar is needed by all the `electron-installer-*` targets
2016-12-15 12:31:49 -04:00
Juan Cruz Viotti
99538e3120 doc: recommend make electron-develop to clean dependency tree (#974)
Because of NPM shrinkwrap, we recommend having a clean dependency tree
in `CONTRIBUTING.md` before upgrading a dependency. We currently
recommend maually wiping out `node_modules`, but since the
`electron-develop` make target already does that, is more user friendly
to recommend that instead.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-13 14:03:09 -04:00
Juan Cruz Viotti
8e7599b366 chore: implement electron-configure-package-win32.sh (#962)
This script configures an Electron package on Windows.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-13 11:04:09 -04:00
Juan Cruz Viotti
cc96a0c1fe chore: persist temporary artifacts during AppImage builds (#936)
Currently, `electron-installer-appimage.sh` deletes temporary stuff it
needs as it goes (like the AppDir, AppImageAssistant, or even the
AppImage after creating a ZIP). Since this is not very Make-friendly,
the script has been split into the following smaller scripts that
perform a single task:

- `electron-create-appimage-linux.sh`
- `electron-create-appdir.sh`

Utilising them in different Makefile rules effectively results in Make
persisting the "temporary artifacts".

See: https://github.com/resin-io/etcher/pull/913#discussion_r90801230
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-13 10:53:10 -04:00
Andrew Scheller
50b69ad06b chore: download files to a temporary filename first, then rename (#973)
This avoids the failure-mode where wget got interrupted (e.g. network error
or server timeout), which caused the download-tool.sh to stop, which caused
the current make to stop. However if you then ran make again, it would see
that the file existed (and not know that it was incomplete / corrupt) and so
not try downloading it again. This commit fixes the problem by modifying
download-tool.sh to download to a temporary filename, and only rename to the
final destination filename after the checksum has been verified.
2016-12-12 16:46:27 -04:00
Andrew Scheller
07713fe6b1 chore: remove backslash-escaping in Makefile errors & warnings (#972)
They're unnecessary, and actually cause the backslash to get printed.
2016-12-12 15:34:58 -04:00
Andrew Scheller
d42291ef9d chore: add distclean target to Makefile (#971)
This new target also deletes the `node_modules` and `bower_components`
directories, taking the project directory to a totally pristine state.
2016-12-12 15:34:47 -04:00
Juan Cruz Viotti
e6d5d9c910 chore: run tests in x64 and x86 in Appveyor (#963)
This will allow us to later publish development builds for both
architectures from Appveyor. In order to easily do so, the Makefile is
used instead of the current `./scripts/build/windows.bat`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-12 14:33:16 -04:00
Andrew Scheller
61860a79e3 chore: fix check-dependency.sh to work with arguments containing spaces (#969) 2016-12-11 19:09:57 -04:00
Andrew Scheller
c4a92d772d chore: fix error functions in Makefile (#970)
`$(error ...)` (and `$(warning ...)`) functions in a Makefile can't be indented - if they are make displays a `*** commands commence before first target. Stop.` error.
2016-12-11 18:45:26 -04:00
Juan Cruz Viotti
db379bd341 chore: use $(BUILD_OUTPUT_DIRECTORY) in PUBLISH_* accumulators (#965)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-11 18:43:00 -04:00
Juan Cruz Viotti
5e987f2f1e chore: fix electron-sign-app-darwin.sh reference (#967)
`electron-sign-dmg-darwin.sh` was incorrectly referring to
`scripts/build/electron-sign-app-darwin.sh` as
`scripts/darwin/electron-sign-app.sh`, causing the DMG builds to fail in
OS X.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-10 15:32:41 -04:00
Juan Cruz Viotti
47d3f0c8fa chore: create re-usable check-dependency.sh script (#959)
We have a little snippet to check if a dependency is installed on the
system that we're literally copy-pasting in every single script in the
build system script collection.

For re-usability purposes, this snippet has been extracted to a
`check-dependency.sh` that is called by every script that needs it.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-09 10:48:01 -04:00
Juan Cruz Viotti
446e457b5b chore: move directory creation responsibility to Makefile (#946)
This commit adds new rules to create directories and sets order only
pre-requisites to the existing rules as a way to centralise directory
creation, which is currently scattered around all the build scripts.

See: https://github.com/resin-io/etcher/pull/923#discussion_r90881453
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-09 10:40:15 -04:00
Juan Cruz Viotti
b0f94b58ca chore: fix small spacing issue in Makefile (#960)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-08 15:26:46 -04:00
Juan Cruz Viotti
d6fbbeff80 chore: update npm configuration in dependencies-npm.sh (#961)
- The Electron npm headers can now be downloaded from
  https://atom.io/download/electron

- We can configure gyp to build from source by using the
  `npm_config_build_from_source` environment variable rather than having
  to pass `--build-from-source`

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-08 15:26:33 -04:00
Andrew Scheller
d9148d585e chore: add publishing Makefile targets (#955)
If there are any files publishable to S3 then a `publish-aws-s3` target will
automagically exist, and similarly if there are any files publishable to
Bintray then a `publish-bintray-debian` target will automagically exist.
Like all phony targets, these get displayed by `make help` when available.
2016-12-08 13:47:42 -04:00
Juan Cruz Viotti
57b89bd77b chore: implement download-tool.sh script (#957)
This script is in charge of downloading any asset from the internet
required by the build system. It accepts a SHA256 checksum and it uses
it to ensure the downloaded file integrity.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-08 12:56:08 -04:00
Juan Cruz Viotti
88d0497982 docs: remind to add S3 links to GitHub Releases entries (#956)
We are now going to be adding links to files published in AWS S3 in
GitHub Releases, so that people used to finding pre-built versions of
the software in GitHub Releases will be re-directed to the right place,
while we still keep the analytics advantages that S3 provides us.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-08 11:57:55 -04:00
Andrew Scheller
4090fe93ad chore: speed up make startup time by using jq (#958)
By changing the `Makefile` to use `jq` instead of `node` for getting settings
from `package.json`, the time to do `make help` drops from over 1.5 seconds to
under 0.05 seconds!
2016-12-08 11:57:22 -04:00
Juan Cruz Viotti
c14257720f chore: group build scripts inside scripts/build (#940)
This makes it easier to have re-usable functionality that we can
call/source from all scripts, like logic to determine the current
operating system, or to check for a dependency in the `$PATH`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-08 11:06:35 -04:00
Andrew Scheller
316d462526 chore: add help Makefile target to show available targets (#954)
Also sets `help` as the default target, so that typing just `make` displays
the list of possible targets. Also customises the list of targets based on
TARGET_PLATFORM (because you can't build e.g. `electron-installer-dmg` when
you're on Linux).
2016-12-07 11:22:41 -04:00
Juan Cruz Viotti
b80bab4562 chore: upgrade Etcher build system to use Visual Studio 2015 (#947)
This version was not working the last time we checked, but it looks like
there were some advancements in node-gyp in the previous months, and all
dependencies have upgraded to it already.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-07 10:35:54 -04:00
Juan Cruz Viotti
ffe0d33026 chore: require MinGW to build Etcher on Windows (#948)
Using MinGW allows us to re-use the build scripts we've been developing
for GNU/Linux and OS X, which are much more robust than their `*.bat`
counterparts (due to Batch limitations).

This commit does the following changes:

- Documents MinGW as a requirement in `RUNNING-LOCALLY.md`
- It setups MinGW in Appveyor CI
- Transforms `windows/sign.bat` into `windows/electron-sign-exe.sh`
- Re-uses `dependencies-npm.sh` and `dependencies-bower.sh` in
  `build/windows.bat`

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-07 09:51:05 -04:00
Benedict Aas
cce9ce25d7 feat(gui): show available version in update notifier modal (#928)
We show the Etcher version string in the update notifier modal, by giving
the version string to the template through options similar to the warning
modal.

- We memoize the version Promise and assume the update version won't change
  during runtime.

Changelog-Entry: Show available Etcher version in the update notifier.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-06 11:33:52 -04:00
Juan Cruz Viotti
b63f967d44 chore: set msvs version on dependencies-npm.sh when running on Windows (#943)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-05 23:01:04 -04:00
Juan Cruz Viotti
f889a0862a chore: don't include *.dll files inside the asar archive (#944)
This change is needed to make `electron-create-asar.sh` output valid
asar packages on Windows (Msys).

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-05 22:56:34 -04:00
Juan Cruz Viotti
457ce16722 chore: make code-signing optional in OS X (#939)
Code-signing in OS X now relies on the presence of a
`CODE_SIGN_IDENTITY` variable. If it doesn't exist, all the builds will
gracefully complete without code-signing.

As a consequence of this change, the `electron-installer-dmg.sh` script
has been divided into `electron-create-readwrite-dmg.sh`,
`electron-create-readwrite-dmg.sh`, and `electron-sign-dmg.sh`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-05 22:21:28 -04:00
Juan Cruz Viotti
00b66a9cf7 chore: use pushd/popd instead of --prefix on dependencies-npm.sh (#941)
We currently use the `--prefix` option in `dependencies-npm.sh` to
install dependencies in another directory, however that function causes
ENOSELF to be thrown on Windows under Msys. As a solution, we take the
same `pushd`/`popd` approach as we do in `dependencies-bower.sh`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-05 21:40:50 -04:00
Juan Cruz Viotti
457c8d194f chore: fix certificate verification error with wget on MinGW (#942)
The `electron-download-package.sh` script yields the following error on
MinGW:

```
cannot verify github.com's certificate
```

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-05 21:25:41 -04:00
Juan Cruz Viotti
d8aee43f2d chore: simplify .travis.yml dependencies installation across OSes (#938)
After our recent changes, the command to install dependencies for both
OS X and GNU/Linux has been unified as `make electron-develop`, so there
is no longer a need to have multiple conditionals for each OS in
`.travis.yml`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-05 15:52:50 -04:00
Juan Cruz Viotti
bf2ff121f3 chore: symlink manifests in dependencies scripts (#935)
See: https://github.com/resin-io/etcher/pull/934#issuecomment-264862767
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-05 15:42:42 -04:00
Juan Cruz Viotti
92bc79df15 chore: move electron package caching responsibility to GNU Make (#926)
Currently, `scripts/unix/electron-download-package.sh` contains its own
logic to determine if the package was already downloaded.

This commit takes the electron package uncompressing task to the
configure scripts, and reduce `electron-download-package.sh` to a script
that simply downloads the zip to a certain location, since this change
allows us to have a separate Make rule to download the Electron zip (and
thus have Make take care of caching).

After this change, the `electron-configure-package-*.sh` scripts are no
longer routines that modify a certain directory, but scripts that take
the zip as an input and actually create the package directory, which
aligns better with Make's design.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-05 12:28:35 -04:00
Juan Cruz Viotti
dcf5a5c2f4 chore: move bower.json removal after popd in dependencies-bower.sh (#934)
The reason for this change is to make things more explicit.

See: https://github.com/resin-io/etcher/pull/923#discussion_r90571316
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-05 11:15:03 -04:00
Benedict Aas
e24c2b6466 feat(GUI): confirm before quitting etcher while writing (#868)
When Etcher is writing to a drive and the user closes the window,
currently there is no confirmation. This commit changes that and
the user has to confirm the exit.

Other changes include the warning modal taking a `rejectionLabel` option
that shows a reject button when provided.

Closes: https://github.com/resin-io/etcher/issues/744
Change-Type: minor
Changelog-Entry: Confirm before user quits while writing.
2016-12-05 10:56:38 -04:00
Benedict Aas
ae6b707bb4 feat(gui): add changelog link to update notifier (#920)
We add a blue clickable link to the Github changelog in the update dialog
modal.

Closes: https://github.com/resin-io/etcher/issues/905
Change-Type: patch
Changelog-Entry: Add a changelog link to the update notifier modal.
2016-12-05 10:55:33 -04:00
Juan Cruz Viotti
0c1f9e93ba chore: use rmdir to delete empty npm etc/ directory (#933)
NPM might create an empty `etc/` directory when calling it with the
`--prefix` option and we have a check to see if this directory indeed
exists and its empty in order to proceed and delete it.

We currently use `rm -rf` for it, even though `rmdir` is sufficient.

See: https://github.com/resin-io/etcher/pull/923#discussion_r90570968
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-05 00:16:13 -04:00