Skip to content

Commit

Permalink
Move scripts to a new scripts/ directory
Browse files Browse the repository at this point in the history
  • Loading branch information
ElvishJerricco committed Mar 4, 2018
1 parent 2223244 commit bc2b93f
Show file tree
Hide file tree
Showing 39 changed files with 78 additions and 67 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,5 @@ jobs:
command: echo "Yes" | ./try-reflex --command "exit 0"
no_output_timeout: 3600

- run: ./benchmark
- run: ./test -j 2
- run: ./scripts/benchmark
- run: ./scripts/test -j 2
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ Fork, then clone the repo:

Make sure the tests pass:

./test
./scripts/test

Make your change. Don't forget to add tests and documentation for your change! Stage or commit your changes locally, and make sure the tests pass:

./test-staged
./scripts/test-staged

Push to your fork and [submit a pull request][pr].

Expand Down
8 changes: 4 additions & 4 deletions HACKING.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Hacking on the Reflex Platform
To work on a particular package, use the work-on script **instead of** `./try-reflex`:

```
~/reflex-platform/work-on ghcjs ./your-project
~/reflex-platform/scripts/work-on ghcjs ./your-project
```

This will use your package's cabal file to determine dependencies. If you have a default.nix, it will use that instead. Note that your project's path must include at least one slash ('/') so that work-on can detect that it is a path, rather than a package name.
Expand Down Expand Up @@ -33,7 +33,7 @@ Checking out a sub-repo
The `hack-on` script is provided for conveniently checking out a sub-repository.

```
./hack-on reflex
./scripts/hack-on reflex
```

This will check out the same version of `reflex` currently being used by the Reflex Platform. Note that `reflex`, here, is a path relative to the current directory, so you must be in this folder when you execute this.
Expand All @@ -43,15 +43,15 @@ Once the repository is checked out, you can make modifications to it, which will
When you have completed some work hacking on the sub-repository, you can use the `hack-add` script to check your changes into this repository without needing to delete the repository, like so:

```
./hack-add reflex
./scripts/hack-add reflex
```

You can then commit and push reflex-platform without needing to delete the sub-repository.

When you are completely done with a sub-repository, you can remove it using `hack-off`:

```
./hack-off reflex
./scripts/hack-off reflex
```

This will remove the repository and replace the `default.nix` and `git.json` files that were pointing to it before running `hack-on`.
8 changes: 0 additions & 8 deletions benchmark

This file was deleted.

2 changes: 1 addition & 1 deletion default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ let iosSupport =
configurePhase = "true";
buildPhase = "true";
target_prefix = stdenv.lib.replaceStrings ["-"] ["_"] p.targetPlatform.config;
setupHook = ./setup-hook-ios.sh;
setupHook = ./scripts/setup-hook-ios.sh;

installPhase = ''
mkdir -p $out/
Expand Down
File renamed without changes.
4 changes: 3 additions & 1 deletion ios/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -354,7 +354,9 @@ nixpkgs.runCommand "${executableName}-app" (rec {
chmod +w "$tmpdir/${executableName}.app"
mkdir -p "$tmpdir/${executableName}.app/config"
cp "$1" "$tmpdir/${executableName}.app/config/route"
focus/reflex-platform/run-in-ios-sim "$tmpdir/${executableName}.app"
# focus????
focus/reflex-platform/scripts/run-in-ios-sim "$tmpdir/${executableName}.app"
'';
}) ''
set -x
Expand Down
6 changes: 0 additions & 6 deletions push

This file was deleted.

File renamed without changes.
8 changes: 8 additions & 0 deletions scripts/benchmark
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

cd "$DIR"

"$(nix-build ./scripts/benchmark.nix)"
2 changes: 1 addition & 1 deletion benchmark.nix → scripts/benchmark.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ reflex-platform ? import ./. {} }:
{ reflex-platform ? import ./.. {} }:
let pkgs = reflex-platform.nixpkgs;
in pkgs.writeScript "benchmark.sh" ''
#!/usr/bin/env bash
Expand Down
4 changes: 3 additions & 1 deletion bump-nix-installer.sh → scripts/bump-nix-installer.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

