3150 Commits

Author SHA1 Message Date
Benedict Aas
db8f7d0862 refactor(gui): revert drive/image selection step order swap (#1086)
We revert the drive and image selection step order swap back from drive
selection first and image second, to image first and drive second.

See: https://github.com/resin-io/etcher/pull/1049
2017-02-10 11:59:01 -04:00
Juan Cruz Viotti
f4d9c8e7c4 docs: add msys-zip as a required Windows dependency (#1080)
We need this dependency to create ZIP packages on Windows.
2017-02-09 14:30:53 -04:00
Juan Cruz Viotti
108a43512d chore: add support for Windows builds in Makefile (#1079)
This commits introduces the following Windows rules:

- `electron-installer-zip`
- `electron-installer-nsis`

Other changes:

- Remove `scripts/build/windows.bat`
- Update `docs/RUNNING-LOCALLY.md` to point to Makefile
- Update `docs/PUBLISHING.md` to point to Makefile
- Remove `7z` from `docs/RUNNING-LOCALLY.md` pre-requisites

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-09 14:30:39 -04:00
Juan Cruz Viotti
79ea4d4983 docs: clarify that a "style" commit type applies to code annotations (#1085)
See: https://github.com/resin-io/etcher/pull/1084
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-09 11:30:39 -04:00
Juan Cruz Viotti
6bdba5ffd4 style(GUI): move update notifier checkbox inside modal body (#1071)
This is a small step towards unifying all the modal skeletons that we
use through the application.

By moving the checkbox to the modal body we can declare the footer and
the header once in a single place.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-09 11:30:19 -04:00
Benedict Aas
838f3cc50d minifix: re-build css (#1088) 2017-02-09 11:29:57 -04:00
Juan Cruz Viotti
b55ff3eef8 style(GUI): use a OS dialog to show the "exit while flashing" warning (#1070)
For better OS integration purposes.

This commit also fixes a bug where the dialog would be shown for some
milliseconds even if the application is not flashing.

Change-Type: minor
Changelog-Entry: Use a OS dialog to show the "exit while flashing" warning.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-08 10:04:45 -04:00
Ștefan Daniel Mihăilă
92fdba3642 upgrade: angular to v1.6.1; angular-ui-bootstrap to v2.5.0 (#1083)
Angular 1.5 has a bug that causes angular's `$exceptionHandler`
to be called for rejected `$q` promises even if they have
a rejection handler. This bug caused duplicate error messages
in Etcher.

A consequence of upgrading to Angular 1.6 is that `$q` promises
without a rejection handler will throw `Possibly unhandled rejection`
errors. To avoid these errors, this commit moves code responsible
for opening a tooltip from the template to the controller and handles
the rejection.

Other packages upgraded:
- angular-moment to v1.0.1
- angular-ui-router to v0.4.2
- angular-mocks to v1.6.1

Change-type: patch
Changelog-Entry: Fix duplicate error messages
Fixes: https://github.com/resin-io/etcher/issues/1082
See: https://github.com/angular/angular.js/issues/7992
See: https://github.com/angular/angular.js/pull/13662
2017-02-07 19:12:32 -04:00
Ștefan Daniel Mihăilă
f4c6597b3d style(GUI): minor fixes in comments (#1084) 2017-02-07 17:31:30 -04:00
Juan Cruz Viotti
05fdd5cc29 refactor(GUI): unify modal body styles (#1073)
- Remove unnecessary `.modal-text` wrapper
- Move drive selector specific styles to `_drive-selector.scss`

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-07 16:14:15 -04:00
Juan Cruz Viotti
70c7ddc52a fix(GUI): don't auto select system drives in unsafe mode
Currently Etcher will auto-select a system drive if its the only
available one when the "unsafe mode" is enabled, which doesn't feel
right.

Change-Type: patch
Changelog-Entry: Don't auto select system drives in unsafe mode.
See: https://github.com/resin-io/etcher/pull/1061
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-07 13:34:07 -04:00
Juan Cruz Viotti
53ea89782c chore: get rid of commitizen
No one on the team is using this and the adaptor we're using proved to
be suboptimal. We might consider this again once we develop a good
Commitizen adapter integrated more closely with Versionist.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-07 13:33:52 -04:00
Shou
048aac5ac2 feat(gui): update main page design
We match the main page design to its updated style.

* Remove help icon text.
* 'Change' image/drive buttons are now violet blue.
* Remove step number icons and accompanying descriptions.
* Flash progress button now turns into a striking orange, from blue.

Changelog-Entry: Update main page design to its new style.
2017-02-07 12:21:45 -04:00
Juan Cruz Viotti
c7d4ac6518 upgrade: drivelist to v5.0.9
This version doesn't throw an error if there is `stderr` output from the
scripts but the scripts exit with code zero.

Instead, the module prints the `stderr` output to a `debug` channel, so
we enable debug information by setting a `localStorage` value in order
to see what's going on.

Fixes: https://github.com/resin-io/etcher/issues/1034
Change-Type: patch
Changelog-Entry: Ignore `stderr` output from drive detection scripts if they exit with code zero.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-06 14:53:38 -04:00
Juan Cruz Viotti
8e5840ce69 chore: integrate codespell and fix existing spelling issues
This tool scans the comments of every source file and reports back
spelling errors.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-06 14:53:20 -04:00
Juan Cruz Viotti
95d4f2f608 fix(GUI): prevent flashing the drive where the source image is located
Currently Etcher will allow you to flash an image to the same drive that
contains the image. As a way to protect against that case we introduce
the concept of a "source drive", which means a drive that contains the
source image.

This commit adds the following logic around this new concept:

- Don't auto-select a source drive
- De-select an already selected drive if an image inside it is selected
- Disable the drive in the drive selector modal
- Add a "Source Drive" badge to the drive in the drive selector modal

Fixes: https://github.com/resin-io/etcher/issues/830
Change-Type: minor
Changelog-Entry: Prevent flashing the drive where the source image is located.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-06 14:53:08 -04:00
Juan Cruz Viotti
16340b412a doc: workaround to npm shrinkwrap development dependencies bug
There are some npm versions that for some strange reason will attempt to
put *every* single development dependency in the `npm-shinkwrap.json`
file when editing the dependencies list.

This commit describes a workaround I've found to ensure only production
dependencies are added to the file.

I also renamed our `npm run shrinkwrap` script to `npm run
clean-shrinkwrap` since in some recent versions of npm, running `npm
shrinkwrap` will trigger our custom script instead of the original
implementation.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-06 14:52:40 -04:00
Juan Cruz Viotti
ea95177e94 test(GUI): fix non-running test in DrivesModel test suite (#1061)
We have a test to ensure a drive is not auto-selected when its
protected, however the real functionality of this test was not being
tested given that the size the fake drive had was not enough to hold the
image.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-30 10:03:24 -04:00
Juan Cruz Viotti
0187cb0b2d upgrade: drivelist to v5.0.8 (#1060)
Change-Type: patch
Changelog-Entry: Fix 'MySQL' is not recognised as an internal or external command error on Windows.
See: https://github.com/resin-io-modules/drivelist/issues/133
Fixes: https://github.com/resin-io/etcher/issues/1025
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-30 10:03:04 -04:00
Juan Cruz Viotti
f0020d9fcf chore: fix undefined TEMPORARY_DIRECTORY variable (#1059)
This variable was renamed to `BUILD_TEMPORARY_DIRECTORY`, but the
Makefile silently expands this to nothing and carries on with the build.

Now that the variable is expanded correctly, we must add it as an
order-only prerequisite so it gets created.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-27 18:01:56 -04:00
Juan Cruz Viotti
7c50f3e742 chore: add a package Makefile target (#1058)
This target would easily allow us to create a package for the
application without being wrapped into an installer, which is
particularly useful to provide custom builds, or test asar related
issues, for example.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-27 13:14:15 -04:00
Juan Cruz Viotti
4f621f6ae3 style(GUI): capitalize every text for consitency purposes (#1056)
Fixes: https://github.com/resin-io/etcher/issues/881
Change-Type: patch
Changelog-Entry: Capitalize every text throughout the application.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-27 11:08:49 -04:00
Juan Cruz Viotti
fd9d3ce749
Revert "refactor: remove extended archives extra functionality (#1055)"
This reverts commit b78473ea0ebd76233217fb4f236bb34be635da90.
2017-01-26 18:36:33 -04:00
Juan Cruz Viotti
b78473ea0e refactor: remove extended archives extra functionality (#1055)
We currently attempt to read extra metadata from ZIP files, such as a
logo, image name, image url, etc. In order to simplify the metadata
story, we decided that this metadata will not live on the image itself,
but rather on a centralised repo, which greatly simplified our custom
archive extraction logic and allows us to make use of these nice
features even when streaming the image directly from the internet.

We'll be working on bringing back this functionality from a centralised
repo in subsequent commits.

Change-Type: major
Changelog-Entry: Remove extended archives metadata extraction logic.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-26 15:21:01 -04:00
Juan Cruz Viotti
1bfcee06e2 refactor(image-stream): stream original/final sizes (#1050)
The `image-stream` module currently returns a readable stream, a
transform stream, a "size", and an optional "estimatedUncompressedSize".

Based on this information, its hard to say what "size" represents. Some
format handlers return the compressed size and provide a decompression
transform stream while others return the decompressed stream directly
and put the decompressed size in "size".

As a way to simplify this, every format handler now returns a "size"
object with the following properties:

- `original`: The original compressed size
- `final.estimated`: Whether the final size is an estimation or not
- `final.value`: The final uncompressed size

As a bonus, we extract the file size retrieval logic to
`imageStream.getFromFilePath()`, which is the onlt part where the
concept of a file should be referred to.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-26 12:01:53 -04:00
Benedict Aas
b25b2d1179 feat(GUI): swap drive and image selection step order (#1049)
Change the first step to be drive selection and the second step to be
image selection, instead of vice versa as it previously was.

Changelog-Entry: Swap the order of the drive and image selection steps.
2017-01-26 12:01:10 -04:00
Juan Cruz Viotti
9dd9065305 refactor(GUI): reuse WarningModalService in FlashErrorModal (#1051)
This is the first commit in a series of changes to normalise the use of
modals throughout the application.

`FlashStateModel` is basically a `WarningModalService` that cleans the
flash state, therefore making it re-use `WarningModalService` directly
removes unnecessary duplication.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-25 17:06:49 -04:00
Juan Cruz Viotti
4649bace00 style(GUI): change WarningModal title to "Attention" (#1052)
See: https://github.com/resin-io/etcher/pull/1043
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-25 17:06:16 -04:00
Juan Cruz Viotti
7165c60f0d fix(GUI): normalize button text casing (#1046)
Some button texts are all uppercase, while the remaining of them are
capitalised. This commit capitalises all button texts for consistency
purposes.

Fixes: https://github.com/resin-io/etcher/issues/881
Change-Type: patch
Changelog-Entry: Normalize button text casing.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-25 10:57:47 -04:00
Juan Cruz Viotti
0e1f50422e refactor: integrate etcher-image-stream into the etcher repository (#1040)
This is a long lasting task. The `etcher-image-stream` project takes
care of converting any kind of image input into a NodeJS readable
stream, handling things like decompression in betwee, however its a
module that, except for weird cases, there is no benefit on having
separate from the main repository.

In order to validate the assumption above, we've left the module
separate for almost a year, and no use case has emerged to keep it
like that.

This commit joins the code and tests of that module in the main
repository.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-25 10:32:37 -04:00
Juan Cruz Viotti
87a782f6ff fix(GUI): emit an analytics event on ENOSPC (#1044)
There exists a change the user will run out of space on his drive when
flashing an image format for which we can't guarantee its uncompressed
size (e.g: gzip and bzip2).

When that happens, we show a friendly error message explaining what
happened, however we should also be emitting an analytics event.

Change-Type: patch
Changelog-Entry: Emit an analytics event on `ENOSPC`.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-25 10:32:26 -04:00
Juan Cruz Viotti
2b303f51ba refactor(CLI): rename lib/cli/cli.js to lib/cli/options.js (#1045)
The path `lib/cli/cli.js` is confusing. Rename to `options.js` which is
how we were already referencing the file in `lib/cli/etcher.js`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-25 10:32:17 -04:00
Juan Cruz Viotti
e5a52c9377 fix(GUI): improve validation error message (#1047)
The current validation message is obscure and tends to lead users to
believe there is a problem with Etcher.

Fixes: https://github.com/resin-io/etcher/issues/735
Change-Type: patch
Changelog-Entry: Improve validation error message.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-25 10:32:07 -04:00
Juan Cruz Viotti
acc1f05269 refactor: move lib/shared/child-writer to lib/child-writer (#1041)
The `child-writer` module is not re-used by both the GUI and the CLI, so
it makes sense to have it in `lib/child-writer`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-24 12:06:34 -04:00
Juan Cruz Viotti
1c99b4b5fc chore: don't print Makefile comments (#1039)
We have a big comment block in the `electron-develop` target which gets
printed everytime the target gets executed.

After some research, turns out GNU Make will ignore the comments if they
are not indented.

See: http://stackoverflow.com/a/18363477/1641422
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-24 11:54:13 -04:00
Benedict Aas
4bf313c7a8 fix(gui): break and wrap bootstrap overflowing tooltip text (#1033)
Instead of letting Bootstrap tooltip text overflow, allow breaks to occur in
words.

Closes: https://github.com/resin-io/etcher/issues/1032
Changelog-Entry: Fix text overflowing on tooltips.
Change-Type: patch
2017-01-17 15:13:07 -04:00
Juan Cruz Viotti
cf1b0904e8 docs: minor edits to ARCHITECTURE.md and CLI.md (#1029)
See: https://github.com/resin-io/etcher/pull/1010
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-17 11:55:19 -04:00
Juan Cruz Viotti
5b3926cf10 v1.0.0-beta.18 v1.0.0-beta.18 2017-01-16 11:02:11 -04:00
Juan Cruz Viotti
e8c4589e1c fix(GUI): don't ignore any robot message from the CLI (#1026)
We recently sent a PR to handle multiple buffered IPC messages being
reported as a single message, confusing `JSON.parse()` in
`lib/shared/child-writer/index.js`, by only sending the last message,
and ignoring the rest, under the assumption that the loss of some state
messages is not critical for the application and the writing process to
work property.

As @lurch pointed out, however, a buffer set of messages might contain
an error object somewhere, and by ignoring all but the last message, we
ignore any error that happened in the way.

See: https://github.com/resin-io/etcher/issues/898
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-13 18:40:32 -04:00
Benedict Aas
0f2cba38d1 fix: allow undefined drives and images in DriveConstraintsModel (#1016)
Currently the `DriveConstraintsModel` errors when given an `undefined`
drive, or image; this commit changes that behaviour. Comes with tests.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-13 18:14:09 -04:00
Juan Cruz Viotti
5ec460ae1e chore: run Travis CI GNU/Linux tests in Docker containers (#1018)
This commit makes Travis CI run GNU/Linux tests inside Ubuntu 14.04
i386/x86_64 docker containers.

It includes a set of Dockerfiles with everything needed to
run/build/package Etcher while a nice `run-command.sh` script that can
be used to easily run a command on such Dockerfiles with access to the
Etcher source code.

The main motivation behind change is that generating cross-architecture
AppImages is not possible at the moment (although there are PRs on the
way), so this permits us to configure Travis CI to build and publish
AppImages for all architectures.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-13 17:37:49 -04:00
Juan Cruz Viotti
543cfea1b4 fix(GUI): expand button in modal menu if its the only one (#1023)
The `.modal-menu` class holds buttons that are shown at the bottom of
the modal. If there are two buttons, the class will show them side by
side with equal sizes, however if there is only one button, it will be
incorrectly resized to 50% of the available space.

Change-Type: patch
Changelog-Entry: Fix alignment of single call to action buttons inside modals.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-13 17:37:35 -04:00
Juan Cruz Viotti
aea4403a16 refactor: move all byte-size conversion logic to lib/shared/units.js (#1021)
This commit extracts the byte-related conversions from the `byte-size`
AngularJS module and the `FlashStateModel` to a re-usable generic
CommonJS module at `lib/shared/units.js`, than can also be used by the
CLI.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-13 16:11:28 -04:00
Juan Cruz Viotti
c552494480 refactor: extract application messages to lib/shared/messages.js (#1022)
There are certain application messages that should be re-used between
the CLI and the GUI. In order to allow such re-usability, we extract out
the application messages used in JavaScript into
`lib/shared/messages.js` as a collection of Lodash `_.template`
templates.

Notice this file doesn't include application messages included in
Angular templates directly since it'd be hard to refactor all of them.
We plan to move to React soon, which will allow moving the remaining
messages very easily.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-13 11:03:46 -04:00
Juan Cruz Viotti
2b4b1da492 upgrade: drivelist to v5.0.6 (#1020)
- https://github.com/resin-io-modules/drivelist/issues/130

Change-Type: patch
Changelog-Entry: Fix "This key is already associated with an element of this collection" error when multiple partitions point to the same drive letter on Windows.
Fixes: https://github.com/resin-io/etcher/issues/1004
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-12 15:21:58 -04:00
Juan Cruz Viotti
c707c76633 feat(CLI): improve error messages (#1015)
- Inline dictionary of common error codes and friendly descriptions

We used to rely on `resin-cli-errors` for this, however the friendly
descriptions set there can be usually very Resin CLI specific, and thus
confusing to Etcher users.

The dictionary, along with other error related utilities live in
`lib/cli/errors.js`.

- Print error descriptions and codes if they are found

- Move `utils.printError()` to `errors.print()`

Change-Type: minor
Changelog-Entry: Improve Etcher CLI error messages.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-11 18:45:59 -04:00
Juan Cruz Viotti
6c8ddcea07 chore: remove unnecessary modules from npm-shrinkwrap.json (#1017)
Somehow some development dependencies slipped into the shrinkwrap file,
and in some cases, dependencies we don't use anymore didn't remove its
own now unneeded dependencies when running `npm uninstall`.

This PR carefully removes the packages that are not needed anymore,
which are a lot.

See: https://github.com/resin-io/etcher/issues/820
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-11 17:53:20 -04:00
Juan Cruz Viotti
a14506f016 fix(GUI): open DevTools in detach mode (#1014)
We were previously using the `undocked` mode, which would open DevTools
in a seaprate window, however the user was still allows to pick a new
mode, causing DevTools to be shown inside the main application and
completely ruining the UI.

The `detach` mode in the other hand, completely prevents user from
putting DevTools in the main application, therefore allowing no way to
make the UI look broken.

See: http://electron.atom.io/docs/api/web-contents/
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-11 16:14:03 -04:00
Juan Cruz Viotti
2c64f0da23 chore: add support for snapshot builds (#968)
This commit introduces a `RELEASE_TYPE` option to the Makefile, which
can be either `production` or `snapshot`. If its `production`, the
behaviour its same as it was before.

If `RELEASE_TYPE` is `snapshot`, the shorter version of the current
commit hash is appended to the version (replacing the
`APPLICATION_VERSION` in the Makefile, as well as the `package.json`
version inside the `.asar`), and the publish scripts get configured to
deploy to different "snapshot" locations.

This commit also reduces the size of the version tag in the bottom right
corner a bit so that it fits when the commit hash is appended to it.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-10 21:37:54 -04:00
Juan Cruz Viotti
0b0b097620 refactor(GUI): extract and test child writer CLI argument utilities (#1012)
These utilities were extracted to `lib/shared/child-writer/cli.js`, and
unit tests have been written for them.

As a result of testing, `.getBooleanArgumentForm()` has been extended to
support single letter options.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-01-10 21:36:33 -04:00