From 247778b8677c82b2cb0749538061e01560b54261 Mon Sep 17 00:00:00 2001 From: Renato Silva Date: Tue, 2 Dec 2014 22:02:45 -0200 Subject: [PATCH] Use subfolders for each implementation. --- easyoptions.sh => bash/easyoptions.sh | 0 example.sh => bash/example.sh | 5 +++-- easyoptions | 2 +- install.sh | 4 ++-- .rubocop.yml => ruby/.rubocop.yml | 0 easyoptions.gemspec => ruby/easyoptions.gemspec | 0 easyoptions.rb => ruby/easyoptions.rb | 0 example.rb => ruby/example.rb | 0 8 files changed, 6 insertions(+), 5 deletions(-) rename easyoptions.sh => bash/easyoptions.sh (100%) rename example.sh => bash/example.sh (87%) rename .rubocop.yml => ruby/.rubocop.yml (100%) rename easyoptions.gemspec => ruby/easyoptions.gemspec (100%) rename easyoptions.rb => ruby/easyoptions.rb (100%) rename example.rb => ruby/example.rb (100%) diff --git a/easyoptions.sh b/bash/easyoptions.sh similarity index 100% rename from easyoptions.sh rename to bash/easyoptions.sh diff --git a/example.sh b/bash/example.sh similarity index 87% rename from example.sh rename to bash/example.sh index 3127215..0700d24 100644 --- a/example.sh +++ b/bash/example.sh @@ -20,8 +20,9 @@ ## used instead. Short version is not available in this ## format. - source easyoptions || exit # Ruby implementation -# source easyoptions.sh || exit # Bash implementation, slower + script_dir=$(dirname "$BASH_SOURCE") + source "${script_dir}/../easyoptions" || exit # Ruby implementation +# source "${script_dir}/easyoptions.sh" || exit # Bash implementation, slower # Boolean and parameter options [[ -n "$some_option" ]] && echo "Option specified: --some-option" diff --git a/easyoptions b/easyoptions index 7c4e0d5..c7c9f9a 100644 --- a/easyoptions +++ b/easyoptions @@ -24,4 +24,4 @@ ## script_dir=$(dirname "$BASH_SOURCE") -eval "$(PATH="$PATH:/usr/lib/ruby/vendor_ruby:${script_dir}" from="$0" easyoptions.rb "$@" || echo exit 1)" +eval "$(PATH="$PATH:/usr/lib/ruby/vendor_ruby:${script_dir}/ruby" from="$0" easyoptions.rb "$@" || echo exit 1)" diff --git a/install.sh b/install.sh index c83a48c..13e98d5 100644 --- a/install.sh +++ b/install.sh @@ -6,8 +6,8 @@ mkdir -p "$where" || exit if [[ "$2" != --remove ]]; then cp -v "$from/easyoptions" "$where" - cp -v "$from/easyoptions.sh" "$where" - cp -v "$from/easyoptions.rb" "$where" + cp -v "$from/bash/easyoptions.sh" "$where" + cp -v "$from/ruby/easyoptions.rb" "$where" else rm -vf "$where/easyoptions" rm -vf "$where/easyoptions.sh" diff --git a/.rubocop.yml b/ruby/.rubocop.yml similarity index 100% rename from .rubocop.yml rename to ruby/.rubocop.yml diff --git a/easyoptions.gemspec b/ruby/easyoptions.gemspec similarity index 100% rename from easyoptions.gemspec rename to ruby/easyoptions.gemspec diff --git a/easyoptions.rb b/ruby/easyoptions.rb similarity index 100% rename from easyoptions.rb rename to ruby/easyoptions.rb diff --git a/example.rb b/ruby/example.rb similarity index 100% rename from example.rb rename to ruby/example.rb