2941 Commits

Author SHA1 Message Date
Andrew Scheller
0c7e1feb4b chore: migrate from scss-lint to sass-lint (#1172)
https://github.com/brigade/scss-lint now says "NOTICE: Consider other tools
before adopting SCSS-Lint", and recommends sass-lint as an alternative.
sass-lint has the additional advantage of being written in NodeJS, which means
it slots nicely into our existing infrastructure, and we can completely
remove our build-time dependency on Ruby.
2017-03-09 15:09:00 -04:00
Andrew Scheller
0a9b67976c chore: create a temporary .dockerignore during the docker build step (#1173)
This speeds up the 'docker build' step, as it reduces the amount of 'build
context' that needs to be sent to docker.
2017-03-09 15:08:48 -04:00
Juan Cruz Viotti
a624b24bfc fix(GUI): stop drive scanning loop if an error occurs (#1169)
If the drive scanning scripts cause an error, the error will be
presented to the user over and over again. Not only this is terrible UX,
which even makes hard to close the application since dialogs keep coming
in, but it also spams TrackJS, our error reporting service, and makes it
seem that errors happened dozens of times, and thus obscuring real
trending errors.

Change-Type: patch
Changelog-Entry: Stop drive scanning loop if an error occurs.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-09 11:58:14 -04:00
Juan Cruz Viotti
d44868ecab upgrade: angular and angular-mocks to v1.6.3 (#1168)
We recently started hitting the following errors in all our CI builds:

```
TypeError: angular.module(...).info is not a function
    at /etcher/node_modules/angular-mocks/angular-mock
```

The `.info()` function was released in AngularJS 1.6.3. We declare
`angular-mocks@^1.6.1` as a development dependency, which means that
once 1.6.3 was out, npm started resolving `angular-mocks@1.6.3`, however
that version is incompatible with the main Angular version we're
shrinkwrapping (1.6.1), and thus the error.

As a solution, I've upgraded both `angular` and `angular-mocks` to
1.6.3, but also locked down `angular-mocks`, since similar errors will
happen again unless we manually keep these versions in sync.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-09 10:27:39 -04:00
Juan Cruz Viotti
df8611df11 chore: add ESLint Lodash plugin (#1148)
This is one step towards enforcing the linter until we barely have to
check for style issues on code reviews.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-08 19:11:15 -04:00
Juan Cruz Viotti
6c8bc117ab chore: revise ESLint built-in configuration (#1149)
There are a lot of new rules since the last time I revised the ESLint
rules documentation.

I've updated the main `.eslintrc.yml` to include some newer additions,
plus I added another ESLint configuration file inside `tests`, so we can
add some stricted rules to the production code while relaxing them for
the test suite (due to the fact that Mocha is not very ES6 friendly and
Angular tests require a bit of dark magic to setup).

This is a summary of the most important changes:

- Disallow "magic numbers"

These should now be extracted to constants, which forces us to think of
a good name for them, and thus make the code more self-documenting (I
had to Google up the meaning of some existing magic numbers, so I guess
this will be great for readability purposes).

- Require consistent `return` statements

Some functions relied on JavaScript relaxed casting mechanism to work,
which now have explicit return values. This flag also helped me detect
some promises that were not being returned, and therefore risked not
being caught by the exception handlers in case of errors.

- Disallow redefining function arguments

Immutability makes functions easier to reason about.

- Enforce JavaScript string templates instead of string concatenation

We were heavily mixing boths across the codebase.

There are some extra rules that I tweaked, however most of codebase
changes in this commit are related to the rules mentioned above.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-07 23:46:44 -04:00
Juan Cruz Viotti
c93f528f96 upgrade: drivelist to v5.0.16 (#1160)
See: https://github.com/resin-io-modules/drivelist/pull/150
Fixes: https://github.com/resin-io/etcher/issues/1159
Change-Type: patch
Changelog-Entry: Fix GNU/Linux udev error when `net.ifnames` is set.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-07 10:44:34 -04:00
Juan Cruz Viotti
10c5e57b98 upgrade: etcher-image-write to v9.0.1 (#1157)
We're particularly interested in:

- https://github.com/resin-io-modules/etcher-image-write/pull/84

Which fixes ENOSPC alignment issues.

This new version upgrades all its dependencies, which is the reason why
`npm-shrinkwrap.json` contains a lot of changes.

Fixes: https://github.com/resin-io/etcher/issues/1109
Change-Type: patch
Changelog-Entry: Fix `ENOSPC` image alignment errors.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-06 14:22:03 -04:00
Juan Cruz Viotti
c2a27301b7 upgrade drivelist to v5.0.15 (#1158)
We're mainly interested in the following change:

- https://github.com/resin-io-modules/drivelist/pull/148

Fixes: https://github.com/resin-io/etcher/issues/1126
Change-Type: patch
Changelog-Entry: Fix errors when unplugging drives exactly when the drive scanning scripts are running.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-06 13:52:39 -04:00
Juan Cruz Viotti
98284bd5e2 fix(GUI): don't report "invalid archive" errors to TrackJS (#1152)
These errors happen when the user selects an archive that contains no
image, or multiple images, and represents a user error, rather than an
unhandled exception.

For this reason, we should not report this to TrackJS.

This means, however, that we need a reliable way to know whether an
error should be reporter or not. This commit implements
`AnalyticsService.shouldReportError()` for this purpose, which will
check an optional `report` property of the error object.

In order to ensure that errors that we don't control are reported, the
function will return `true` if the error object doesn't have that
property.

Change-Type: patch
Changelog-Entry: Don't report "invalid archive" errors to TrackJS.
Fixes: https://github.com/resin-io/etcher/issues/1103
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-02 12:21:48 -04:00
Juan Cruz Viotti
1a00430999 chore: fix JSDoc warnings (#1151)
- The type in `@type` should be surrounded by curly braces
- We should use `@type` in some cases where we used `@property`
- `@module` descriptions should go above such tag
- Namespaces should not declare their access type

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-02 12:13:28 -04:00
Juan Cruz Viotti
dfd5f70013 style(GUI): fix small chain indentation issue (#1150)
I couldn't find an ESLint rule that would protect us from this in the
future.

See: https://github.com/resin-io/etcher/pull/1148#discussion_r103525165
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-01 18:52:29 -04:00
Juan Cruz Viotti
4172291a10 chore: improve JSDoc ESLint rules (#1147)
- Prefer `@returns` to `@return`
- Prefer `@param` to `@arg`
- Prefer capitalised types

See: https://github.com/resin-io/etcher/pull/1111#discussion_r103483879
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-01 14:26:47 -04:00
Benedict Aas
33a4ed8c95 feat(GUI): allow opening drive selector modal when no drives (#1146)
We change the drive selector button text to be a static 'select drive'
and allow the user to open the dialog even if there are no drives,
displaying the 'no drives' warning inside the modal.

Closes: https://github.com/resin-io/etcher/issues/884
Changelog-Entry: Allow opening the drive selector modal when there are no
drives.
2017-03-01 10:27:26 -04:00
Ștefan Daniel Mihăilă
4604e89b4f chore: add aknowledge->acknowledge to codespell dictionary 2017-02-28 11:45:29 -04:00
Juan Cruz Viotti
311dcd27a8 chore: add missing : after options in publish scripts (#1134)
Not including the colon means that the option parsing mechanism is not
expecting an argument for the `-t` and the `-p` option (for
`bintray-debian.sh` and `aws-s3.sh` respectively), and thus `$OPTARG`
will be undefined.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-27 17:06:02 -04:00
Juan Cruz Viotti
8d71307831 chore: define S3_BUCKET in Makefile (#1141)
We use that variable in the Makefile but we're not defining it, which
means that maintainers publishing Etcher need to remember to pass that
as an option.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-27 17:05:58 -04:00
Juan Cruz Viotti
2ebef51d38 chore: don't use symbolic links on Windows builds (#1133)
Cygwin can't resolve them correctly, causing cryptic errors during
build.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-27 10:09:04 -04:00
Juan Cruz Viotti
d9bd509d22 chore: fix various code-signing Windows issues (#1135)
- Add missing backslash that caused the command to not be interpreted
  completely

- Update `electron-sign-exe.exe` to `electron-sign-exe-win32.exe` in
  Makefile

- Use hyphen options instead of Windows slash style, which confuses bash

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-27 10:08:44 -04:00
Juan Cruz Viotti
be001cc266
v1.0.0-beta.19
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
v1.0.0-beta.19
2017-02-24 15:15:14 -04:00
Ștefan Daniel Mihăilă
5b9104e8aa feat(GUI): warn when atempting to burn Windows images (#1043)
Change-Type: minor
Changelog-Entry: Show warning when user tries to flash a Windows image
Closes: https://github.com/resin-io/etcher/issues/1035
2017-02-24 15:12:03 -04:00
Juan Cruz Viotti
d845cccff5 upgrade: drivelist to v5.0.14 (#1130)
See: https://github.com/resin-io-modules/drivelist/pull/146
Change-Type: patch
Changelog-Entry: Don't ignore errors coming from the Windows drive detection script.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-24 10:51:40 -04:00
Juan Cruz Viotti
810e3a085b chore: add execution permissions to Windows bash scripts (#1131)
I edited these files in Windows, which seems to have caused the
permissions bits to get lost.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-24 10:51:31 -04:00
Juan Cruz Viotti
0db335c8f1 chore: start codespell dictionary file in the root of the project (#1087)
codespell works by having a dictionary of pairs of malformed words and
their correct equivalents. This means that codespell will not catch most
issues out of the box, but we can train it based on the common spelling
issues we encounter along the way.

The plan is to add a pair to `dictionary` every time we encounter a typo
during a code review, and we ensure that error will not happen again
anymore.

See: https://github.com/resin-io/etcher/pull/1084
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-23 14:56:43 -04:00
Juan Cruz Viotti
96a9b65ea7 chore: ensure npm run sass was ran and the results committed (#1121)
We recently encountered a UI regression caused by forgetting to commit
the generated CSS files.

The solution is to make the CI servers run `npm run sass` and check if
there are unstaged files afterwards. If so, the tests halt.

In order to avoid duplication between Travis CI and Appveyor CI, this
logic has been encoded into a bash script at `scripts/ci`.

See: https://github.com/resin-io/etcher/pull/1120
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-23 11:20:47 -04:00
Juan Cruz Viotti
f4c92676a9 fix(GUI): update notifier transformRequest error at startup (#1122)
Etcher checks what is the latest version by making an HTTP request to S3
in order to see if it should present the update notifier modal at
startup.

If the user is not connected to the internet, or is on an unstable
connection, the request might fail completely or timeout, leading to a
weird error message being presented to the user:

```json
{
  "data": null,
  "status": -1,
  "config": {
    "method": "GET",
    "transformRequest": [null],
    "transformResponse": [null],
    "url": "https://resin-production-downloads.s3.amazonaws.com",
    "headers": {
      "Accept": "application/json, text/plain, */*"
    }
  },
  "statusText": ""
}
```

To solve the error, we tweak `UpdateNotifierService.getLatestVersion()`
to resolve the current version if there was a problem making the request
(e.g: the response didn't come through at all), which after some
experimentation, we can check by comparing the `status` property with
`-1`.

This error happens in all operating systems, and currently is trending
on TrackJS.

Change-Type: patch
Changelog-Entry: Fix `transformRequest` error at startup when not connected to the internet, or when on an unstable connection.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-23 11:20:10 -04:00
Juan Cruz Viotti
389102af62 chore: don't install electron-installer-debian in OS X builds (#1129)
The `electron-installer-debian` is not needed for OS X builds. On top of
that, it seems that we're installing it twice.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-22 20:46:37 -04:00
Juan Cruz Viotti
b6c6e94448 upgrade: drivelist to v5.0.13 (#1123)
This version fixes an `EACCES` issue when spawning the platform scripts
in OS X and GNU/Linux, which caused because previous versions were
published to NPM from Windows, and Windows seems to mess up the file
permissions (the execution bit in this particular case).

I'm not adding a changelog entry given this issue happen on `master` and
didn't affect any release.

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-22 15:46:25 -04:00
Juan Cruz Viotti
c3e7e07532 docs: group CLI developer oriented documentation at lib/cli/README.md (#1105)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-21 17:43:25 -04:00
Juan Cruz Viotti
9aa23c1590 docs: add developer documentation to the lib/image-stream module (#1107)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-21 17:43:10 -04:00
Juan Cruz Viotti
2f153479da docs: C++ are not auto-selected by Visual Studio anymore (#1112)
Its not possible to build Etcher without it. For some reason, the Visual
Studio Community 2015 installer is not ticking it by default anymore.

See: https://github.com/resin-io/etcher/pull/1110
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-21 08:12:48 -04:00
Juan Cruz Viotti
d002ed164b docs: document supported operating systems and versions (#1114)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-21 08:12:30 -04:00
Benedict Aas
295585fb06 feat(gui): new flashing step icon (#1119)
We update the flashing step's icon to the new lightning strike icon.

Changelog-Type: Update flashing step's icon to a lightning strike.
2017-02-21 08:12:09 -04:00
Benedict Aas
78ff320d98 minifix: re-build css (#1120) 2017-02-21 08:11:50 -04:00
Juan Cruz Viotti
d9a92a63ee upgrade: drivelist to v5.0.11 (#1117)
Change-Type: patch
Changelog-Entry: Omit empty SD Card readers in the drive selector on Windows.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-20 09:26:11 -04:00
Benedict Aas
7adb5b5485 feat(GUI): update image step icon (#1118)
We replace the old image step with the more general 'plus' icon.

Changelog-Entry: Update the image step icon with an hexagonal "plus" icon.
2017-02-20 09:03:55 -04:00
Juan Cruz Viotti
9e80f154f0 chore: update angular-ui-router in npm-shrinkwrap.json (#1102)
Looks like this dependency was not updated correctly on the shrinkwrap
file. Probably happened in the linked pull request, where the shrinkwrap
file was hand edited at some point (see PR discussion).

See: https://github.com/resin-io/etcher/pull/1083
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-16 13:51:15 -04:00
Juan Cruz Viotti
98f8c3f87f upgrade: drivelist to v5.0.10 (#1101)
This version contains a fix to omit drive letters assigned to partitions
without a valid file system (read "valid for Windows"), causing our
unmounting routine to fail in these cases.

Change-Type: patch
Changelog-Entry: Fix "Error: Command Failed" error when unmounting on Windows.
Fixes: https://github.com/resin-io/etcher/issues/1019
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-16 13:50:53 -04:00
Juan Cruz Viotti
cf4dc5ff37 refactor(GUI): remove component-drive-selector-body outdated class (#1072)
The rules inside this class should be moved to
`.modal-drive-selector-modal`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-13 14:59:29 -04:00
Juan Cruz Viotti
a60f7134fc chore: add an HTML linter and fix its warnings (#1077)
This PR creates a script at `scripts/html-lint.js` that runs a NodeJS
HTML linter package that understands AngularJS on top of all our HTML
templates.

The following error was detected and fixed:

```
1 errors at lib/gui/pages/finish/templates/success.tpl.html
  [4:63] Duplicate attribute “class”.
```

This script will run as part of `npm run lint`, but you can call it
independently as `npm run htmllint`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-13 14:58:29 -04:00
Juan Cruz Viotti
43c08d1547 docs: explain the "robot" module in a high level way (#1081)
This commit adds a README file at `lib/shared/robot` explaining in
detail how the "robot" mechanism works, and why it is needed.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-10 11:59:23 -04:00
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