637 Commits

Author SHA1 Message Date
Juan Cruz Viotti
5535111314 upgrade: elevator to v2.2.0 (#1298)
This version contains a patch to output debugging information.

See: https://github.com/resin-io-modules/elevator/pull/9
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-14 12:27:19 -04:00
Juan Cruz Viotti
5f9b46b98b upgrade: etcher-image-write to v9.0.2 (#1286)
This release fixes an uncaught error when there is a validation error.

See: https://github.com/resin-io-modules/etcher-image-write/pull/94
Change-Type: patch
Changelog-Entry: Fix "function createError(opts) {}" error on validation failure.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-13 14:37:56 -04:00
Juan Cruz Viotti
a1d8f28fc2 upgrade: mountutils to v1.0.4 (#1294)
This version contains a fix for when unmounting a physical drive with no
logical volumes attached.

See: http://github.com/resin-io-modules/mountutils/pull/24
Change-Type: patch
Changelog-Entry: Fix "Unmount failed, invalid drive" error on Windows.
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-04-13 14:37:43 -04:00
Ștefan Daniel Mihăilă
5ace384607 upgrade: resin-corvus to 1.0.0.beta-24 (#1296)
This version fixes the release not being sent to Mixpanel.

Change-Type: patch
2017-04-13 14:30:04 -04:00
Jonas Hermsmeier
7fc10b71e3 chore(package): fix codespell binary file warnings (#1289)
This avoids codespell printing warnings for binary files
which have been added recently (`.iso`, `.dmg`), as well as dotfiles (i.e. `.DS_Store`).

Change-Type: patch
2017-04-13 08:45:02 -04:00
Juan Cruz Viotti
36822b1f91
v1.0.0-rc.2 2017-04-11 01:00:08 -04:00
Juan Cruz Viotti
53bc5a51e9
v1.0.0-rc.1 2017-04-10 17:01:15 -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
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
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
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
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
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
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
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
4417d94913 upgrade: unbzip2-stream to v1.0.11 (#1194)
We believe this issue fixes the "rawr i'm a dinosaur" error on certain
problematic images.

Gives this only happens on a minority of images, we couldn't confirm
that the fix really solves the issue, but we'll include the upgrade on
the next Etcher version and see how it goes in the real world.

Change-Type: patch
Changelog-Entry: Fix "rawr i'm a dinosaur" bzip2 error.
Fixes: https://github.com/resin-io/etcher/issues/734
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-21 14:31:58 -04:00
Juan Cruz Viotti
9f3798978d upgrade: is-elevated to v2.0.1 (#1184)
This version contains a fix for correctly checking whether a process is
running with administrator right or not, without depending on the
"Server" service.

Fixes: https://github.com/resin-io/etcher/issues/1180
See: https://github.com/sindresorhus/is-admin/pull/4
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-21 11:17:02 -04:00
Andrew Scheller
c9702c3a6d chore: get the CI tests working again (#1182)
* chore: get the CI tests working again
 * an updated eslint-plugin-lodash was creating extra linter errors where we
   were using built-in String methods instead of the lodash equivalents
 * an updated codespell package now installs with a different executable-name
   (no .py extension), and now supports multiple dictionaries
 * while I was at it I replaced the messy double-quoting-string logic with the
   command-join module

Changelog-type: patch

* chore: downgrade codespell to 1.9.2 because the latest version has issues running on Windows
(we'll hopefully be able to revert this commit when codespell works again properly!)
2017-03-15 16:32:25 -04:00
Juan Cruz Viotti
66c0cb6e17 chore: automatically enforce compatible angular core module versions (#1175)
We've recently had an incident were the `angular-mocks` version we were
running was incompatible with the `angular` version.

Each AngularJS core module is versioned equally, therefore we can write
a small script that automatically tests that they match, so we're
guarded against forgetting to similarly upgrade different dependencies.

See: https://github.com/resin-io/etcher/pull/1168
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-15 10:43:20 -04:00
Ștefan Daniel Mihăilă
fe20f5061f fix(GUI): don't log absolute paths in Mixpanel (#1161)
The event data may contain absolute paths that contain user information that
should not be logged in Mixpanel. Instead, we replace absolute path properties
with their base name.

Change-Type: patch
Changelog-Entry: Don't include user paths in Mixpanel analytics events.
2017-03-15 00:05:48 -04:00
Andrew Scheller
ee2bbef9da chore: codespell improvements (#1174)
* fix the command so it actually works - see https://github.com/lucasdemarchi/codespell/issues/101
 * check the spelling of more files
 * ignore known-binary filetypes
 * fix a couple of spelling mistakes it caught

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-11 18:10:54 -04:00
Ștefan Daniel Mihăilă
34c85eb150 feat(GUI): improve analytics events (#1111)
* feat(GUI): improve analytics events

This commit adds more events to our current analytics.
Will further improve in a future commit.

Change-Type: patch
See: https://github.com/resin-io/etcher/issues/1100

* refactor(gui): use single function to set normal and dangerous settings

Change-Type: patch
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-03-10 15:18:49 -04:00
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
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
be001cc266
v1.0.0-beta.19
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2017-02-24 15:15:14 -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
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
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
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
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
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
Ș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
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
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