echo "Updating installNix.sh with the latest official version"
echo ""
curl https://nixos.org/nix/install > installNix.sh
curl https://nixos.org/nix/install > $DIR/scripts/installNix.sh
echo ""
echo "Done"
echo "Consider committing installNix.sh"
7 changes: 4 additions & 3 deletions cache → scripts/cache
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

CONFIG_DIR="$HOME/.reflex-platform"

Expand All @@ -13,7 +13,8 @@ trap "rm -rf \"$TMPDIR\"" EXIT
(
cd "$DIR"

nix-push --dest "$TMPDIR" --key-file ~/.reflex-platform/ryantrinkle.com-1 "$(nix-instantiate $NIXOPTS --add-root "$DIR/gc-roots/cache.drv" --indirect ./cache.nix "$@")"
# TODO: Rewrite this for Nix 2.0; nix-push is gone
nix-push --dest "$TMPDIR" --key-file ~/.reflex-platform/ryantrinkle.com-1 "$(nix-instantiate $NIXOPTS --add-root "$DIR/gc-roots/cache.drv" --indirect ./scripts/cache.nix "$@")"

sed -i '/^\(System\|Deriver\): /d' "$TMPDIR/"*.narinfo # Get rid of these, because they can vary in apparently-meaningless between systems

Expand Down
6 changes: 3 additions & 3 deletions cache.nix → scripts/cache.nix
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
with import ./. {};
with import ./.. {};
let inherit (nixpkgs.lib) optionals;
inputs = builtins.concatLists [
(builtins.attrValues sources)
(map (system: (import ./. { inherit system; iosSupportForce = true; }).tryReflexShell) cacheTargetSystems)
(map (system: (import ./.. { inherit system; iosSupportForce = true; }).tryReflexShell) cacheTargetSystems)
];
getOtherDeps = reflexPlatform: [
reflexPlatform.stage2Script
Expand All @@ -17,6 +17,6 @@ let inherit (nixpkgs.lib) optionals;
]
);
otherDeps = builtins.concatLists (
map (system: getOtherDeps (import ./. { inherit system; })) cacheTargetSystems
map (system: getOtherDeps (import ./.. { inherit system; })) cacheTargetSystems
) ++ [(import ./benchmark.nix {})];
in pinBuildInputs "reflex-platform" inputs otherDeps
2 changes: 1 addition & 1 deletion common-setup.sh → scripts/common-setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ if [ ! -d /nix ]; then
fi

echo "In order to continue, $0 must install the Nix package manager. This requires root access, so you will be prompted for your password. If you do not wish to continue, just hit Ctrl-C at the password prompt."
./installNix.sh
./scripts/installNix.sh
fi

)
Expand Down
4 changes: 2 additions & 2 deletions docs-for → scripts/docs-for
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

