Created
October 14, 2019 05:18
-
-
Save egeneralov/8bac1a54bd2fc2a256c066c06841e9e2 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| mkdir hello_app | |
| cd hello_app | |
| echo '#!/usr/bin/env ruby' > hello.rb | |
| echo 'puts "hello world"' >> hello.rb | |
| ruby hello.rb | |
| mkdir -p hello-1.0.0-linux-x86/lib/app | |
| cp hello.rb hello-1.0.0-linux-x86/lib/app/ | |
| mkdir -p hello-1.0.0-linux-x86_64/lib/app | |
| cp hello.rb hello-1.0.0-linux-x86_64/lib/app/ | |
| mkdir -p hello-1.0.0-osx/lib/app/ | |
| cp hello.rb hello-1.0.0-osx/lib/app/ | |
| mkdir packaging | |
| cd packaging | |
| curl -L -O --fail https://d6r77u77i8pq3.cloudfront.net/releases/traveling-ruby-20141215-2.1.5-linux-x86.tar.gz | |
| curl -L -O --fail https://d6r77u77i8pq3.cloudfront.net/releases/traveling-ruby-20141215-2.1.5-linux-x86_64.tar.gz | |
| curl -L -O --fail https://d6r77u77i8pq3.cloudfront.net/releases/traveling-ruby-20141215-2.1.5-osx.tar.gz | |
| cd .. | |
| mkdir hello-1.0.0-linux-x86/lib/ruby && tar -xzf packaging/traveling-ruby-20141215-2.1.5-linux-x86.tar.gz -C hello-1.0.0-linux-x86/lib/ruby | |
| mkdir hello-1.0.0-linux-x86_64/lib/ruby && tar -xzf packaging/traveling-ruby-20141215-2.1.5-linux-x86_64.tar.gz -C hello-1.0.0-linux-x86_64/lib/ruby | |
| mkdir hello-1.0.0-osx/lib/ruby && tar -xzf packaging/traveling-ruby-20141215-2.1.5-osx.tar.gz -C hello-1.0.0-osx/lib/ruby | |
| cd hello-1.0.0-osx | |
| ./lib/ruby/bin/ruby lib/app/hello.rb | |
| # => hello world | |
| cd .. | |
| cat << EOF > packaging/wrapper.sh | |
| #!/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" | |
| EOF | |
| chmod +x packaging/wrapper.sh | |
| cp packaging/wrapper.sh hello-1.0.0-linux-x86/hello | |
| cp packaging/wrapper.sh hello-1.0.0-linux-x86_64/hello | |
| cp packaging/wrapper.sh hello-1.0.0-osx/hello | |
| tar -czf hello-1.0.0-linux-x86.tar.gz hello-1.0.0-linux-x86 | |
| tar -czf hello-1.0.0-linux-x86_64.tar.gz hello-1.0.0-linux-x86_64 | |
| tar -czf hello-1.0.0-osx.tar.gz hello-1.0.0-osx | |
| # rm -rf hello-1.0.0-linux-x86 | |
| # rm -rf hello-1.0.0-linux-x86_64 | |
| # rm -rf hello-1.0.0-osx | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment