Skip to content

Commit

Permalink
Add first pass at local build.
Browse files Browse the repository at this point in the history
  • Loading branch information
tobyclemson committed Jan 19, 2021
1 parent 524f2af commit 3f15345
Show file tree
Hide file tree
Showing 7 changed files with 93 additions and 1 deletion.
6 changes: 6 additions & 0 deletions .envrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/usr/bin/env bash

PROJECT_DIR="$(pwd)"

PATH_add ${PROJECT_DIR}
PATH_add ${PROJECT_DIR}/node_modules/.bin
1 change: 1 addition & 0 deletions .ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
2.7.2
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source 'https://rubygems.org'

gem 'rake', '~> 13.0'
13 changes: 13 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
GEM
remote: https://rubygems.org/
specs:
rake (13.0.3)

PLATFORMS
x86_64-darwin-19

DEPENDENCIES
rake (~> 13.0)

BUNDLED WITH
2.2.6
8 changes: 8 additions & 0 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
task :default => :"contracts:compile"

namespace :contracts do
desc "Compile all contracts"
task :compile do
sh('npm run compile')
end
end
61 changes: 61 additions & 0 deletions go
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#!/usr/bin/env bash

[ -n "$GO_DEBUG" ] && set -x
set -e

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

verbose="no"
offline="no"
skip_checks="no"

missing_dependency="no"

[ -n "$GO_DEBUG" ] && verbose="yes"
[ -n "$GO_SKIP_CHECKS" ] && skip_checks="yes"
[ -n "$GO_OFFLINE" ] && offline="yes"


if [[ "$skip_checks" = "no" ]]; then
echo "Checking for system dependencies."
ruby_version="$(cat "$project_dir"/.ruby-version)"
if ! type ruby >/dev/null 2>&1 || ! ruby -v | grep -q "$ruby_version"; then
echo "This codebase requires Ruby $ruby_version."
missing_dependency="yes"
fi

if ! type bundler >/dev/null 2>&1; then
echo "This codebase requires Bundler."
missing_dependency="yes"
fi

if [[ "$missing_dependency" = "yes" ]]; then
echo "Please install missing dependencies to continue."
exit 1
fi

echo "All system dependencies present. Continuing."
fi

if [[ "$offline" = "no" ]]; then
echo "Installing bundler."
if [[ "$verbose" = "yes" ]]; then
gem install --no-document bundler
else
gem install --no-document bundler > /dev/null
fi

echo "Installing ruby dependencies."
if [[ "$verbose" = "yes" ]]; then
bundle install
else
bundle install > /dev/null
fi
fi

echo "Starting rake."
if [[ "$verbose" = "yes" ]]; then
time bundle exec rake --verbose "$@"
else
time bundle exec rake "$@"
fi
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "test"
},
"scripts": {
"compile": "truffle compile",
"compile": "truffle compile --all",
"test:unit": "truffle test",
"coverage": "node --max-old-space-size=4096 ./node_modules/.bin/truffle run coverage --network coverage",
"migrate-dev": "truffle migrate --network=rinkeby",
Expand Down

0 comments on commit 3f15345

Please sign in to comment.