diff --git a/bin/rbenv-bundler-ruby-version b/bin/rbenv-bundler-ruby-version index c42906e..8da7e77 100755 --- a/bin/rbenv-bundler-ruby-version +++ b/bin/rbenv-bundler-ruby-version @@ -29,7 +29,7 @@ version_from_gemfile() { -e 's/engine:/:engine =>/' -e 's/engine_version:/:engine_version =>/' \ -e "s/.*:engine *=> *['\"]\([^'\"]*\).*:engine_version *=> *['\"]\([^'\"]*\).*/\1-\2/" \ -e "s/.*:engine_version *=> *['\"]\([^'\"]*\).*:engine *=> *['\"]\([^'\"]*\).*/\2-\1/" \ - -e "s/ *ruby ['\"]\([^'\"]*\).*/\1/" | + -e "s/ *ruby *['\"]\([^'\"]*\).*/\1/" | head -1 } diff --git a/test/bundler-ruby-version.bats b/test/bundler-ruby-version.bats index b6d1821..ddd8de3 100644 --- a/test/bundler-ruby-version.bats +++ b/test/bundler-ruby-version.bats @@ -13,7 +13,7 @@ load test_helper @test 'Recognize simple ruby version in single quotes with leading spaces' { mkdir -p "$EXAMPLE_APP_DIR" cd "$EXAMPLE_APP_DIR" - echo " ruby '1.2.3'" > "$EXAMPLE_APP_DIR/Gemfile" + echo " ruby '1.2.3'" > "$EXAMPLE_APP_DIR/Gemfile" run rbenv bundler-ruby-version assert_success '1.2.3' }