Permalink
Browse files

Run the app locally with Traveling Ruby

This commit adds the resources/wrapper.sh script that is
the main executable shell script of the app. It also adds
the make target to drop and recreate the OSX directory
to run the app.
  • Loading branch information...
1 parent e4c12cb commit 1ff6a6bf0ea51f0e856f352f3509490d98841f28 @adomokos committed May 23, 2016
Showing with 32 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +22 −0 Makefile
  3. +9 −0 resources/wrapper.sh
View
@@ -0,0 +1 @@
+hello-1.0.0-osx
View
@@ -0,0 +1,22 @@
+OSXDIR=hello-1.0.0-osx
+
+THIS_FILE := $(lastword $(MAKEFILE_LIST))
+
+.DEFAULT_GOAL := help
+
+run: ## Runs the code locally
+ @echo 'Run the app locally'
+ @echo '-------------------'
+ @rm -fr $(OSXDIR)
+ @mkdir -p $(OSXDIR)/lib/ruby
+ @tar -xzf resources/traveling-ruby-20150715-2.2.2-osx.tar.gz -C $(OSXDIR)/lib/ruby
+ @mkdir $(OSXDIR)/lib/app
+ @cp hello_ruby/lib/hello.rb $(OSXDIR)/lib/app/hello.rb
+ @cp resources/wrapper.sh $(OSXDIR)/hello
+ @chmod +x $(OSXDIR)/hello
+ @cd $(OSXDIR) && ./hello
+
+.PHONY: help
+
+help:
+ @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-30s\033[0m %s\n", $$1, $$2}'
@@ -0,0 +1,9 @@
+#!/bin/bash
+set -e
+
+# Figure out where this script is located.
+SELFDIR="`dirname \"$0\"`"
+SELFDIR="`cd \"$SELFDIR\" && pwd`"
+
+# Run the actual app using the bundled Ruby interpreter.
+exec "$SELFDIR/lib/ruby/bin/ruby" "$SELFDIR/lib/app/hello.rb"

0 comments on commit 1ff6a6b

Please sign in to comment.