Skip to content

Commit

Permalink
Install ruby tools into ./vendor and add scripting in Makefile
Browse files Browse the repository at this point in the history
I have a go tool named bundle installed via macports which gets in the
way of using ruby bundle in the usual way.
  • Loading branch information
bdarnell committed Jun 8, 2017
1 parent 9b8b411 commit fa7f1d8
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ Railroad.jar
.sass-cache
_site
.jekyll-metadata
bootstrap
vendor/
7 changes: 3 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ The CockroachDB docs are open source just like the database itself. We welcome y

``` shell
$ cd path/to/docs
$ gem install bundler
$ bundle
$ make bootstrap
```

3. Learn the essentials of our [Docs Structure](#docs-structure).
Expand Down Expand Up @@ -299,7 +298,7 @@ Once you've installed Jekyll and have a local clone of the docs repository, you
1. From the root directory of your clone, run:

``` shell
$ jekyll serve --incremental
$ make serve
```

2. Point your browser to `http://127.0.0.1:4000/docs/` and manually check your changes.
Expand All @@ -313,5 +312,5 @@ Once you've installed Jekyll and have a local clone of the docs repository, you
3. Run automated tests against the Jekyll-generate HTML files to check for problems (broken links, missing alt texts for images, etc.):

``` shell
$ htmlproofer ./_site --allow-hash-href true
$ make test
```
35 changes: 34 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,28 @@
# implied. See the License for the specific language governing
# permissions and limitations under the License.

# Install all our ruby dependencies in an isolated environment. We
# depend on gem being installed globally, but not bundler. (Go
# developers sometimes manage to install
# https://github.com/golang/tools/tree/master/cmd/bundle in a location
# that conflicts with the ruby tool of the same name)
export GEM_HOME := vendor
export PATH := $(GEM_HOME)/bin:$(PATH)

# HACK: Make has a fast path and a slow path for command execution,
# but the fast path uses the PATH variable from when make was started,
# not the one we set on the previous line. In order for the above
# line to have any effect, we must force make to always take the slow path.
# Setting the SHELL variable to a value other than the default (/bin/sh)
# is one way to do this globally.
# http://stackoverflow.com/questions/8941110/how-i-could-add-dir-to-path-in-makefile/13468229#13468229
export SHELL := $(shell which bash)
ifeq ($(SHELL),)
$(error bash is required)
endif

.PHONY: all
all: generate
all: bootstrap

# The generate target regenerates the SQL diagrams and function lists.
# It assumes that the docs repo is checked out in a $GOPATH/src directory,
Expand All @@ -22,3 +42,16 @@ all: generate
generate:
cd generate && go run main.go
cd generate && go run *.go funcs

.PHONY: serve
serve: bootstrap
bundle exec jekyll serve --incremental

.PHONY: test
test: bootstrap
bundle exec rake htmlproofer

bootstrap: Gemfile.lock
gem install bundler
bundle install
touch $@

0 comments on commit fa7f1d8

Please sign in to comment.