Sha256: 464543c07d38fa68f7e43b8c14362aea0e74a4dc4d102117760ee9e4bbecf545

Contents?: true

Size: 575 Bytes

Versions: 15

Compression:

Stored size: 575 Bytes

Contents

class RubyEnv

  def self.bundler?(project_path)
    Gem.available?("bundler") && File.exists?("#{project_path}/Gemfile")
  end

  def self.ruby_command(project_path, opts = {})
    ruby_interpeter = opts[:ruby_interpeter] || "ruby"
    
    if File.exists?("#{project_path}/#{opts[:script]}")
      command = opts[:script]
    elsif opts[:bin]
      command = opts[:bin]
    else
      command = ruby_interpeter
    end 

    if bundler?(project_path)
      "#{ruby_interpeter} -S bundle exec #{command}"
    else
      "#{ruby_interpeter} -S #{command}"
    end
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
testbot-0.5.3 lib/shared/adapters/helpers/ruby_env.rb
testbot-0.5.2 lib/shared/adapters/helpers/ruby_env.rb
testbot-0.5.1 lib/shared/adapters/helpers/ruby_env.rb
testbot-0.5.0 lib/shared/adapters/helpers/ruby_env.rb
testbot-0.4.9 lib/shared/adapters/helpers/ruby_env.rb
testbot-0.4.8 lib/shared/adapters/helpers/ruby_env.rb
testbot-0.4.7 lib/shared/adapters/helpers/ruby_env.rb
testbot-0.4.6 lib/adapters/helpers/ruby_env.rb
testbot-0.4.5 lib/adapters/helpers/ruby_env.rb
testbot-0.4.4 lib/adapters/helpers/ruby_env.rb
testbot-0.4.2 lib/adapters/helpers/ruby_env.rb
testbot-0.4.1 lib/adapters/helpers/ruby_env.rb
testbot-0.4.0 lib/adapters/helpers/ruby_env.rb
testbot-0.3.9 lib/adapters/helpers/ruby_env.rb
testbot-0.3.9.pre lib/adapters/helpers/ruby_env.rb