licensed 3.2.3 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,95 +0,0 @@
1
- #!/bin/bash
2
- #/ Usage: script/packages/build <RUBYC> [VERSION]
3
- #/
4
- #/ WARNING: Do not call this directly. Please create packages using
5
- #/ `script/package [platform]` or `bundle exec rake package[platform]`
6
- #/
7
- #/ Builds a distributable package for licensed for a given RUBYC compiler and licensed VERSION.
8
- #/ Packages are of the form licensed-$VERSION-$PLATFORM-x64.tar.gz and contain a `./licensed` executable
9
- #/ Built Packages are placed in the <root>/pkg/$VERSION directory.
10
- #/
11
- #/ OPTIONS:
12
- #/ <RUBYC> The path to a rubyc compiler that should be used to compile the target executable
13
- #/ [VERSION] (optional, default to current git branch or SHA1) version of licensed to build exe at
14
- #/
15
- #/ EXAMPLES:
16
- #/
17
- #/ Builds a package for version 1.1.0 using a local rubyc compiler
18
- #/ $ script/packages/build RUBYC="./rubyc-darwin" VERSION="1.1.0"
19
- #/
20
-
21
- set -euo pipefail
22
-
23
- BASE_DIR="$(cd "$(dirname $0)/../.." && pwd)"
24
- RUBYC=${RUBYC:=""}
25
- if [ ! -f "$RUBYC" ]; then
26
- echo "Specify a rubyc compiler using the RUBYC environment variable" >&2
27
- exit 127
28
- fi
29
-
30
- # if a version is not provided, get an identifier from the current HEAD
31
- VERSION=${VERSION:="$(git rev-parse --abbrev-ref HEAD)"}
32
-
33
- BUILD_DIR="$(mktemp -d)"
34
- COPY_DIR="$(mktemp -d)"
35
- trap "rm -rf $BUILD_DIR; rm -rf $COPY_DIR" EXIT
36
-
37
- # copy the repo to a separate directory. determining license metadata
38
- # will require a clean environment with no Gemfile.lock. using a work location
39
- # is preferred to messing with a development repository
40
- rsync -r --exclude="test/" --exclude=".licenses/" --exclude="vendor/" --exclude="Gemfile.lock" --exclude="pkg/" $BASE_DIR/ $COPY_DIR
41
- cd $COPY_DIR
42
-
43
- # ensure repo is at $VERSION and build executable, restoring the repo to previous
44
- # state after build.
45
- (
46
- # run in a subshell for ease of returning to the current branch after building
47
- # the executable
48
- CURRENT_BRANCH="$(git rev-parse --abbrev-ref HEAD)"
49
- if [[ "$VERSION" != "$CURRENT_BRANCH" ]]; then
50
- git checkout "$VERSION"
51
- trap "git checkout $CURRENT_BRANCH" EXIT
52
- fi
53
-
54
- # get the openssl dir to use when building based on ruby's default ssl cert dir
55
- OPENSSL_DIR="$(cd "$(ruby -e 'require "net/https"; puts OpenSSL::X509::DEFAULT_CERT_DIR')/.." && pwd)"
56
-
57
- # build the licensed rubyc executable
58
- "$RUBYC" --openssl-dir "$OPENSSL_DIR" --clean-tmpdir -o "$BUILD_DIR/licensed" "$COPY_DIR/exe/licensed"
59
- chmod +x $BUILD_DIR/licensed
60
- )
61
-
62
- # non-executable content will be stored in a `meta` directory
63
- mkdir -p "$BUILD_DIR/meta"
64
-
65
- # include dependency license data in package; run bundle update in temp work dir
66
- # and then run licensed on itself in that directory to grab license data
67
- # NOTE: this does not produce accurate license information if any licensed
68
- # depends on any platform-specific gems.
69
- (
70
- # run in a subshell so that `unset BUNDLER_VERSION` is contained. the ENV var
71
- # is required to successfully build a distributable executable on
72
- # dockerized linux
73
- unset BUNDLER_VERSION
74
-
75
- # determining dependency license data needs to be done from a clean environment
76
- # without previous dependencies or a Gemfile.lock so as to pull in the latest
77
- # bundler version, which is what the distributed executable uses
78
- script/bootstrap
79
- bundle exec exe/licensed cache
80
- cp -R "$COPY_DIR/.licenses" "$BUILD_DIR/meta"
81
- )
82
-
83
- # copy static metadata to build directory
84
- mkdir -p "$BUILD_DIR/meta/ruby"
85
- curl -o "$BUILD_DIR/meta/ruby/license.txt" "https://www.ruby-lang.org/en/about/license.txt"
86
- cp "$BASE_DIR/LICENSE" "$BUILD_DIR/meta"
87
- cp "$BASE_DIR/README.md" "$BUILD_DIR/meta"
88
-
89
- # create release archive
90
- PLATFORM="$(uname -s | tr '[:upper:]' '[:lower:]')"
91
- TARGET="$BASE_DIR/pkg/$VERSION/licensed-$VERSION-$PLATFORM-x64.tar.gz"
92
- mkdir -p "$(dirname $TARGET)"
93
- tar -C "$BUILD_DIR" -czf "$TARGET" .
94
-
95
- echo "licensed package built to $TARGET"
@@ -1,57 +0,0 @@
1
- #!/bin/bash
2
- #/ Usage: script/packages/linux [VERSION]
3
- #/
4
- #/ WARNING: You should not need to call this directly. Please create packages using
5
- #/ `script/package [platform]` or `bundle exec rake package[platform]`
6
- #/
7
- #/ Builds a linux distributable package for licensed for a given and licensed VERSION.
8
- #/ Packages are of the form licensed-$VERSION-linux-x64.tar.gz and contain a `./licensed` executable
9
- #/ Built packages are placed in the <root>/pkg directory.
10
- #/
11
- #/ If calling from a non-linux OS, docker is used to build a linux binary
12
- #/
13
- #/ OPTIONS:
14
- #/ [VERSION] (optional, default to current git branch or SHA1) version of licensed to build exe at
15
- #/
16
-
17
- set -euo pipefail
18
-
19
- BASE_DIR="$(cd "$(dirname $0)/../.." && pwd)"
20
- VERSION=${VERSION:=""}
21
-
22
- build_linux_docker() {
23
- IMAGE="licensed/build-linux"
24
- docker build -t "$IMAGE" - < "$BASE_DIR/docker/Dockerfile.build-linux"
25
- docker run --rm \
26
- -e VERSION="$VERSION" \
27
- -v "$BASE_DIR":/var/licensed \
28
- -w /var/licensed \
29
- "$IMAGE" \
30
- "script/packages/build"
31
- }
32
-
33
- build_linux_local() {
34
- sudo apt-get update
35
- sudo apt-get install -y --no-install-recommends cmake make gcc pkg-config squashfs-tools curl bison git rsync
36
-
37
- sudo gem update --system
38
- sudo gem update bundler
39
-
40
- RUBYC="$BASE_DIR/bin/rubyc-linux"
41
- if [ ! -f "$RUBYC" ]; then
42
- mkdir -p "$(dirname "$RUBYC")"
43
- curl -L https://github.com/kontena/ruby-packer/releases/download/2.6.0-0.6.0/rubyc-2.6.0-0.6.0-linux-amd64.gz | gunzip > "$RUBYC"
44
- chmod +x "$RUBYC"
45
- fi
46
-
47
- export CPPFLAGS="-P"
48
- export SSL_CERT_DIR="/etc/ssl/certs"
49
- export RUBYC
50
- "$BASE_DIR"/script/packages/build
51
- }
52
-
53
- if [[ "$(uname -s)" != "Linux" ]]; then
54
- build_linux_docker
55
- else
56
- build_linux_local
57
- fi
data/script/packages/mac DELETED
@@ -1,41 +0,0 @@
1
- #!/bin/bash
2
- #/ Usage: script/packages/mac [VERSION]
3
- #/
4
- #/ WARNING: You should not need to call this directly. Please create packages using
5
- #/ `script/package [platform]` or `bundle exec rake package[platform]`
6
- #/
7
- #/ Builds a mac distributable package for licensed for a given licensed VERSION.
8
- #/ Packages are of the form licensed-$VERSION-darwin-x64.tar.gz and contain a `./licensed` executable
9
- #/ Built packages are placed in the <root>/pkg directory.
10
- #/
11
- #/ Must be called from a Mac OS.
12
- #/
13
- #/ OPTIONS:
14
- #/ [VERSION] (optional, default to current git branch or SHA1) version of licensed to build exe at
15
- #/
16
-
17
- set -euo pipefail
18
-
19
- if [[ "$(uname -s)" != "Darwin" ]]; then
20
- echo "A Mac OS is required to build a licensed executable for mac" >&2
21
- exit 1
22
- fi
23
-
24
- BASE_DIR="$(cd "$(dirname $0)/../.." && pwd)"
25
- RUBYC="$BASE_DIR/bin/rubyc-darwin"
26
-
27
- brew update
28
- brew list "squashfs" &>/dev/null || brew install "squashfs"
29
- brew list "pkg-config" &>/dev/null || brew install "pkg-config"
30
-
31
- gem update --system
32
- gem update bundler
33
-
34
- if [ ! -f "$RUBYC" ]; then
35
- mkdir -p "$(dirname "$RUBYC")"
36
- curl -L https://github.com/kontena/ruby-packer/releases/download/2.6.0-0.6.0/rubyc-2.6.0-0.6.0-osx-amd64.gz | gunzip > "$RUBYC"
37
- chmod +x "$RUBYC"
38
- fi
39
-
40
- export RUBYC
41
- "$BASE_DIR"/script/packages/build
data/script/setup DELETED
@@ -1,5 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- bundle exec rake setup["$@"]
@@ -1,17 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- if [ -z "$(which bower)" ]; then
5
- echo "A local bower installation is required for bower development." >&2
6
- exit 127
7
- fi
8
-
9
- # setup test fixtures
10
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
11
- cd $BASE_PATH/test/fixtures/bower
12
-
13
- if [ "$1" == "-f" ]; then
14
- find . -not -regex "\.*" -and -not -name "bower\.json" -print0 | xargs -0 rm -rf
15
- fi
16
-
17
- bower install
@@ -1,20 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- if [ -z "$(which bundle)" ]; then
5
- echo "A local bundler instalation is required for bundler development." >&2
6
- exit 127
7
- fi
8
-
9
- # setup test fixtures
10
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
11
- cd $BASE_PATH/test/fixtures/bundler
12
-
13
- # unset any pre-existing gemfile when installing test fixtures
14
- unset BUNDLE_GEMFILE
15
-
16
- if [ "$1" == "-f" ]; then
17
- find . -not -regex "\.*" -and -not -name "Gemfile" -and -not \( -path ./pathed-gem-fixture -prune \) -print0 | xargs -0 rm -rf
18
- fi
19
-
20
- bundle install --path vendor/gems --without ignore
@@ -1,19 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- if [ -z "$(which cabal)" ]; then
5
- echo "A local cabal installation is required for cabal development." >&2
6
- exit 127
7
- fi
8
-
9
- cabal --version
10
-
11
- # setup test fixtures
12
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
13
- cd $BASE_PATH/test/fixtures/cabal
14
-
15
- if [ "$1" == "-f" ]; then
16
- find . -not -regex "\.*" -and -not -path "*app*" -print0 | xargs -0 rm -rf
17
- fi
18
-
19
- (cabal new-update && cabal new-build) || (cabal update && cabal install)
@@ -1,38 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- if [ -z "$(which php)" ]; then
5
- echo "A local php installation is required for php development." >&2
6
- exit 127
7
- fi
8
-
9
- # setup test fixtures
10
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
11
- cd $BASE_PATH/test/fixtures/composer
12
-
13
- if [ "$1" == "-f" ]; then
14
- find . -not -regex "\.*" -and -not -name "composer\.json" -print0 | xargs -0 rm -rf
15
- fi
16
-
17
- if [ ! -f "composer.phar" ]; then
18
- EXPECTED_SIGNATURE="$(curl -s https://composer.github.io/installer.sig)"
19
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
20
- ACTUAL_SIGNATURE="$(php -r "echo hash_file('sha384', 'composer-setup.php');")"
21
-
22
- if [ "$EXPECTED_SIGNATURE" != "$ACTUAL_SIGNATURE" ]; then
23
- >&2 echo 'ERROR: Invalid installer signature'
24
- rm composer-setup.php
25
- exit 1
26
- fi
27
-
28
- php composer-setup.php
29
- RESULT=$?
30
- rm composer-setup.php
31
-
32
- if [ $RESULT -ne 0 ]; then
33
- >&2 echo 'ERROR: composer.phar installation failed'
34
- exit $RESULT
35
- fi
36
- fi
37
-
38
- php composer.phar install
@@ -1,39 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- # setup test fixtures
5
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
6
- cd $BASE_PATH/test/fixtures/git_submodule
7
-
8
- FIXTURES="$(pwd)/nested $(pwd)/submodule $(pwd)/project"
9
- SUBMODULE=""
10
- echo "setting up git_submodule test fixtures"
11
- for fixture in $FIXTURES; do
12
- if [ "$1" == "-f" ]; then
13
- rm -rf $fixture
14
- fi
15
-
16
- mkdir -p $fixture
17
- pushd $fixture >/dev/null
18
-
19
- # fixture is already set up, use "-f" to force a refresh
20
- if [ -e ".git" ]; then
21
- continue
22
- fi
23
-
24
- git init -q .
25
- cp $BASE_PATH/LICENSE .
26
- git add LICENSE
27
- git commit -q -m "init"
28
-
29
- if [ -n "$SUBMODULE" ] ; then
30
- git submodule add -q "$SUBMODULE" "vendor/$(basename $SUBMODULE)"
31
- git submodule update --recursive --init -q
32
- git add . && git commit -q -m "update submodule"
33
- fi
34
-
35
- echo "$(basename $fixture) created"
36
-
37
- SUBMODULE="$(pwd)"
38
- popd >/dev/null
39
- done
@@ -1,31 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- if [ -z "$(which go)" ]; then
5
- echo "A local Go installation is required for go development." >&2
6
- exit 127
7
- fi
8
-
9
- # setup test fixtures
10
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
11
- export GOPATH="$BASE_PATH/test/fixtures/go"
12
- cd $BASE_PATH/test/fixtures/go
13
-
14
- if [ "$1" == "-f" ]; then
15
- find . -not -regex "\.*" \
16
- -and -not -path "*/src/test*" \
17
- -and -not -path "*/src/modules_test*" \
18
- -and -not -path "*/pkg/mod*" \
19
- -and -not -path "*/pkg" \
20
- -and -not -path "*/src" \
21
- -print0 | xargs -0 rm -rf
22
-
23
- if go help mod >/dev/null; then
24
- go clean -modcache
25
- fi
26
- fi
27
-
28
- (export GO111MODULE=off && cd src/test && go get)
29
- if go help mod >/dev/null; then
30
- (cd src/modules_test && GO111MODULE=on go mod download)
31
- fi
@@ -1,19 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- if [ -z "$(which mix)" ]; then
5
- echo "A local mix installation is required for elixir development." >&2
6
- exit 127
7
- fi
8
-
9
- # setup test fixtures
10
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
11
- cd $BASE_PATH/test/fixtures/mix
12
-
13
- if [ "$1" == "-f" ]; then
14
- echo "removing old fixture setup..."
15
- mix deps.clean --all || true
16
- mix clean || true
17
- fi
18
-
19
- mix deps.get
@@ -1,34 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- if [ -z "$(which npm)" ]; then
5
- echo "A local npm installation is required for npm development." >&2
6
- exit 127
7
- fi
8
-
9
- # setup test fixtures
10
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
11
- cd $BASE_PATH/test/fixtures/npm
12
-
13
- FORCE=""
14
- if [ "$1" == "-f" ]; then
15
- FORCE=1
16
- fi
17
-
18
- NPM_MAJOR_VERSION="$(npm -v | cut -d'.' -f1)"
19
- if [ "$NPM_MAJOR_VERSION" -ge "7" ]; then
20
- PACKAGE_JSON_SRC="package.json.npm7"
21
- else
22
- PACKAGE_JSON_SRC="package.json.npm6"
23
- fi
24
-
25
- if [ ! -f "package.json" ] || [ "$(cat package.json | md5sum )" != "$(cat "$PACKAGE_JSON_SRC" | md5sum)" ]; then
26
- FORCE=1
27
- cp -f "$PACKAGE_JSON_SRC" package.json
28
- fi
29
-
30
- if [ -n "$FORCE" ]; then
31
- find . -not -regex "\.*" -and -not -name "package\.json*" -print0 | xargs -0 rm -rf
32
- fi
33
-
34
- npm install
@@ -1,17 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- if [ -z "$(which dotnet)" ]; then
5
- echo "A local dotnet installation is required for dotnet/nuget development." >&2
6
- exit 127
7
- fi
8
-
9
- # setup test fixtures
10
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
11
- cd $BASE_PATH/test/fixtures/nuget
12
-
13
- if [ "$1" == "-f" ]; then
14
- dotnet clean
15
- fi
16
-
17
- dotnet restore
@@ -1,29 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- if [ -z "$(which pip)" ]; then
5
- echo "A local pip installation is required for python development." >&2
6
- exit 127
7
- fi
8
-
9
- if [ -z "$(which virtualenv)" ]; then
10
- echo "A local virtualenv installation is required for python development." >&2
11
- exit 127
12
- fi
13
-
14
-
15
- # setup test fixtures
16
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
17
-
18
-
19
- # clean up any previous fixture venv that might have been created.
20
- if [ "$1" == "-f" ]; then
21
- echo "removing old fixture setup..."
22
- rm -rf $BASE_PATH/test/fixtures/pip/venv
23
- fi
24
-
25
- # set up a virtualenv and install the packages in the test requirements
26
- virtualenv $BASE_PATH/test/fixtures/pip/venv
27
- . $BASE_PATH/test/fixtures/pip/venv/bin/activate
28
- pip install -r $BASE_PATH/test/fixtures/pip/requirements.txt
29
- deactivate
@@ -1,21 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- if [ -z "$(which pipenv)" ]; then
5
- echo "A local pipenv installation is required for python development." >&2
6
- exit 127
7
- fi
8
-
9
-
10
- # setup test fixtures
11
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
12
- cd $BASE_PATH/test/fixtures/pipenv
13
-
14
- # clean up any previous fixture venv that might have been created.
15
- if [ "$1" == "-f" ]; then
16
- echo "removing old fixture setup..."
17
- pipenv --rm || true
18
- fi
19
-
20
- # set up a virtualenv and install the packages in the test requirements
21
- pipenv update
@@ -1,22 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- if [ -z "$(which swift)" ]; then
5
- echo "A local swift installation is required for swift development." >&2
6
- exit 127
7
- fi
8
-
9
- swift --version
10
-
11
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
12
- cd $BASE_PATH/test/fixtures/swift
13
-
14
- if [ "$1" == "-f" ]; then
15
- find . -not -regex "\.*" \
16
- -and -not -path "*/Package.swift" \
17
- -and -not -path "*/Sources*" \
18
- -and -not -path "*/Tests*" \
19
- -print0 | xargs -0 rm -rf
20
- fi
21
-
22
- swift package resolve
@@ -1,17 +0,0 @@
1
- #!/bin/bash
2
- set -e
3
-
4
- if [ -z "$(which yarn)" ]; then
5
- echo "A local yarn installation is required for yarn development." >&2
6
- exit 127
7
- fi
8
-
9
- # setup test fixtures
10
- BASE_PATH="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
11
- cd $BASE_PATH/test/fixtures/yarn
12
-
13
- if [ "$1" == "-f" ]; then
14
- find . -not -regex "\.*" -and -not -name "package\.json" -print0 | xargs -0 rm -rf
15
- fi
16
-
17
- yarn install
data/script/test DELETED
@@ -1,16 +0,0 @@
1
- #!/bin/bash
2
-
3
- set -e
4
-
5
- if [ "$#" -gt "0" ] ; then
6
- if [ -f "$1" ]; then
7
- # argument was a file, run it's tests only
8
- bundle exec rake test TEST="$1"
9
- else
10
- # argument was not a file, execute it as a test suite identifier
11
- bundle exec rake test:"$1"
12
- fi
13
- else
14
- # no arguments, run all tests
15
- bundle exec rake test
16
- fi