Makefile 1.25 KB
VERSION = 1.3
TARBALL = noosfero-deps-$(VERSION).tar.gz
PREFIX = /usr
WGET = wget
NOOSFERO_BRANCH = master
BUNDLE_OPTS = --verbose --without='development test cucumber'

all:
	bundle install $(BUNDLE_OPTS) --local --deployment
	grep -rl '/usr/local/bin/ruby' vendor/bundle/ruby/gems/*/ | xargs --no-run-if-empty sed -i -e '1,2 s|.*|#!/usr/bin/env ruby|'
	grep -rl '/this/will/be/overwritten/or/wrapped/anyways/do/not/worry/ruby' vendor/bundle/ruby/gems/*/bin | xargs --no-run-if-empty sed -i -e '1 s|.*|#!/usr/bin/env ruby|'
dist: $(TARBALL)

$(TARBALL):
	(git archive --prefix=noosfero-deps-$(VERSION)/ HEAD | gzip > $@) || ($(RM) $@; false)

install: all
	mkdir -p                        $(DESTDIR)$(PREFIX)/lib/noosfero/vendor
	install -m 0644 Gemfile         $(DESTDIR)$(PREFIX)/lib/noosfero
	install -m 0644 Gemfile.lock    $(DESTDIR)$(PREFIX)/lib/noosfero
	cp -r .bundle                   $(DESTDIR)$(PREFIX)/lib/noosfero/.bundle
	cp -r vendor/bundle             $(DESTDIR)$(PREFIX)/lib/noosfero/vendor/bundle

update: clean
	$(WGET) -O Gemfile https://gitlab.com/noosfero/noosfero/raw/$(NOOSFERO_BRANCH)/Gemfile
	$(RM) Gemfile.lock
	$(MAKE) bundle

bundle:
	bundle install $(BUNDLE_OPTS) --path vendor/bundle
	bundle package

clean:
	$(RM) -r .bundle/ vendor/bundle/ $(TARBALL)