Sha256: e73fcfe1c9fab21ce1fdc5f525e38b1b71f29c83b6a89859a0f471675bda1951

Contents?: true

Size: 686 Bytes

Versions: 1

Compression:

Stored size: 686 Bytes

Contents

class Nib::Console
  include Nib::Command
  prepend Nib::History

  SCRIPT = <<~SH.freeze
    has_pry=false
    has_boot=false
    if hash pry 2>/dev/null ; then
      has_pry=true
    fi
    if [ -f config/boot.rb ]; then
      has_boot=true
    fi
    if [ -f bin/console ]; then
      bin/console
    elif [ -f bin/rails ]; then
      rails console
    elif [ \\$has_boot = true ] && [ \\$has_pry = true ]; then
      pry -r ./config/boot
    elif [ \\$has_boot = true ]; then
      irb -r ./config/boot
    elif [ \\$has_pry = true ]; then
      bundle config console pry
      bundle console
    else
      bundle console
    fi
  SH

  private

  def command
    SCRIPT
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nib-1.4.0 lib/nib/console.rb