Sha256: 0e953204f7f3d0cab54d2d1c2222dad4c5b476357dedee09bb612a7c8dc6c0a8

Contents?: true

Size: 1006 Bytes

Versions: 2

Compression:

Stored size: 1006 Bytes

Contents

desc 'console [TARGET]', 'Open a Rails console locally or on a Capistrano deploy target'
long_desc <<-LONGDESC
Local (development): `geordi console`

Remote: `geordi console staging`

Selecting the server: `geordi console staging -s` shows a menu with all available
servers. When passed a number, directly connects to the selected server.
LONGDESC

# This option is duplicated in shelll.rb
option :select_server, type: :string, aliases: '-s', banner: '[SERVER_NUMBER]',
  desc: 'Select a server to connect to'

def console(target = 'development', *_args)
  require 'geordi/remote'

  Hint.did_you_know [
    :shelll,
    [:console, :select_server],
  ]

  if target == 'development'
    invoke_geordi 'bundle_install'
    invoke_geordi 'yarn_install'

    Interaction.announce 'Opening a local Rails console'

    command = Util.console_command(target)
    Util.run!(command)
  else
    Interaction.announce 'Opening a Rails console on ' + target

    Geordi::Remote.new(target).console(options)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
geordi-9.6.1 lib/geordi/commands/console.rb
geordi-9.6.0 lib/geordi/commands/console.rb