Sha256: aeebd363f28983ef44f8c05f635dd03c754c74f6de9cd90220b78919068e05fa

Contents?: true

Size: 1.97 KB

Versions: 2

Compression:

Stored size: 1.97 KB

Contents

# Copyright (c) 2012- RightScale Inc
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
#
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

# Magic hooks that is necessary due to Bundler/RVM craziness interfering with
# our own Cucumbers. This is necessary because our Cucumber scenarios need to create a
# Ruby app that has a distinct, separate bundle from right_develop's own Gemfile, e.g. we
# need to test what happens when RSpec or Cucumber isn't available. Therefore the subprocesses
# that RightDevelop's Cucumber suite launches, should not inherit our bundle.
module FileUtilsBundlerMixin
  def self.included(base)
    if base.respond_to?(:sh) && !base.respond_to?(:sh_without_bundler_taint)
      base.instance_eval {
        alias_method :sh_without_bundler_taint, :sh
        alias_method :sh, :sh_with_bundler_taint
      }
    end
  end

  def sh_with_bundler_taint(*params)
    Bundler.with_clean_env do
      sh_without_bundler_taint(*params)
    end
  end
end

# Install the magic hook.
Kernel.instance_eval { include(::FileUtilsBundlerMixin) }

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
right_develop-1.2.0 features/support/file_utils_bundler_mixin.rb
right_develop-1.1.0 features/support/file_utils_bundler_mixin.rb