Sha256: b97a863ab416a02da02a8088ead21a96fd4bfaae51457b47cb36c18989459ed1

Contents?: true

Size: 827 Bytes

Versions: 15

Compression:

Stored size: 827 Bytes

Contents

module Padrino
  ##
  # Replaces the current process with it's binstub.
  #
  def self.replace_with_binstub(executable)
    begin
      return if Bundler.definition.missing_specs.empty?
    rescue NameError, NoMethodError, Bundler::GemfileNotFound
    end

    project_root = Dir.pwd
    until project_root.empty?
      break if File.file?(File.join(project_root, 'Gemfile'))
      project_root = project_root.rpartition('/').first
    end

    if %w(Gemfile .components).all? { |file| File.file?(File.join(project_root, file)) }
      binstub = File.join(project_root, 'bin', executable)
      if File.file?(binstub)
        exec Gem.ruby, binstub, *ARGV
      else
        puts 'Please run `bundler install --binstubs` from your project root to generate bundle-specific executables'
        exit!
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
padrino-core-0.14.4 lib/padrino-core/cli/binstub.rb
padrino-core-0.14.3 lib/padrino-core/cli/binstub.rb
padrino-core-0.12.9 lib/padrino-core/cli/binstub.rb
padrino-core-0.14.2 lib/padrino-core/cli/binstub.rb
padrino-core-0.13.3.4 lib/padrino-core/cli/binstub.rb
padrino-core-0.14.1.1 lib/padrino-core/cli/binstub.rb
padrino-core-0.14.1 lib/padrino-core/cli/binstub.rb
padrino-core-0.14.0.2 lib/padrino-core/cli/binstub.rb
padrino-core-0.14.0.1 lib/padrino-core/cli/binstub.rb
padrino-core-0.14.0 lib/padrino-core/cli/binstub.rb
padrino-core-0.14.0.rc2 lib/padrino-core/cli/binstub.rb
padrino-core-0.14.0.rc1 lib/padrino-core/cli/binstub.rb
padrino-core-0.13.3.3 lib/padrino-core/cli/binstub.rb
padrino-core-0.13.3.2 lib/padrino-core/cli/binstub.rb
padrino-core-0.12.8.1 lib/padrino-core/cli/binstub.rb