Skip to content
This repository has been archived by the owner on Nov 30, 2024. It is now read-only.

Create local build environment using rbenv and GNU make #111

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,7 @@ Thumbs.db

.rbenv-version
.rvmrc

Makefile.local
.cache/
.pkg/
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
source "http://rubygems.org"
gem 'jekyll', '= 0.11.0'
gem 'liquid', '= 2.2.2'
29 changes: 29 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
GEM
remote: http://rubygems.org/
specs:
albino (1.3.3)
posix-spawn (>= 0.3.6)
classifier (1.3.3)
fast-stemmer (>= 1.0.0)
directory_watcher (1.4.1)
fast-stemmer (1.0.1)
jekyll (0.11.0)
albino (>= 1.3.2)
classifier (>= 1.3.1)
directory_watcher (>= 1.1.1)
kramdown (>= 0.13.2)
liquid (>= 1.9.0)
maruku (>= 0.5.9)
kramdown (0.14.0)
liquid (2.2.2)
maruku (0.6.1)
syntax (>= 1.0.0)
posix-spawn (0.3.6)
syntax (1.0.0)

PLATFORMS
ruby

DEPENDENCIES
jekyll (= 0.11.0)
liquid (= 2.2.2)
97 changes: 97 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
ROOT=$(shell pwd)
CACHE_ROOT=${ROOT}/.cache
PKG_ROOT=${ROOT}/.pkg

-include Makefile.local

.PHONY: all
all: ${PKG_ROOT}/.stamp-h

.PHONY: shell
run: all
RBENV_ROOT="${PKG_ROOT}" "${PKG_ROOT}"/bin/rbenv exec \
jekyll --server --pygments --no-lsi --safe

.PHONY: shell
shell: all
RBENV_ROOT="${PKG_ROOT}" "${PKG_ROOT}"/bin/rbenv exec \
irb

.PHONY: mostlyclean
mostlyclean:

.PHONY: clean
clean: mostlyclean
-rm -rf "${PKG_ROOT}"

.PHONY: distclean
distclean: clean
-rm -rf "${CACHE_ROOT}"
-rm -rf Makefile.local

.PHONY: maintainer-clean
maintainer-clean: distclean
@echo 'This command is intended for maintainers to use; it'
@echo 'deletes files that may need special tools to rebuild.'

# ===--------------------------------------------------------------------===

${CACHE_ROOT}/rbenv/rbenv-0.3.0.tar.gz:
mkdir -p ${CACHE_ROOT}/rbenv
curl -L 'https://nodeload.github.com/sstephenson/rbenv/tarball/v0.3.0' >'$@'

${CACHE_ROOT}/rbenv/rbenv-gemset-0.3.0.tar.gz:
mkdir -p ${CACHE_ROOT}/rbenv
curl -L 'https://nodeload.github.com/jamis/rbenv-gemset/tarball/v0.3.0' >'$@'

${CACHE_ROOT}/rbenv/ruby-build-20120815.tar.gz:
mkdir -p ${CACHE_ROOT}/rbenv
curl -L 'https://nodeload.github.com/sstephenson/ruby-build/tarball/v20120815' >'$@'

${PKG_ROOT}/.stamp-h: Gemfile Gemfile.lock ${CACHE_ROOT}/rbenv/rbenv-0.3.0.tar.gz ${CACHE_ROOT}/rbenv/rbenv-gemset-0.3.0.tar.gz ${CACHE_ROOT}/rbenv/ruby-build-20120815.tar.gz
# Because build and run-time dependencies are not thoroughly tracked,
# it is entirely possible that rebuilding the development environment
# on top of an existing one could result in a broken build. For the
# sake of consistency and preventing unnecessary, difficult-to-debug
# problems, the entire development environment is rebuilt from scratch
# everytime this make target is selected.
${MAKE} clean

# The `${PKG_ROOT}` directory, if it exists, is removed by the `clean`
# target. This might cause problems with build scripts executed later
# which assume their existence, so they are created now if they don't
# already exist.
mkdir -p "${PKG_ROOT}"

# rbenv (and its plugins, ruby-build and rbenv-gemset) is used to build,
# install, and manage ruby environments:
tar \
-C "${PKG_ROOT}" --strip-components 1 --gzip \
-xf "${CACHE_ROOT}"/rbenv/rbenv-0.3.0.tar.gz
mkdir -p "${PKG_ROOT}"/plugins/ruby-build
tar \
-C "${PKG_ROOT}"/plugins/ruby-build --strip-components 1 --gzip \
-xf "${CACHE_ROOT}"/rbenv/ruby-build-20120815.tar.gz
mkdir -p "${PKG_ROOT}"/plugins/rbenv-gemset
tar \
-C "${PKG_ROOT}"/plugins/rbenv-gemset --strip-components 1 --gzip \
-xf "${CACHE_ROOT}"/rbenv/rbenv-gemset-0.3.0.tar.gz

# Trigger a build and install of our required ruby version, configure our
# gemset, and select ruby version & gemset environments:
- RBENV_ROOT="${PKG_ROOT}" "${PKG_ROOT}"/bin/rbenv install 1.9.3-p194
- RBENV_ROOT="${PKG_ROOT}" "${PKG_ROOT}"/bin/rbenv rehash
echo 1.9.3-p194 >.rbenv-version

# Install bundler & gemset dependencies:
RBENV_ROOT="${PKG_ROOT}" "${PKG_ROOT}"/bin/rbenv exec gem install bundler
- RBENV_ROOT="${PKG_ROOT}" "${PKG_ROOT}"/bin/rbenv rehash
RBENV_ROOT="${PKG_ROOT}" "${PKG_ROOT}"/bin/rbenv exec bundle install
- RBENV_ROOT="${PKG_ROOT}" "${PKG_ROOT}"/bin/rbenv rehash

# All done!
touch "${PKG_ROOT}"/.stamp-h

# ===--------------------------------------------------------------------===
# End of File
# ===--------------------------------------------------------------------===
2 changes: 1 addition & 1 deletion _config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# For more see: https://github.com/mojombo/jekyll/wiki/Permalinks
permalink: /:categories/:year/:month/:day/:title

exclude: [".rvmrc", ".rbenv-version", "README.md", "Rakefile", "changelog.md"]
exclude: [".rvmrc", ".rbenv-version", "Gemfile", "Gemfile.lock", "Makefile", "README.md", "Rakefile", "changelog.md", "configure"]
auto: true
pygments: true

Expand Down
7 changes: 7 additions & 0 deletions configure
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh

touch Makefile.local

# ===--------------------------------------------------------------------===
# End of File
# ===--------------------------------------------------------------------===