<commit_before>#!/bin/bash

###
# Copyright 2016 resin.io
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###

set -u
set -e

function check_dep() {
  if ! command -v $1 2>/dev/null 1>&2; then
    echo "Dependency missing: $1" 1>&2
    exit 1
  fi
}

check_dep wget

function usage() {
  echo "Usage: $0"
  echo ""
  echo "Options"
  echo ""
  echo "    -r <electron architecture>"
  echo "    -v <electron version>"
  echo "    -s <electron operating system>"
  echo "    -o <output directory>"
  exit 1
}

ARGV_ARCHITECTURE=""
ARGV_ELECTRON_VERSION=""
ARGV_OPERATING_SYSTEM=""
ARGV_OUTPUT=""

while getopts ":r:v:s:o:" option; do
  case $option in
    r) ARGV_ARCHITECTURE=$OPTARG ;;
    v) ARGV_ELECTRON_VERSION=$OPTARG ;;
    s) ARGV_OPERATING_SYSTEM=$OPTARG ;;
    o) ARGV_OUTPUT=$OPTARG ;;
    *) usage ;;
  esac
done

if [ -z "$ARGV_ARCHITECTURE" ] \
  || [ -z "$ARGV_ELECTRON_VERSION" ] \
  || [ -z "$ARGV_OPERATING_SYSTEM" ] \
  || [ -z "$ARGV_OUTPUT" ]
then
  usage
fi

ELECTRON_ARCHITECTURE=$ARGV_ARCHITECTURE
if [ "$ELECTRON_ARCHITECTURE" == "x86" ]; then
  ELECTRON_ARCHITECTURE="ia32"
fi

ELECTRON_GITHUB_REPOSITORY=https://github.com/electron/electron
ELECTRON_FILENAME="electron-v$ARGV_ELECTRON_VERSION-$ARGV_OPERATING_SYSTEM-$ELECTRON_ARCHITECTURE.zip"

mkdir -p $(dirname $ARGV_OUTPUT)
wget "$ELECTRON_GITHUB_REPOSITORY/releases/download/v$ARGV_ELECTRON_VERSION/$ELECTRON_FILENAME" -O "$ARGV_OUTPUT"<commit_msg>chore: fix certificate verification error with wget on MinGW (#942)<commit_after>#!/bin/bash

###
# Copyright 2016 resin.io
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#   http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###

set -u
set -e

function check_dep() {
  if ! command -v $1 2>/dev/null 1>&2; then
    echo "Dependency missing: $1" 1>&2
    exit 1
  fi
}

check_dep wget

function usage() {
  echo "Usage: $0"
  echo ""
  echo "Options"
  echo ""
  echo "    -r <electron architecture>"
  echo "    -v <electron version>"
  echo "    -s <electron operating system>"
  echo "    -o <output directory>"
  exit 1
}

ARGV_ARCHITECTURE=""
ARGV_ELECTRON_VERSION=""
ARGV_OPERATING_SYSTEM=""
ARGV_OUTPUT=""

while getopts ":r:v:s:o:" option; do
  case $option in
    r) ARGV_ARCHITECTURE=$OPTARG ;;
    v) ARGV_ELECTRON_VERSION=$OPTARG ;;
    s) ARGV_OPERATING_SYSTEM=$OPTARG ;;
    o) ARGV_OUTPUT=$OPTARG ;;
    *) usage ;;
  esac
done

if [ -z "$ARGV_ARCHITECTURE" ] \
  || [ -z "$ARGV_ELECTRON_VERSION" ] \
  || [ -z "$ARGV_OPERATING_SYSTEM" ] \
  || [ -z "$ARGV_OUTPUT" ]
then
  usage
fi

ELECTRON_ARCHITECTURE=$ARGV_ARCHITECTURE
if [ "$ELECTRON_ARCHITECTURE" == "x86" ]; then
  ELECTRON_ARCHITECTURE="ia32"
fi

ELECTRON_GITHUB_REPOSITORY=https://github.com/electron/electron
ELECTRON_FILENAME="electron-v$ARGV_ELECTRON_VERSION-$ARGV_OPERATING_SYSTEM-$ELECTRON_ARCHITECTURE.zip"

mkdir -p $(dirname $ARGV_OUTPUT)
wget --no-check-certificate "$ELECTRON_GITHUB_REPOSITORY/releases/download/v$ARGV_ELECTRON_VERSION/$ELECTRON_FILENAME" -O "$ARGV_OUTPUT"
{'fraction_non_alphanumeric': 0.12121212121212122, 'fraction_numerical': 0.011968423733129615, 'mean_word_length': 4.230359520639148, 'pattern_counts': {'":': 2, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '239724', 'n_tokens_mistral': 1487, 'n_tokens_neox': 1378, 'n_words': 379}