if [[ $# -eq 0 ]] ; then
echo "Usage: $0 <packagename> [<packagename...>]"
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions hack-add → scripts/hack-add
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

REPO="$1"

Expand Down
4 changes: 2 additions & 2 deletions hack-off → scripts/hack-off
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

REPO="$1"

Expand Down
4 changes: 2 additions & 2 deletions hack-on → scripts/hack-on
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

REPO="$(echo "$1" | sed 's_/$__')"

Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions prof-huge-table-with → scripts/prof-huge-table-with
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

REV="$1"

Expand Down
10 changes: 10 additions & 0 deletions scripts/push
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

cd $DIR

./scripts/test-staged
./scripts/cache
git push
4 changes: 2 additions & 2 deletions run-in-commit → scripts/run-in-commit
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ set -euo pipefail
REV="$1"
shift

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

CLEAN=$(mktemp -d 2>/dev/null || mktemp -d -t 'clean') # This crazy workaround ensures that it will work on both Mac OS and Linux; see https://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x
trap "rm -rf \"$CLEAN\"" EXIT
Expand Down
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions setup → scripts/setup
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

# Nothing to do; common-setup will ensure things are set up
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions test → scripts/test
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

nix-shell $NIXOPTS -E "{path}: let this = import path {}; in this.nixpkgs.runCommand \"shell\" { buildInputs = [ (this.ghc.ghcWithPackages (p: with p; [ shelly hspec ])) ]; } \"\"" --argstr path "$DIR/." --show-trace --command "runghc $(printf "%q " "$DIR/test.hs" "$@") ; exit $?"
nix-shell $NIXOPTS -E "{path}: let this = import path {}; in this.nixpkgs.runCommand \"shell\" { buildInputs = [ (this.ghc.ghcWithPackages (p: with p; [ shelly hspec ])) ]; } \"\"" --argstr path "$DIR/." --show-trace --command "runghc $(printf "%q " "$DIR/scripts/test.hs" "$@") ; exit $?"
6 changes: 3 additions & 3 deletions test-staged → scripts/test-staged
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

(
CLEAN=$(mktemp -d 2>/dev/null || mktemp -d -t 'clean') # This crazy workaround ensures that it will work on both Mac OS and Linux; see https://unix.stackexchange.com/questions/30091/fix-or-alternative-for-mktemp-in-os-x
Expand All @@ -19,5 +19,5 @@ fi

cd $CLEAN

nice ./test "$@"
nice ./scripts/test "$@"
)
File renamed without changes.
8 changes: 5 additions & 3 deletions update → scripts/update
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

cd $DIR

NIX_PREFETCH_GIT="$(nix-build "$DIR/nixpkgs" -A nix-prefetch-scripts)/bin/nix-prefetch-git"

$NIX_PREFETCH_GIT git://github.com/ghcjs/shims > shims/git.json
$NIX_PREFETCH_GIT git://github.com/ghcjs/ghcjs > ghcjs/git.json
$NIX_PREFETCH_GIT --fetch-submodules git://github.com/ghcjs/ghcjs-boot > ghcjs-boot/git.json

./test
./scripts/test
6 changes: 3 additions & 3 deletions uploadDocs → scripts/uploadDocs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

HACKAGE_USER="$1"
PKG="$2"

#TODO: Check that this build corresponds to the one on hackage
RC="$(nix-build --no-out-link -A "releaseCandidates.$PKG")"
RC="$(nix-build $DIR --no-out-link -A "releaseCandidates.$PKG")"
PKGNAME="$(cat "$RC/pkgname")"

echo -n "Hackage password: "
Expand Down
6 changes: 3 additions & 3 deletions uploadReleaseCandidate → scripts/uploadReleaseCandidate
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

HACKAGE_USER="$1"
PKG="$2"

RC="$(nix-build --no-out-link -A "releaseCandidates.$PKG")"
RC="$(nix-build $DIR --no-out-link -A "releaseCandidates.$PKG")"
PKGNAME="$(cat "$RC/pkgname")"

echo -n "Hackage password: "
Expand Down
4 changes: 2 additions & 2 deletions work-on → scripts/work-on
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

if [ "$#" -lt 2 ] ; then
echo "Usage: $0 PLATFORM PACKAGE ..."
Expand All @@ -13,7 +13,7 @@ if [ "$#" -lt 2 ] ; then
exit 1
fi

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

PLATFORM="$1"
shift
Expand Down
4 changes: 2 additions & 2 deletions work-on-multi → scripts/work-on-multi
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )/.." && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

PLATFORM="$1"
shift
Expand Down
2 changes: 1 addition & 1 deletion try-reflex
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ set -euo pipefail

DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )

. "$DIR/common-setup.sh"
. "$DIR/scripts/common-setup.sh"

ROOT_PERMISSION_FIX_SUGGESTION="please use your operating system's \"repair permissions\" feature, if it has one, or manually remove write permissions for your user from the '/' directory."

Expand Down

0 comments on commit bc2b93f

Please sign in to comment.