Skip to content

Latest commit

 

History

History
116 lines (90 loc) · 3.57 KB

BUILD.adoc

File metadata and controls

116 lines (90 loc) · 3.57 KB

Installing the gem

asciibuild is available on Ruby Gems by just installing from the internet:

Install with gem
gem install asciibuild

Building with gem

asciibuild is packaged as a gem. Build and install it from source using gem build and gem install. For convenience, there is a make target that will perform both steps.

Build and Install with make
git clone git@github.com:jbrisbin/asciibuild.git
cd asciibuild
make gem

Or you can perform the steps separately.

Build the gem
gem build asciibuild.gemspec
gem install asciibuild-*.gem

Building with Bundler

Building asciibuild can be done with bundler. The included Gemfile contains the necessary configuration to build and install asciibuild using a simple bundle install.

Build asciibuild itself
> make install
rm -Rf *.gem vendor *.log metastore_db Dockerfile Gemfile.lock
gem uninstall -x asciibuild
bundle install
Fetching gem metadata from https://rubygems.org/.........
Fetching version metadata from https://rubygems.org/.
Resolving dependencies...
Using asciidoctor 1.5.4
Using mustache 1.0.3
Using posix-spawn 0.3.11
Using yajl-ruby 1.2.1
Using bundler 1.13.1
Using pygments.rb 0.6.3
Using asciibuild 0.1.0 from source at `.`
Bundle complete! 4 Gemfile dependencies, 7 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.

This installs the necessary dependencies, as well as the asciibuild gem with bundler. In order to execute asciibuild installed this way, you must invoke it with bundle exec asciibuild. An example invocation can be found in the Makefile. See the USAGE document for more on running asciibuild.

Building with Docker

If you’re using rbenv [1] or rvm [2] to manage your Ruby environments, then it may not matter to you to have asciibuild installed globally. As an alternative to installing asciibuild globally, you can use a Docker image to process documents (assuming the image contains anything you’re likely to need to run from any of your listing blocks like bash, python, or what have you).

Note
This is an asciibuild-enabled file. You can change the variables defined here by passing -a flags when running asciibuild on this file.
Variables
  • workdir = /tmp/asciibuild

Alpine-based Docker container
FROM alpine
RUN apk add --no-cache bash make build-base ruby ruby-rdoc ruby-irb ruby-bundler ruby-dev py-pip docker
RUN pip install pygments

RUN mkdir -p {{workdir}}
COPY . {{workdir}}/
WORKDIR {{workdir}}
RUN bundle install
RUN gem build asciibuild.gemspec
RUN gem install ./asciibuild-*.gem -l
RUN rm -Rf {{workdir}}
RUN apk del build-base make ruby-dev

VOLUME /usr/src
WORKDIR /usr/src

ENTRYPOINT ["asciibuild"]

Build the Docker image that can run asciibuild by using docker build:

Docker build
docker build -t asciibuild .

If you’ve bootstrapped asciibuild by running one of Building with gem or Building with Bundler to install it, you can later run the build with asciibuild on this file.

Docker build using asciibuild installed via gem
asciibuild doc/BUILD.adoc
Docker build using asciibuild installed via bundler
bundle exec asciibuild doc/BUILD.adoc

For documentation on how to run asciibuild after it’s installed, see the USAGE document.