243 Commits

Author SHA1 Message Date
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
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
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
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
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
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
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
61860a79e3 chore: fix check-dependency.sh to work with arguments containing spaces (#969) 2016-12-11 19:09:57 -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
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
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
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
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
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
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
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
Andrew Scheller
ce206fc0b7 chore: fix the bintray-debian publishing script (#930)
This change prevents the script erroring with `BINTRAY_USER: unbound variable` when `$BINTRAY_USER` isn't defined, and instead displays the "Please define the following ..." message as expected.
2016-12-04 20:24:50 -04:00
Andrew Scheller
223932eb7b chore: exit with error code 1 on build script usage section (#925) 2016-12-01 20:34:37 -04:00
Juan Cruz Viotti
b7aee7affe chore: attempt to re-use $TMPDIR in installer-appimage.sh (#917)
We currently hardcode the temporary directory location to `/tmp`. Some
Linux systems define `$TMPDIR`, so we should attempt to re-use that
first.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-01 19:52:27 -04:00
Juan Cruz Viotti
832bfad9d1 chore: reuse npm/bower dependencies across builds (#923)
Currently, we create a "resources app" and install dependencies on it.
This means that to create another "resources app", the whole dependency
installation process needs to be repeated.

As a solution, we cache dependencies at
`release/electron-$(TARGET_PLATFORM)-$(TARGET_ARCH)-dependencies/` and
copy them to the resources apps as we need them.

This has the additional benefit that the resources app depends on the
dependencies rather than the other way around (dependencies depend on
the resources app), which didn't feel right.

In order to accomodate to these changes, the dependencies scripts are
now in charge of taking their corresponding manifests with them when the
prefix option is passed, given that neither `npm` nor `bower` allow to
customise the output location.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-01 19:52:07 -04:00
Juan Cruz Viotti
68a71d89e2 chore: add Makefile to build OS X and GNU/Linux (#922)
This Makefile ties together all the build scripts we've been developing
so far. It currently only supports UNIX based operating systems, but
Windows support will be added soon.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-01 15:16:47 -04:00
Juan Cruz Viotti
4f233f20e0 chore: move GNU/Linux zip generation to installer-appimage (#913)
Currently, `installer-appimage` creates only the AppImage, and we rely
on code outside the main task to package it up as a Zip. Since Zip is
a required step for AppImage deployment (since the AppImage will lose
its execution permissions if its moved around), we integrate Zip
generation into the AppImage task itself.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-01 12:29:27 -04:00
Juan Cruz Viotti
6f0fe93aad chore: improve naming of build scripts (#918)
- `darwin/configure-electron.sh` -> `darwin/electron-configure-package-darwin.sh`
- `darwin/installer-zip.sh` -> `darwin/electron-installer-app-zip.sh`
- `darwin/installer-dmg.sh` -> `darwin/electron-installer-dmg.sh`
- `darwin/sign.sh` -> `darwin/electron-sign-app.sh`
- `linux/configure-electron.sh` -> `linux/electron-configure-package-linux.sh`
- `linux/installer-appimage.sh` -> `linux/electron-installer-appimage.sh`
- `linux/installer-deb.sh` -> `linux/electron-installer-debian.sh`
- `unix/create-asar.sh` -> `unix/electron-create-asar.sh`
- `unix/create-electron-app.sh` -> `unix/electron-create-resources-app.sh`
- `unix/download-electron.sh` -> `unix/electron-download-package.sh`

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-01 12:11:08 -04:00
Juan Cruz Viotti
100ab79eab chore: exit with error code 1 on build script usage section (#916)
We're currently exitting with error code 0 when displaying the usage
information on build scripts, which means that if the user forgets or
mistypes an option argument, the script will carry on its way.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-01 11:58:10 -04:00
Juan Cruz Viotti
b2124499c7 chore: extract code-signing logic from windows.bat to sign.bat (#911)
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-01 10:59:26 -04:00
Juan Cruz Viotti
5b6f3cca60 chore: split dependencies.sh into bower and npm scripts (#914)
The purpose of this change is to stay true to the Makefile approach,
where each rule is meant to create a single directory/file.

Currently, `unix/dependencies.sh` resulted in `bower_components` and
`node_modules`. Splitting this rule also means that we don't have to
install bower dependencies where we don't need them (e.g: the CLI).

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-12-01 10:58:26 -04:00
Juan Cruz Viotti
a8116250d2 chore: install dependencies directly in package (#909)
Previously, the build scripts would override the top level
`node_modules` and `bower_components`. After this commit, the
dependencies are installed directly in the Electron package.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-30 11:38:31 -04:00
Juan Cruz Viotti
43922f94c0 chore: extract dependencies.bat from windows.bat (#910)
The logic to install dependencies on Windows now separately lives in
`scripts/windows/dependencies.bat`, similarly to what we've been done
with other operating systems.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-30 11:33:47 -04:00
Andrew Scheller
b8ffd24cce chore: refactor and enhance dependency checking in build scripts (#908)
This refactors the way that the build shell-scripts check for dependencies
in order to cut down on code duplication, and also adds additional
dependency-checks that were missing previously.

Change-Type: minor
2016-11-29 19:37:31 -04:00
Juan Cruz Viotti
2397b5d2aa chore: don't include LICENSE and version in OS X package (#907)
Including them means we have to nicely display them in the final `.dmg`.
For simplicity reasons, we'll omit it for now.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-29 19:18:31 -04:00
Juan Cruz Viotti
ad3636c31a fix: don't lock installer-cli architecture to x64 in build scripts (#904)
We were accidentally hardcoding the installer generation to `x64`.

See: https://github.com/resin-io/etcher/pull/896#discussion_r89999295
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-29 15:20:59 -04:00
Juan Cruz Viotti
0ed4f5d3c8 chore: adopt new build command convention for OS X (#903)
The `darwin.sh` script now accepts the following commands:

- `develop-electron`
- `installer-dmg`
- `installer-zip`

In order to accomplish this, `./scripts/darwin/package.sh` is no longer
relying on `electron-packager`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-28 09:56:14 -04:00
Juan Cruz Viotti
7794bf06d1 refactor: extract electron downloading logic to its own script (#902)
This will allow us to easily re-use this functionality in the OS X
package script.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-28 01:13:12 -04:00
Juan Cruz Viotti
6e0d8e1f5c refactor: ditch electron-osx-sign for OS X signing (#901)
Making use of `codesign` directly allows us to have much more
flexibility in how we sign things, which will prove very valuable when
adapting this `sign.sh` script to code sign the Etcher CLI.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-28 01:13:02 -04:00
Juan Cruz Viotti
19b3bc56c2 chore: adopt new build script command convention in GNU/Linux (#899)
The GNU/Linux build script (as the rest of the OSes will in the near
future), now accepts the following command:

- `develop-electron`
- `develop-cli`
- `installer-cli`
- `installer-appimage`
- `installer-debian`

Each of the commands is now completely independent from the others.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-27 22:29:23 -04:00
Juan Cruz Viotti
553f7f3f4b refactor: get rid of electron-packager in GNU/Linux (#897)
In order to take a whitelisting approach to dependencies, the
`unix/dependencies.sh` script is ran as part of packaging as well, but
passing the `-p` (production) flag.

In the future, the current `install`, `package`, and `installer` targets
will be deplaced by `develop-<type>`, `installer-<type>`.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-25 16:13:59 -04:00
Juan Cruz Viotti
151d19ce63 chore: add "cli" command to GNU/Linux and OS X build script (#896)
This is the first step towards properly publishing the Etcher CLI. The
option is not present in Windows yet, and its intentionally undocumented
for the time being.

See: https://github.com/resin-io/etcher/issues/355
Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-25 14:11:13 -04:00
Juan Cruz Viotti
a01c9aa6b1 refactor: improve and unify dependencies.sh script across UNIX targets (#894)
- Unify both `linux/dependencies.sh` and `darwin/dependencies.sh` in
  `unix/dependencies.sh`

- Add `-f` (force) option to `unix/dependencies.sh`

- Add `-p` (production) option to `unix/dependencies.sh`

- Allow passing a target type to `unix/dependencies.sh`

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-25 12:57:09 -04:00
Juan Cruz Viotti
f0bc04c238 refactor: extract GNU/Linux build scripts into many files (#890)
Related changes

- Remove AppImages related binary blob from `scripts/build/AppImages` and
  fetch them from the internet instead.

Signed-off-by: Juan Cruz Viotti <jviotti@openmailbox.org>
2016-11-23 12:20:51 -04:00