Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Minor fixes to scripts/setrubyenv.sh #4

Merged
merged 1 commit into from

2 participants

@citizen428

It's not much, but while I try to get more into owtf I'll try to fix/improve small things I see, and since I'm usually a Ruby developer this script got my attention.

@7a 7a merged commit 9c50c07 into owtf:master
@7a
Owner
7a commented

Terrific thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 13, 2012
  1. @citizen428
This page is out of date. Refresh to see the latest.
Showing with 25 additions and 13 deletions.
  1. +25 −13 scripts/setrubyenv.sh
View
38 scripts/setrubyenv.sh
@@ -7,10 +7,10 @@
# owtf is an OWASP+PTES-focused try to unite great tools and facilitate pen testing
# Copyright (c) 2011, Abraham Aranguren <name.surname@gmail.com> Twitter: @7a_ http://7-a.org
# All rights reserved.
-#
+#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
-# * Redistributions of source code must retain the above copyright
+# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
@@ -18,7 +18,7 @@
# * Neither the name of the copyright owner nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
-#
+#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
@@ -31,26 +31,38 @@
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
+# TODO: replace Ruby 1.9.2 with 1.9.3
+
+SCRIPT=`basename $0`
+
if [ $# -ne 1 ]; then
- echo "Syntax: $0 <ruby_version: 1.8, 1.9.2>"
- echo
- echo "Examples:"
- echo "- Set ruby 1.8: $0 1.8"
- echo "- Set ruby 1.9.2: $0 1.9.2"
- exit
+ cat <<-EOF
+ Usage: $SCRIPT <ruby_version: 1.8, 1.9.2>
+
+ Examples:
+ - Set ruby 1.8: $SCRIPT 1.8
+ - Set ruby 1.9.2: $SCRIPT 1.9.2
+EOF
+ exit
fi
VERSION=$1
-echo $VERSION
+echo "* Switching to Ruby $VERSION..."
OPTION="1"
-if [ '1.9.2' == $VERSION ]; then
- OPTION="2"
+if [ $VERSION == '1.9.2' ]; then
+ OPTION="2"
fi
# Export version gem paths
export GEM_PATH=/var/lib/gems/$VERSION/gems
export GEM_HOME=/var/lib/gems/$VERSION/gems
+
# Pick ruby version
-#(sleep 2 ; echo $OPTION) | update-alternatives --config ruby > /dev/null
(sleep 2 ; echo $OPTION) | update-alternatives --config ruby
+
+if [ -z $? ] ; then
+ echo "* Successfully switched to Ruby $VERSION."
+else
+ echo "* Could not switch to Ruby $VERSION."
+fi
Something went wrong with that request. Please try again.